From c3fb11c2c98a5c28ece6a27093a0f9def350ac64 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 7 Jul 2018 02:40:29 +1000 Subject: devcb3 There are multiple issues with the current device callbacks: * They always dispatch through a pointer-to-member * Chained callbacks are a linked list so the branch unit can't predict the early * There's a runtime decision made on the left/right shift direction * There are runtime NULL checks on various objects * Binding a lambda isn't practical * Arbitrary transformations are not supported * When chaining callbacks it isn't clear what the MCFG_DEVCB_ modifiers apply to * It isn't possible to just append to a callback in derived configuration * The macros need a magic, hidden local called devcb * Moving code that uses the magic locals around is error-prone * Writing the MCFG_ macros to make a device usable is a pain * You can't discover applicable MCFG_ macros with intellisense * Macros are not scoped * Using an inappropriate macro isn't detected at compile time * Lots of other things This changeset overcomes the biggest obstacle to remving MCFG_ macros altogether. Essentially, to allow a devcb to be configured, call .bind() and expose the result (a bind target for the callback). Bind target methods starting with "set" repace the current callbacks; methods starting with "append" append to them. You can't reconfigure a callback after resolving it. There's no need to use a macro matching the handler signatures - use FUNC for everything. Current device is implied if no tag/finder is supplied (no need for explicit this). Lambdas are supported, and the memory space and offset are optional. These kinds of things work: * .read_cb().set([this] () { return something; }); * .read_cb().set([this] (offs_t offset) { return ~offset; }); * .write_cb().set([this] (offs_t offset, u8 data) { m_array[offset] = data; }); * .write_cb().set([this] (int state) { some_var = state; }); Arbitrary transforms are allowed, and they can modify offset/mask for example: * .read_cb().set(FUNC(my_state::handler)).transform([] (u8 data) { return bitswap<4>(data, 1, 3, 0, 2); }); * .read_cb().set(m_dev, FUNC(some_device::member)).transform([] (offs_t &offset, u8 data) { offset ^= 3; return data; }); It's possible to stack arbitrary transforms, at the cost of compile time (the whole transform stack gets inlined at compile time). Shifts count as an arbitrary transform, but mask/exor does not. Order of mask/shift/exor now matters. Modifications are applied in the specified order. These are NOT EQUIVALENT: * .read_cb().set(FUNC(my_state::handler)).mask(0x06).lshift(2); * .read_cb().set(FUNC(my_state::handler)).lshift(2).mask(0x06); The bit helper no longer reverses its behaviour for read callbacks, and I/O ports are no longer aware of the field mask. Binding a read callback to no-op is not supported - specify a constant. The GND and VCC aliases have been removed intentionally - they're TTL-centric, and were already being abused. Other quirks have been preserved, including write logger only logging when the data is non-zero (quite unhelpful in many of the cases where it's used). Legacy syntax is still supported for simple cases, but will be phased out. New devices should not have MCFG_ macros. I don't think I've missed any fundamental issues, but if I've broken something, let me know. --- src/mame/audio/atarijsa.h | 14 +- src/mame/audio/cage.h | 2 +- src/mame/audio/cmi01a.h | 2 +- src/mame/audio/dsbz80.cpp | 27 +- src/mame/audio/dsbz80.h | 2 +- src/mame/audio/efo_zsu.cpp | 20 +- src/mame/audio/exidy.h | 8 +- src/mame/audio/harddriv.cpp | 20 +- src/mame/audio/irem.cpp | 38 +- src/mame/audio/irem.h | 7 +- src/mame/audio/namco52.h | 4 +- src/mame/audio/rad_eu3a05.h | 2 +- src/mame/audio/segag80r.cpp | 2 +- src/mame/audio/segam1audio.cpp | 12 +- src/mame/audio/segam1audio.h | 8 +- src/mame/audio/segasnd.h | 2 +- src/mame/audio/seibu.h | 4 +- src/mame/audio/svis_snd.h | 2 +- src/mame/audio/tvc.h | 2 +- src/mame/audio/williams.cpp | 24 +- src/mame/audio/zaccaria.h | 2 +- src/mame/drivers/24cdjuke.cpp | 6 +- src/mame/drivers/2mindril.cpp | 12 +- src/mame/drivers/68ksbc.cpp | 29 +- src/mame/drivers/a7150.cpp | 22 +- src/mame/drivers/abc80x.cpp | 12 +- src/mame/drivers/aerofgt.cpp | 18 +- src/mame/drivers/alesis.cpp | 30 +- src/mame/drivers/alpha68k.cpp | 8 +- src/mame/drivers/alphatpx.cpp | 20 +- src/mame/drivers/alphatro.cpp | 6 +- src/mame/drivers/altair.cpp | 6 +- src/mame/drivers/altos2.cpp | 43 +- src/mame/drivers/altos486.cpp | 10 +- src/mame/drivers/altos5.cpp | 24 +- src/mame/drivers/altos8600.cpp | 49 +- src/mame/drivers/amiga.cpp | 40 +- src/mame/drivers/ampro.cpp | 20 +- src/mame/drivers/amust.cpp | 6 +- src/mame/drivers/apc.cpp | 16 +- src/mame/drivers/apricot.cpp | 28 +- src/mame/drivers/asteroid.cpp | 40 +- src/mame/drivers/astrocde.cpp | 34 +- src/mame/drivers/asuka.cpp | 96 ++-- src/mame/drivers/atarist.cpp | 24 +- src/mame/drivers/atarisy1.cpp | 12 +- src/mame/drivers/attache.cpp | 64 +-- src/mame/drivers/aussiebyte.cpp | 38 +- src/mame/drivers/avt.cpp | 28 +- src/mame/drivers/balsente.cpp | 28 +- src/mame/drivers/bbc.cpp | 8 +- src/mame/drivers/bbusters.cpp | 16 +- src/mame/drivers/bebox.cpp | 16 +- src/mame/drivers/bigbord2.cpp | 22 +- src/mame/drivers/bladestl.cpp | 6 +- src/mame/drivers/bml3.cpp | 6 +- src/mame/drivers/bombjack.cpp | 18 +- src/mame/drivers/bw2.cpp | 16 +- src/mame/drivers/capbowl.cpp | 24 +- src/mame/drivers/cat.cpp | 9 +- src/mame/drivers/ccastles.cpp | 32 +- src/mame/drivers/cclimber.cpp | 62 ++- src/mame/drivers/ccs2810.cpp | 66 +-- src/mame/drivers/ccs300.cpp | 6 +- src/mame/drivers/cdc721.cpp | 18 +- src/mame/drivers/centiped.cpp | 28 +- src/mame/drivers/cgc7900.cpp | 10 +- src/mame/drivers/cidelsa.cpp | 24 +- src/mame/drivers/cit101.cpp | 38 +- src/mame/drivers/clcd.cpp | 28 +- src/mame/drivers/cloak.cpp | 14 +- src/mame/drivers/cloud9.cpp | 28 +- src/mame/drivers/clshroad.cpp | 20 +- src/mame/drivers/cntsteer.cpp | 18 +- src/mame/drivers/coco12.cpp | 70 ++- src/mame/drivers/coco3.cpp | 22 +- src/mame/drivers/codata.cpp | 16 +- src/mame/drivers/commando.cpp | 19 +- src/mame/drivers/compucolor.cpp | 6 +- src/mame/drivers/comx35.cpp | 4 +- src/mame/drivers/cortex.cpp | 9 +- src/mame/drivers/cosmicos.cpp | 2 +- src/mame/drivers/cp1.cpp | 24 +- src/mame/drivers/cpzodiac.cpp | 22 +- src/mame/drivers/crshrace.cpp | 16 +- src/mame/drivers/darkseal.cpp | 4 +- src/mame/drivers/dblewing.cpp | 16 +- src/mame/drivers/ddenlovr.cpp | 55 +-- src/mame/drivers/dec8.cpp | 72 ++- src/mame/drivers/deco32.cpp | 53 +- src/mame/drivers/decwritr.cpp | 18 +- src/mame/drivers/destroyr.cpp | 6 +- src/mame/drivers/dietgo.cpp | 14 +- src/mame/drivers/divebomb.cpp | 20 +- src/mame/drivers/dkong.cpp | 39 +- src/mame/drivers/dmax8000.cpp | 24 +- src/mame/drivers/dms86.cpp | 57 +-- src/mame/drivers/dmv.cpp | 28 +- src/mame/drivers/docastle.cpp | 32 +- src/mame/drivers/dragon.cpp | 24 +- src/mame/drivers/dragrace.cpp | 44 +- src/mame/drivers/dreambal.cpp | 12 +- src/mame/drivers/dsb46.cpp | 18 +- src/mame/drivers/duet16.cpp | 32 +- src/mame/drivers/dynamoah.cpp | 29 +- src/mame/drivers/dynax.cpp | 40 +- src/mame/drivers/dynduke.cpp | 22 +- src/mame/drivers/einstein.cpp | 8 +- src/mame/drivers/eti660.cpp | 14 +- src/mame/drivers/exterm.cpp | 14 +- src/mame/drivers/f1gp.cpp | 12 +- src/mame/drivers/fanucspmg.cpp | 4 +- src/mame/drivers/fc100.cpp | 10 +- src/mame/drivers/firefox.cpp | 38 +- src/mame/drivers/fmtowns.cpp | 4 +- src/mame/drivers/ft68m.cpp | 14 +- src/mame/drivers/gaelco.cpp | 34 +- src/mame/drivers/gaelco3d.cpp | 3 +- src/mame/drivers/gaiden.cpp | 18 +- src/mame/drivers/galaga.cpp | 114 +++-- src/mame/drivers/galastrm.cpp | 16 +- src/mame/drivers/galaxold.cpp | 22 +- src/mame/drivers/gaplus.cpp | 23 +- src/mame/drivers/gimix.cpp | 10 +- src/mame/drivers/gladiatr.cpp | 24 +- src/mame/drivers/gng.cpp | 22 +- src/mame/drivers/gotcha.cpp | 19 +- src/mame/drivers/groundfx.cpp | 18 +- src/mame/drivers/gstriker.cpp | 20 +- src/mame/drivers/gsword.cpp | 14 +- src/mame/drivers/guab.cpp | 6 +- src/mame/drivers/gunbustr.cpp | 18 +- src/mame/drivers/h8.cpp | 10 +- src/mame/drivers/harriet.cpp | 6 +- src/mame/drivers/hazelgr.cpp | 16 +- src/mame/drivers/hazeltin.cpp | 6 +- src/mame/drivers/hnayayoi.cpp | 20 +- src/mame/drivers/holeland.cpp | 16 +- src/mame/drivers/hp16500.cpp | 29 +- src/mame/drivers/i7000.cpp | 4 +- src/mame/drivers/ibm6580.cpp | 10 +- src/mame/drivers/igs017.cpp | 12 +- src/mame/drivers/imds2.cpp | 4 +- src/mame/drivers/imolagp.cpp | 14 +- src/mame/drivers/imsai.cpp | 12 +- src/mame/drivers/inder.cpp | 11 +- src/mame/drivers/interpro.cpp | 8 +- src/mame/drivers/ipc.cpp | 69 +-- src/mame/drivers/irisha.cpp | 16 +- src/mame/drivers/isbc.cpp | 52 +- src/mame/drivers/isbc8030.cpp | 74 ++- src/mame/drivers/iteagle.cpp | 16 +- src/mame/drivers/jade.cpp | 11 +- src/mame/drivers/jp.cpp | 36 +- src/mame/drivers/jpmsys5.cpp | 127 ++--- src/mame/drivers/kaypro.cpp | 61 ++- src/mame/drivers/kdt6.cpp | 70 +-- src/mame/drivers/kingobox.cpp | 62 ++- src/mame/drivers/kinst.cpp | 3 +- src/mame/drivers/konin.cpp | 16 +- src/mame/drivers/kopunch.cpp | 26 +- src/mame/drivers/kyugo.cpp | 8 +- src/mame/drivers/liberatr.cpp | 18 +- src/mame/drivers/m24.cpp | 2 +- src/mame/drivers/m79152pc.cpp | 6 +- src/mame/drivers/magmax.cpp | 6 +- src/mame/drivers/mappy.cpp | 272 ++++++----- src/mame/drivers/marineb.cpp | 25 +- src/mame/drivers/mbee.cpp | 28 +- src/mame/drivers/mc8020.cpp | 8 +- src/mame/drivers/mc8030.cpp | 6 +- src/mame/drivers/mccpm.cpp | 6 +- src/mame/drivers/meritm.cpp | 26 +- src/mame/drivers/metro.cpp | 2 +- src/mame/drivers/mfabfz.cpp | 37 +- src/mame/drivers/mice.cpp | 10 +- src/mame/drivers/micro3d.cpp | 6 +- src/mame/drivers/microdec.cpp | 75 ++- src/mame/drivers/microkit.cpp | 2 +- src/mame/drivers/microterm.cpp | 37 +- src/mame/drivers/milwaukee.cpp | 55 +-- src/mame/drivers/miniframe.cpp | 22 +- src/mame/drivers/mits680b.cpp | 6 +- src/mame/drivers/mk14.cpp | 2 +- src/mame/drivers/mmd1.cpp | 4 +- src/mame/drivers/model1.cpp | 18 +- src/mame/drivers/model2.cpp | 49 +- src/mame/drivers/model3.cpp | 10 +- src/mame/drivers/mrflea.cpp | 20 +- src/mame/drivers/multi8.cpp | 6 +- src/mame/drivers/munchmo.cpp | 3 +- src/mame/drivers/mx2178.cpp | 10 +- src/mame/drivers/namcos12.cpp | 13 +- src/mame/drivers/namcos23.cpp | 49 +- src/mame/drivers/nbmj9195.cpp | 20 +- src/mame/drivers/nemesis.cpp | 18 +- src/mame/drivers/neogeo.cpp | 16 +- src/mame/drivers/neogeocd.cpp | 3 +- src/mame/drivers/ngen.cpp | 20 +- src/mame/drivers/ninjaw.cpp | 28 +- src/mame/drivers/norautp.cpp | 22 +- src/mame/drivers/nss.cpp | 6 +- src/mame/drivers/ob68k1a.cpp | 70 +-- src/mame/drivers/octopus.cpp | 20 +- src/mame/drivers/okean240.cpp | 8 +- src/mame/drivers/olyboss.cpp | 22 +- src/mame/drivers/onyx.cpp | 12 +- src/mame/drivers/osbexec.cpp | 43 +- src/mame/drivers/othello.cpp | 2 +- src/mame/drivers/othunder.cpp | 16 +- src/mame/drivers/p8k.cpp | 12 +- src/mame/drivers/pacman.cpp | 8 +- src/mame/drivers/pandoras.cpp | 16 +- src/mame/drivers/pc100.cpp | 2 +- src/mame/drivers/pc88va.cpp | 4 +- src/mame/drivers/pc9801.cpp | 38 +- src/mame/drivers/pcd.cpp | 2 +- src/mame/drivers/pcm.cpp | 18 +- src/mame/drivers/pecom.cpp | 2 +- src/mame/drivers/peoplepc.cpp | 4 +- src/mame/drivers/peyper.cpp | 4 +- src/mame/drivers/pg685.cpp | 6 +- src/mame/drivers/pimps.cpp | 66 +-- src/mame/drivers/pktgaldx.cpp | 10 +- src/mame/drivers/play_2.cpp | 14 +- src/mame/drivers/play_3.cpp | 16 +- src/mame/drivers/playch10.cpp | 52 +- src/mame/drivers/plus4.cpp | 42 +- src/mame/drivers/pm68k.cpp | 10 +- src/mame/drivers/pntnpuzl.cpp | 12 +- src/mame/drivers/pokechmp.cpp | 26 +- src/mame/drivers/polepos.cpp | 102 ++-- src/mame/drivers/polgar.cpp | 22 +- src/mame/drivers/policetr.cpp | 9 +- src/mame/drivers/poly.cpp | 9 +- src/mame/drivers/prof80.cpp | 42 +- src/mame/drivers/proteus.cpp | 24 +- src/mame/drivers/pulsar.cpp | 10 +- src/mame/drivers/punchout.cpp | 18 +- src/mame/drivers/pve500.cpp | 34 +- src/mame/drivers/qtsbc.cpp | 12 +- src/mame/drivers/qvt6800.cpp | 6 +- src/mame/drivers/qx10.cpp | 10 +- src/mame/drivers/raiden.cpp | 22 +- src/mame/drivers/rainbow.cpp | 6 +- src/mame/drivers/rc702.cpp | 25 +- src/mame/drivers/retofinv.cpp | 14 +- src/mame/drivers/rmnimbus.cpp | 4 +- src/mame/drivers/rohga.cpp | 32 +- src/mame/drivers/royalmah.cpp | 18 +- src/mame/drivers/runaway.cpp | 16 +- src/mame/drivers/s7.cpp | 18 +- src/mame/drivers/sbrain.cpp | 14 +- src/mame/drivers/sbrkout.cpp | 28 +- src/mame/drivers/scopus.cpp | 6 +- src/mame/drivers/sdk85.cpp | 12 +- src/mame/drivers/sdk86.cpp | 10 +- src/mame/drivers/seattle.cpp | 6 +- src/mame/drivers/seattlecmp.cpp | 28 +- src/mame/drivers/segac2.cpp | 29 +- src/mame/drivers/segae.cpp | 14 +- src/mame/drivers/segajw.cpp | 26 +- src/mame/drivers/segam1.cpp | 20 +- src/mame/drivers/segas16a.cpp | 2 +- src/mame/drivers/segas16b.cpp | 11 +- src/mame/drivers/segas18.cpp | 38 +- src/mame/drivers/segas24.cpp | 57 +-- src/mame/drivers/segas32.cpp | 92 ++-- src/mame/drivers/segaufo.cpp | 132 +++-- src/mame/drivers/segaxbd.cpp | 22 +- src/mame/drivers/segaybd.cpp | 18 +- src/mame/drivers/selz80.cpp | 10 +- src/mame/drivers/seta.cpp | 8 +- src/mame/drivers/seta2.cpp | 2 +- src/mame/drivers/sfcbox.cpp | 6 +- src/mame/drivers/shangkid.cpp | 61 ++- src/mame/drivers/shougi.cpp | 18 +- src/mame/drivers/slapfght.cpp | 66 +-- src/mame/drivers/slapshot.cpp | 24 +- src/mame/drivers/snes.cpp | 6 +- src/mame/drivers/snesb.cpp | 6 +- src/mame/drivers/splash.cpp | 10 +- src/mame/drivers/stargame.cpp | 23 +- src/mame/drivers/starwars.cpp | 53 +- src/mame/drivers/studio2.cpp | 8 +- src/mame/drivers/subs.cpp | 18 +- src/mame/drivers/sun1.cpp | 67 +-- src/mame/drivers/super6.cpp | 28 +- src/mame/drivers/superchs.cpp | 16 +- src/mame/drivers/superslave.cpp | 16 +- src/mame/drivers/suprloco.cpp | 10 +- src/mame/drivers/suprslam.cpp | 14 +- src/mame/drivers/supstarf.cpp | 4 +- src/mame/drivers/swtpc.cpp | 82 ++-- src/mame/drivers/swtpc09.cpp | 16 +- src/mame/drivers/sys9002.cpp | 10 +- src/mame/drivers/systec.cpp | 6 +- src/mame/drivers/taito_b.cpp | 302 ++++++------ src/mame/drivers/taito_f2.cpp | 56 +-- src/mame/drivers/taito_h.cpp | 42 +- src/mame/drivers/taito_l.cpp | 60 +-- src/mame/drivers/taito_z.cpp | 142 +++--- src/mame/drivers/taitoair.cpp | 14 +- src/mame/drivers/taitojc.cpp | 14 +- src/mame/drivers/taotaido.cpp | 26 +- src/mame/drivers/tatsumi.cpp | 6 +- src/mame/drivers/tavernie.cpp | 6 +- src/mame/drivers/thedealr.cpp | 18 +- src/mame/drivers/tim100.cpp | 54 +-- src/mame/drivers/timelimt.cpp | 12 +- src/mame/drivers/tmc1800.cpp | 8 +- src/mame/drivers/tmc2000e.cpp | 4 +- src/mame/drivers/tmc600.cpp | 12 +- src/mame/drivers/toaplan2.cpp | 859 ++++++++++++++++----------------- src/mame/drivers/tomcat.cpp | 18 +- src/mame/drivers/topspeed.cpp | 24 +- src/mame/drivers/tranz330.cpp | 12 +- src/mame/drivers/triplhnt.cpp | 47 +- src/mame/drivers/trs80dt1.cpp | 20 +- src/mame/drivers/ts803.cpp | 12 +- src/mame/drivers/tsamurai.cpp | 18 +- src/mame/drivers/tv912.cpp | 71 +-- src/mame/drivers/twincobr.cpp | 14 +- src/mame/drivers/undrfire.cpp | 44 +- src/mame/drivers/unior.cpp | 21 +- src/mame/drivers/univac.cpp | 36 +- src/mame/drivers/v100.cpp | 36 +- src/mame/drivers/v1050.cpp | 14 +- src/mame/drivers/v550.cpp | 10 +- src/mame/drivers/v6809.cpp | 14 +- src/mame/drivers/vaportra.cpp | 4 +- src/mame/drivers/vastar.cpp | 8 +- src/mame/drivers/vector4.cpp | 14 +- src/mame/drivers/victor9k.cpp | 11 +- src/mame/drivers/vip.cpp | 2 +- src/mame/drivers/votrpss.cpp | 12 +- src/mame/drivers/votrtnt.cpp | 6 +- src/mame/drivers/vt100.cpp | 30 +- src/mame/drivers/vta2000.cpp | 28 +- src/mame/drivers/vtech1.cpp | 33 +- src/mame/drivers/wardner.cpp | 14 +- src/mame/drivers/warriorb.cpp | 28 +- src/mame/drivers/wgp.cpp | 14 +- src/mame/drivers/wicat.cpp | 18 +- src/mame/drivers/williams.cpp | 52 +- src/mame/drivers/wiping.cpp | 13 +- src/mame/drivers/xain.cpp | 31 +- src/mame/drivers/xerox820.cpp | 14 +- src/mame/drivers/xor100.cpp | 10 +- src/mame/drivers/z100.cpp | 4 +- src/mame/drivers/z88.cpp | 13 +- src/mame/drivers/zac2650.cpp | 24 +- src/mame/drivers/zn.cpp | 37 +- src/mame/drivers/zorba.cpp | 28 +- src/mame/drivers/zsbc3.cpp | 52 +- src/mame/includes/alesis.h | 2 +- src/mame/includes/apexc.h | 1 - src/mame/includes/apollo.h | 10 +- src/mame/includes/asteroid.h | 7 +- src/mame/includes/balsente.h | 1 - src/mame/includes/ccastles.h | 1 - src/mame/includes/cloud9.h | 2 - src/mame/includes/cvs.h | 6 +- src/mame/includes/dec8.h | 1 - src/mame/includes/dragon.h | 4 +- src/mame/includes/galaxold.h | 2 +- src/mame/includes/gng.h | 2 - src/mame/includes/jpmsys5.h | 1 - src/mame/includes/kopunch.h | 6 + src/mame/includes/liberatr.h | 2 - src/mame/includes/pgm2.h | 1 - src/mame/includes/super6.h | 26 +- src/mame/includes/taito_b.h | 34 +- src/mame/includes/triplhnt.h | 4 - src/mame/includes/v1050.h | 4 +- src/mame/includes/xbox_pci.h | 8 +- src/mame/includes/z88.h | 6 +- src/mame/machine/315_5296.h | 102 +--- src/mame/machine/315_5338a.h | 83 +--- src/mame/machine/315_5649.h | 52 +- src/mame/machine/6883sam.h | 2 +- src/mame/machine/abc80kb.h | 2 +- src/mame/machine/acs8600_ics.cpp | 122 ++--- src/mame/machine/acs8600_ics.h | 43 +- src/mame/machine/apollo.cpp | 16 +- src/mame/machine/apollo_kbd.h | 4 +- src/mame/machine/apricotkb.h | 2 +- src/mame/machine/at.cpp | 48 +- src/mame/machine/atarigen.h | 2 +- src/mame/machine/balsente.cpp | 5 - src/mame/machine/c117.h | 2 +- src/mame/machine/cammu.h | 2 +- src/mame/machine/cat702.h | 2 +- src/mame/machine/cit101_kbd.h | 2 +- src/mame/machine/compiskb.h | 2 +- src/mame/machine/cuda.h | 8 +- src/mame/machine/dec_lk201.h | 2 +- src/mame/machine/deco104.h | 4 - src/mame/machine/deco146.h | 12 +- src/mame/machine/deco_irq.h | 12 +- src/mame/machine/egret.h | 8 +- src/mame/machine/esqpanel.h | 4 +- src/mame/machine/fm_scsi.h | 4 +- src/mame/machine/gaelco3d.h | 2 +- src/mame/machine/hp9845_printer.h | 6 +- src/mame/machine/ibm6580_fdc.h | 6 +- src/mame/machine/ibm6580_kbd.h | 15 +- src/mame/machine/interpro_ioga.h | 27 +- src/mame/machine/interpro_sga.h | 2 +- src/mame/machine/ioptimer.h | 2 +- src/mame/machine/isbc_208.h | 2 +- src/mame/machine/isbc_215g.h | 2 +- src/mame/machine/k573cass.h | 18 +- src/mame/machine/kay_kbd.h | 8 +- src/mame/machine/kc_keyb.h | 2 +- src/mame/machine/km035.h | 4 +- src/mame/machine/m24_kbd.h | 2 +- src/mame/machine/m24_z8000.h | 2 +- src/mame/machine/mackbd.cpp | 25 +- src/mame/machine/mackbd.h | 2 +- src/mame/machine/microdrv.h | 2 +- src/mame/machine/micropolis.h | 6 +- src/mame/machine/midikbd.h | 2 +- src/mame/machine/midwayic.h | 6 +- src/mame/machine/mm1kb.h | 2 +- src/mame/machine/model1io.cpp | 49 +- src/mame/machine/model1io.h | 32 +- src/mame/machine/model1io2.cpp | 98 ++-- src/mame/machine/model1io2.h | 32 +- src/mame/machine/ms7004.h | 4 +- src/mame/machine/msx_matsushita.h | 2 +- src/mame/machine/namco06.h | 24 +- src/mame/machine/namco51.h | 14 +- src/mame/machine/namco53.h | 15 +- src/mame/machine/namco62.h | 12 +- src/mame/machine/namco_c148.h | 4 +- src/mame/machine/namcoio.h | 39 +- src/mame/machine/nb1412m2.h | 2 +- src/mame/machine/nextkbd.h | 6 +- src/mame/machine/nextmo.h | 4 +- src/mame/machine/pc1512kb.h | 4 +- src/mame/machine/pc9801_kbd.h | 2 +- src/mame/machine/pcd_kbd.h | 2 +- src/mame/machine/pcshare.cpp | 4 +- src/mame/machine/ps2timer.h | 3 +- src/mame/machine/psxcd.h | 2 +- src/mame/machine/qimi.h | 2 +- src/mame/machine/rad_eu3a05gpio.h | 6 +- src/mame/machine/segaic16.h | 15 +- src/mame/machine/seibucop/seibucop.h | 4 +- src/mame/machine/tait8741.h | 8 +- src/mame/machine/taito68705interface.h | 6 +- src/mame/machine/taitocchip.h | 14 +- src/mame/machine/taitoio.h | 140 +----- src/mame/machine/taitosjsec.h | 8 +- src/mame/machine/tandy2kb.h | 4 +- src/mame/machine/trs80m2kb.h | 2 +- src/mame/machine/upd65031.h | 12 +- src/mame/machine/v1050kb.h | 2 +- src/mame/machine/victor9k_fdc.h | 21 +- src/mame/machine/victor9k_kb.h | 4 +- src/mame/machine/vs9209.h | 68 +-- src/mame/machine/vt100_kbd.h | 2 +- src/mame/machine/wangpckb.h | 2 +- src/mame/machine/x820kb.h | 2 +- src/mame/machine/xbox.cpp | 4 +- src/mame/machine/znmcu.h | 10 +- src/mame/machine/zx8302.h | 28 +- src/mame/video/733_asr.h | 4 +- src/mame/video/911_vdt.h | 4 +- src/mame/video/abc800.cpp | 11 +- src/mame/video/abc802.cpp | 13 +- src/mame/video/atarivad.h | 2 +- src/mame/video/bfm_dm01.h | 2 +- src/mame/video/cidelsa.cpp | 6 +- src/mame/video/comx35.cpp | 4 +- src/mame/video/decodmd1.cpp | 14 +- src/mame/video/dynax_blitter_rev2.h | 22 +- src/mame/video/exidy440.cpp | 14 +- src/mame/video/gime.h | 6 +- src/mame/video/gp9001.h | 17 +- src/mame/video/gtia.h | 4 +- src/mame/video/k051960.h | 6 +- src/mame/video/k052109.h | 2 +- src/mame/video/k053250_ps.h | 2 +- src/mame/video/k057714.h | 2 +- src/mame/video/k1ge.h | 8 +- src/mame/video/liberatr.cpp | 6 - src/mame/video/nick.h | 2 +- src/mame/video/pcd.h | 2 +- src/mame/video/pecom.cpp | 2 +- src/mame/video/runaway.cpp | 3 +- src/mame/video/segaic24.h | 4 +- src/mame/video/seibu_crtc.h | 10 +- src/mame/video/taito_b.cpp | 6 +- src/mame/video/tc0180vcu.h | 4 +- src/mame/video/tia.h | 6 +- src/mame/video/tmc1800.cpp | 4 +- src/mame/video/tmc600.cpp | 2 +- src/mame/video/uv201.h | 6 +- src/mame/video/vsystem_gga.h | 2 +- src/mame/video/vtvideo.h | 8 +- src/mame/video/wpc_dmd.h | 2 +- src/mame/video/ygv608.h | 4 +- src/mame/video/zx8301.h | 2 +- 505 files changed, 5353 insertions(+), 5786 deletions(-) (limited to 'src/mame') diff --git a/src/mame/audio/atarijsa.h b/src/mame/audio/atarijsa.h index f8cef0ca4a4..30e543311f3 100644 --- a/src/mame/audio/atarijsa.h +++ b/src/mame/audio/atarijsa.h @@ -38,23 +38,22 @@ DECLARE_DEVICE_TYPE(ATARI_JSA_IIIS, atari_jsa_iiis_device) #define MCFG_ATARI_JSA_I_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_I, 0) \ - devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); + downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_II_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_II, 0) \ - devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); + downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_III_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_III, 0) \ - devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); + downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_IIIS_ADD(_tag, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_JSA_IIIS, 0) \ - devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); + downcast(*device).set_main_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_JSA_TEST_PORT(_port, _bitnum) \ - devcb = &downcast(*device).set_test_read_cb(DEVCB_IOPORT(_port)); \ - MCFG_DEVCB_RSHIFT(_bitnum); + downcast(*device).test_read_cb().set_ioport(_port).bit(_bitnum); //************************************************************************** @@ -84,8 +83,9 @@ protected: public: // configuration - template devcb_base &set_test_read_cb(Object &&cb) { return m_test_read_cb.set_callback(std::forward(cb)); } template devcb_base &set_main_int_cb(Object &&cb) { return m_main_int_cb.set_callback(std::forward(cb)); } + auto test_read_cb() { return m_test_read_cb.bind(); } + auto main_int_cb() { return m_main_int_cb.bind(); } // getters m6502_device &soundcpu() const { return *m_jsacpu; } diff --git a/src/mame/audio/cage.h b/src/mame/audio/cage.h index d54a52888e0..d1202918ac2 100644 --- a/src/mame/audio/cage.h +++ b/src/mame/audio/cage.h @@ -17,7 +17,7 @@ #include "sound/dmadac.h" #define MCFG_ATARI_CAGE_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_irqhandler_callback(DEVCB_##_write); + downcast(*device).set_irqhandler_callback(DEVCB_##_write); #define MCFG_ATARI_CAGE_SPEEDUP(_speedup) \ downcast(*device).set_speedup(_speedup); diff --git a/src/mame/audio/cmi01a.h b/src/mame/audio/cmi01a.h index 5f9bbd9f15f..8c8272507ea 100644 --- a/src/mame/audio/cmi01a.h +++ b/src/mame/audio/cmi01a.h @@ -16,7 +16,7 @@ #define ENV_DIR_UP 1 #define MCFG_CMI01A_IRQ_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_irq_callback(DEVCB_##_devcb); + downcast(*device).set_irq_callback(DEVCB_##_devcb); class cmi01a_device : public device_t, public device_sound_interface { public: diff --git a/src/mame/audio/dsbz80.cpp b/src/mame/audio/dsbz80.cpp index ea7a83ae824..c521ac825b6 100644 --- a/src/mame/audio/dsbz80.cpp +++ b/src/mame/audio/dsbz80.cpp @@ -45,19 +45,20 @@ DEFINE_DEVICE_TYPE(DSBZ80, dsbz80_device, "dsbz80_device", "Sega Z80-based Digit // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(dsbz80_device::device_add_mconfig) - MCFG_DEVICE_ADD(Z80_TAG, Z80, 4000000) /* unknown clock, but probably pretty slow considering the z80 does like nothing */ - MCFG_DEVICE_PROGRAM_MAP(dsbz80_map) - MCFG_DEVICE_IO_MAP(dsbz80io_map) - - MCFG_DEVICE_ADD("uart", I8251, 4000000) - MCFG_I8251_RXRDY_HANDLER(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_I8251_TXD_HANDLER(WRITELINE(*this, dsbz80_device, output_txd)) - - MCFG_CLOCK_ADD("uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_txc)) -MACHINE_CONFIG_END +void dsbz80_device::device_add_mconfig(machine_config &config) +{ + Z80(config, m_ourcpu, 4000000); // unknown clock, but probably pretty slow considering the z80 does like nothing + m_ourcpu->set_addrmap(AS_PROGRAM, &dsbz80_device::dsbz80_map); + m_ourcpu->set_addrmap(AS_IO, &dsbz80_device::dsbz80io_map); + + I8251(config, m_uart, 4000000); + m_uart->rxrdy_handler().set_inputline(m_ourcpu, INPUT_LINE_IRQ0); + m_uart->txd_handler().set(FUNC(dsbz80_device::output_txd)); + + clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_txc)); +} //************************************************************************** // LIVE DEVICE diff --git a/src/mame/audio/dsbz80.h b/src/mame/audio/dsbz80.h index 43f2b0c9fcd..1db717c5484 100644 --- a/src/mame/audio/dsbz80.h +++ b/src/mame/audio/dsbz80.h @@ -15,7 +15,7 @@ MCFG_DEVICE_ADD(_tag, DSBZ80, 0) #define MCFG_DSBZ80_RXD_HANDLER(_devcb) \ - devcb = &downcast(*device).set_rxd_handler(DEVCB_##_devcb); + downcast(*device).set_rxd_handler(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/audio/efo_zsu.cpp b/src/mame/audio/efo_zsu.cpp index 0bcb2ea8097..a847c98a177 100644 --- a/src/mame/audio/efo_zsu.cpp +++ b/src/mame/audio/efo_zsu.cpp @@ -209,10 +209,10 @@ MACHINE_CONFIG_START(efo_zsu_device::device_add_mconfig) MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, efo_zsu_device, ctc1_z2_w)) #if 0 // does nothing useful now - MCFG_DEVICE_ADD("ck1mhz", CLOCK, 4000000/4) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc1", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc1", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc1", z80ctc_device, trg2)) + clock_device &ck1mhz(CLOCK(config, "ck1mhz", 4000000/4); + ck1mhz.signal_handler().set(m_ctc1, FUNC(z80ctc_device::trg0)); + ck1mhz.signal_handler().append(m_ctc1, FUNC(z80ctc_device::trg1)); + ck1mhz.signal_handler().append(m_ctc1, FUNC(z80ctc_device::trg2)); #endif MCFG_GENERIC_LATCH_8_ADD("soundlatch") @@ -223,13 +223,13 @@ MACHINE_CONFIG_START(efo_zsu_device::device_add_mconfig) SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("aysnd0", AY8910, 4000000/2) - MCFG_AY8910_PORT_A_WRITE_CB(MEMBANK("rombank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + ay8910_device &aysnd0(AY8910(config, "aysnd0", 4000000/2)); + aysnd0.port_a_write_callback().set_membank("rombank").mask(0x03); + aysnd0.add_route(ALL_OUTPUTS, "mono", 0.5); - MCFG_DEVICE_ADD("aysnd1", AY8910, 4000000/2) - MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, efo_zsu_device, ay1_porta_w)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + ay8910_device &aysnd1(AY8910(config, "aysnd1", 4000000/2)); + aysnd1.port_a_write_callback().set(FUNC(efo_zsu_device::ay1_porta_w)); + aysnd1.add_route(ALL_OUTPUTS, "mono", 0.5); MCFG_DEVICE_ADD("fifo", CD40105, 0) MCFG_40105_DATA_OUT_READY_CB(WRITELINE(*this, efo_zsu_device, fifo_dor_w)) diff --git a/src/mame/audio/exidy.h b/src/mame/audio/exidy.h index 703c4cd1fe1..b40d4fd489e 100644 --- a/src/mame/audio/exidy.h +++ b/src/mame/audio/exidy.h @@ -127,13 +127,13 @@ protected: }; #define MCFG_EXIDY_VENTURE_WRITEPA_HANDLER(_devcb) \ - devcb = &downcast(*device).set_pa_callback(DEVCB_##_devcb); + downcast(*device).set_pa_callback(DEVCB_##_devcb); #define MCFG_EXIDY_VENTURE_WRITEPB_HANDLER(_devcb) \ - devcb = &downcast(*device).set_pb_callback(DEVCB_##_devcb); + downcast(*device).set_pb_callback(DEVCB_##_devcb); #define MCFG_EXIDY_VENTURE_CA2_HANDLER(_devcb) \ - devcb = &downcast(*device).set_ca2_callback(DEVCB_##_devcb); + downcast(*device).set_ca2_callback(DEVCB_##_devcb); #define MCFG_EXIDY_VENTURE_CB2_HANDLER(_devcb) \ - devcb = &downcast(*device).set_cb2_callback(DEVCB_##_devcb); + downcast(*device).set_cb2_callback(DEVCB_##_devcb); class venture_sound_device : public exidy_sh8253_sound_device { diff --git a/src/mame/audio/harddriv.cpp b/src/mame/audio/harddriv.cpp index 70916a3b95f..5bb4c7a4967 100644 --- a/src/mame/audio/harddriv.cpp +++ b/src/mame/audio/harddriv.cpp @@ -435,16 +435,16 @@ void harddriv_sound_board_device::driversnd_dsp_io_map(address_map &map) MACHINE_CONFIG_START(harddriv_sound_board_device::device_add_mconfig) /* basic machine hardware */ - MCFG_DEVICE_ADD("soundcpu", M68000, XTAL(16'000'000)/2) - MCFG_DEVICE_PROGRAM_MAP(driversnd_68k_map) - - MCFG_DEVICE_ADD("latch", LS259, 0) // 80R - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, harddriv_sound_board_device, speech_write_w)) // SPWR - 5220 write strobe - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, harddriv_sound_board_device, speech_reset_w)) // SPRES - 5220 hard reset - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, harddriv_sound_board_device, speech_rate_w)) // SPRATE - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, harddriv_sound_board_device, cram_enable_w)) // CRAMEN - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(INPUTLINE("sounddsp", INPUT_LINE_HALT)) MCFG_DEVCB_INVERT // RES320 - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, harddriv_sound_board_device, led_w)) + M68000(config, m_soundcpu, 16_MHz_XTAL/2); + m_soundcpu->set_addrmap(AS_PROGRAM, &harddriv_sound_board_device::driversnd_68k_map); + + LS259(config, m_latch, 0); // 80R + m_latch->q_out_cb<0>().set(FUNC(harddriv_sound_board_device::speech_write_w)); // SPWR - 5220 write strobe + m_latch->q_out_cb<1>().set(FUNC(harddriv_sound_board_device::speech_reset_w)); // SPRES - 5220 hard reset + m_latch->q_out_cb<2>().set(FUNC(harddriv_sound_board_device::speech_rate_w)); // SPRATE + m_latch->q_out_cb<3>().set(FUNC(harddriv_sound_board_device::cram_enable_w)); // CRAMEN + m_latch->q_out_cb<4>().set_inputline(m_sounddsp, INPUT_LINE_HALT).invert(); // RES320 + m_latch->q_out_cb<7>().set(FUNC(harddriv_sound_board_device::led_w)); MCFG_DEVICE_ADD("sounddsp", TMS32010, XTAL(20'000'000)) MCFG_DEVICE_PROGRAM_MAP(driversnd_dsp_program_map) diff --git a/src/mame/audio/irem.cpp b/src/mame/audio/irem.cpp index 88d312bbabc..7898c493a2b 100644 --- a/src/mame/audio/irem.cpp +++ b/src/mame/audio/irem.cpp @@ -20,14 +20,14 @@ DEFINE_DEVICE_TYPE(IREM_M52_LARGE_AUDIO, m52_large_audio_device, "m52_large_au irem_audio_device::irem_audio_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_cpu(*this, "iremsound") + , m_adpcm1(*this, "msm1") + , m_adpcm2(*this, "msm2") , m_port1(0) , m_port2(0) , m_soundlatch(0) - , m_cpu(*this, "iremsound") , m_ay_45L(*this, "ay_45l") , m_ay_45M(*this, "ay_45m") - , m_adpcm1(*this, "msm1") - , m_adpcm2(*this, "msm2") , m_audio_BD(*this, "snd_nl:ibd") , m_audio_SD(*this, "snd_nl:isd") , m_audio_OH(*this, "snd_nl:ioh") @@ -431,15 +431,15 @@ MACHINE_CONFIG_START(m62_audio_device::device_add_mconfig) MCFG_SOUND_ROUTE(1, "snd_nl", 1.0, 4) MCFG_SOUND_ROUTE(2, "snd_nl", 1.0, 5) - MCFG_DEVICE_ADD("msm1", MSM5205, XTAL(384'000)) /* verified on pcb */ - MCFG_MSM5205_VCK_CALLBACK(INPUTLINE("iremsound", INPUT_LINE_NMI)) // driven through NPN inverter - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("msm2", msm5205_device, vclk_w)) // the first MSM5205 clocks the second - MCFG_MSM5205_PRESCALER_SELECTOR(S96_4B) /* default to 4KHz, but can be changed at run time */ - MCFG_SOUND_ROUTE(0, "snd_nl", 1.0, 6) + MSM5205(config, m_adpcm1, 384_kHz_XTAL); // verified on PCB + m_adpcm1->vck_callback().set_inputline(m_cpu, INPUT_LINE_NMI); // driven through NPN inverter + m_adpcm1->vck_callback().append(m_adpcm2, FUNC(msm5205_device::vclk_w)); // the first MSM5205 clocks the second + m_adpcm1->set_prescaler_selector(msm5205_device::S96_4B); // default to 4KHz, but can be changed at run time + m_adpcm1->add_route(0, "snd_nl", 1.0, 6); - MCFG_DEVICE_ADD("msm2", MSM5205, XTAL(384'000)) /* verified on pcb */ - MCFG_MSM5205_PRESCALER_SELECTOR(SEX_4B) /* default to 4KHz, but can be changed at run time, slave */ - MCFG_SOUND_ROUTE(0, "snd_nl", 1.0, 7) + MSM5205(config, m_adpcm2, 384_kHz_XTAL); // verified on PCB + m_adpcm2->set_prescaler_selector(msm5205_device::SEX_4B); // default to 4KHz, but can be changed at run time, slave + m_adpcm2->add_route(0, "snd_nl", 1.0, 7); /* NETLIST configuration using internal AY8910 resistor values */ @@ -530,15 +530,15 @@ MACHINE_CONFIG_START(m52_large_audio_device::device_add_mconfig) /* 10 yard fig MCFG_AY8910_PORT_A_WRITE_CB(WRITE8(*this, irem_audio_device, ay8910_45L_porta_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) - MCFG_DEVICE_ADD("msm1", MSM5205, XTAL(384'000)) /* verified on pcb */ - MCFG_MSM5205_VCK_CALLBACK(INPUTLINE("iremsound", INPUT_LINE_NMI)) // driven through NPN inverter - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("msm2", msm5205_device, vclk_w)) // the first MSM5205 clocks the second - MCFG_MSM5205_PRESCALER_SELECTOR(S96_4B) /* default to 4KHz, but can be changed at run time */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MSM5205(config, m_adpcm1, 384_kHz_XTAL); // verified on PCB + m_adpcm1->vck_callback().set_inputline(m_cpu, INPUT_LINE_NMI); // driven through NPN inverter + m_adpcm1->vck_callback().append(m_adpcm2, FUNC(msm5205_device::vclk_w)); // the first MSM5205 clocks the second + m_adpcm1->set_prescaler_selector(msm5205_device::S96_4B); // default to 4KHz, but can be changed at run time + m_adpcm1->add_route(ALL_OUTPUTS, "mono", 0.80); - MCFG_DEVICE_ADD("msm2", MSM5205, XTAL(384'000)) /* verified on pcb */ - MCFG_MSM5205_PRESCALER_SELECTOR(SEX_4B) /* default to 4KHz, but can be changed at run time, slave */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) + MSM5205(config, m_adpcm2, 384_kHz_XTAL); // verified on PCB + m_adpcm2->set_prescaler_selector(msm5205_device::SEX_4B); // default to 4KHz, but can be changed at run time, slave + m_adpcm2->add_route(ALL_OUTPUTS, "mono", 0.80); MACHINE_CONFIG_END diff --git a/src/mame/audio/irem.h b/src/mame/audio/irem.h index cbe85dd2853..7bbb614e634 100644 --- a/src/mame/audio/irem.h +++ b/src/mame/audio/irem.h @@ -39,6 +39,10 @@ protected: virtual void device_start() override; virtual void device_reset() override; + required_device m_cpu; + required_device m_adpcm1; + optional_device m_adpcm2; + private: // internal state uint8_t m_port1; @@ -46,11 +50,8 @@ private: uint8_t m_soundlatch; - required_device m_cpu; required_device m_ay_45L; required_device m_ay_45M; - required_device m_adpcm1; - optional_device m_adpcm2; optional_device m_audio_BD; optional_device m_audio_SD; optional_device m_audio_OH; diff --git a/src/mame/audio/namco52.h b/src/mame/audio/namco52.h index 97221fb91cb..0412ed14dcb 100644 --- a/src/mame/audio/namco52.h +++ b/src/mame/audio/namco52.h @@ -19,10 +19,10 @@ downcast(*device).set_extclock(_clock); #define MCFG_NAMCO_52XX_ROMREAD_CB(_devcb) \ - devcb = &downcast(*device).set_romread_callback(DEVCB_##_devcb); + downcast(*device).set_romread_callback(DEVCB_##_devcb); #define MCFG_NAMCO_52XX_SI_CB(_devcb) \ - devcb = &downcast(*device).set_si_callback(DEVCB_##_devcb); + downcast(*device).set_si_callback(DEVCB_##_devcb); class namco_52xx_device : public device_t diff --git a/src/mame/audio/rad_eu3a05.h b/src/mame/audio/rad_eu3a05.h index 8dcd61927a4..16325185758 100644 --- a/src/mame/audio/rad_eu3a05.h +++ b/src/mame/audio/rad_eu3a05.h @@ -5,7 +5,7 @@ #define MAME_AUDIO_RAD_EU3A05_H #define MCFG_RADICA6502_SOUND_SPACE_READ_CB(_devcb) \ - devcb = &downcast(*device).set_space_read_callback(DEVCB_##_devcb); + downcast(*device).set_space_read_callback(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/audio/segag80r.cpp b/src/mame/audio/segag80r.cpp index 12cc48e6b40..4e83f39f723 100644 --- a/src/mame/audio/segag80r.cpp +++ b/src/mame/audio/segag80r.cpp @@ -696,7 +696,7 @@ void monsterb_sound_device::device_start() MACHINE_CONFIG_START(monsterb_sound_device::device_add_mconfig) /* basic machine hardware */ MCFG_DEVICE_ADD(m_audiocpu, N7751, 6000000) - MCFG_MCS48_PORT_T1_IN_CB(GND) // labelled as "TEST", connected to ground + MCFG_MCS48_PORT_T1_IN_CB(CONSTANT(0)) // labelled as "TEST", connected to ground MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, monsterb_sound_device, n7751_command_r)) MCFG_MCS48_PORT_BUS_IN_CB(READ8(*this, monsterb_sound_device, n7751_rom_r)) MCFG_MCS48_PORT_P1_OUT_CB(WRITE8("dac", dac_byte_interface, data_w)) diff --git a/src/mame/audio/segam1audio.cpp b/src/mame/audio/segam1audio.cpp index 85475dc28bb..4638106761a 100644 --- a/src/mame/audio/segam1audio.cpp +++ b/src/mame/audio/segam1audio.cpp @@ -80,13 +80,13 @@ MACHINE_CONFIG_START(segam1audio_device::device_add_mconfig) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - MCFG_DEVICE_ADD(UART_TAG, I8251, 8000000) // T82C51, clock unknown - MCFG_I8251_RXRDY_HANDLER(INPUTLINE(M68000_TAG, M68K_IRQ_2)) - MCFG_I8251_TXD_HANDLER(WRITELINE(*this, segam1audio_device, output_txd)) + I8251(config, m_uart, 8000000); // T82C51, clock unknown + m_uart->rxrdy_handler().set_inputline(m_audiocpu, M68K_IRQ_2); + m_uart->txd_handler().set(FUNC(segam1audio_device::output_txd)); - MCFG_CLOCK_ADD("uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(UART_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(UART_TAG, i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END //************************************************************************** diff --git a/src/mame/audio/segam1audio.h b/src/mame/audio/segam1audio.h index c31349b5ea2..9dc09cbf84c 100644 --- a/src/mame/audio/segam1audio.h +++ b/src/mame/audio/segam1audio.h @@ -15,12 +15,6 @@ #define M1AUDIO_MPCM1_REGION "m1audio:pcm1" #define M1AUDIO_MPCM2_REGION "m1audio:pcm2" -#define MCFG_SEGAM1AUDIO_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, SEGAM1AUDIO, 0) - -#define MCFG_SEGAM1AUDIO_RXD_HANDLER(_devcb) \ - devcb = &downcast(*device).set_rxd_handler(DEVCB_##_devcb); - //************************************************************************** // TYPE DEFINITIONS @@ -33,7 +27,7 @@ public: segam1audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - template devcb_base &set_rxd_handler(Object &&cb) { return m_rxd_handler.set_callback(std::forward(cb)); } + auto rxd_handler() { return m_rxd_handler.bind(); } DECLARE_WRITE16_MEMBER(m1_snd_mpcm_bnk1_w); DECLARE_WRITE16_MEMBER(m1_snd_mpcm_bnk2_w); diff --git a/src/mame/audio/segasnd.h b/src/mame/audio/segasnd.h index 70551a8e39b..8e0f902a13e 100644 --- a/src/mame/audio/segasnd.h +++ b/src/mame/audio/segasnd.h @@ -36,7 +36,7 @@ protected: #define SEGASND_SEGASPEECH_REGION "segaspeech:speech" #define MCFG_SEGASPEECH_INT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_int_cb(DEVCB_##_devcb); + downcast(*device).set_int_cb(DEVCB_##_devcb); class speech_sound_device : public device_t, public device_sound_interface { diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h index 546ab085b85..e4c8473ffa3 100644 --- a/src/mame/audio/seibu.h +++ b/src/mame/audio/seibu.h @@ -189,10 +189,10 @@ DECLARE_DEVICE_TYPE(SEIBU_ADPCM, seibu_adpcm_device) downcast(*device).set_rombank_tag(_banktag); #define MCFG_SEIBU_SOUND_YM_READ_CB(_devcb) \ - devcb = &downcast(*device).set_ym_read_callback(DEVCB_##_devcb); + downcast(*device).set_ym_read_callback(DEVCB_##_devcb); #define MCFG_SEIBU_SOUND_YM_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_ym_write_callback(DEVCB_##_devcb); + downcast(*device).set_ym_write_callback(DEVCB_##_devcb); /**************************************************************************/ diff --git a/src/mame/audio/svis_snd.h b/src/mame/audio/svis_snd.h index 44a40e5de86..802d3019371 100644 --- a/src/mame/audio/svis_snd.h +++ b/src/mame/audio/svis_snd.h @@ -17,7 +17,7 @@ //************************************************************************** #define MCFG_SVISION_SOUND_IRQ_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_irq_cb(DEVCB_##_devcb); + downcast(*device).set_irq_cb(DEVCB_##_devcb); // ======================> svision_sound_device diff --git a/src/mame/audio/tvc.h b/src/mame/audio/tvc.h index b91a103d784..4555598bca7 100644 --- a/src/mame/audio/tvc.h +++ b/src/mame/audio/tvc.h @@ -12,7 +12,7 @@ #pragma once #define MCFG_TVC_SOUND_SNDINT_CALLBACK(_write) \ - devcb = &downcast(*device).set_sndint_wr_callback(DEVCB_##_write); + downcast(*device).set_sndint_wr_callback(DEVCB_##_write); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/audio/williams.cpp b/src/mame/audio/williams.cpp index dce51aee1d6..c8968b1085a 100644 --- a/src/mame/audio/williams.cpp +++ b/src/mame/audio/williams.cpp @@ -177,25 +177,25 @@ void williams_cvsd_sound_device::williams_cvsd_map(address_map &map) //------------------------------------------------- MACHINE_CONFIG_START(williams_cvsd_sound_device::device_add_mconfig) - MCFG_DEVICE_ADD("cpu", MC6809E, CVSD_MASTER_CLOCK / 4) + MCFG_DEVICE_ADD(m_cpu, MC6809E, CVSD_MASTER_CLOCK / 4) MCFG_DEVICE_PROGRAM_MAP(williams_cvsd_map) - MCFG_DEVICE_ADD("pia", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams_cvsd_sound_device, talkback_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("cpu", M6809_FIRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("cpu", INPUT_LINE_NMI)) + PIA6821(config, m_pia, 0); + m_pia->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pia->writepb_handler().set(FUNC(williams_cvsd_sound_device::talkback_w)); + m_pia->irqa_handler().set_inputline(m_cpu, M6809_FIRQ_LINE); + m_pia->irqb_handler().set_inputline(m_cpu, INPUT_LINE_NMI); - MCFG_DEVICE_ADD("ym2151", YM2151, CVSD_FM_CLOCK) - MCFG_YM2151_IRQ_HANDLER(WRITELINE("pia", pia6821_device, ca1_w)) MCFG_DEVCB_INVERT // IRQ is not true state - MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 0.10) + ym2151_device &ym(YM2151(config, "ym2151", CVSD_FM_CLOCK)); + ym.irq_handler().set(m_pia, FUNC(pia6821_device::ca1_w)).invert(); // IRQ is not true state + ym.add_route(ALL_OUTPUTS, *this, 0.10); - MCFG_DEVICE_ADD("dac", MC1408, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 0.25) + MC1408(config, "dac", 0).add_route(ALL_OUTPUTS, *this, 0.25); MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) - MCFG_DEVICE_ADD("cvsd", HC55516, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, *this, 0.60) + HC55516(config, m_hc55516, 0); + m_hc55516->add_route(ALL_OUTPUTS, *this, 0.60); MACHINE_CONFIG_END diff --git a/src/mame/audio/zaccaria.h b/src/mame/audio/zaccaria.h index 63605b079e6..468e9bd1ec7 100644 --- a/src/mame/audio/zaccaria.h +++ b/src/mame/audio/zaccaria.h @@ -25,7 +25,7 @@ DECLARE_DEVICE_TYPE(ZACCARIA_1B11142, zac1b11142_audio_device) //************************************************************************** #define MCFG_ZACCARIA_1B11142_SET_ACS_CALLBACK(_devcb) \ - devcb = &downcast(device).set_acs_cb(DEVCB_##_devcb); + downcast(device).set_acs_cb(DEVCB_##_devcb); diff --git a/src/mame/drivers/24cdjuke.cpp b/src/mame/drivers/24cdjuke.cpp index b75e5c7ec75..e559e700e18 100644 --- a/src/mame/drivers/24cdjuke.cpp +++ b/src/mame/drivers/24cdjuke.cpp @@ -302,9 +302,9 @@ MACHINE_CONFIG_START(midcoin24cdjuke_state::midcoin24cdjuke) MCFG_I8255_IN_PORTC_CB(READ8(*this, midcoin24cdjuke_state, kb_row_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, midcoin24cdjuke_state, kb_col_w)) - MCFG_DEVICE_ADD("ic31", I8255A, 0) - MCFG_I8255_OUT_PORTB_CB(LOGGER("PPI8255 - unmapped write port B")) - MCFG_I8255_IN_PORTC_CB(IOPORT("MD4")) + i8255_device &ic32(I8255A(config, "ic31", 0)); + ic32.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ic32.in_pc_callback().set_ioport("MD4"); MACHINE_CONFIG_END diff --git a/src/mame/drivers/2mindril.cpp b/src/mame/drivers/2mindril.cpp index e66bd8c98b7..639b2c77c80 100644 --- a/src/mame/drivers/2mindril.cpp +++ b/src/mame/drivers/2mindril.cpp @@ -366,12 +366,12 @@ MACHINE_CONFIG_START(_2mindril_state::drill) //MCFG_DEVICE_PERIODIC_INT_DRIVER(_2mindril_state, drill_device_irq, 60) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_2mindril) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSW")) - MCFG_TC0510NIO_READ_1_CB(READ8(*this, _2mindril_state, arm_pwr_r)) - MCFG_TC0510NIO_READ_2_CB(READ8(*this, _2mindril_state, sensors_r)) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, _2mindril_state, coins_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("COINS")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_0_callback().set_ioport("DSW"); + tc0510nio.read_1_callback().set(FUNC(_2mindril_state::arm_pwr_r)); + tc0510nio.read_2_callback().set(FUNC(_2mindril_state::sensors_r)); + tc0510nio.write_4_callback().set(FUNC(_2mindril_state::coins_w)); + tc0510nio.read_7_callback().set_ioport("COINS"); MCFG_MACHINE_START_OVERRIDE(_2mindril_state,drill) MCFG_MACHINE_RESET_OVERRIDE(_2mindril_state,drill) diff --git a/src/mame/drivers/68ksbc.cpp b/src/mame/drivers/68ksbc.cpp index f0a4b623010..40d635d8d35 100644 --- a/src/mame/drivers/68ksbc.cpp +++ b/src/mame/drivers/68ksbc.cpp @@ -45,6 +45,7 @@ public: private: void c68ksbc_mem(address_map &map); + required_device m_maincpu; }; @@ -62,23 +63,23 @@ static INPUT_PORTS_START( c68ksbc ) INPUT_PORTS_END -MACHINE_CONFIG_START(c68ksbc_state::c68ksbc) - /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, 8000000) // text says 8MHz, schematic says 10MHz - MCFG_DEVICE_PROGRAM_MAP(c68ksbc_mem) +void c68ksbc_state::c68ksbc(machine_config &config) +{ + M68000(config, m_maincpu, 8000000); // text says 8MHz, schematic says 10MHz + m_maincpu->set_addrmap(AS_PROGRAM, &c68ksbc_state::c68ksbc_mem); - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) + acia6850_device &acia(ACIA6850(config, "acia", 0)); + acia.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(WRITELINE("acia", acia6850_device, write_cts)) + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set("acia", FUNC(acia6850_device::write_rxd)); + rs232.cts_handler().set("acia", FUNC(acia6850_device::write_cts)); - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) -MACHINE_CONFIG_END + clock_device &acia_clock(CLOCK(config, "acia_clock", 153600)); + acia_clock.signal_handler().set("acia", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia", FUNC(acia6850_device::write_rxc)); +} /* ROM definition */ ROM_START( 68ksbc ) diff --git a/src/mame/drivers/a7150.cpp b/src/mame/drivers/a7150.cpp index a93a74d0886..3823d23d656 100644 --- a/src/mame/drivers/a7150.cpp +++ b/src/mame/drivers/a7150.cpp @@ -526,17 +526,17 @@ MACHINE_CONFIG_START(a7150_state::a7150) MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(8) MCFG_ADDRESS_MAP_BANK_STRIDE(0x10000) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 1230750) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(Z80CTC_TAG, z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80CTC_TAG, z80ctc_device, trg2)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80CTC_TAG, z80ctc_device, trg3)) - - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, XTAL(16'000'000)/3) - MCFG_Z80CTC_INTR_CB(INPUTLINE("gfxcpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(Z80SIO_TAG, z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80SIO_TAG, z80sio_device, txca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(Z80SIO_TAG, z80sio_device, rxtxcb_w)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 1230750)); + ctc_clock.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg2)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg3)); + + Z80CTC(config, m_ctc, 16_MHz_XTAL/3); + m_ctc->intr_callback().set_inputline(m_gfxcpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(Z80SIO_TAG, FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<0>().append(Z80SIO_TAG, FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().set(Z80SIO_TAG, FUNC(z80sio_device::rxtxcb_w)); MCFG_DEVICE_ADD(Z80SIO_TAG, Z80SIO, XTAL(16'000'000)/4) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("gfxcpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/abc80x.cpp b/src/mame/drivers/abc80x.cpp index e07fa3a445f..c679698c026 100644 --- a/src/mame/drivers/abc80x.cpp +++ b/src/mame/drivers/abc80x.cpp @@ -1059,12 +1059,12 @@ MACHINE_CONFIG_START(abc800_state::common) MCFG_DEVICE_OPCODES_MAP(abc800_m1) // peripheral hardware - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, ABC800_X01/2/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE(*this, abc800_state, ctc_z0_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE(*this, abc800_state, ctc_z1_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(Z80DART_TAG, z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_TAG, z80dart_device, txca_w)) + Z80CTC(config, m_ctc, ABC800_X01/2/2); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set(FUNC(abc800_state::ctc_z0_w)); + m_ctc->zc_callback<1>().set(FUNC(abc800_state::ctc_z1_w)); + m_ctc->zc_callback<2>().set(m_dart, FUNC(z80dart_device::rxca_w)); + m_ctc->zc_callback<2>().append(m_dart, FUNC(z80dart_device::txca_w)); MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_CTC_TAG, abc800_state, ctc_tick, attotime::from_hz(ABC800_X01/2/2/2)) MCFG_DEVICE_ADD(Z80SIO_TAG, Z80SIO, ABC800_X01/2/2) diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp index bc65f9f4d4d..198ba678bbc 100644 --- a/src/mame/drivers/aerofgt.cpp +++ b/src/mame/drivers/aerofgt.cpp @@ -1988,15 +1988,15 @@ MACHINE_CONFIG_START(aerofgt_state::aerofgt) MCFG_MACHINE_START_OVERRIDE(aerofgt_state,aerofgt) MCFG_MACHINE_RESET_OVERRIDE(aerofgt_state,aerofgt) - MCFG_DEVICE_ADD("io", VS9209, 0) - MCFG_VS9209_IN_PORTA_CB(IOPORT("P1")) - MCFG_VS9209_IN_PORTB_CB(IOPORT("P2")) - MCFG_VS9209_IN_PORTC_CB(IOPORT("SYSTEM")) - MCFG_VS9209_IN_PORTD_CB(IOPORT("DSW1")) - MCFG_VS9209_IN_PORTE_CB(IOPORT("DSW2")) - MCFG_VS9209_IN_PORTG_CB(READLINE("soundlatch", generic_latch_8_device, pending_r)) MCFG_DEVCB_BIT(0) - MCFG_VS9209_OUT_PORTG_CB(WRITELINE("watchdog", mb3773_device, write_line_ck)) MCFG_DEVCB_BIT(7) - MCFG_VS9209_IN_PORTH_CB(IOPORT("JP1")) + vs9209_device &io(VS9209(config, "io", 0)); + io.porta_input_cb().set_ioport("P1"); + io.portb_input_cb().set_ioport("P2"); + io.portc_input_cb().set_ioport("SYSTEM"); + io.portd_input_cb().set_ioport("DSW1"); + io.porte_input_cb().set_ioport("DSW2"); + io.portg_input_cb().set(m_soundlatch, FUNC(generic_latch_8_device::pending_r)).lshift(0); + io.portg_output_cb().set("watchdog", FUNC(mb3773_device::write_line_ck)).bit(7); + io.porth_input_cb().set_ioport("JP1"); MCFG_DEVICE_ADD("watchdog", MB3773, 0) diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp index 8fe0d4fd534..699e4bb5fb7 100644 --- a/src/mame/drivers/alesis.cpp +++ b/src/mame/drivers/alesis.cpp @@ -416,12 +416,12 @@ HD44780_PIXEL_UPDATE(alesis_state::sr16_pixel_update) MACHINE_CONFIG_START(alesis_state::hr16) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8031, 12_MHz_XTAL) - MCFG_DEVICE_PROGRAM_MAP(hr16_mem) - MCFG_DEVICE_IO_MAP(hr16_io) - MCFG_MCS51_PORT_P1_IN_CB(IOPORT("SELECT")) - MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, alesis_state, p3_r)) - MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, alesis_state, p3_w)) + I8031(config, m_maincpu, 12_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &alesis_state::hr16_mem); + m_maincpu->set_addrmap(AS_IO, &alesis_state::hr16_io); + m_maincpu->port_in_cb<1>().set_ioport("SELECT"); + m_maincpu->port_in_cb<3>().set(FUNC(alesis_state::p3_r)); + m_maincpu->port_out_cb<3>().set(FUNC(alesis_state::p3_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", LCD) @@ -451,11 +451,11 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(alesis_state::sr16) hr16(config); + /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(sr16_mem) - MCFG_DEVICE_IO_MAP(sr16_io) - MCFG_MCS51_PORT_P1_IN_CB(NOOP) + m_maincpu->set_addrmap(AS_PROGRAM, &alesis_state::sr16_mem); + m_maincpu->set_addrmap(AS_IO, &alesis_state::sr16_io); + m_maincpu->port_in_cb<1>().set_constant(0); /* video hardware */ MCFG_SCREEN_MODIFY("screen") @@ -470,12 +470,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(alesis_state::mmt8) hr16(config); + /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_IO_MAP(mmt8_io) - MCFG_MCS51_PORT_P1_IN_CB(READ8(*this, alesis_state, kb_r)) - MCFG_MCS51_PORT_P3_IN_CB(READ8(*this, alesis_state, mmt8_p3_r)) - MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, alesis_state, mmt8_p3_w)) + m_maincpu->set_addrmap(AS_IO, &alesis_state::mmt8_io); + m_maincpu->port_in_cb<1>().set(FUNC(alesis_state::kb_r)); + m_maincpu->port_in_cb<3>().set(FUNC(alesis_state::mmt8_p3_r)); + m_maincpu->port_out_cb<3>().set(FUNC(alesis_state::mmt8_p3_w)); MCFG_DEVICE_REMOVE("dm3ag") MACHINE_CONFIG_END diff --git a/src/mame/drivers/alpha68k.cpp b/src/mame/drivers/alpha68k.cpp index 8a0cb630e86..4fa7f393a99 100644 --- a/src/mame/drivers/alpha68k.cpp +++ b/src/mame/drivers/alpha68k.cpp @@ -2105,10 +2105,10 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_II) MCFG_DEVICE_IO_MAP(sound_portmap) MCFG_DEVICE_PERIODIC_INT_DRIVER(alpha68k_state, alpha68k_sound_nmi, 7614) - MCFG_DEVICE_ADD("outlatch", LS259, 0) // 14A - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, alpha68k_state, video_control2_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, alpha68k_state, video_control3_w)) - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, alpha68k_state, video_bank_w)) MCFG_DEVCB_MASK(0x70) MCFG_DEVCB_RSHIFT(-4) + LS259(config, m_outlatch); // 14A + m_outlatch->q_out_cb<2>().set(FUNC(alpha68k_state::video_control2_w)); + m_outlatch->q_out_cb<3>().set(FUNC(alpha68k_state::video_control3_w)); + m_outlatch->parallel_out_cb().set(FUNC(alpha68k_state::video_bank_w)).rshift(4).mask(0x07); MCFG_MACHINE_START_OVERRIDE(alpha68k_state,alpha68k_II) MCFG_MACHINE_RESET_OVERRIDE(alpha68k_state,alpha68k_II) diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp index e707af694a1..91848adb5d1 100644 --- a/src/mame/drivers/alphatpx.cpp +++ b/src/mame/drivers/alphatpx.cpp @@ -1232,11 +1232,11 @@ MACHINE_CONFIG_START(alphatp_12_state::alphatp2) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("crtc", CRT5027, 12.8544_MHz_XTAL / 8) - MCFG_TMS9927_CHAR_WIDTH(8) - MCFG_TMS9927_HSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST55_LINE)) - MCFG_TMS9927_VSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) MCFG_DEVCB_XOR(1) - MCFG_VIDEO_SET_SCREEN("screen") + CRT5027(config, m_crtc, 12.8544_MHz_XTAL / 8); + m_crtc->set_char_width(8); + m_crtc->hsyn_wr_callback().set_inputline("maincpu", I8085_RST55_LINE); + m_crtc->vsyn_wr_callback().set_inputline("maincpu", I8085_RST65_LINE).exor(1); + m_crtc->set_screen("screen"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alphatp3) @@ -1314,10 +1314,10 @@ MACHINE_CONFIG_START(alphatp_34_state::alphatp3) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("crtc", CRT5037, 12.8544_MHz_XTAL / 8) - MCFG_TMS9927_CHAR_WIDTH(8) - MCFG_TMS9927_VSYN_CALLBACK(INPUTLINE("maincpu", I8085_RST65_LINE)) MCFG_DEVCB_XOR(1) - MCFG_VIDEO_SET_SCREEN("screen") + CRT5037(config, m_crtc, 12.8544_MHz_XTAL / 8); + m_crtc->set_char_width(8); + m_crtc->vsyn_wr_callback().set_inputline("maincpu", I8085_RST65_LINE).exor(1); + m_crtc->set_screen("screen"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alphatp3) @@ -1347,7 +1347,7 @@ MACHINE_CONFIG_START(alphatp_34_state::alphatp30) MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("i8088", 0)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("pit", PIT8253, 0) MCFG_PIT8253_CLK0(100000) // 15Mhz osc with unknown divisor diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp index fcebc5d0290..85f30d5ad6a 100644 --- a/src/mame/drivers/alphatro.cpp +++ b/src/mame/drivers/alphatro.cpp @@ -746,9 +746,9 @@ MACHINE_CONFIG_START(alphatro_state::alphatro) MCFG_DEVICE_ADD("usart", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE(*this, alphatro_state, txdata_callback)) - MCFG_DEVICE_ADD("usart_clock", CLOCK, 19218) // 19218 to load a real tape, 19222 to load a tape made by this driver - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("usart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("usart", i8251_device, write_rxc)) + clock_device &usart_clock(CLOCK(config, "usart_clock", 19218)); // 19218 to load a real tape, 19222 to load a tape made by this driver + usart_clock.signal_handler().set(m_usart, FUNC(i8251_device::write_txc)); + usart_clock.signal_handler().append(m_usart, FUNC(i8251_device::write_rxc)); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) diff --git a/src/mame/drivers/altair.cpp b/src/mame/drivers/altair.cpp index 8840e4dda67..8929942a73c 100644 --- a/src/mame/drivers/altair.cpp +++ b/src/mame/drivers/altair.cpp @@ -113,9 +113,9 @@ MACHINE_CONFIG_START(altair_state::altair) MCFG_RS232_DCD_HANDLER(WRITELINE("acia", acia6850_device, write_dcd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) // TODO: this is set using jumpers S3/S2/S1/S0 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); // TODO: this is set using jumpers S3/S2/S1/S0 + uart_clock.signal_handler().set("acia", FUNC(acia6850_device::write_txc)); + uart_clock.signal_handler().append("acia", FUNC(acia6850_device::write_rxc)); /* quickload */ MCFG_QUICKLOAD_ADD("quickload", altair_state, altair, "bin", 0) diff --git a/src/mame/drivers/altos2.cpp b/src/mame/drivers/altos2.cpp index db1272a1d8c..7261f9778a5 100644 --- a/src/mame/drivers/altos2.cpp +++ b/src/mame/drivers/altos2.cpp @@ -102,31 +102,32 @@ static const z80_daisy_config daisy_chain[] = MACHINE_CONFIG_START(altos2_state::altos2) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",Z80, XTAL(4'000'000)) // unknown clock + MCFG_DEVICE_ADD(m_maincpu, Z80, XTAL(4'000'000)) // unknown clock MCFG_DEVICE_PROGRAM_MAP(mem_map) MCFG_DEVICE_IO_MAP(io_map) MCFG_Z80_DAISY_CHAIN(daisy_chain) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 4915200) // ctc & dart connections are guesswork - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("dart1", z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart1", z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("dart1", z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("dart2", z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart2", z80dart_device, txca_w)) - - MCFG_DEVICE_ADD("dart1", Z80DART, XTAL(4'000'000)) - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("dart2", Z80DART, XTAL(4'000'000)) // channel B not used for communications - MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80DART_OUT_DTRB_CB(WRITELINE("novram", x2210_device, store)) MCFG_DEVCB_INVERT // FIXME: no inverter should be needed - - MCFG_DEVICE_ADD("novram", X2210, 0) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 4915200)); // ctc & dart connections are guesswork + ctc_clock.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg2)); + + z80ctc_device &ctc(Z80CTC(config, "ctc", 4_MHz_XTAL)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("dart1", FUNC(z80dart_device::txca_w)); + ctc.zc_callback<0>().append("dart1", FUNC(z80dart_device::rxca_w)); + ctc.zc_callback<1>().set("dart1", FUNC(z80dart_device::rxtxcb_w)); + ctc.zc_callback<2>().set("dart2", FUNC(z80dart_device::rxca_w)); + ctc.zc_callback<2>().append("dart2", FUNC(z80dart_device::txca_w)); + + z80dart_device &dart1(Z80DART(config, "dart1", 4_MHz_XTAL)); + dart1.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + + z80dart_device &dart2(Z80DART(config, "dart2", 4_MHz_XTAL)); // channel B not used for communications + dart2.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + dart2.out_dtrb_callback().set(m_novram, FUNC(x2210_device::store)).invert(); // FIXME: no inverter should be needed + + X2210(config, m_novram, 0); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL(40'000'000) / 2, 960, 0, 800, 347, 0, 325) diff --git a/src/mame/drivers/altos486.cpp b/src/mame/drivers/altos486.cpp index 098386f982b..afa25857d3e 100644 --- a/src/mame/drivers/altos486.cpp +++ b/src/mame/drivers/altos486.cpp @@ -132,7 +132,7 @@ void altos486_state::altos486_z80_io(address_map &map) } MACHINE_CONFIG_START(altos486_state::altos486) - MCFG_DEVICE_ADD("maincpu", I80186, XTAL(8'000'000)) + MCFG_DEVICE_ADD(m_maincpu, I80186, XTAL(8'000'000)) MCFG_DEVICE_PROGRAM_MAP(altos486_mem) MCFG_DEVICE_IO_MAP(altos486_io) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259", pic8259_device, inta_cb) // yes, really @@ -141,10 +141,10 @@ MACHINE_CONFIG_START(altos486_state::altos486) MCFG_DEVICE_PROGRAM_MAP(altos486_z80_mem) MCFG_DEVICE_IO_MAP(altos486_z80_io) - MCFG_DEVICE_ADD("pic8259", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("maincpu", i80186_cpu_device, int0_w)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, altos486_state, read_rmx_ack)) + pic8259_device &pic8259(PIC8259(config, "pic8259", 0)); + pic8259.out_int_callback().set(m_maincpu, FUNC(i80186_cpu_device::int0_w)); + pic8259.in_sp_callback().set_constant(1); + pic8259.read_slave_ack_callback().set(FUNC(altos486_state::read_rmx_ack)); MCFG_DEVICE_ADD("ppi8255", I8255, 0) diff --git a/src/mame/drivers/altos5.cpp b/src/mame/drivers/altos5.cpp index 958a81ed330..746039d0a6e 100644 --- a/src/mame/drivers/altos5.cpp +++ b/src/mame/drivers/altos5.cpp @@ -415,10 +415,10 @@ MACHINE_CONFIG_START(altos5_state::altos5) MCFG_DEVICE_IO_MAP(io_map) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 8_MHz_XTAL / 4) // 2MHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc" ,z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc" ,z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc" ,z80ctc_device, trg2)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 8_MHz_XTAL / 4)); // 2MHz + ctc_clock.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg2)); /* devices */ MCFG_DEVICE_ADD("dma", Z80DMA, 8_MHz_XTAL / 2) @@ -454,14 +454,14 @@ MACHINE_CONFIG_START(altos5_state::altos5) MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs232", rs232_port_device, write_rts)) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) // SIO Ch B - MCFG_Z80CTC_ZC1_CB(WRITELINE("dart", z80dart_device, txca_w)) // Z80DART Ch A, SIO Ch A - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart" ,z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio" ,z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio" ,z80sio_device, rxca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("dart", z80dart_device, rxtxcb_w)) // Z80DART Ch B + z80ctc_device &ctc(Z80CTC(config, "ctc", 8_MHz_XTAL / 2)); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<0>().set("sio", FUNC(z80sio_device::rxtxcb_w)); // SIO Ch B + ctc.zc_callback<1>().set("dart", FUNC(z80dart_device::txca_w)); // Z80DART Ch A, SIO Ch A + ctc.zc_callback<1>().append("dart", FUNC(z80dart_device::rxca_w)); + ctc.zc_callback<1>().append("sio", FUNC(z80sio_device::txca_w)); + ctc.zc_callback<1>().append("sio", FUNC(z80sio_device::rxca_w)); + ctc.zc_callback<2>().set("dart", FUNC(z80dart_device::rxtxcb_w)); // Z80DART Ch B MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxb_w)) diff --git a/src/mame/drivers/altos8600.cpp b/src/mame/drivers/altos8600.cpp index 78565331a70..cdad666251b 100644 --- a/src/mame/drivers/altos8600.cpp +++ b/src/mame/drivers/altos8600.cpp @@ -725,7 +725,7 @@ static void altos8600_floppies(device_slot_interface &device) } MACHINE_CONFIG_START(altos8600_state::altos8600) - MCFG_DEVICE_ADD("maincpu", I8086, 5_MHz_XTAL) + MCFG_DEVICE_ADD(m_maincpu, I8086, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(cpu_mem) MCFG_DEVICE_IO_MAP(cpu_io) MCFG_DEVICE_OPCODES_MAP(code_mem) @@ -735,25 +735,25 @@ MACHINE_CONFIG_START(altos8600_state::altos8600) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(altos8600_state, inta) MCFG_I8086_IF_HANDLER(WRITELINE(*this, altos8600_state, cpuif_w)) - MCFG_DEVICE_ADD("dmac", I8089, 5_MHz_XTAL) + MCFG_DEVICE_ADD(m_dmac, I8089, 5_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(dmac_mem) MCFG_DEVICE_IO_MAP(dmac_io) MCFG_I8089_DATA_WIDTH(16) MCFG_I8089_SINTR1(WRITELINE(*this, altos8600_state, sintr1_w)) - MCFG_I8089_SINTR2(WRITELINE("pic8259_2", pic8259_device, ir4_w)) + MCFG_I8089_SINTR2(WRITELINE(m_pic2, pic8259_device, ir4_w)) - MCFG_DEVICE_ADD("pic8259_1", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, altos8600_state, get_slave_ack)) + PIC8259(config, m_pic1, 0); + m_pic1->out_int_callback().set_inputline(m_maincpu, 0); + m_pic1->in_sp_callback().set_constant(1); + m_pic1->read_slave_ack_callback().set(FUNC(altos8600_state::get_slave_ack)); - MCFG_DEVICE_ADD("pic8259_2", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_1", pic8259_device, ir2_w)) - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_pic2, 0); + m_pic2->out_int_callback().set(m_pic1, FUNC(pic8259_device::ir2_w)); + m_pic2->in_sp_callback().set_constant(0); - MCFG_DEVICE_ADD("pic8259_3", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_1", pic8259_device, ir3_w)) - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_pic3, 0); + m_pic3->out_int_callback().set(m_pic1, FUNC(pic8259_device::ir3_w)); + m_pic3->in_sp_callback().set_constant(0); MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("1M") @@ -780,14 +780,14 @@ MACHINE_CONFIG_START(altos8600_state::altos8600) MCFG_DEVICE_ADD("ppi", I8255A, 0) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(1228800) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("uart8274", i8274_new_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart8274", i8274_new_device, txca_w)) - MCFG_PIT8253_CLK1(1228800) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart8274", i8274_new_device, rxtxcb_w)) - MCFG_PIT8253_CLK2(1228800) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("pic8259_1", pic8259_device, ir1_w)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(1228800); + pit.out_handler<0>().set(m_uart8274, FUNC(i8274_new_device::rxca_w)); + pit.out_handler<0>().append(m_uart8274, FUNC(i8274_new_device::txca_w)); + pit.set_clk<1>(1228800); + pit.out_handler<1>().set(m_uart8274, FUNC(i8274_new_device::rxtxcb_w)); + pit.set_clk<2>(1228800); + pit.out_handler<1>().set(m_pic1, FUNC(pic8259_device::ir1_w)); MCFG_DEVICE_ADD("fd1797", FD1797, 2000000) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE("pic8259_2", pic8259_device, ir1_w)) @@ -797,9 +797,10 @@ MACHINE_CONFIG_START(altos8600_state::altos8600) MCFG_FLOPPY_DRIVE_ADD("fd1797:2", altos8600_floppies, "8dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("fd1797:3", altos8600_floppies, "8dd", floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD("ics", ACS8600_ICS, "dmac") - MCFG_ACS8600_ICS_IRQ1(WRITELINE("pic8259_1", pic8259_device, ir5_w)) - MCFG_ACS8600_ICS_IRQ2(WRITELINE("pic8259_1", pic8259_device, ir6_w)) + ACS8600_ICS(config, m_ics, 0); + m_ics->set_host_space(m_dmac, AS_PROGRAM); // TODO: fixme + m_ics->irq1_callback().set(m_pic1, FUNC(pic8259_device::ir5_w)); + m_ics->irq2_callback().set(m_pic1, FUNC(pic8259_device::ir6_w)); MCFG_HARDDISK_ADD("hdd") MACHINE_CONFIG_END diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp index c4f178a0f52..debff0fdf97 100644 --- a/src/mame/drivers/amiga.cpp +++ b/src/mame/drivers/amiga.cpp @@ -1381,19 +1381,19 @@ MACHINE_CONFIG_START(amiga_state::amiga_base) MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga) // cia - MCFG_DEVICE_ADD("cia_0", MOS8520, amiga_state::CLK_E_PAL) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, amiga_state, cia_0_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(IOPORT("cia_0_port_a")) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(*this, amiga_state, cia_0_port_a_write)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8("cent_data_out", output_latch_device, bus_w)) - MCFG_MOS6526_PC_CALLBACK(WRITELINE("centronics", centronics_device, write_strobe)) - MCFG_MOS6526_SP_CALLBACK(WRITELINE("kbd", amiga_keyboard_bus_device, kdat_in_w)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("cia_1", MOS8520, amiga_state::CLK_E_PAL) - MCFG_MOS6526_IRQ_CALLBACK(WRITELINE(*this, amiga_state, cia_1_irq)) - MCFG_MOS6526_PA_INPUT_CALLBACK(READ8(*this, amiga_state, cia_1_port_a_read)) - MCFG_MOS6526_PA_OUTPUT_CALLBACK(WRITE8(*this, amiga_state, cia_1_port_a_write)) - MCFG_MOS6526_PB_OUTPUT_CALLBACK(WRITE8("fdc", amiga_fdc_device, ciaaprb_w)) + MOS8520(config, m_cia_0, amiga_state::CLK_E_PAL); + m_cia_0->irq_wr_callback().set(FUNC(amiga_state::cia_0_irq)); + m_cia_0->pa_rd_callback().set_ioport("cia_0_port_a"); + m_cia_0->pa_wr_callback().set(FUNC(amiga_state::cia_0_port_a_write)); + m_cia_0->pb_wr_callback().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_cia_0->pc_wr_callback().set(m_centronics, FUNC(centronics_device::write_strobe)); + m_cia_0->sp_wr_callback().set("kbd", FUNC(amiga_keyboard_bus_device::kdat_in_w)).invert(); + + MOS8520(config, m_cia_1, amiga_state::CLK_E_PAL); + m_cia_1->irq_wr_callback().set(FUNC(amiga_state::cia_1_irq)); + m_cia_1->pa_rd_callback().set(FUNC(amiga_state::cia_1_port_a_read)); + m_cia_1->pa_wr_callback().set(FUNC(amiga_state::cia_1_port_a_write)); + m_cia_1->pb_wr_callback().set(m_fdc, FUNC(amiga_fdc_device::ciaaprb_w)); // audio SPEAKER(config, "lspeaker").front_left(); @@ -1618,13 +1618,13 @@ MACHINE_CONFIG_START(cdtv_state::cdtv) MCFG_TPI6525_OUT_PB_CB(WRITE8(*this, cdtv_state, tpi_port_b_write)) // cd-rom - MCFG_CR511B_ADD("cdrom") - MCFG_CR511B_SCOR_HANDLER(WRITELINE("u32", tpi6525_device, i1_w)) MCFG_DEVCB_INVERT - MCFG_CR511B_STCH_HANDLER(WRITELINE("u32", tpi6525_device, i2_w)) MCFG_DEVCB_INVERT - MCFG_CR511B_STEN_HANDLER(WRITELINE("u32", tpi6525_device, i3_w)) - MCFG_CR511B_XAEN_HANDLER(WRITELINE("u32", tpi6525_device, pb2_w)) - MCFG_CR511B_DRQ_HANDLER(WRITELINE("u36", amiga_dmac_device, xdreq_w)) - MCFG_CR511B_DTEN_HANDLER(WRITELINE("u36", amiga_dmac_device, xdreq_w)) + CR511B(config, m_cdrom, 0); + m_cdrom->scor_handler().set("u32", FUNC(tpi6525_device::i1_w)).invert(); + m_cdrom->stch_handler().set("u32", FUNC(tpi6525_device::i2_w)).invert(); + m_cdrom->sten_handler().set("u32", FUNC(tpi6525_device::i3_w)); + m_cdrom->xaen_handler().set("u32", FUNC(tpi6525_device::pb2_w)); + m_cdrom->drq_handler().set("u36", FUNC(amiga_dmac_device::xdreq_w)); + m_cdrom->dten_handler().set("u36", FUNC(amiga_dmac_device::xdreq_w)); // software MCFG_SOFTWARE_LIST_ADD("cd_list", "cdtv") diff --git a/src/mame/drivers/ampro.cpp b/src/mame/drivers/ampro.cpp index 005ef171d3f..f26e4583856 100644 --- a/src/mame/drivers/ampro.cpp +++ b/src/mame/drivers/ampro.cpp @@ -39,8 +39,8 @@ public: : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") , m_dart(*this, "dart") - , m_ctc (*this, "ctc") - , m_fdc (*this, "fdc") + , m_ctc(*this, "ctc") + , m_fdc(*this, "fdc") , m_floppy0(*this, "fdc:0") { } @@ -160,16 +160,16 @@ MACHINE_CONFIG_START(ampro_state::ampro) MCFG_Z80_DAISY_CHAIN(daisy_chain_intf) MCFG_MACHINE_RESET_OVERRIDE(ampro_state, ampro) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 16_MHz_XTAL / 8) // 2MHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 16_MHz_XTAL / 8)); // 2MHz + ctc_clock.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); /* Devices */ - MCFG_DEVICE_ADD("ctc", Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("dart", z80dart_device, txca_w)) // Z80DART Ch A, SIO Ch A - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart", z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("dart", z80dart_device, rxtxcb_w)) // SIO Ch B + Z80CTC(config, m_ctc, 16_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set("dart", FUNC(z80dart_device::txca_w)); // Z80DART Ch A, SIO Ch A + m_ctc->zc_callback<0>().append("dart", FUNC(z80dart_device::rxca_w)); + m_ctc->zc_callback<1>().set("dart", FUNC(z80dart_device::rxtxcb_w)); // SIO Ch B MCFG_DEVICE_ADD("dart", Z80DART, 16_MHz_XTAL / 4) MCFG_Z80DART_OUT_TXDA_CB(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp index bdc8dd3dfba..bd8377301a3 100644 --- a/src/mame/drivers/amust.cpp +++ b/src/mame/drivers/amust.cpp @@ -415,9 +415,9 @@ MACHINE_CONFIG_START(amust_state::amust) MCFG_FLOPPY_DRIVE_ADD("fdc:1", amust_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart1", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp index 6457de80048..967b000dcdb 100644 --- a/src/mame/drivers/apc.cpp +++ b/src/mame/drivers/apc.cpp @@ -949,14 +949,14 @@ MACHINE_CONFIG_START(apc_state::apc) MCFG_PIT8253_CLK1(MAIN_CLOCK) /* Memory Refresh */ MCFG_PIT8253_CLK2(MAIN_CLOCK) /* RS-232c */ - MCFG_DEVICE_ADD(m_i8259_m, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE(m_maincpu, 0)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, apc_state, get_slave_ack)) - - MCFG_DEVICE_ADD(m_i8259_s, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(m_i8259_m, pic8259_device, ir7_w)) // TODO: check ir7_w - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_i8259_m, 0); + m_i8259_m->out_int_callback().set_inputline(m_maincpu, 0); + m_i8259_m->in_sp_callback().set_constant(1); + m_i8259_m->read_slave_ack_callback().set(FUNC(apc_state::get_slave_ack)); + + PIC8259(config, m_i8259_s, 0); + m_i8259_s->out_int_callback().set(m_i8259_m, FUNC(pic8259_device::ir7_w)); // TODO: check ir7_w + m_i8259_s->in_sp_callback().set_constant(0); MCFG_DEVICE_ADD(m_dmac, AM9517A, MAIN_CLOCK) MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, apc_state, apc_dma_hrq_changed)) diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp index 736f9726a59..d6e03a92627 100644 --- a/src/mame/drivers/apricot.cpp +++ b/src/mame/drivers/apricot.cpp @@ -408,15 +408,15 @@ MACHINE_CONFIG_START(apricot_state::apricot) MCFG_DEVICE_ADD("ic31", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("ic91", 0)) - MCFG_DEVICE_ADD("ic16", PIT8253, 0) - MCFG_PIT8253_CLK0(4_MHz_XTAL / 16) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("ic31", pic8259_device, ir6_w)) - MCFG_PIT8253_CLK1(4_MHz_XTAL / 2) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("ic14", ttl153_device, i0a_w)) - MCFG_PIT8253_CLK2(4_MHz_XTAL / 2) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("ic14", ttl153_device, i0b_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ic14", ttl153_device, i2a_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ic14", ttl153_device, i2b_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(4_MHz_XTAL / 16); + m_pit->out_handler<0>().set("ic31", FUNC(pic8259_device::ir6_w)); + m_pit->set_clk<1>(4_MHz_XTAL / 2); + m_pit->out_handler<1>().set("ic14", FUNC(ttl153_device::i0a_w)); + m_pit->set_clk<2>(4_MHz_XTAL / 2); + m_pit->out_handler<2>().set("ic14", FUNC(ttl153_device::i0b_w)); + m_pit->out_handler<2>().append("ic14", FUNC(ttl153_device::i2a_w)); + m_pit->out_handler<2>().append("ic14", FUNC(ttl153_device::i2b_w)); MCFG_DEVICE_ADD("ic14", TTL153) MCFG_TTL153_ZA_CB(WRITELINE("ic15", z80sio_device, rxca_w)) @@ -437,12 +437,12 @@ MACHINE_CONFIG_START(apricot_state::apricot) MCFG_Z80SIO_OUT_INT_CB(WRITELINE("ic31", pic8259_device, ir5_w)) // rs232 port - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) + RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); // note: missing a receive clock callback to support external clock mode (i1 to 153) - MCFG_RS232_RXD_HANDLER(WRITELINE("ic15", z80sio_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("ic15", z80sio_device, dcda_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("ic15", z80sio_device, synca_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("ic15", z80sio_device, ctsa_w)) MCFG_DEVCB_XOR(1) + m_rs232->rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)); + m_rs232->dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)); + m_rs232->dsr_handler().set(m_sio, FUNC(z80sio_device::synca_w)); + m_rs232->cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)).invert(); // keyboard MCFG_APRICOT_KEYBOARD_INTERFACE_ADD("kbd", "hle") diff --git a/src/mame/drivers/asteroid.cpp b/src/mame/drivers/asteroid.cpp index d652d35c06d..781a6f42aed 100644 --- a/src/mame/drivers/asteroid.cpp +++ b/src/mame/drivers/asteroid.cpp @@ -740,17 +740,17 @@ MACHINE_CONFIG_START(asteroid_state::asteroid_base) MCFG_WATCHDOG_ADD("watchdog") - MCFG_DEVICE_ADD("dsw_sel", TTL153) - - MCFG_DEVICE_ADD("outlatch", OUTPUT_LATCH, 0) // LS174 at N11 - MCFG_OUTPUT_LATCH_BIT0_HANDLER(OUTPUT("led1")) MCFG_DEVCB_INVERT // 2 PLYR START LAMP - MCFG_OUTPUT_LATCH_BIT1_HANDLER(OUTPUT("led0")) MCFG_DEVCB_INVERT // 1 PLYR START LAMP - MCFG_OUTPUT_LATCH_BIT2_HANDLER(MEMBANK("ram1")) // RAMSEL - MCFG_DEVCB_CHAIN_OUTPUT(MEMBANK("ram2")) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, asteroid_state, cocktail_inv_w)) - MCFG_OUTPUT_LATCH_BIT3_HANDLER(WRITELINE(*this, asteroid_state, coin_counter_left_w)) // COIN CNTRL - MCFG_OUTPUT_LATCH_BIT4_HANDLER(WRITELINE(*this, asteroid_state, coin_counter_center_w)) // COIN CNTRC - MCFG_OUTPUT_LATCH_BIT5_HANDLER(WRITELINE(*this, asteroid_state, coin_counter_right_w)) // COIN CNTRR + TTL153(config, m_dsw_sel); + + output_latch_device &outlatch(OUTPUT_LATCH(config, "outlatch")); // LS174 at N11 + outlatch.bit_handler<0>().set_output("led1").invert(); // 2 PLYR START LAMP + outlatch.bit_handler<1>().set_output("led0").invert(); // 1 PLYR START LAMP + outlatch.bit_handler<2>().set_membank("ram1"); // RAMSEL + outlatch.bit_handler<2>().append_membank("ram2"); + outlatch.bit_handler<2>().append(FUNC(asteroid_state::cocktail_inv_w)); + outlatch.bit_handler<3>().set(FUNC(asteroid_state::coin_counter_left_w)); // COIN CNTRL + outlatch.bit_handler<4>().set(FUNC(asteroid_state::coin_counter_center_w)); // COIN CNTRC + outlatch.bit_handler<5>().set(FUNC(asteroid_state::coin_counter_right_w)); // COIN CNTRR /* video hardware */ MCFG_VECTOR_ADD("vector") @@ -798,15 +798,15 @@ MACHINE_CONFIG_START(asteroid_state::astdelux) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MCFG_DEVICE_REMOVE("outlatch") - MCFG_DEVICE_MODIFY("audiolatch") - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // START1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // START2 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(MEMBANK("ram1")) // RAMSEL - MCFG_DEVCB_CHAIN_OUTPUT(MEMBANK("ram2")) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, asteroid_state, cocktail_inv_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, asteroid_state, coin_counter_left_w)) // LEFT COIN - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, asteroid_state, coin_counter_center_w)) // CENTER COIN - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, asteroid_state, coin_counter_right_w)) // RIGHT COIN + ls259_device &audiolatch(*subdevice("audiolatch")); + audiolatch.q_out_cb<0>().set_output("led0").invert(); // START1 + audiolatch.q_out_cb<1>().set_output("led1").invert(); // START2 + audiolatch.q_out_cb<4>().set_membank("ram1"); // RAMSEL + audiolatch.q_out_cb<4>().append_membank("ram2"); + audiolatch.q_out_cb<4>().append(FUNC(asteroid_state::cocktail_inv_w)); + audiolatch.q_out_cb<5>().set(FUNC(asteroid_state::coin_counter_left_w)); // LEFT COIN + audiolatch.q_out_cb<6>().set(FUNC(asteroid_state::coin_counter_center_w)); // CENTER COIN + audiolatch.q_out_cb<7>().set(FUNC(asteroid_state::coin_counter_right_w)); // RIGHT COIN MACHINE_CONFIG_END diff --git a/src/mame/drivers/astrocde.cpp b/src/mame/drivers/astrocde.cpp index 9924585c5f4..fd54719916e 100644 --- a/src/mame/drivers/astrocde.cpp +++ b/src/mame/drivers/astrocde.cpp @@ -1266,23 +1266,23 @@ MACHINE_CONFIG_START(seawolf2_state::seawolf2) MCFG_DEVICE_PROGRAM_MAP(seawolf2_map) MCFG_DEVICE_IO_MAP(port_map_discrete) - MCFG_DEVICE_ADD("lamplatch1", OUTPUT_LATCH, 0) // 74174 on game board at N2 - MCFG_OUTPUT_LATCH_BIT0_HANDLER(OUTPUT("lamp6")) // right player torpedo 4 available - MCFG_OUTPUT_LATCH_BIT1_HANDLER(OUTPUT("lamp5")) // right player torpedo 3 available - MCFG_OUTPUT_LATCH_BIT2_HANDLER(OUTPUT("lamp4")) // right player torpedo 2 available - MCFG_OUTPUT_LATCH_BIT3_HANDLER(OUTPUT("lamp3")) // right player torpedo 1 available - MCFG_OUTPUT_LATCH_BIT4_HANDLER(OUTPUT("lamp2")) // right player ready - MCFG_DEVCB_CHAIN_OUTPUT(OUTPUT("lamp1")) MCFG_DEVCB_INVERT // right player reload (active low) - MCFG_OUTPUT_LATCH_BIT5_HANDLER(OUTPUT("lamp0")) // right player explosion (hit) - - MCFG_DEVICE_ADD("lamplatch2", OUTPUT_LATCH, 0) // 74174 on game board at P2 - MCFG_OUTPUT_LATCH_BIT0_HANDLER(OUTPUT("lamp13")) // left player torpedo 4 available - MCFG_OUTPUT_LATCH_BIT1_HANDLER(OUTPUT("lamp12")) // left player torpedo 3 available - MCFG_OUTPUT_LATCH_BIT2_HANDLER(OUTPUT("lamp11")) // left player torpedo 2 available - MCFG_OUTPUT_LATCH_BIT3_HANDLER(OUTPUT("lamp10")) // left player torpedo 1 available - MCFG_OUTPUT_LATCH_BIT4_HANDLER(OUTPUT("lamp9")) // left player ready - MCFG_DEVCB_CHAIN_OUTPUT(OUTPUT("lamp8")) MCFG_DEVCB_INVERT // left player reload (active low) - MCFG_OUTPUT_LATCH_BIT5_HANDLER(OUTPUT("lamp7")) // left player explosion (hit) + output_latch_device &lamplatch1(OUTPUT_LATCH(config, "lamplatch1")); // 74174 on game board at N2 + lamplatch1.bit_handler<0>().set_output("lamp6"); // right player torpedo 4 available + lamplatch1.bit_handler<1>().set_output("lamp5"); // right player torpedo 3 available + lamplatch1.bit_handler<2>().set_output("lamp4"); // right player torpedo 2 available + lamplatch1.bit_handler<3>().set_output("lamp3"); // right player torpedo 1 available + lamplatch1.bit_handler<4>().set_output("lamp2"); // right player ready + lamplatch1.bit_handler<4>().append_output("lamp1").invert(); // right player reload (active low) + lamplatch1.bit_handler<5>().set_output("lamp0"); // right player explosion (hit) + + output_latch_device &lamplatch2(OUTPUT_LATCH(config, "lamplatch2")); // 74174 on game board at P2 + lamplatch2.bit_handler<0>().set_output("lamp13"); // left player torpedo 4 available + lamplatch2.bit_handler<1>().set_output("lamp12"); // left player torpedo 3 available + lamplatch2.bit_handler<2>().set_output("lamp11"); // left player torpedo 2 available + lamplatch2.bit_handler<3>().set_output("lamp10"); // left player torpedo 1 available + lamplatch2.bit_handler<4>().set_output("lamp9"); // left player ready + lamplatch2.bit_handler<4>().append_output("lamp8").invert(); // left player reload (active low) + lamplatch2.bit_handler<5>().set_output("lamp7"); // left player explosion (hit) /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/asuka.cpp b/src/mame/drivers/asuka.cpp index 1da7f2756e5..5cc1f8158c2 100644 --- a/src/mame/drivers/asuka.cpp +++ b/src/mame/drivers/asuka.cpp @@ -913,13 +913,13 @@ MACHINE_CONFIG_START(asuka_state::asuka) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, asuka_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(asuka_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -951,11 +951,11 @@ MACHINE_CONFIG_START(asuka_state::asuka) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(16'000'000)/4) /* verified on pcb */ - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_YM2151_PORT_WRITE_HANDLER(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) + ym2151_device &ymsnd(YM2151(config, "ymsnd", 16_MHz_XTAL/4)); // verified on PCB + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_write_handler().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.50); + ymsnd.add_route(1, "mono", 0.50); MCFG_DEVICE_ADD("msm", MSM5205, XTAL(384'000)) /* verified on pcb */ MCFG_MSM5205_VCLK_CB(WRITELINE(*this, asuka_state, asuka_msm5205_vck)) /* VCK function */ @@ -987,13 +987,13 @@ MACHINE_CONFIG_START(asuka_state::cadash) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, asuka_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(asuka_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1026,11 +1026,11 @@ MACHINE_CONFIG_START(asuka_state::cadash) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(8'000'000)/2) /* verified on pcb */ - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_YM2151_PORT_WRITE_HANDLER(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) + ym2151_device &ymsnd(YM2151(config, "ymsnd", 8_MHz_XTAL/2)); // verified on PCB + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_write_handler().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.50); + ymsnd.add_route(1, "mono", 0.50); MCFG_DEVICE_ADD("ciu", PC060HA, 0) MCFG_PC060HA_MASTER_CPU("maincpu") @@ -1050,13 +1050,13 @@ MACHINE_CONFIG_START(asuka_state::mofflott) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, asuka_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(asuka_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1088,11 +1088,11 @@ MACHINE_CONFIG_START(asuka_state::mofflott) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, 4000000) - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_YM2151_PORT_WRITE_HANDLER(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) + ym2151_device &ymsnd(YM2151(config, "ymsnd", 4000000)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_write_handler().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.50); + ymsnd.add_route(1, "mono", 0.50); MCFG_DEVICE_ADD("msm", MSM5205, 384000) MCFG_MSM5205_VCLK_CB(WRITELINE(*this, asuka_state, asuka_msm5205_vck)) /* VCK function */ @@ -1120,13 +1120,13 @@ MACHINE_CONFIG_START(asuka_state::eto) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, asuka_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(asuka_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1158,11 +1158,11 @@ MACHINE_CONFIG_START(asuka_state::eto) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, 4000000) - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_YM2151_PORT_WRITE_HANDLER(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) + ym2151_device &ymsnd(YM2151(config, "ymsnd", 4000000)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_write_handler().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.50); + ymsnd.add_route(1, "mono", 0.50); MCFG_DEVICE_ADD("ciu", PC060HA, 0) MCFG_PC060HA_MASTER_CPU("maincpu") diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp index b0131e09b30..075a04326b0 100644 --- a/src/mame/drivers/atarist.cpp +++ b/src/mame/drivers/atarist.cpp @@ -2055,9 +2055,9 @@ MACHINE_CONFIG_START(st_state::st) // devices - MCFG_DEVICE_ADD(WD1772_TAG, WD1772, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, st_state, fdc_drq_w)) + WD1772(config, m_fdc, Y2/4); + m_fdc->intrq_wr_callback().set(m_mfp, FUNC(mc68901_device::i5_w)).invert(); + m_fdc->drq_wr_callback().set(FUNC(st_state::fdc_drq_w)); MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, nullptr, st_state::floppy_formats) @@ -2146,9 +2146,9 @@ MACHINE_CONFIG_START(megast_state::megast) // devices MCFG_DEVICE_ADD(RP5C15_TAG, RP5C15, XTAL(32'768)) - MCFG_DEVICE_ADD(WD1772_TAG, WD1772, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, st_state, fdc_drq_w)) + WD1772(config, m_fdc, Y2/4); + m_fdc->intrq_wr_callback().set(m_mfp, FUNC(mc68901_device::i5_w)).invert(); + m_fdc->drq_wr_callback().set(FUNC(st_state::fdc_drq_w)); MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, nullptr, st_state::floppy_formats) @@ -2245,9 +2245,9 @@ MACHINE_CONFIG_START(ste_state::ste) // devices - MCFG_DEVICE_ADD(WD1772_TAG, WD1772, Y2/4) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, st_state, fdc_drq_w)) + WD1772(config, m_fdc, Y2/4); + m_fdc->intrq_wr_callback().set(m_mfp, FUNC(mc68901_device::i5_w)).invert(); + m_fdc->drq_wr_callback().set(FUNC(st_state::fdc_drq_w)); MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", st_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, nullptr, st_state::floppy_formats) @@ -2359,9 +2359,9 @@ static MACHINE_CONFIG_START(stbook_state::stbook) MCFG_MC68901_OUT_TDO_CB(WRITELINE(*this, st_state, mfp_tdo_w)) MCFG_MC68901_OUT_SO_CB(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_DEVICE_ADD(WD1772_TAG, WD1772, U517/2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(MC68901_TAG, mc68901_device, i5_w)) MCFG_DEVCB_INVERT - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, st_state, fdc_drq_w)) + WD1772(config, m_fdc, U517/2); + m_fdc->intrq_wr_callback().set(m_mfp, FUNC(mc68901_device::i5_w)).invert(); + m_fdc->drq_wr_callback().set(FUNC(st_state::fdc_drq_w)); MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":0", atari_floppies, "35dd", 0, st_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD1772_TAG ":1", atari_floppies, 0, 0, st_state::floppy_formats) diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp index 6bd68569a54..40a6027420c 100644 --- a/src/mame/drivers/atarisy1.cpp +++ b/src/mame/drivers/atarisy1.cpp @@ -736,12 +736,12 @@ MACHINE_CONFIG_START(atarisy1_state::atarisy1) MCFG_EEPROM_2804_ADD("eeprom") MCFG_EEPROM_28XX_LOCK_AFTER_WRITE(true) - MCFG_DEVICE_ADD("outlatch", LS259, 0) // 15H (TTL) or 14F (LSI) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE("ymsnd", ym2151_device, reset_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // J106 pin 4 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // J106 pin 3 - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, atarisy1_state, coin_counter_right_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, atarisy1_state, coin_counter_left_w)) + LS259(config, m_outlatch); // 15H (TTL) or 14F (LSI) + m_outlatch->q_out_cb<0>().set("ymsnd", FUNC(ym2151_device::reset_w)); + m_outlatch->q_out_cb<4>().set_output("led0").invert(); // J106 pin 4 + m_outlatch->q_out_cb<5>().set_output("led1").invert(); // J106 pin 3 + m_outlatch->q_out_cb<6>().set(FUNC(atarisy1_state::coin_counter_right_w)); + m_outlatch->q_out_cb<7>().set(FUNC(atarisy1_state::coin_counter_left_w)); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp index 97d38b2366e..9182cdfdce1 100644 --- a/src/mame/drivers/attache.cpp +++ b/src/mame/drivers/attache.cpp @@ -1162,15 +1162,15 @@ MACHINE_CONFIG_START(attache_state::attache) MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsb_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 2); + m_ctc->zc_callback<0>().set(m_sio, FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<0>().append(m_sio, FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("brc", CLOCK, 8_MHz_XTAL / 26) // 307.692 KHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) + clock_device &brc(CLOCK(config, "brc", 8_MHz_XTAL / 26)); // 307.692 KHz + brc.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + brc.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); MCFG_DEVICE_ADD("dma", AM9517A, 8_MHz_XTAL / 4) MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(*this, attache_state, hreq_w)) @@ -1181,11 +1181,11 @@ MACHINE_CONFIG_START(attache_state::attache) MCFG_AM9517A_OUT_IOW_0_CB(WRITE8(*this, attache_state, fdc_dma_w)) // MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(*this, attache_state, fdc_dack_w)) - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE("ctc", z80ctc_device, trg3)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("dma", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) + UPD765A(config, m_fdc, true, true); + m_fdc->intrq_wr_callback().set(m_ctc, FUNC(z80ctc_device::trg3)); + m_fdc->drq_wr_callback().set(m_dma, FUNC(am9517a_device::dreq0_w)).invert(); + FLOPPY_CONNECTOR(config, "fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats); MCFG_DEVICE_ADD("crtc", TMS9927, 12324000 / 8) MCFG_TMS9927_CHAR_WIDTH(8) @@ -1246,22 +1246,22 @@ MACHINE_CONFIG_START(attache816_state::attache816) MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsb_w)) - MCFG_DEVICE_ADD("ctc", Z80CTC, 8_MHz_XTAL / 2) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc, 8_MHz_XTAL / 2); + m_ctc->zc_callback<0>().set(m_sio, FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<0>().append(m_sio, FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); - MCFG_DEVICE_ADD("brc", CLOCK, 8_MHz_XTAL / 26) // 307.692 KHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) + clock_device &brc(CLOCK(config, "brc", 8_MHz_XTAL / 26)); // 307.692 KHz + brc.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + brc.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); - MCFG_DEVICE_ADD("ppi", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, attache816_state, x86_comms_w)) - MCFG_I8255_IN_PORTA_CB(READ8(*this, attache816_state, x86_comms_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, attache816_state, x86_irq_enable)) - MCFG_I8255_OUT_PORTC_CB(WRITELINE(*this, attache816_state, x86_dsr)) MCFG_DEVCB_BIT(0) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, attache816_state, ppi_irq)) MCFG_DEVCB_BIT(7) MCFG_DEVCB_INVERT + I8255A(config, m_ppi, 0); + m_ppi->out_pa_callback().set(FUNC(attache816_state::x86_comms_w)); + m_ppi->in_pa_callback().set(FUNC(attache816_state::x86_comms_r)); + m_ppi->out_pb_callback().set(FUNC(attache816_state::x86_irq_enable)); + m_ppi->out_pc_callback().set(FUNC(attache816_state::x86_dsr)).bit(0); + m_ppi->out_pc_callback().append(FUNC(attache816_state::ppi_irq)).bit(7).invert(); MCFG_DEVICE_ADD("dma", AM9517A, 8_MHz_XTAL / 4) MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(*this, attache_state, hreq_w)) @@ -1272,11 +1272,11 @@ MACHINE_CONFIG_START(attache816_state::attache816) MCFG_AM9517A_OUT_IOW_0_CB(WRITE8(*this, attache_state, fdc_dma_w)) // MCFG_AM9517A_OUT_DACK_0_CB(WRITELINE(*this, attache_state, fdc_dack_w)) - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE("ctc", z80ctc_device, trg3)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("dma", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats) + UPD765A(config, m_fdc, true, true); + m_fdc->intrq_wr_callback().set(m_ctc, FUNC(z80ctc_device::trg3)); + m_fdc->drq_wr_callback().set(m_dma, FUNC(am9517a_device::dreq0_w)).invert(); + FLOPPY_CONNECTOR(config, "fdc:0", attache_floppies, "525dd", floppy_image_device::default_floppy_formats); + FLOPPY_CONNECTOR(config, "fdc:1", attache_floppies, "525dd", floppy_image_device::default_floppy_formats); MCFG_DEVICE_ADD("crtc", TMS9927, 12324000) MCFG_TMS9927_CHAR_WIDTH(8) diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp index b6ba84a6b58..82932a19a88 100644 --- a/src/mame/drivers/aussiebyte.cpp +++ b/src/mame/drivers/aussiebyte.cpp @@ -526,20 +526,20 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte) MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 4.9152_MHz_XTAL / 4) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, 16_MHz_XTAL / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio1", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio1", z80sio_device, rxtxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, aussiebyte_state, ctc_z2_w)) // SIO2 Ch B, CTC Ch 3 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2", z80sio_device, rxtxcb_w)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 4.9152_MHz_XTAL / 4)); + ctc_clock.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg2)); + + Z80CTC(config, m_ctc, 16_MHz_XTAL / 4); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<0>().set("sio1", FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<0>().append("sio1", FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().set("sio1", FUNC(z80sio_device::rxtxcb_w)); + m_ctc->zc_callback<1>().append("sio2", FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<1>().append("sio2", FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<2>().set(FUNC(aussiebyte_state::ctc_z2_w)); // SIO2 Ch B, CTC Ch 3 + m_ctc->zc_callback<2>().append("sio2", FUNC(z80sio_device::rxtxcb_w)); MCFG_DEVICE_ADD("dma", Z80DMA, 16_MHz_XTAL / 4) MCFG_Z80DMA_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) @@ -550,11 +550,11 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte) MCFG_Z80DMA_IN_IORQ_CB(READ8(*this, aussiebyte_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(*this, aussiebyte_state, io_write_byte)) - MCFG_DEVICE_ADD("pio1", Z80PIO, 16_MHz_XTAL / 4) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8("cent_data_out", output_latch_device, bus_w)) - MCFG_Z80PIO_IN_PB_CB(READ8("cent_data_in", input_buffer_device, bus_r)) - MCFG_Z80PIO_OUT_ARDY_CB(WRITELINE(m_centronics, centronics_device, write_strobe)) MCFG_DEVCB_INVERT + Z80PIO(config, m_pio1, 16_MHz_XTAL / 4); + m_pio1->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_pio1->out_pa_callback().set("cent_data_out", FUNC(output_latch_device::bus_w)); + m_pio1->in_pb_callback().set("cent_data_in", FUNC(input_buffer_device::bus_r)); + m_pio1->out_ardy_callback().set(m_centronics, FUNC(centronics_device::write_strobe)).invert(); MCFG_DEVICE_ADD("pio2", Z80PIO, 16_MHz_XTAL / 4) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/avt.cpp b/src/mame/drivers/avt.cpp index 02a69d01aa0..20536778729 100644 --- a/src/mame/drivers/avt.cpp +++ b/src/mame/drivers/avt.cpp @@ -981,11 +981,12 @@ MACHINE_CONFIG_START(avt_state::avt) MCFG_PALETTE_ADD("palette", 8*16) MCFG_PALETTE_INIT_OWNER(avt_state, avt) - MCFG_MC6845_ADD("crtc", MC6845, "screen", CRTC_CLOCK) /* guess */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE("ctc0", z80ctc_device, trg3)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, avt_state, avtbingo_w)) + mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); // guess + crtc.set_screen("screen"); + crtc.set_show_border_area(false); + crtc.set_char_width(8); + crtc.out_vsync_callback().set("ctc0", FUNC(z80ctc_device::trg3)); + crtc.out_vsync_callback().append(FUNC(avt_state::avtbingo_w)); /* sound hardware */ SPEAKER(config, "mono").front_center(); @@ -1018,15 +1019,16 @@ WRITE_LINE_MEMBER( avt_state::avtnfl_w ) m_pio1->port_b_write((m_pio1->port_b_read() & 0xbf) | (state ? 0x40 : 0)); } -MACHINE_CONFIG_START(avt_state::avtnfl) +void avt_state::avtnfl(machine_config &config) +{ avt(config); - MCFG_DEVICE_REMOVE("crtc") - MCFG_MC6845_ADD("crtc", MC6845, "screen", CRTC_CLOCK) /* guess */ - MCFG_MC6845_SHOW_BORDER_AREA(false) - MCFG_MC6845_CHAR_WIDTH(8) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE("ctc0", z80ctc_device, trg3)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, avt_state, avtnfl_w)) -MACHINE_CONFIG_END + mc6845_device &crtc(MC6845(config.replace(), "crtc", CRTC_CLOCK)); // guess + crtc.set_screen("screen"); + crtc.set_show_border_area(false); + crtc.set_char_width(8); + crtc.out_vsync_callback().set("ctc0", FUNC(z80ctc_device::trg3)); + crtc.out_vsync_callback().append(FUNC(avt_state::avtnfl_w)); +} /********************************************* * Rom Load * diff --git a/src/mame/drivers/balsente.cpp b/src/mame/drivers/balsente.cpp index d10470bd42a..3c3af0fe6cf 100644 --- a/src/mame/drivers/balsente.cpp +++ b/src/mame/drivers/balsente.cpp @@ -1315,20 +1315,20 @@ MACHINE_CONFIG_START(balsente_state::balsente) MCFG_DEVICE_PROGRAM_MAP(cpu2_map) MCFG_DEVICE_IO_MAP(cpu2_io_map) - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE("audiouart", acia6850_device, write_rxd)) - MCFG_ACIA6850_IRQ_HANDLER(INPUTLINE("maincpu", M6809_FIRQ_LINE)) - - MCFG_DEVICE_ADD("audiouart", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, balsente_state, uint_w)) - - MCFG_DEVICE_ADD("uartclock", CLOCK, 8_MHz_XTAL / 16) // 500 kHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, balsente_state, uint_propagate_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("audiouart", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("audiouart", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_txc)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) MCFG_DEVCB_INVERT + ACIA6850(config, m_acia, 0); + m_acia->txd_handler().set(m_audiouart, FUNC(acia6850_device::write_rxd)); + m_acia->irq_handler().set_inputline(m_maincpu, M6809_FIRQ_LINE); + + ACIA6850(config, m_audiouart, 0); + m_audiouart->txd_handler().set(m_acia, FUNC(acia6850_device::write_rxd)); + m_audiouart->irq_handler().set([this] (int state) { m_uint = bool(state); }); + + clock_device &uartclock(CLOCK(config, "uartclock", 8_MHz_XTAL / 16)); // 500 kHz + uartclock.signal_handler().set(FUNC(balsente_state::uint_propagate_w)); + uartclock.signal_handler().append(m_audiouart, FUNC(acia6850_device::write_txc)); + uartclock.signal_handler().append(m_audiouart, FUNC(acia6850_device::write_rxc)); + uartclock.signal_handler().append(m_acia, FUNC(acia6850_device::write_txc)).invert(); + uartclock.signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)).invert(); MCFG_X2212_ADD_AUTOSAVE("nov0") // system NOVRAM MCFG_X2212_ADD_AUTOSAVE("nov1") // cart NOVRAM diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp index a4e0c6d9b03..32875e01502 100644 --- a/src/mame/drivers/bbc.cpp +++ b/src/mame/drivers/bbc.cpp @@ -953,8 +953,8 @@ MACHINE_CONFIG_START(bbc_state::bbcb) MCFG_UPD7002_EOC_CB(bbc_state, BBC_uPD7002_EOC) /* printer */ - MCFG_DEVICE_ADD("centronics", CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ + centronics_device ¢ronics(CENTRONICS(config, "centronics", centronics_devices, "printer")); + centronics.ack_handler().set("via6522_1", FUNC(via6522_device::write_ca1)).invert(); // ack seems to be inverted? MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") /* fdc */ @@ -1352,8 +1352,8 @@ MACHINE_CONFIG_START(bbc_state::bbcm) MCFG_DEVICE_ADD("rtc", MC146818, 32.768_kHz_XTAL) /* printer */ - MCFG_DEVICE_ADD("centronics", CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE("via6522_1", via6522_device, write_ca1)) MCFG_DEVCB_INVERT /* ack seems to be inverted? */ + centronics_device ¢ronics(CENTRONICS(config, "centronics", centronics_devices, "printer")); + centronics.ack_handler().set("via6522_1", FUNC(via6522_device::write_ca1)).invert(); // ack seems to be inverted? MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") /* cassette */ diff --git a/src/mame/drivers/bbusters.cpp b/src/mame/drivers/bbusters.cpp index 4cab0f3c6ee..22972485c9d 100644 --- a/src/mame/drivers/bbusters.cpp +++ b/src/mame/drivers/bbusters.cpp @@ -667,14 +667,14 @@ MACHINE_CONFIG_START(bbusters_state::bbusters) MCFG_NVRAM_ADD_0FILL("eeprom") /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(bbusters_state, screen_update_bbuster) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("spriteram2", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_size(64*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(bbusters_state::screen_update_bbuster)); + screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.screen_vblank().append(m_spriteram2, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.set_palette("palette"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bbusters) MCFG_PALETTE_ADD("palette", 2048) diff --git a/src/mame/drivers/bebox.cpp b/src/mame/drivers/bebox.cpp index 08008374502..751a7b38b2c 100644 --- a/src/mame/drivers/bebox.cpp +++ b/src/mame/drivers/bebox.cpp @@ -176,14 +176,14 @@ MACHINE_CONFIG_START(bebox_state::bebox) MCFG_DEVICE_ADD( "dma8237_2", AM9517A, XTAL(14'318'181)/3 ) - MCFG_DEVICE_ADD("pic8259_1", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, bebox_state, bebox_pic8259_master_set_int_line)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, bebox_state, get_slave_ack)) - - MCFG_DEVICE_ADD("pic8259_2", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, bebox_state, bebox_pic8259_slave_set_int_line)) - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_pic8259_1, 0); + m_pic8259_1->out_int_callback().set(FUNC(bebox_state::bebox_pic8259_master_set_int_line)); + m_pic8259_1->in_sp_callback().set_constant(1); + m_pic8259_1->read_slave_ack_callback().set(FUNC(bebox_state::get_slave_ack)); + + PIC8259(config, m_pic8259_2, 0); + m_pic8259_2->out_int_callback().set(FUNC(bebox_state::bebox_pic8259_slave_set_int_line)); + m_pic8259_2->in_sp_callback().set_constant(0); MCFG_DEVICE_ADD( "ns16550_0", NS16550, 0 ) /* TODO: Verify model */ MCFG_DEVICE_ADD( "ns16550_1", NS16550, 0 ) /* TODO: Verify model */ diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp index 9c1d69f9f32..191d87f26fa 100644 --- a/src/mame/drivers/bigbord2.cpp +++ b/src/mame/drivers/bigbord2.cpp @@ -604,17 +604,17 @@ MACHINE_CONFIG_START(bigbord2_state::bigbord2) MCFG_DEVICE_ADD("proglatch", LS259, 0) // U41 MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE("outlatch1", ls259_device, clear_w)) // FCRST - also resets the 8877 - MCFG_DEVICE_ADD("syslatch1", LS259, 0) // U14 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(MEMBANK("bankr")) // D_S - MCFG_DEVCB_CHAIN_OUTPUT(MEMBANK("bankv")) - MCFG_DEVCB_CHAIN_OUTPUT(MEMBANK("banka")) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, bigbord2_state, side_select_w)) // SIDSEL - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, bigbord2_state, smc1_w)) // SMC1 - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, bigbord2_state, smc2_w)) // SMC2 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("fdc", mb8877_device, dden_w)) // DDEN - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, bigbord2_state, head_load_w)) // HLD - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, bigbord2_state, disk_motor_w)) // MOTOR - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE("beeper", beep_device, set_state)) // BELL + LS259(config, m_syslatch1, 0); // U14 + m_syslatch1->q_out_cb<0>().set_membank(m_bankr); // D_S + m_syslatch1->q_out_cb<0>().append_membank(m_bankv); + m_syslatch1->q_out_cb<0>().append_membank(m_banka); + m_syslatch1->q_out_cb<1>().set(FUNC(bigbord2_state::side_select_w)); // SIDSEL + m_syslatch1->q_out_cb<2>().set(FUNC(bigbord2_state::smc1_w)); // SMC1 + m_syslatch1->q_out_cb<3>().set(FUNC(bigbord2_state::smc2_w)); // SMC2 + m_syslatch1->q_out_cb<4>().set(m_fdc, FUNC(mb8877_device::dden_w)); // DDEN + m_syslatch1->q_out_cb<5>().set(FUNC(bigbord2_state::head_load_w)); // HLD + m_syslatch1->q_out_cb<6>().set(FUNC(bigbord2_state::disk_motor_w)); // MOTOR + m_syslatch1->q_out_cb<7>().set("beeper", FUNC(beep_device::set_state)); // BELL MCFG_DEVICE_ADD("outlatch1", LS259, 0) // U96 diff --git a/src/mame/drivers/bladestl.cpp b/src/mame/drivers/bladestl.cpp index 945e59a2659..468c52779bc 100644 --- a/src/mame/drivers/bladestl.cpp +++ b/src/mame/drivers/bladestl.cpp @@ -349,9 +349,9 @@ MACHINE_CONFIG_START(bladestl_state::bladestl) called at initialization time */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, M6809_IRQ_LINE)) - MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE); + m_soundlatch->set_separate_acknowledge(true); MCFG_DEVICE_ADD(m_upd7759, UPD7759) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp index 9602b333156..e3a01365976 100644 --- a/src/mame/drivers/bml3.cpp +++ b/src/mame/drivers/bml3.cpp @@ -1007,9 +1007,9 @@ MACHINE_CONFIG_START(bml3_state::bml3_common) MCFG_ACIA6850_RTS_HANDLER(WRITELINE(*this, bml3_state, bml3_acia_rts_w)) MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, bml3_state, bml3_acia_irq_w)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 9600) // 600 baud x 16(divider) = 9600 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 9'600)); // 600 baud x 16(divider) = 9600 + acia_clock.signal_handler().set(m_acia, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)); MCFG_CASSETTE_ADD( "cassette" ) diff --git a/src/mame/drivers/bombjack.cpp b/src/mame/drivers/bombjack.cpp index 510627272c9..2fc76a3f90f 100644 --- a/src/mame/drivers/bombjack.cpp +++ b/src/mame/drivers/bombjack.cpp @@ -362,15 +362,15 @@ MACHINE_CONFIG_START(bombjack_state::bombjack) MCFG_GENERIC_LATCH_8_ADD("soundlatch") /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(bombjack_state, screen_update_bombjack) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, bombjack_state, vblank_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(32*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(bombjack_state::screen_update_bombjack)); + screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(bombjack_state::vblank_irq)); + screen.screen_vblank().append_inputline("audiocpu", INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bombjack) MCFG_PALETTE_ADD("palette", 128) diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp index f0021d272fe..5b3640c2a81 100644 --- a/src/mame/drivers/bw2.cpp +++ b/src/mame/drivers/bw2.cpp @@ -561,14 +561,14 @@ MACHINE_CONFIG_START(bw2_state::bw2) MCFG_PALETTE_INIT_OWNER(bw2_state, bw2) // devices - MCFG_DEVICE_ADD(m_pit, PIT8253, 0) - MCFG_PIT8253_CLK0(16_MHz_XTAL / 4) // 8251 USART TXC, RXC - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_uart, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_uart, i8251_device, write_rxc)) - MCFG_PIT8253_CLK1(11000) // LCD controller - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_pit, pit8253_device, write_clk2)) - MCFG_PIT8253_CLK2(0) // Floppy /MTRON - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, bw2_state, mtron_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(16_MHz_XTAL / 4); // 8251 USART TXC, RXC + m_pit->out_handler<0>().set(m_uart, FUNC(i8251_device::write_txc)); + m_pit->out_handler<0>().append(m_uart, FUNC(i8251_device::write_rxc)); + m_pit->set_clk<1>(11000); // LCD controller + m_pit->out_handler<1>().set(m_pit, FUNC(pit8253_device::write_clk2)); + m_pit->set_clk<2>(0); // Floppy /MTRON + m_pit->out_handler<2>().set(FUNC(bw2_state::mtron_w)); MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, bw2_state, ppi_pa_w)) diff --git a/src/mame/drivers/capbowl.cpp b/src/mame/drivers/capbowl.cpp index ff5ae422f27..bd8feea3aa8 100644 --- a/src/mame/drivers/capbowl.cpp +++ b/src/mame/drivers/capbowl.cpp @@ -349,18 +349,18 @@ MACHINE_CONFIG_START(capbowl_state::capbowl) /* sound hardware */ SPEAKER(config, "speaker").front_center(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - - MCFG_DEVICE_ADD("ymsnd", YM2203, MASTER_CLOCK / 2) - MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", M6809_FIRQ_LINE)) - MCFG_AY8910_PORT_A_READ_CB(READLINE("ticket", ticket_dispenser_device, line_r)) MCFG_DEVCB_BIT(7) - MCFG_AY8910_PORT_B_WRITE_CB(WRITELINE("ticket", ticket_dispenser_device, motor_w)) MCFG_DEVCB_BIT(7) /* Also a status LED. See memory map above */ - MCFG_SOUND_ROUTE(0, "speaker", 0.07) - MCFG_SOUND_ROUTE(1, "speaker", 0.07) - MCFG_SOUND_ROUTE(2, "speaker", 0.07) - MCFG_SOUND_ROUTE(3, "speaker", 0.75) - - MCFG_DEVICE_ADD("dac", DAC0832, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) + GENERIC_LATCH_8(config, m_soundlatch); + + ym2203_device &ymsnd(YM2203(config, "ymsnd", MASTER_CLOCK / 2)); + ymsnd.irq_handler().set_inputline(m_audiocpu, M6809_FIRQ_LINE); + ymsnd.port_a_read_callback().set("ticket", FUNC(ticket_dispenser_device::line_r)).lshift(7); + ymsnd.port_b_write_callback().set("ticket", FUNC(ticket_dispenser_device::motor_w)).bit(7); // Also a status LED. See memory map above + ymsnd.add_route(0, "speaker", 0.07); + ymsnd.add_route(1, "speaker", 0.07); + ymsnd.add_route(2, "speaker", 0.07); + ymsnd.add_route(3, "speaker", 0.75); + + DAC0832(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.5); MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) MACHINE_CONFIG_END diff --git a/src/mame/drivers/cat.cpp b/src/mame/drivers/cat.cpp index b61f7bda4de..52b58dc4ad3 100644 --- a/src/mame/drivers/cat.cpp +++ b/src/mame/drivers/cat.cpp @@ -1080,14 +1080,13 @@ MACHINE_CONFIG_START(cat_state::cat) MCFG_MC68681_B_TX_CALLBACK(WRITELINE(*this, cat_state, cat_duart_txb)) MCFG_MC68681_OUTPORT_CALLBACK(WRITE8(*this, cat_state, cat_duart_output)) - MCFG_DEVICE_ADD(m_ctx, CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(*this, cat_state, prn_ack_ff)) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE("duartn68681", mc68681_device, ip4_w)) MCFG_DEVCB_XOR(1) + CENTRONICS(config, m_ctx, centronics_devices, "printer"); + m_ctx->ack_handler().set(FUNC(cat_state::prn_ack_ff)); + m_ctx->busy_handler().set("duartn68681", FUNC(mc68681_device::ip4_w)).invert(); MCFG_CENTRONICS_OUTPUT_LATCH_ADD("ctx_data_out", "ctx") SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) + SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 1.00); MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp index 8f8824da2ad..feeac10c134 100644 --- a/src/mame/drivers/ccastles.cpp +++ b/src/mame/drivers/ccastles.cpp @@ -247,12 +247,6 @@ WRITE8_MEMBER(ccastles_state::irq_ack_w) } -template WRITE_LINE_MEMBER(ccastles_state::ccounter_w) -{ - machine().bookkeeping().coin_counter_w(C, state); -} - - READ8_MEMBER(ccastles_state::leta_r) { static const char *const letanames[] = { "LETA0", "LETA1", "LETA2", "LETA3" }; @@ -440,19 +434,19 @@ GFXDECODE_END MACHINE_CONFIG_START(ccastles_state::ccastles) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M6502, MASTER_CLOCK/8) - MCFG_DEVICE_PROGRAM_MAP(main_map) - - MCFG_DEVICE_ADD("outlatch0", LS259, 0) // 8N - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, ccastles_state, nvram_store_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, ccastles_state, nvram_store_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, ccastles_state, ccounter_w<0>)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, ccastles_state, ccounter_w<1>)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(MEMBANK("bank1")) - - MCFG_DEVICE_ADD("outlatch1", LS259, 0) // 6P + M6502(config, m_maincpu, MASTER_CLOCK/8); + m_maincpu->set_addrmap(AS_PROGRAM, &ccastles_state::main_map); + + LS259(config, m_outlatch[0]); // 8N + m_outlatch[0]->q_out_cb<0>().set_output("led0").invert(); + m_outlatch[0]->q_out_cb<1>().set_output("led1").invert(); + m_outlatch[0]->q_out_cb<2>().set(FUNC(ccastles_state::nvram_store_w)); + m_outlatch[0]->q_out_cb<3>().set(FUNC(ccastles_state::nvram_store_w)); + m_outlatch[0]->q_out_cb<5>().set([this] (int state) { machine().bookkeeping().coin_counter_w(0, state); }); + m_outlatch[0]->q_out_cb<6>().set([this] (int state) { machine().bookkeeping().coin_counter_w(1, state); }); + m_outlatch[0]->q_out_cb<7>().set_membank("bank1"); + + LS259(config, m_outlatch[1]); // 6P MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 8) diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp index ebd5258c9c1..2ecfd8f9d03 100644 --- a/src/mame/drivers/cclimber.cpp +++ b/src/mame/drivers/cclimber.cpp @@ -1138,56 +1138,55 @@ MACHINE_CONFIG_START(cclimber_state::root) MACHINE_CONFIG_END -MACHINE_CONFIG_START(cclimber_state::cclimber) +void cclimber_state::cclimber(machine_config &config) +{ root(config); - MCFG_DEVICE_MODIFY("mainlatch") // 7J on CCG-1 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("cclimber_audio", cclimber_audio_device, sample_trigger)) + + // 7J on CCG-1 + m_mainlatch->q_out_cb<4>().set("cclimber_audio", FUNC(cclimber_audio_device::sample_trigger)); /* sound hardware */ SPEAKER(config, "speaker").front_center(); - MCFG_DEVICE_ADD("cclimber_audio", CCLIMBER_AUDIO, 0) -MACHINE_CONFIG_END + CCLIMBER_AUDIO(config, "cclimber_audio", 0); +} -MACHINE_CONFIG_START(cclimber_state::cclimberx) +void cclimber_state::cclimberx(machine_config &config) +{ cclimber(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_OPCODES_MAP(decrypted_opcodes_map) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_OPCODES, &cclimber_state::decrypted_opcodes_map); +} -MACHINE_CONFIG_START(cclimber_state::ckongb) +void cclimber_state::ckongb(machine_config &config) +{ cclimber(config); - MCFG_DEVICE_MODIFY("mainlatch") - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, cclimber_state, nmi_mask_w)) //used by Crazy Kong Bootleg with alt levels and speed up -MACHINE_CONFIG_END + m_mainlatch->q_out_cb<3>().set(FUNC(cclimber_state::nmi_mask_w)); //used by Crazy Kong Bootleg with alt levels and speed up +} MACHINE_CONFIG_START(cclimber_state::cannonb) cclimber(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(cannonb_map) + m_maincpu->set_addrmap(AS_PROGRAM, &cclimber_state::cannonb_map); - MCFG_DEVICE_MODIFY("mainlatch") - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, cclimber_state, flip_screen_x_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, cclimber_state, flip_screen_y_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // not used + m_mainlatch->q_out_cb<1>().set(FUNC(cclimber_state::flip_screen_x_w)); + m_mainlatch->q_out_cb<1>().append(FUNC(cclimber_state::flip_screen_y_w)); + m_mainlatch->q_out_cb<2>().set_nop(); // not used /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_cannonb) MACHINE_CONFIG_END -MACHINE_CONFIG_START(cclimber_state::bagmanf) +void cclimber_state::bagmanf(machine_config &config) +{ cclimber(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(bagmanf_map) + m_maincpu->set_addrmap(AS_PROGRAM, &cclimber_state::bagmanf_map); - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cclimber_state, bagmanf_vblank_irq)) -MACHINE_CONFIG_END + subdevice("screen")->screen_vblank().set(FUNC(cclimber_state::bagmanf_vblank_irq)); +} MACHINE_CONFIG_START(cclimber_state::yamato) @@ -1233,9 +1232,8 @@ MACHINE_CONFIG_START(cclimber_state::toprollr) MCFG_SEGACRPT_SET_NUMBANKS(3) MCFG_SEGACRPT_SET_BANKSIZE(0x6000) - MCFG_DEVICE_MODIFY("mainlatch") - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, cclimber_state, toprollr_rombank_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, cclimber_state, toprollr_rombank_w)) + m_mainlatch->q_out_cb<5>().set(FUNC(cclimber_state::toprollr_rombank_w)); + m_mainlatch->q_out_cb<6>().set(FUNC(cclimber_state::toprollr_rombank_w)); /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_toprollr) @@ -1295,12 +1293,12 @@ MACHINE_CONFIG_START(cclimber_state::swimmer) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) MACHINE_CONFIG_END -MACHINE_CONFIG_START(cclimber_state::guzzler) +void cclimber_state::guzzler(machine_config &config) +{ swimmer(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(guzzler_map) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_PROGRAM, &cclimber_state::guzzler_map); +} /*************************************************************************** diff --git a/src/mame/drivers/ccs2810.cpp b/src/mame/drivers/ccs2810.cpp index cb26477eea4..d7abac8548d 100644 --- a/src/mame/drivers/ccs2810.cpp +++ b/src/mame/drivers/ccs2810.cpp @@ -73,8 +73,8 @@ ToDo: class ccs_state : public driver_device { public: - ccs_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ccs_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_rom(*this, "maincpu"), @@ -89,25 +89,31 @@ public: { } + void init_ccs2810(); + void init_ccs2422(); + + void ccs2810(machine_config &config); + void ccs2422(machine_config &config); + +protected: DECLARE_READ8_MEMBER(memory_read); DECLARE_WRITE8_MEMBER(memory_write); DECLARE_READ8_MEMBER(io_read); DECLARE_WRITE8_MEMBER(io_write); - void init_ccs2810(); - void init_ccs2422(); + virtual void machine_start() override; virtual void machine_reset() override; + DECLARE_READ8_MEMBER(port04_r); DECLARE_READ8_MEMBER(port34_r); DECLARE_WRITE8_MEMBER(port04_w); DECLARE_WRITE8_MEMBER(port34_w); DECLARE_WRITE8_MEMBER(port40_w); - void ccs2810(machine_config &config); - void ccs2422(machine_config &config); void ccs2422_io(address_map &map); void ccs2810_io(address_map &map); void ccs2810_mem(address_map &map); + private: required_device m_maincpu; required_device m_ram; @@ -913,18 +919,18 @@ MACHINE_CONFIG_START(ccs_state::ccs2810) MCFG_RAM_DEFAULT_SIZE("64K") /* Devices */ - MCFG_DEVICE_ADD("ins8250", INS8250, 1.8432_MHz_XTAL) - MCFG_INS8250_OUT_TX_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_OUT1_CB(WRITELINE("rs232", rs232_port_device, write_spds)) // RLSD - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("ins8250", ins8250_device, rx_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ins8250", ins8250_device, ri_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("ins8250", ins8250_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("ins8250", ins8250_device, dsr_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("ins8250", ins8250_device, cts_w)) + INS8250(config, m_ins8250, 1.8432_MHz_XTAL); + m_ins8250->out_tx_callback().set("rs232", FUNC(rs232_port_device::write_txd)); + m_ins8250->out_dtr_callback().set("rs232", FUNC(rs232_port_device::write_dtr)); + m_ins8250->out_rts_callback().set("rs232", FUNC(rs232_port_device::write_rts)); + m_ins8250->out_out1_callback().set("rs232", FUNC(rs232_port_device::write_spds)); // RLSD + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(m_ins8250, FUNC(ins8250_device::rx_w)); + rs232.rxd_handler().append(m_ins8250, FUNC(ins8250_device::ri_w)); + rs232.dcd_handler().set(m_ins8250, FUNC(ins8250_device::dcd_w)); + rs232.dsr_handler().set(m_ins8250, FUNC(ins8250_device::dsr_w)); + rs232.cts_handler().set(m_ins8250, FUNC(ins8250_device::cts_w)); MACHINE_CONFIG_END MACHINE_CONFIG_START(ccs_state::ccs2422) @@ -937,18 +943,18 @@ MACHINE_CONFIG_START(ccs_state::ccs2422) MCFG_RAM_DEFAULT_SIZE("64K") /* Devices */ - MCFG_DEVICE_ADD("ins8250", INS8250, 1.8432_MHz_XTAL) - MCFG_INS8250_OUT_TX_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_INS8250_OUT_DTR_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_INS8250_OUT_RTS_CB(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_INS8250_OUT_OUT1_CB(WRITELINE("rs232", rs232_port_device, write_etc)) // RLSD - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("ins8250", ins8250_device, rx_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ins8250", ins8250_device, ri_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("ins8250", ins8250_device, dcd_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("ins8250", ins8250_device, dsr_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("ins8250", ins8250_device, cts_w)) + INS8250(config, m_ins8250, 1.8432_MHz_XTAL); + m_ins8250->out_tx_callback().set("rs232", FUNC(rs232_port_device::write_txd)); + m_ins8250->out_dtr_callback().set("rs232", FUNC(rs232_port_device::write_dtr)); + m_ins8250->out_rts_callback().set("rs232", FUNC(rs232_port_device::write_rts)); + m_ins8250->out_out1_callback().set("rs232", FUNC(rs232_port_device::write_etc)); // RLSD + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set(m_ins8250, FUNC(ins8250_device::rx_w)); + rs232.rxd_handler().append(m_ins8250, FUNC(ins8250_device::ri_w)); + rs232.dcd_handler().set(m_ins8250, FUNC(ins8250_device::dcd_w)); + rs232.dsr_handler().set(m_ins8250, FUNC(ins8250_device::dsr_w)); + rs232.cts_handler().set(m_ins8250, FUNC(ins8250_device::cts_w)); MCFG_DEVICE_ADD("fdc", MB8877, 16_MHz_XTAL / 8) // UB1793 or MB8877 MCFG_FLOPPY_DRIVE_ADD("fdc:0", ccs_floppies, "8sssd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/ccs300.cpp b/src/mame/drivers/ccs300.cpp index a852ac599f8..170f211315c 100644 --- a/src/mame/drivers/ccs300.cpp +++ b/src/mame/drivers/ccs300.cpp @@ -125,9 +125,9 @@ MACHINE_CONFIG_START(ccs300_state::ccs300) MCFG_MACHINE_RESET_OVERRIDE(ccs300_state, ccs300) /* video hardware */ - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxca_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153'600)); + uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txca_w)); + uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxca_w)); /* Devices */ MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(4'000'000)) diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp index e3bd4e15691..8095ba851c1 100644 --- a/src/mame/drivers/cdc721.cpp +++ b/src/mame/drivers/cdc721.cpp @@ -357,15 +357,15 @@ MACHINE_CONFIG_START(cdc721_state::cdc721) MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, cdc721_state, interrupt_mask_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, cdc721_state, misc_w)) - MCFG_DEVICE_ADD("ledlatch", OUTPUT_LATCH, 0) - MCFG_OUTPUT_LATCH_BIT0_HANDLER(OUTPUT("error")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT1_HANDLER(OUTPUT("alert")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT2_HANDLER(OUTPUT("lock")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT3_HANDLER(OUTPUT("message")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT4_HANDLER(OUTPUT("prog1")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT5_HANDLER(OUTPUT("prog2")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT6_HANDLER(OUTPUT("prog3")) MCFG_DEVCB_INVERT - MCFG_OUTPUT_LATCH_BIT7_HANDLER(OUTPUT("dsr")) MCFG_DEVCB_INVERT + output_latch_device &ledlatch(OUTPUT_LATCH(config, "ledlatch")); + ledlatch.bit_handler<0>().set_output("error").invert(); + ledlatch.bit_handler<1>().set_output("alert").invert(); + ledlatch.bit_handler<2>().set_output("lock").invert(); + ledlatch.bit_handler<3>().set_output("message").invert(); + ledlatch.bit_handler<4>().set_output("prog1").invert(); + ledlatch.bit_handler<5>().set_output("prog2").invert(); + ledlatch.bit_handler<6>().set_output("prog3").invert(); + ledlatch.bit_handler<7>().set_output("dsr").invert(); MCFG_DEVICE_ADD("comuart", INS8250, 1.8432_MHz_XTAL) MCFG_INS8250_OUT_INT_CB(WRITELINE(*this, cdc721_state, int_w<0>)) diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp index 404e900c10c..7a2249e9f73 100644 --- a/src/mame/drivers/centiped.cpp +++ b/src/mame/drivers/centiped.cpp @@ -1749,12 +1749,12 @@ MACHINE_CONFIG_START(centiped_state::centiped_base) MCFG_DEVICE_ADD("earom", ER2055) - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, centiped_state, coin_counter_left_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, centiped_state, coin_counter_center_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, centiped_state, coin_counter_right_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // LED 1 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // LED 2 + ls259_device &outlatch(LS259(config, "outlatch")); + outlatch.q_out_cb<0>().set(FUNC(centiped_state::coin_counter_left_w)); + outlatch.q_out_cb<1>().set(FUNC(centiped_state::coin_counter_center_w)); + outlatch.q_out_cb<2>().set(FUNC(centiped_state::coin_counter_right_w)); + outlatch.q_out_cb<3>().set_output("led0").invert(); // LED 1 + outlatch.q_out_cb<4>().set_output("led1").invert(); // LED 2 MCFG_WATCHDOG_ADD("watchdog") @@ -1915,9 +1915,9 @@ MACHINE_CONFIG_START(centiped_state::warlords) MCFG_DEVICE_REMOVE("earom") // these extra LEDs also appear on Centipede schematics - MCFG_DEVICE_MODIFY("outlatch") // P9 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT // LED 3 - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led3")) MCFG_DEVCB_INVERT // LED 4 + ls259_device &outlatch(*subdevice("outlatch")); // P9 + outlatch.q_out_cb<5>().set_output("led2").invert(); // LED 3 + outlatch.q_out_cb<6>().set_output("led3").invert(); // LED 4 /* video hardware */ MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_warlords) @@ -1966,11 +1966,11 @@ MACHINE_CONFIG_START(centiped_state::bullsdrt) MCFG_DEVICE_ADD("earom", ER2055) - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, centiped_state, bullsdrt_coin_count_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, centiped_state, flip_screen_w)) + ls259_device &outlatch(LS259(config, "outlatch")); + outlatch.q_out_cb<1>().set(FUNC(centiped_state::bullsdrt_coin_count_w)); + outlatch.q_out_cb<3>().set_output("led0").invert(); + outlatch.q_out_cb<4>().set_output("led1").invert(); + outlatch.q_out_cb<7>().set(FUNC(centiped_state::flip_screen_w)); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/cgc7900.cpp b/src/mame/drivers/cgc7900.cpp index 3f9c2bae652..6547c5312f5 100644 --- a/src/mame/drivers/cgc7900.cpp +++ b/src/mame/drivers/cgc7900.cpp @@ -494,11 +494,11 @@ MACHINE_CONFIG_START(cgc7900_state::cgc7900) MCFG_DEVICE_ADD(MM58167_TAG, MM58167, XTAL(32'768)) MCFG_MM58167_IRQ_CALLBACK(WRITELINE(*this, cgc7900_state, irq<0x0>)) - MCFG_DEVICE_ADD(K1135A_TAG, COM8116, XTAL(5'068'800)) - MCFG_COM8116_FR_HANDLER(WRITELINE(INS8251_0_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(INS8251_0_TAG, i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE(INS8251_1_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(INS8251_1_TAG, i8251_device, write_rxc)) + com8116_device &k1135a(COM8116(config, K1135A_TAG, XTAL(5'068'800))); + k1135a.fr_handler().set(m_i8251_0, FUNC(i8251_device::write_txc)); + k1135a.fr_handler().append(m_i8251_0, FUNC(i8251_device::write_rxc)); + k1135a.ft_handler().set(m_i8251_1, FUNC(i8251_device::write_txc)); + k1135a.ft_handler().append(m_i8251_1, FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD(INS8251_0_TAG, I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/cidelsa.cpp b/src/mame/drivers/cidelsa.cpp index 09337876144..5a9cb6a0ff0 100644 --- a/src/mame/drivers/cidelsa.cpp +++ b/src/mame/drivers/cidelsa.cpp @@ -405,7 +405,7 @@ MACHINE_CONFIG_START(cidelsa_state::destryer) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, DESTRYER_CHR1) MCFG_DEVICE_PROGRAM_MAP(destryer_map) MCFG_DEVICE_IO_MAP(destryer_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, cidelsa_state, clear_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, cidelsa_state, q_w)) @@ -420,7 +420,7 @@ MACHINE_CONFIG_START(cidelsa_state::destryera) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, DESTRYER_CHR1) MCFG_DEVICE_PROGRAM_MAP(destryera_map) MCFG_DEVICE_IO_MAP(destryer_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, cidelsa_state, clear_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, cidelsa_state, q_w)) @@ -435,7 +435,7 @@ MACHINE_CONFIG_START(cidelsa_state::altair) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, ALTAIR_CHR1) MCFG_DEVICE_PROGRAM_MAP(altair_map) MCFG_DEVICE_IO_MAP(altair_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, cidelsa_state, clear_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, cidelsa_state, q_w)) @@ -443,16 +443,16 @@ MACHINE_CONFIG_START(cidelsa_state::altair) /* input/output hardware */ MCFG_DEVICE_ADD("ic23", CDP1852, 0) // clock is really tied to CDP1869 CMSEL (pin 37) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN0")) MCFG_DEVICE_ADD("ic24", CDP1852, 0) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN1")) MCFG_DEVICE_ADD("ic25", CDP1852, 0) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN2")) MCFG_DEVICE_ADD("ic26", CDP1852, ALTAIR_CHR1 / 8) // clock is CDP1802 TPB - MCFG_CDP1852_MODE_CALLBACK(VCC) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(1)) MCFG_CDP1852_DO_CALLBACK(WRITE8(*this, cidelsa_state, altair_out1_w)) /* sound and video hardware */ @@ -464,7 +464,7 @@ MACHINE_CONFIG_START(draco_state::draco) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, DRACO_CHR1) MCFG_DEVICE_PROGRAM_MAP(draco_map) MCFG_DEVICE_IO_MAP(draco_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, cidelsa_state, clear_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, cidelsa_state, q_w)) @@ -481,16 +481,16 @@ MACHINE_CONFIG_START(draco_state::draco) /* input/output hardware */ MCFG_DEVICE_ADD("ic29", CDP1852, 0) // clock is really tied to CDP1869 CMSEL (pin 37) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN0")) MCFG_DEVICE_ADD("ic30", CDP1852, 0) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN1")) MCFG_DEVICE_ADD("ic31", CDP1852, 0) - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) MCFG_CDP1852_DI_CALLBACK(IOPORT("IN2")) MCFG_DEVICE_ADD("ic32", CDP1852, ALTAIR_CHR1 / 8) // clock is CDP1802 TPB - MCFG_CDP1852_MODE_CALLBACK(VCC) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(1)) MCFG_CDP1852_DO_CALLBACK(WRITE8(*this, draco_state, out1_w)) /* sound and video hardware */ diff --git a/src/mame/drivers/cit101.cpp b/src/mame/drivers/cit101.cpp index 26612a5d5d0..b7ed97eb12c 100644 --- a/src/mame/drivers/cit101.cpp +++ b/src/mame/drivers/cit101.cpp @@ -335,7 +335,7 @@ MACHINE_CONFIG_START(cit101_state::cit101) MCFG_DEVICE_ADD("maincpu", I8085A, 6.144_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(mem_map) MCFG_DEVICE_IO_MAP(io_map) - MCFG_I8085A_SID(GND) // used to time NVR reads + MCFG_I8085A_SID(CONSTANT(0)) // used to time NVR reads MCFG_I8085A_SOD(WRITELINE(*this, cit101_state, blink_w)) MCFG_SCREEN_ADD("screen", RASTER) @@ -385,24 +385,24 @@ MACHINE_CONFIG_START(cit101_state::cit101) // OUT2 might be used for an internal expansion similar to the VT100 STP. // The output appears to be fixed to a 307.2 kHz rate; turning this off boosts driver performance. - MCFG_DEVICE_ADD("pit1", PIT8253, 0) - MCFG_PIT8253_CLK0(6.144_MHz_XTAL / 4) - MCFG_PIT8253_CLK1(6.144_MHz_XTAL / 4) - MCFG_PIT8253_CLK2(6.144_MHz_XTAL / 4) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("comuart", i8251_device, write_txc)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("comuart", i8251_device, write_rxc)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("kbduart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("kbduart", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("ppi", I8255A, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, cit101_state, nvr_address_w)) - MCFG_I8255_IN_PORTB_CB(READ8(*this, cit101_state, nvr_data_r)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, cit101_state, nvr_data_w)) - MCFG_I8255_IN_PORTC_CB(READLINE("comm", rs232_port_device, cts_r)) MCFG_DEVCB_BIT(0) - MCFG_DEVCB_CHAIN_INPUT(READLINE("comm", rs232_port_device, dcd_r)) MCFG_DEVCB_BIT(1) // tied to DSR for loopback test - MCFG_DEVCB_CHAIN_INPUT(READLINE("comm", rs232_port_device, ri_r)) MCFG_DEVCB_BIT(2) // tied to CTS for loopback test - MCFG_DEVCB_CHAIN_INPUT(READLINE("comm", rs232_port_device, si_r)) MCFG_DEVCB_BIT(3) // tied to CTS for loopback test - MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, cit101_state, nvr_control_w)) + pit8253_device &pit1(PIT8253(config, "pit1", 0)); + pit1.set_clk<0>(6.144_MHz_XTAL / 4); + pit1.set_clk<1>(6.144_MHz_XTAL / 4); + pit1.set_clk<2>(6.144_MHz_XTAL / 4); + pit1.out_handler<0>().set("comuart", FUNC(i8251_device::write_txc)); + pit1.out_handler<1>().set("comuart", FUNC(i8251_device::write_rxc)); + pit1.out_handler<2>().set("kbduart", FUNC(i8251_device::write_txc)); + pit1.out_handler<2>().append("kbduart", FUNC(i8251_device::write_rxc)); + + i8255_device &ppi(I8255A(config, "ppi", 0)); + ppi.out_pa_callback().set(FUNC(cit101_state::nvr_address_w)); + ppi.in_pb_callback().set(FUNC(cit101_state::nvr_data_r)); + ppi.out_pb_callback().set(FUNC(cit101_state::nvr_data_w)); + ppi.in_pc_callback().set("comm", FUNC(rs232_port_device::cts_r)).lshift(0); + ppi.in_pc_callback().append("comm", FUNC(rs232_port_device::dcd_r)).lshift(1); // tied to DSR for loopback test + ppi.in_pc_callback().append("comm", FUNC(rs232_port_device::ri_r)).lshift(2); // tied to CTS for loopback test + ppi.in_pc_callback().append("comm", FUNC(rs232_port_device::si_r)).lshift(3); // tied to CTS for loopback test + ppi.out_pc_callback().set(FUNC(cit101_state::nvr_control_w)); MCFG_DEVICE_ADD("nvr", ER2055, 0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp index 2f2db635bc4..6accadc5021 100644 --- a/src/mame/drivers/clcd.cpp +++ b/src/mame/drivers/clcd.cpp @@ -745,18 +745,18 @@ MACHINE_CONFIG_START(clcd_state::clcd) MCFG_DEVICE_ADD("maincpu", M65C02, 2000000) MCFG_DEVICE_PROGRAM_MAP(clcd_mem) - MCFG_DEVICE_ADD("via0", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(*this, clcd_state, via0_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(*this, clcd_state, via0_pb_w)) - MCFG_VIA6522_CB1_HANDLER(WRITELINE(*this, clcd_state, via0_cb1_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(*this, clcd_state, write_irq_via0)) - - MCFG_DEVICE_ADD("via1", VIA6522, 2000000) - MCFG_VIA6522_WRITEPA_HANDLER(WRITE8(*this, clcd_state, via1_pa_w)) - MCFG_VIA6522_WRITEPB_HANDLER(WRITE8(*this, clcd_state, via1_pb_w)) - MCFG_VIA6522_IRQ_HANDLER(WRITELINE(*this, clcd_state, write_irq_via1)) - MCFG_VIA6522_CA2_HANDLER(WRITELINE(m_centronics, centronics_device, write_strobe)) MCFG_DEVCB_XOR(1) - MCFG_VIA6522_CB2_HANDLER(WRITELINE("speaker", speaker_sound_device, level_w)) + via6522_device &via0(VIA6522(config, "via0", 2000000)); + via0.writepa_handler().set(FUNC(clcd_state::via0_pa_w)); + via0.writepb_handler().set(FUNC(clcd_state::via0_pb_w)); + via0.cb1_handler().set(FUNC(clcd_state::via0_cb1_w)); + via0.irq_handler().set(FUNC(clcd_state::write_irq_via0)); + + via6522_device &via1(VIA6522(config, "via1", 2000000)); + via1.writepa_handler().set(FUNC(clcd_state::via1_pa_w)); + via1.writepb_handler().set(FUNC(clcd_state::via1_pb_w)); + via1.irq_handler().set(FUNC(clcd_state::write_irq_via1)); + via1.ca2_handler().set(m_centronics, FUNC(centronics_device::write_strobe)).invert(); + via1.cb2_handler().set("speaker", FUNC(speaker_sound_device::level_w)); MCFG_DEVICE_ADD("acia", MOS6551, 2000000) MCFG_MOS6551_XTAL(XTAL(1'843'200)) @@ -771,8 +771,8 @@ MACHINE_CONFIG_START(clcd_state::clcd) MCFG_RS232_DSR_HANDLER(WRITELINE("acia", mos6551_device, write_dsr)) MCFG_RS232_CTS_HANDLER(WRITELINE("via1", via6522_device, write_pb4)) - MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, nullptr) - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE("via1", via6522_device, write_pb6)) MCFG_DEVCB_XOR(1) + CENTRONICS(config, m_centronics, centronics_devices, nullptr); + m_centronics->busy_handler().set("via1", FUNC(via6522_device::write_pb6)).invert(); MCFG_DEVICE_ADD("bank1", ADDRESS_MAP_BANK, 0) MCFG_DEVICE_PROGRAM_MAP(clcd_banked_mem) diff --git a/src/mame/drivers/cloak.cpp b/src/mame/drivers/cloak.cpp index 97cdc984c3a..66cb8278daf 100644 --- a/src/mame/drivers/cloak.cpp +++ b/src/mame/drivers/cloak.cpp @@ -328,13 +328,13 @@ MACHINE_CONFIG_START(cloak_state::cloak) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("outlatch", LS259, 0) // 10B - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, cloak_state, coin_counter_r_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, cloak_state, coin_counter_l_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, cloak_state, cocktail_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(NOOP) // ??? - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // START LED 2 - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // START LED 1 + ls259_device &outlatch(LS259(config, "outlatch")); // 10B + outlatch.q_out_cb<0>().set(FUNC(cloak_state::coin_counter_r_w)); + outlatch.q_out_cb<1>().set(FUNC(cloak_state::coin_counter_l_w)); + outlatch.q_out_cb<3>().set(FUNC(cloak_state::cocktail_w)); + outlatch.q_out_cb<5>().set_nop(); // ??? + outlatch.q_out_cb<6>().set_output("led1").invert(); // START LED 2 + outlatch.q_out_cb<7>().set_output("led0").invert(); // START LED 1 MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/cloud9.cpp b/src/mame/drivers/cloud9.cpp index a69700dafe4..d89f0811fef 100644 --- a/src/mame/drivers/cloud9.cpp +++ b/src/mame/drivers/cloud9.cpp @@ -216,18 +216,6 @@ WRITE8_MEMBER(cloud9_state::irq_ack_w) } -WRITE_LINE_MEMBER(cloud9_state::coin1_counter_w) -{ - machine().bookkeeping().coin_counter_w(0, state); -} - - -WRITE_LINE_MEMBER(cloud9_state::coin2_counter_w) -{ - machine().bookkeeping().coin_counter_w(1, state); -} - - READ8_MEMBER(cloud9_state::leta_r) { return ioport(offset ? "TRACKX" : "TRACKY")->read(); @@ -407,14 +395,14 @@ GFXDECODE_END MACHINE_CONFIG_START(cloud9_state::cloud9) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M6502, MASTER_CLOCK/8) - MCFG_DEVICE_PROGRAM_MAP(cloud9_map) - - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, cloud9_state, coin1_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, cloud9_state, coin2_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT + M6502(config, m_maincpu, MASTER_CLOCK/8); + m_maincpu->set_addrmap(AS_PROGRAM, &cloud9_state::cloud9_map); + + ls259_device &outlatch(LS259(config, "outlatch")); + outlatch.q_out_cb<0>().set([this] (int state) { machine().bookkeeping().coin_counter_w(0, state); }); + outlatch.q_out_cb<1>().set([this] (int state) { machine().bookkeeping().coin_counter_w(1, state); }); + outlatch.q_out_cb<2>().set_output("led0").invert(); + outlatch.q_out_cb<3>().set_output("led1").invert(); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 8) diff --git a/src/mame/drivers/clshroad.cpp b/src/mame/drivers/clshroad.cpp index f53d7385874..e30127ebc0b 100644 --- a/src/mame/drivers/clshroad.cpp +++ b/src/mame/drivers/clshroad.cpp @@ -283,11 +283,11 @@ MACHINE_CONFIG_START(clshroad_state::firebatl) MCFG_DEVICE_PROGRAM_MAP(clshroad_sound_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(clshroad_state, sound_timer_irq, 120) /* periodic interrupt, don't know about the frequency */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, clshroad_state, main_irq_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, clshroad_state, sound_irq_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, clshroad_state, flipscreen_w)) + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<1>().set(FUNC(clshroad_state::main_irq_mask_w)); + mainlatch.q_out_cb<3>().set(FUNC(clshroad_state::sound_irq_mask_w)); + mainlatch.q_out_cb<4>().set(FUNC(clshroad_state::flipscreen_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -324,11 +324,11 @@ MACHINE_CONFIG_START(clshroad_state::clshroad) //MCFG_DEVICE_VBLANK_INT_DRIVER("screen", clshroad_state, irq0_line_hold) /* IRQ, no NMI */ MCFG_DEVICE_PERIODIC_INT_DRIVER(clshroad_state, sound_timer_irq, 60) /* periodic interrupt, don't know about the frequency */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // never writes here? - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, clshroad_state, main_irq_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, clshroad_state, sound_irq_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, clshroad_state, flipscreen_w)) + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_nop(); // never writes here? + mainlatch.q_out_cb<1>().set(FUNC(clshroad_state::main_irq_mask_w)); + mainlatch.q_out_cb<3>().set(FUNC(clshroad_state::sound_irq_mask_w)); + mainlatch.q_out_cb<4>().set(FUNC(clshroad_state::flipscreen_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/cntsteer.cpp b/src/mame/drivers/cntsteer.cpp index 9677b7328a6..f34bf620848 100644 --- a/src/mame/drivers/cntsteer.cpp +++ b/src/mame/drivers/cntsteer.cpp @@ -938,15 +938,15 @@ MACHINE_CONFIG_START(cntsteer_state::cntsteer) MCFG_MACHINE_RESET_OVERRIDE(cntsteer_state,cntsteer) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) - MCFG_SCREEN_UPDATE_DRIVER(cntsteer_state, screen_update_cntsteer) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) // ? - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, cntsteer_state, subcpu_vblank_irq)) // ? + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_size(256, 256); + screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); + screen.set_screen_update(FUNC(cntsteer_state::screen_update_cntsteer)); + screen.set_palette(m_palette); + screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI); // ? + screen.screen_vblank().append(FUNC(cntsteer_state::subcpu_vblank_irq)); // ? MCFG_QUANTUM_PERFECT_CPU("maincpu") MCFG_QUANTUM_PERFECT_CPU("subcpu") diff --git a/src/mame/drivers/coco12.cpp b/src/mame/drivers/coco12.cpp index 22e3d9e27a2..b9e22c24f8c 100644 --- a/src/mame/drivers/coco12.cpp +++ b/src/mame/drivers/coco12.cpp @@ -474,10 +474,10 @@ MACHINE_CONFIG_START(coco12_state::coco) MCFG_RS232_DCD_HANDLER(WRITELINE(PIA1_TAG, pia6821_device, ca1_w)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("printer", printer) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "pak") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "pak")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); // video hardware MCFG_SCREEN_MC6847_NTSC_ADD(SCREEN_TAG, VDG_TAG) @@ -516,11 +516,10 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(coco12_state::cocoe) coco(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdc")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); MCFG_COCO_VHD_ADD(VHD0_TAG) MCFG_COCO_VHD_ADD(VHD1_TAG) MACHINE_CONFIG_END @@ -535,11 +534,10 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(coco12_state::coco2) coco(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdcv11")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); MCFG_COCO_VHD_ADD(VHD0_TAG) MCFG_COCO_VHD_ADD(VHD1_TAG) MACHINE_CONFIG_END @@ -569,33 +567,33 @@ MACHINE_CONFIG_START(coco12_state::coco2bh) MCFG_RAM_DEFAULT_SIZE("64K") MACHINE_CONFIG_END -MACHINE_CONFIG_START(coco12_state::cp400) +void coco12_state::cp400(machine_config &config) +{ coco(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cp450_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) -MACHINE_CONFIG_END + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "cp450_fdc")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); +} -MACHINE_CONFIG_START(coco12_state::t4426) +void coco12_state::t4426(machine_config &config) +{ coco2(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, t4426_cart, "t4426") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) - MCFG_SLOT_FIXED(true) // This cart is fixed so no way to change it -MACHINE_CONFIG_END + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), t4426_cart, "t4426")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); + cartslot.set_fixed(true); // This cart is fixed so no way to change it +} -MACHINE_CONFIG_START(coco12_state::cd6809) +void coco12_state::cd6809(machine_config &config) +{ coco(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cd6809_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) -MACHINE_CONFIG_END + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "cd6809_fdc")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); +} //************************************************************************** // ROMS diff --git a/src/mame/drivers/coco3.cpp b/src/mame/drivers/coco3.cpp index 2419e5b9358..1ae287a428f 100644 --- a/src/mame/drivers/coco3.cpp +++ b/src/mame/drivers/coco3.cpp @@ -281,10 +281,10 @@ MACHINE_CONFIG_START(coco3_state::coco3) MCFG_RS232_DCD_HANDLER(WRITELINE(PIA1_TAG, pia6821_device, ca1_w)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("printer", printer) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "fdcv11") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "fdcv11")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); MCFG_COCO_VHD_ADD(VHD0_TAG) MCFG_COCO_VHD_ADD(VHD1_TAG) @@ -354,14 +354,14 @@ MACHINE_CONFIG_START(coco3_state::coco3h) MCFG_DEVICE_PROGRAM_MAP(coco3_mem) MACHINE_CONFIG_END -MACHINE_CONFIG_START(coco3_state::coco3dw1) +void coco3_state::coco3dw1(machine_config &config) +{ coco3(config); - MCFG_COCO_CARTRIDGE_REMOVE(CARTRIDGE_TAG) - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, coco_cart, "cc3hdb1") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) -MACHINE_CONFIG_END + cococart_slot_device &cartslot(COCOCART_SLOT(config.replace(), CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), coco_cart, "cc3hdb1")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); +} //************************************************************************** // ROMS diff --git a/src/mame/drivers/codata.cpp b/src/mame/drivers/codata.cpp index d47767f90e1..7fa5f64e27c 100644 --- a/src/mame/drivers/codata.cpp +++ b/src/mame/drivers/codata.cpp @@ -74,14 +74,14 @@ MACHINE_CONFIG_START(codata_state::codata) MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs423b", rs232_port_device, write_txd)) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", M68K_IRQ_5)) - MCFG_DEVICE_ADD("timer", AM9513A, XTAL(16'000'000) / 4) - MCFG_AM9513_OUT1_CALLBACK(NOOP) // Timer 1 = "Abort/Reset" (watchdog) - MCFG_AM9513_OUT2_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_6)) // Timer 2 - MCFG_AM9513_OUT3_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_7)) // Refresh - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("uart", upd7201_new_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", upd7201_new_device, txca_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("uart", upd7201_new_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", upd7201_new_device, txcb_w)) + am9513_device &timer(AM9513A(config, "timer", 16_MHz_XTAL / 4)); + timer.out1_cb().set_nop(); // Timer 1 = "Abort/Reset" (watchdog) + timer.out2_cb().set_inputline(m_maincpu, M68K_IRQ_6); // Timer 2 + timer.out3_cb().set_inputline(m_maincpu, M68K_IRQ_7); // Refresh + timer.out4_cb().set("uart", FUNC(upd7201_new_device::rxca_w)); + timer.out4_cb().append("uart", FUNC(upd7201_new_device::txca_w)); + timer.out5_cb().set("uart", FUNC(upd7201_new_device::rxcb_w)); + timer.out5_cb().append("uart", FUNC(upd7201_new_device::txcb_w)); MCFG_DEVICE_ADD("rs423a", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE("uart", upd7201_new_device, rxa_w)) diff --git a/src/mame/drivers/commando.cpp b/src/mame/drivers/commando.cpp index e628310992d..be69b8b2dc1 100644 --- a/src/mame/drivers/commando.cpp +++ b/src/mame/drivers/commando.cpp @@ -263,17 +263,16 @@ MACHINE_CONFIG_START(commando_state::commando) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(commando_state, irq0_line_hold, 4*60) - /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(commando_state, screen_update_commando) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, commando_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(32*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(commando_state::screen_update_commando)); + screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising)); + screen.screen_vblank().append(FUNC(commando_state::vblank_irq)); + screen.set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_commando) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) diff --git a/src/mame/drivers/compucolor.cpp b/src/mame/drivers/compucolor.cpp index 4a3d829ae4a..264048fab80 100644 --- a/src/mame/drivers/compucolor.cpp +++ b/src/mame/drivers/compucolor.cpp @@ -414,9 +414,9 @@ MACHINE_CONFIG_START(compucolor2_state::compucolor2) MCFG_TMS9927_VSYN_CALLBACK(WRITELINE("blink", ripple_counter_device, clock_w)) MCFG_VIDEO_SET_SCREEN("screen") - MCFG_DEVICE_ADD("blink", RIPPLE_COUNTER, 0) // 74LS393 at UG10 - MCFG_RIPPLE_COUNTER_STAGES(8) - MCFG_RIPPLE_COUNTER_COUNT_OUT_CB(WRITELINE(TMS5501_TAG, tms5501_device, sens_w)) MCFG_DEVCB_BIT(4) + ripple_counter_device &blink(RIPPLE_COUNTER(config, "blink", 0)); // 74LS393 at UG10 + blink.set_stages(8); + blink.count_out_cb().set(m_mioc, FUNC(tms5501_device::sens_w)).bit(4); // devices MCFG_DEVICE_ADD(TMS5501_TAG, TMS5501, XTAL(17'971'200)/9) diff --git a/src/mame/drivers/comx35.cpp b/src/mame/drivers/comx35.cpp index dd1fa84c61f..47f4da2ced4 100644 --- a/src/mame/drivers/comx35.cpp +++ b/src/mame/drivers/comx35.cpp @@ -600,7 +600,7 @@ MACHINE_CONFIG_START(comx35_state::pal) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, cdp1869_device::CPU_CLK_PAL) MCFG_DEVICE_PROGRAM_MAP(comx35_mem) MCFG_DEVICE_IO_MAP(comx35_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, comx35_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, comx35_state, ef2_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, comx35_state, ef4_r)) @@ -650,7 +650,7 @@ MACHINE_CONFIG_START(comx35_state::ntsc) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, cdp1869_device::CPU_CLK_NTSC) MCFG_DEVICE_PROGRAM_MAP(comx35_mem) MCFG_DEVICE_IO_MAP(comx35_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, comx35_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, comx35_state, ef2_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, comx35_state, ef4_r)) diff --git a/src/mame/drivers/cortex.cpp b/src/mame/drivers/cortex.cpp index f685fbbc61c..bdecceeafdb 100644 --- a/src/mame/drivers/cortex.cpp +++ b/src/mame/drivers/cortex.cpp @@ -196,10 +196,11 @@ MACHINE_CONFIG_START(cortex_state::cortex) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE("beeper", beep_device, set_state)) /* video hardware */ - MCFG_DEVICE_ADD( "crtc", TMS9929A, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_OUT_INT_LINE_CB(INPUTLINE("maincpu", INT_9995_INT1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, cortex_state, vdp_int_w)) - MCFG_TMS9928A_VRAM_SIZE(0x4000) + tms9929a_device &crtc(TMS9929A(config, "crtc", XTAL(10'738'635) / 2)); + crtc.out_int_line_callback().set_inputline(m_maincpu, INT_9995_INT1); + crtc.out_int_line_callback().append(FUNC(cortex_state::vdp_int_w)); + crtc.set_vram_size(0x4000); + device = &crtc; // FIXME: this line is needed because the following macro is nasty MCFG_TMS9928A_SCREEN_ADD_PAL( "screen" ) MCFG_SCREEN_UPDATE_DEVICE( "crtc", tms9928a_device, screen_update ) diff --git a/src/mame/drivers/cosmicos.cpp b/src/mame/drivers/cosmicos.cpp index 160883b0e1e..4121cb9c32b 100644 --- a/src/mame/drivers/cosmicos.cpp +++ b/src/mame/drivers/cosmicos.cpp @@ -536,7 +536,7 @@ MACHINE_CONFIG_START(cosmicos_state::cosmicos) MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(*this, cosmicos_state, dmaout_w), WRITELINE(*this, cosmicos_state, efx_w), NOOP, VCC, VCC, VCC) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), WRITELINE(*this, cosmicos_state, dmaout_w), WRITELINE(*this, cosmicos_state, efx_w), NOOP, CONSTANT(1), CONSTANT(1), CONSTANT(1)) MCFG_CDP1864_CHROMINANCE(RES_K(2), 0, 0, 0) // R2 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/cp1.cpp b/src/mame/drivers/cp1.cpp index 233cea9e3ab..5fe52c736e8 100644 --- a/src/mame/drivers/cp1.cpp +++ b/src/mame/drivers/cp1.cpp @@ -22,8 +22,8 @@ class cp1_state : public driver_device { public: - cp1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) , + cp1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_i8155(*this, "i8155"), m_i8155_cp3(*this, "i8155_cp3"), @@ -266,16 +266,16 @@ QUICKLOAD_LOAD_MEMBER( cp1_state, quickload ) MACHINE_CONFIG_START(cp1_state::cp1) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", I8049, XTAL(6'000'000)) - MCFG_DEVICE_IO_MAP(cp1_io) - MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, cp1_state, port1_r)) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, cp1_state, port1_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, cp1_state, port2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, cp1_state, port2_w)) - MCFG_MCS48_PORT_BUS_IN_CB(LOGGER("getbus")) - MCFG_MCS48_PORT_BUS_OUT_CB(LOGGER("putbus")) - MCFG_MCS48_PORT_T0_IN_CB(LOGGER("t0_r")) - MCFG_MCS48_PORT_T1_IN_CB(LOGGER("t1_r")) + i8049_device &maincpu(I8049(config, m_maincpu, 6_MHz_XTAL)); + maincpu.set_addrmap(AS_IO, &cp1_state::cp1_io); + maincpu.p1_in_cb().set(FUNC(cp1_state::port1_r)); + maincpu.p1_out_cb().set(FUNC(cp1_state::port1_w)); + maincpu.p2_in_cb().set(FUNC(cp1_state::port2_r)); + maincpu.p2_out_cb().set(FUNC(cp1_state::port2_w)); + maincpu.bus_in_cb().set_log("getbus"); + maincpu.bus_out_cb().set_log("putbus"); + maincpu.t0_in_cb().set_log("t0_r"); + maincpu.t1_in_cb().set_log("t1_r"); MCFG_DEVICE_ADD("i8155", I8155, 0) MCFG_I8155_OUT_PORTA_CB(WRITE8(*this, cp1_state, i8155_porta_w)) diff --git a/src/mame/drivers/cpzodiac.cpp b/src/mame/drivers/cpzodiac.cpp index b8d71521228..170aa5e188e 100644 --- a/src/mame/drivers/cpzodiac.cpp +++ b/src/mame/drivers/cpzodiac.cpp @@ -168,20 +168,20 @@ MACHINE_CONFIG_START(cpzodiac_state::cpzodiac) MCFG_DEVICE_IO_MAP(main_io_map) MCFG_Z80_DAISY_CHAIN(daisy_chain) - MCFG_DEVICE_ADD("io", TE7750, 0) - MCFG_TE7750_IOS_CB(CONSTANT(4)) - MCFG_TE7750_IN_PORT1_CB(IOPORT("IN1")) - MCFG_TE7750_IN_PORT2_CB(IOPORT("IN2")) - MCFG_TE7750_IN_PORT3_CB(IOPORT("IN3")) - MCFG_TE7750_IN_PORT4_CB(IOPORT("IN4")) - MCFG_TE7750_OUT_PORT8_CB(MEMBANK("databank")) MCFG_DEVCB_RSHIFT(-4) + te7750_device &io(TE7750(config, "io", 0)); + io.ios_cb().set_constant(4); + io.in_port1_cb().set_ioport("IN1"); + io.in_port2_cb().set_ioport("IN2"); + io.in_port3_cb().set_ioport("IN3"); + io.in_port4_cb().set_ioport("IN4"); + io.out_port8_cb().set_membank(m_bank).rshift(4); // Code initializes Port 3 and 4 latches to 0 by mistake? - MCFG_DEVICE_ADD("ctc", Z80CTC, 12_MHz_XTAL/2) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", 0)) + z80ctc_device &ctc(Z80CTC(config, "ctc", 12_MHz_XTAL/2)); + ctc.intr_callback().set_inputline(m_maincpu, 0); - MCFG_DEVICE_ADD("audiocpu", Z80, 12_MHz_XTAL/2) - MCFG_DEVICE_PROGRAM_MAP(sound_map) + Z80(config, m_audiocpu, 12_MHz_XTAL/2); + m_audiocpu->set_addrmap(AS_PROGRAM, &cpzodiac_state::sound_map); /* video hardware */ // TODO diff --git a/src/mame/drivers/crshrace.cpp b/src/mame/drivers/crshrace.cpp index 7a0aee56d55..6c4524725c7 100644 --- a/src/mame/drivers/crshrace.cpp +++ b/src/mame/drivers/crshrace.cpp @@ -415,14 +415,14 @@ MACHINE_CONFIG_START(crshrace_state::crshrace) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) - MCFG_SCREEN_UPDATE_DRIVER(crshrace_state, screen_update_crshrace) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("spriteram2", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_size(64*8, 32*8); + screen.set_visarea(0*8, 40*8-1, 0*8, 28*8-1); + screen.set_screen_update(FUNC(crshrace_state::screen_update_crshrace)); + screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.screen_vblank().append(m_spriteram2, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_crshrace) MCFG_PALETTE_ADD("palette", 2048) diff --git a/src/mame/drivers/darkseal.cpp b/src/mame/drivers/darkseal.cpp index 5a13e860963..636785a7103 100644 --- a/src/mame/drivers/darkseal.cpp +++ b/src/mame/drivers/darkseal.cpp @@ -263,8 +263,8 @@ MACHINE_CONFIG_START(darkseal_state::darkseal) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, 0)) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); MCFG_DEVICE_ADD("ym1", YM2203, XTAL(32'220'000)/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.45) diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp index f1503af323c..bf81eb8dc90 100644 --- a/src/mame/drivers/dblewing.cpp +++ b/src/mame/drivers/dblewing.cpp @@ -404,14 +404,14 @@ MACHINE_CONFIG_START(dblewing_state::dblewing) MCFG_DECO_SPRITE_PRIORITY_CB(dblewing_state, pri_callback) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR - MCFG_DECO146_SOUNDLATCH_IRQ_CB(WRITELINE(*this, dblewing_state, soundlatch_irq_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("soundirq", input_merger_device, in_w<0>)) + DECO104PROT(config, m_deco104, 0); + m_deco104->port_a_cb().set_ioport("INPUTS"); + m_deco104->port_b_cb().set_ioport("SYSTEM"); + m_deco104->port_c_cb().set_ioport("DSW"); + m_deco104->set_interface_scramble_interleave(); + m_deco104->set_use_magic_read_address_xor(true); + m_deco104->soundlatch_irq_cb().set(FUNC(dblewing_state::soundlatch_irq_w)); + m_deco104->soundlatch_irq_cb().append("soundirq", FUNC(input_merger_device::in_w<0>)); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp index f2594ab4691..eb9a78db775 100644 --- a/src/mame/drivers/ddenlovr.cpp +++ b/src/mame/drivers/ddenlovr.cpp @@ -9859,15 +9859,15 @@ MACHINE_CONFIG_START(ddenlovr_state::quizchq) MCFG_MACHINE_RESET_OVERRIDE(ddenlovr_state,ddenlovr) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(336, 256+22) - MCFG_SCREEN_VISIBLE_AREA(0, 336-1, 5, 256-16+5-1) - MCFG_SCREEN_UPDATE_DRIVER(ddenlovr_state, screen_update_ddenlovr) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, strobe_a)) MCFG_DEVCB_INVERT + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(336, 256+22); + m_screen->set_visarea(0, 336-1, 5, 256-16+5-1); + m_screen->set_screen_update(FUNC(ddenlovr_state::screen_update_ddenlovr)); + m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE); + m_screen->set_palette("palette"); + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::strobe_a)).invert(); MCFG_PALETTE_ADD("palette", 0x100) @@ -9885,8 +9885,7 @@ MACHINE_CONFIG_START(ddenlovr_state::quizchq) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, trg2)) MCFG_DEVCB_INVERT + MSM6242(config, "rtc", 32.768_kHz_XTAL).out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::trg2)).invert(); MACHINE_CONFIG_END MACHINE_CONFIG_START(ddenlovr_state::rongrong) @@ -10175,12 +10174,10 @@ MACHINE_CONFIG_START(ddenlovr_state::funkyfig) MCFG_MACHINE_START_OVERRIDE(ddenlovr_state,funkyfig) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, ddenlovr_state, funkyfig_sound_irq)) + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)); + m_screen->screen_vblank().append(FUNC(ddenlovr_state::funkyfig_sound_irq)); - MCFG_DEVICE_MODIFY("rtc") - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, trg1)) MCFG_DEVCB_INVERT + subdevice("rtc")->out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::trg1)).invert(); MCFG_DDENLOVR_BLITTER_IRQ(ddenlovr_state, funkyfig_blitter_irq) @@ -10237,8 +10234,7 @@ MACHINE_CONFIG_START(ddenlovr_state::mjschuka) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80) /* devices */ - MCFG_DEVICE_ADD("rtc", RTC62421, XTAL(32'768)) // internal oscillator - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, pa7_w)) MCFG_DEVCB_INVERT + RTC62421(config, "rtc", 32.768_kHz_XTAL).out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::pa7_w)).invert(); // internal oscillator MACHINE_CONFIG_END @@ -10264,8 +10260,7 @@ MACHINE_CONFIG_START(ddenlovr_state::mjmyster) MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(*this, ddenlovr_state, mjmyster_rambank_w)) MCFG_TMPZ84C015_OUT_PB_CB(WRITE8(*this, ddenlovr_state, mmpanic_rombank_w)) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)).invert(); MCFG_DEVICE_MODIFY("rtc") MCFG_MSM6242_OUT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) @@ -10305,8 +10300,7 @@ MACHINE_CONFIG_START(ddenlovr_state::hginga) MCFG_DEVICE_MODIFY("screen") MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) - MCFG_DEVICE_MODIFY("rtc") - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, pa7_w)) MCFG_DEVCB_INVERT + subdevice("rtc")->out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::pa7_w)).invert(); MCFG_DDENLOVR_BLITTER_IRQ(ddenlovr_state, mjmyster_blitter_irq) @@ -10332,8 +10326,7 @@ MACHINE_CONFIG_START(ddenlovr_state::hgokou) MCFG_DEVICE_MODIFY("screen") MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) - MCFG_DEVICE_MODIFY("rtc") - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, pa7_w)) MCFG_DEVCB_INVERT + subdevice("rtc")->out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::pa7_w)).invert(); MCFG_DDENLOVR_BLITTER_IRQ(ddenlovr_state, mjmyster_blitter_irq) @@ -10375,8 +10368,7 @@ MACHINE_CONFIG_START(ddenlovr_state::mjmyuniv) MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(*this, ddenlovr_state, mjmyster_rambank_w)) MCFG_TMPZ84C015_OUT_PB_CB(WRITE8(*this, ddenlovr_state, mmpanic_rombank_w)) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)).invert(); MCFG_MACHINE_START_OVERRIDE(ddenlovr_state,mjmyster) @@ -10401,8 +10393,7 @@ MACHINE_CONFIG_START(ddenlovr_state::mjmyornt) MCFG_TMPZ84C015_OUT_PA_CB(WRITE8(*this, ddenlovr_state, mjmyster_rambank_w)) MCFG_TMPZ84C015_OUT_PB_CB(WRITE8(*this, ddenlovr_state, mmpanic_rombank_w)) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)).invert(); MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_VISIBLE_AREA(0, 336-1, 4, 256-16+4-1) @@ -10457,12 +10448,10 @@ MACHINE_CONFIG_START(ddenlovr_state::mjflove) MCFG_MACHINE_START_OVERRIDE(ddenlovr_state,mjflove) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ddenlovr_state, mjflove_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("maincpu", tmpz84c015_device, trg0)) // frame counter? + m_screen->screen_vblank().set(FUNC(ddenlovr_state::mjflove_irq)); + m_screen->screen_vblank().append(m_maincpu, FUNC(tmpz84c015_device::trg0)); // frame counter? - MCFG_DEVICE_REPLACE("rtc", RTC72421, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE(*this, ddenlovr_state, mjflove_rtc_irq)) + RTC72421(config.replace(), "rtc", 32.768_kHz_XTAL).out_int_handler().set(FUNC(ddenlovr_state::mjflove_rtc_irq)); MCFG_DDENLOVR_BLITTER_IRQ(ddenlovr_state, mjflove_blitter_irq) diff --git a/src/mame/drivers/dec8.cpp b/src/mame/drivers/dec8.cpp index eb914d7598f..ab40ed28395 100644 --- a/src/mame/drivers/dec8.cpp +++ b/src/mame/drivers/dec8.cpp @@ -349,12 +349,6 @@ WRITE8_MEMBER(dec8_state::ghostb_bank_w) flip_screen_set(BIT(data, 3)); } -WRITE_LINE_MEMBER(dec8_state::ghostb_nmi_w) -{ - if (state && m_nmi_enable) - m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); -} - WRITE8_MEMBER(dec8_state::csilver_control_w) { /* @@ -2090,19 +2084,18 @@ MACHINE_CONFIG_START(dec8_state::gondo) MCFG_DECO_KARNOVSPRITES_GFX_REGION(1) MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode") - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(58) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */) -// MCFG_SCREEN_SIZE(32*8, 32*8) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) - MCFG_SCREEN_RAW_PARAMS_DATA_EAST - MCFG_SCREEN_UPDATE_DRIVER(dec8_state, screen_update_gondo) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dec8_state, screen_vblank_dec8)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("nmigate", input_merger_device, in_w<1>)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); +// screen.set_refresh_hz(58); +// screen.set_vblank_time(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */); +// screen.set_size(32*8, 32*8); +// screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); + device = &screen; MCFG_SCREEN_RAW_PARAMS_DATA_EAST + screen.set_screen_update(FUNC(dec8_state::screen_update_gondo)); + screen.screen_vblank().set(FUNC(dec8_state::screen_vblank_dec8)); + screen.screen_vblank().append(m_nmigate, FUNC(input_merger_device::in_w<1>)); + screen.set_palette("palette"); - MCFG_INPUT_MERGER_ALL_HIGH("nmigate") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) + INPUT_MERGER_ALL_HIGH(config, m_nmigate).output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gondo) MCFG_DEVICE_ADD("palette", DECO_RMC3, 0) // xxxxBBBBGGGGRRRR with custom weighting @@ -2151,19 +2144,18 @@ MACHINE_CONFIG_START(dec8_state::garyoret) MCFG_DECO_KARNOVSPRITES_GFX_REGION(1) MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode") - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(58) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */) -// MCFG_SCREEN_SIZE(32*8, 32*8) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) - MCFG_SCREEN_RAW_PARAMS_DATA_EAST - MCFG_SCREEN_UPDATE_DRIVER(dec8_state, screen_update_garyoret) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dec8_state, screen_vblank_dec8)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("nmigate", input_merger_device, in_w<1>)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); +// screen.set_refresh_hz(58); +// screen.set_vblank_time(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */); +// screen.set_size(32*8, 32*8); +// screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); + device = &screen; MCFG_SCREEN_RAW_PARAMS_DATA_EAST + screen.set_screen_update(FUNC(dec8_state::screen_update_garyoret)); + screen.screen_vblank().set(FUNC(dec8_state::screen_vblank_dec8)); + screen.screen_vblank().append(m_nmigate, FUNC(input_merger_device::in_w<1>)); + screen.set_palette("palette"); - MCFG_INPUT_MERGER_ALL_HIGH("nmigate") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) + INPUT_MERGER_ALL_HIGH(config, m_nmigate).output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gondo) MCFG_DEVICE_ADD("palette", DECO_RMC3, 0) // xxxxBBBBGGGGRRRR with custom weighting @@ -2216,16 +2208,16 @@ MACHINE_CONFIG_START(dec8_state::ghostb) MCFG_DECO_KARNOVSPRITES_GFX_REGION(1) MCFG_DECO_KARNOVSPRITES_GFXDECODE("gfxdecode") - MCFG_SCREEN_ADD("screen", RASTER) -// MCFG_SCREEN_REFRESH_RATE(58) -// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* 58Hz, 529ms Vblank duration */) -// MCFG_SCREEN_SIZE(32*8, 32*8) -// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) - MCFG_SCREEN_RAW_PARAMS_DATA_EAST - MCFG_SCREEN_UPDATE_DRIVER(dec8_state, screen_update_ghostb) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dec8_state, screen_vblank_dec8)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, dec8_state, ghostb_nmi_w)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); +// screen.set_refresh_hz(58); +// screen.set_vblank_time(ATTOSECONDS_IN_USEC(529) /* 58Hz, 529ms Vblank duration */); +// screen.set_size(32*8, 32*8); +// screen.set_visarea(0*8, 32*8-1, 1*8, 31*8-1); + device = &screen; MCFG_SCREEN_RAW_PARAMS_DATA_EAST + screen.set_screen_update(FUNC(dec8_state::screen_update_ghostb)); + screen.screen_vblank().set(FUNC(dec8_state::screen_vblank_dec8)); + screen.screen_vblank().append([this] (int state) { if (state && m_nmi_enable) m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); }); + screen.set_palette("palette"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ghostb) MCFG_DECO_RMC3_ADD_PROMS("palette","proms",1024) // xxxxBBBBGGGGRRRR with custom weighting diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp index e3568125696..e182c7bcd40 100644 --- a/src/mame/drivers/deco32.cpp +++ b/src/mame/drivers/deco32.cpp @@ -2004,12 +2004,12 @@ MACHINE_CONFIG_START(fghthist_state::fghthist) MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO146_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR + DECO146PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("IN0"); + m_ioprot->port_b_cb().set("eeprom", FUNC(eeprom_serial_93cxx_device::do_read)).lshift(0); + m_ioprot->port_c_cb().set_ioport("IN1"); + m_ioprot->set_interface_scramble_interleave(); + m_ioprot->set_use_magic_read_address_xor(true); MCFG_VIDEO_START_OVERRIDE(fghthist_state, fghthist) @@ -2170,11 +2170,11 @@ MACHINE_CONFIG_START(dragngun_state::dragngun) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "gun_speaker", 1.0) MCFG_DEVICE_ADD("vol_main", LC7535) - MCFG_LC7535_SELECT_CB(VCC) + MCFG_LC7535_SELECT_CB(CONSTANT(1)) MCFG_LC7535_VOLUME_CB(dragngun_state, volume_main_changed) MCFG_DEVICE_ADD("vol_gun", LC7535) - MCFG_LC7535_SELECT_CB(GND) + MCFG_LC7535_SELECT_CB(CONSTANT(0)) MCFG_LC7535_VOLUME_CB(dragngun_state, volume_gun_changed) MACHINE_CONFIG_END @@ -2298,7 +2298,7 @@ MACHINE_CONFIG_START(dragngun_state::lockload) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.35) MCFG_DEVICE_ADD("vol_main", LC7535) - MCFG_LC7535_SELECT_CB(VCC) + MCFG_LC7535_SELECT_CB(CONSTANT(1)) MCFG_LC7535_VOLUME_CB(dragngun_state, volume_main_changed) MACHINE_CONFIG_END @@ -2359,12 +2359,12 @@ MACHINE_CONFIG_START(nslasher_state::tattass) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "deco_ace", gfx_tattass) - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(READ16(*this, nslasher_state, port_b_tattass)) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(WRITELINE(*this, nslasher_state, tattass_sound_irq_w)) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE + DECO104PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("IN0"); + m_ioprot->port_b_cb().set(FUNC(nslasher_state::port_b_tattass)); + m_ioprot->port_c_cb().set_ioport("IN1"); + m_ioprot->soundlatch_irq_cb().set(FUNC(nslasher_state::tattass_sound_irq_w)); + m_ioprot->set_interface_scramble_interleave(); MCFG_VIDEO_START_OVERRIDE(nslasher_state,nslasher) @@ -2440,12 +2440,12 @@ MACHINE_CONFIG_START(nslasher_state::nslasher) MCFG_VIDEO_START_OVERRIDE(nslasher_state, nslasher) - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(WRITELINE("sound_irq_merger", input_merger_any_high_device, in_w<0>)) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE + DECO104PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("IN0"); + m_ioprot->port_b_cb().set("eeprom", FUNC(eeprom_serial_93cxx_device::do_read)).lshift(0); + m_ioprot->port_c_cb().set_ioport("IN1"); + m_ioprot->soundlatch_irq_cb().set("sound_irq_merger", FUNC(input_merger_any_high_device::in_w<0>)); + m_ioprot->set_interface_scramble_interleave(); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -2469,19 +2469,16 @@ MACHINE_CONFIG_END // the US release uses a H6280 instead of a Z80, much like Lock 'n' Loaded MACHINE_CONFIG_START(nslasher_state::nslasheru) nslasher(config); + MCFG_DEVICE_REPLACE("audiocpu", H6280, 32220000/8) MCFG_DEVICE_PROGRAM_MAP(h6280_sound_map) + MCFG_DEVICE_REMOVE("sound_irq_merger") + MCFG_DEVICE_MODIFY("ymsnd") MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 1)) - MCFG_DEVICE_REMOVE("ioprot") - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("IN0")) - MCFG_DECO146_IN_PORTB_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(0) - MCFG_DECO146_IN_PORTC_CB(IOPORT("IN1")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(INPUTLINE("audiocpu", 0)) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE + m_ioprot->soundlatch_irq_cb().set_inputline("audiocpu", 0); MACHINE_CONFIG_END diff --git a/src/mame/drivers/decwritr.cpp b/src/mame/drivers/decwritr.cpp index 8290ac08105..34753234ef9 100644 --- a/src/mame/drivers/decwritr.cpp +++ b/src/mame/drivers/decwritr.cpp @@ -429,15 +429,15 @@ MACHINE_CONFIG_START(decwriter_state::la120) //MCFG_DC305_OUT_TXC_CB(WRITELINE("usart", i8251_device, write_txc)) //MCFG_DC305_OUT_INT_CB(WRITELINE("mainint", input_merger_device, in_w<0>)) - MCFG_DEVICE_ADD("ledlatch", LS259, 0) // E2 on keyboard - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // ON LINE - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT // LOCAL - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led3")) MCFG_DEVCB_INVERT // ALT CHAR SET - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led4")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led5")) MCFG_DEVCB_INVERT // CTS - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led6")) MCFG_DEVCB_INVERT // DSR - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led7")) MCFG_DEVCB_INVERT // SETUP - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led8")) MCFG_DEVCB_INVERT // PAPER OUT + LS259(config, m_ledlatch); // E2 on keyboard + m_ledlatch->q_out_cb<0>().set_output("led1").invert(); // ON LINE + m_ledlatch->q_out_cb<1>().set_output("led2").invert(); // LOCAL + m_ledlatch->q_out_cb<2>().set_output("led3").invert(); // ALT CHAR SET + m_ledlatch->q_out_cb<3>().set_output("led4").invert(); + m_ledlatch->q_out_cb<4>().set_output("led5").invert(); // CTS + m_ledlatch->q_out_cb<5>().set_output("led6").invert(); // DSR + m_ledlatch->q_out_cb<6>().set_output("led7").invert(); // SETUP + m_ledlatch->q_out_cb<7>().set_output("led8").invert(); // PAPER OUT //MCFG_DEFAULT_LAYOUT( layout_la120 ) diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp index 07fdbad8d54..da185a09194 100644 --- a/src/mame/drivers/destroyr.cpp +++ b/src/mame/drivers/destroyr.cpp @@ -472,9 +472,9 @@ MACHINE_CONFIG_START(destroyr_state::destroyr) MCFG_DEVICE_PROGRAM_MAP(destroyr_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(destroyr_state, irq0_line_assert, 4*60) - MCFG_DEVICE_ADD("outlatch", F9334, 0) // F8 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // LED 1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // LED 2 (no second LED present on cab) + f9334_device &outlatch(F9334(config, "outlatch")); // F8 + outlatch.q_out_cb<0>().set_output("led0").invert(); // LED 1 + outlatch.q_out_cb<1>().set_output("led1").invert(); // LED 2 (no second LED present on cab) // Q2 => songate // Q3 => launch // Q4 => explosion diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp index 667bc2a9a90..9ce2b3f3273 100644 --- a/src/mame/drivers/dietgo.cpp +++ b/src/mame/drivers/dietgo.cpp @@ -252,13 +252,13 @@ MACHINE_CONFIG_START(dietgo_state::dietgo) MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(INPUTLINE("audiocpu", 0)) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_INTERLEAVE - MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR + DECO104PROT(config, m_deco104, 0); + m_deco104->port_a_cb().set_ioport("INPUTS"); + m_deco104->port_b_cb().set_ioport("SYSTEM"); + m_deco104->port_c_cb().set_ioport("DSW"); + m_deco104->soundlatch_irq_cb().set_inputline(m_audiocpu, 0); + m_deco104->set_interface_scramble_interleave(); + m_deco104->set_use_magic_read_address_xor(true); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/divebomb.cpp b/src/mame/drivers/divebomb.cpp index 340571645eb..284199f4f5c 100644 --- a/src/mame/drivers/divebomb.cpp +++ b/src/mame/drivers/divebomb.cpp @@ -437,16 +437,16 @@ MACHINE_CONFIG_START(divebomb_state::divebomb) MCFG_VIDEO_START_OVERRIDE(divebomb_state, divebomb) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(256, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1-32) - MCFG_SCREEN_UPDATE_DRIVER(divebomb_state, screen_update_divebomb) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("fgcpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("spritecpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("rozcpu", INPUT_LINE_NMI)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(256, 256); + screen.set_visarea(0, 256-1, 0, 256-1-32); + screen.set_screen_update(FUNC(divebomb_state::screen_update_divebomb)); + screen.set_palette("palette"); + screen.screen_vblank().set_inputline(m_fgcpu, INPUT_LINE_NMI); + screen.screen_vblank().append_inputline(m_spritecpu, INPUT_LINE_NMI); + screen.screen_vblank().append_inputline(m_rozcpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_divebomb) MCFG_PALETTE_ADD("palette", 0x400+0x400+0x400+0x100) diff --git a/src/mame/drivers/dkong.cpp b/src/mame/drivers/dkong.cpp index c0252f2cbdf..c8e760fb189 100644 --- a/src/mame/drivers/dkong.cpp +++ b/src/mame/drivers/dkong.cpp @@ -1695,7 +1695,7 @@ WRITE_LINE_MEMBER(dkong_state::busreq_w ) MACHINE_CONFIG_START(dkong_state::dkong_base) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, CLOCK_1H) + MCFG_DEVICE_ADD(m_maincpu, Z80, CLOCK_1H) MCFG_DEVICE_PROGRAM_MAP(dkong_map) MCFG_MACHINE_START_OVERRIDE(dkong_state,dkong2b) @@ -1710,7 +1710,7 @@ MACHINE_CONFIG_START(dkong_state::dkong_base) MCFG_I8257_REVERSE_RW_MODE(1) // why? /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD(m_screen, RASTER) MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) MCFG_SCREEN_UPDATE_DRIVER(dkong_state, screen_update_dkong) MCFG_SCREEN_PALETTE("palette") @@ -1791,7 +1791,7 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(dkong_state::dkong3) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(8'000'000) / 2) /* verified in schematics */ + MCFG_DEVICE_ADD(m_maincpu, Z80, XTAL(8'000'000) / 2) /* verified in schematics */ MCFG_DEVICE_PROGRAM_MAP(dkong3_map) MCFG_DEVICE_IO_MAP(dkong3_io_map) @@ -1803,13 +1803,13 @@ MACHINE_CONFIG_START(dkong_state::dkong3) MCFG_Z80DMA_OUT_MREQ_CB(WRITE8(*this, dkong_state, memory_write_byte)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) - MCFG_SCREEN_UPDATE_DRIVER(dkong_state, screen_update_dkong) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dkong_state, vblank_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("n2a03a", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("n2a03b", INPUT_LINE_NMI)) + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART); + m_screen->set_screen_update(FUNC(dkong_state::screen_update_dkong)); + m_screen->set_palette(m_palette); + m_screen->screen_vblank().set(FUNC(dkong_state::vblank_irq)); + m_screen->screen_vblank().append_inputline(m_dev_n2a03a, INPUT_LINE_NMI); + m_screen->screen_vblank().append_inputline(m_dev_n2a03b, INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dkong) MCFG_PALETTE_ADD("palette", DK3_PALETTE_LENGTH) @@ -1839,8 +1839,7 @@ MACHINE_CONFIG_START(dkong_state::pestplce) /* video hardware */ MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_INIT_OWNER(dkong_state,dkong2b) /* wrong! */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(dkong_state, screen_update_pestplce) + m_screen->set_screen_update(FUNC(dkong_state::screen_update_pestplce)); MACHINE_CONFIG_END MACHINE_CONFIG_START(dkong_state::dkong3b) @@ -1861,15 +1860,14 @@ MACHINE_CONFIG_START(dkong_state::s2650) dkong2b(config); /* basic machine hardware */ - MCFG_DEVICE_REPLACE("maincpu", S2650, CLOCK_1H / 2) /* ??? */ + MCFG_DEVICE_REPLACE(m_maincpu, S2650, CLOCK_1H / 2) /* ??? */ MCFG_DEVICE_PROGRAM_MAP(s2650_map) MCFG_DEVICE_IO_MAP(s2650_io_map) MCFG_DEVICE_DATA_MAP(s2650_data_map) MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_S2650_FLAG_OUTPUT(WRITELINE(*this, dkong_state, s2650_fo_w)) - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dkong_state, s2650_interrupt)) + m_screen->screen_vblank().set(FUNC(dkong_state::s2650_interrupt)); MCFG_DEVICE_MODIFY("dma8257") MCFG_I8257_IN_MEMR_CB(READ8(*this, dkong_state, hb_dma_read_byte)) @@ -1878,11 +1876,11 @@ MACHINE_CONFIG_START(dkong_state::s2650) MCFG_MACHINE_START_OVERRIDE(dkong_state,s2650) MACHINE_CONFIG_END -MACHINE_CONFIG_START(dkong_state::herbiedk) +void dkong_state::herbiedk(machine_config &config) +{ s2650(config); - MCFG_DEVICE_MODIFY("maincpu") - MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_DEVCB_INVERT // ??? -MACHINE_CONFIG_END + downcast(*m_maincpu).sense_handler().set(m_screen, FUNC(screen_device::vblank)).invert(); // ??? +} MACHINE_CONFIG_START(dkong_state::spclforc) herbiedk(config); @@ -1891,8 +1889,7 @@ MACHINE_CONFIG_START(dkong_state::spclforc) MCFG_DEVICE_REMOVE("soundcpu") /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(dkong_state, screen_update_spclforc) + m_screen->set_screen_update(FUNC(dkong_state::screen_update_spclforc)); MACHINE_CONFIG_END /************************************* diff --git a/src/mame/drivers/dmax8000.cpp b/src/mame/drivers/dmax8000.cpp index ae667a9ae28..8e2bb019f5d 100644 --- a/src/mame/drivers/dmax8000.cpp +++ b/src/mame/drivers/dmax8000.cpp @@ -159,18 +159,18 @@ MACHINE_CONFIG_START(dmax8000_state::dmax8000) MCFG_DEVICE_IO_MAP(dmax8000_io) MCFG_MACHINE_RESET_OVERRIDE(dmax8000_state, dmax8000) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 4'000'000 / 2) // 2MHz - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, 4'000'000) - MCFG_Z80CTC_ZC0_CB(WRITELINE("dart1", z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart1", z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart2", z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart2", z80dart_device, txca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("dart2", z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("dart1", z80dart_device, rxtxcb_w)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 4_MHz_XTAL / 2)); // 2MHz + ctc_clock.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append("ctc", FUNC(z80ctc_device::trg2)); + + z80ctc_device &ctc(Z80CTC(config, "ctc", 4_MHz_XTAL)); + ctc.zc_callback<0>().set("dart1", FUNC(z80dart_device::rxca_w)); + ctc.zc_callback<0>().append("dart1", FUNC(z80dart_device::txca_w)); + ctc.zc_callback<0>().append("dart2", FUNC(z80dart_device::rxca_w)); + ctc.zc_callback<0>().append("dart2", FUNC(z80dart_device::txca_w)); + ctc.zc_callback<1>().set("dart2", FUNC(z80dart_device::rxtxcb_w)); + ctc.zc_callback<2>().set("dart1", FUNC(z80dart_device::rxtxcb_w)); MCFG_DEVICE_ADD("dart1", Z80DART, 4'000'000) // A = terminal; B = aux MCFG_Z80DART_OUT_TXDA_CB(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/dms86.cpp b/src/mame/drivers/dms86.cpp index 40cff98c1d7..20127eb5637 100644 --- a/src/mame/drivers/dms86.cpp +++ b/src/mame/drivers/dms86.cpp @@ -135,38 +135,39 @@ void dms86_state::kbd_put(u8 data) MACHINE_CONFIG_START(dms86_state::dms86) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", I8086, XTAL(14'745'600) / 3) // according to the manual... hmm - MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_IO_MAP(io_map) + I8086(config, m_maincpu, XTAL(14'745'600) / 3); // according to the manual... hmm + m_maincpu->set_addrmap(AS_PROGRAM, &dms86_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &dms86_state::io_map); // According to the manual the clock is 14,765,600 / 4 but that couldn't possibly work. // By maths, clock should be 9600*32*4*16 = 19,660,800 but not working either // So, commented out because it makes the whole thing crawl, only get 18% on my machine - //MCFG_DEVICE_ADD("ctc_clock", CLOCK, 19660800) //XTAL(14'745'600) / 4) - //MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc" ,z80ctc_device, trg0)) - //MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc" ,z80ctc_device, trg1)) - //MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc" ,z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(14'745'600) / 3) - //MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // frame rate interrupt to maincpu - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio1", z80sio_device, rxtxcb_w)) // SIO1 Ch B - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio1", z80sio_device, txca_w)) // SIO1 Ch A - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1" ,z80sio_device, rxca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("sio2", z80sio_device, rxtxcb_w)) // SIO2 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2" ,z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2" ,z80sio_device, rxca_w)) - - MCFG_DEVICE_ADD("sio1", Z80SIO, XTAL(14'745'600) / 3) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("sio1", z80sio_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("sio1", z80sio_device, dcdb_w)) // HiNet / Monitor switch - MCFG_RS232_CTS_HANDLER(WRITELINE("sio1", z80sio_device, ctsb_w)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("sio2", Z80SIO, XTAL(14'745'600) / 3) + //clock_device &ctc_clock(CLOCK(config, "ctc_clock", 19660800)); //XTAL(14'745'600) / 4 + //ctc_clock.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + //ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); + //ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg2)); + + Z80CTC(config, m_ctc, XTAL(14'745'600) / 3); + //m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // frame rate interrupt to maincpu + m_ctc->zc_callback<0>().set(m_sio[0], FUNC(z80sio_device::rxtxcb_w)); // SIO1 Ch B + m_ctc->zc_callback<1>().set(m_sio[0], FUNC(z80sio_device::txca_w)); // SIO1 Ch A + m_ctc->zc_callback<1>().append(m_sio[0], FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<2>().set(m_sio[1], FUNC(z80sio_device::rxtxcb_w)); // SIO2 + m_ctc->zc_callback<2>().append(m_sio[1], FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<2>().append(m_sio[1], FUNC(z80sio_device::rxca_w)); + + Z80SIO(config, m_sio[0], XTAL(14'745'600) / 3); + m_sio[0]->out_txdb_callback().set("rs232", FUNC(rs232_port_device::write_txd)); + m_sio[0]->out_dtrb_callback().set("rs232", FUNC(rs232_port_device::write_dtr)); + m_sio[0]->out_rtsb_callback().set("rs232", FUNC(rs232_port_device::write_rts)); + + Z80SIO(config, m_sio[1], XTAL(14'745'600) / 3); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, nullptr)); + rs232.rxd_handler().set(m_sio[0], FUNC(z80sio_device::rxb_w)); + rs232.dcd_handler().set(m_sio[0], FUNC(z80sio_device::dcdb_w)); // HiNet / Monitor switch + rs232.cts_handler().set(m_sio[0], FUNC(z80sio_device::ctsb_w)).invert(); + MCFG_DEVICE_ADD("terminal", GENERIC_TERMINAL, 0) MCFG_GENERIC_TERMINAL_KEYBOARD_CB(PUT(dms86_state, kbd_put)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp index 01466c1edf4..28317f8ab69 100644 --- a/src/mame/drivers/dmv.cpp +++ b/src/mame/drivers/dmv.cpp @@ -806,20 +806,20 @@ MACHINE_CONFIG_START(dmv_state::dmv) MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(dmv_state, hgdc_display_pixels) MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(dmv_state, hgdc_draw_text) - MCFG_DEVICE_ADD( "dma8237", AM9517A, XTAL(4'000'000) ) - MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, dmv_state, dma_hrq_changed)) - MCFG_I8237_OUT_EOP_CB(WRITELINE(*this, dmv_state, dmac_eop)) - MCFG_I8237_IN_MEMR_CB(READ8(*this, dmv_state, program_r)) - MCFG_I8237_OUT_MEMW_CB(WRITE8(*this, dmv_state, program_w)) - MCFG_I8237_IN_IOR_0_CB(LOGGER("Read DMA CH1")) - MCFG_I8237_OUT_IOW_0_CB(LOGGER("Write DMA CH1")) - MCFG_I8237_IN_IOR_1_CB(LOGGER("Read DMA CH2")) - MCFG_I8237_OUT_IOW_1_CB(LOGGER("Write DMA CH2")) - MCFG_I8237_IN_IOR_2_CB(READ8("upd7220", upd7220_device, dack_r)) - MCFG_I8237_OUT_IOW_2_CB(WRITE8("upd7220", upd7220_device, dack_w)) - MCFG_I8237_IN_IOR_3_CB(READ8("i8272", i8272a_device, mdma_r)) - MCFG_I8237_OUT_IOW_3_CB(WRITE8("i8272", i8272a_device, mdma_w)) - MCFG_I8237_OUT_DACK_3_CB(WRITELINE(*this, dmv_state, dmac_dack3)) + AM9517A(config, m_dmac, 4_MHz_XTAL); + m_dmac->out_hreq_callback().set(FUNC(dmv_state::dma_hrq_changed)); + m_dmac->out_eop_callback().set(FUNC(dmv_state::dmac_eop)); + m_dmac->in_memr_callback().set(FUNC(dmv_state::program_r)); + m_dmac->out_memw_callback().set(FUNC(dmv_state::program_w)); + m_dmac->in_ior_callback<0>().set_log("Read DMA CH1"); + m_dmac->out_iow_callback<0>().set_log("Write DMA CH1"); + m_dmac->in_ior_callback<1>().set_log("Read DMA CH2"); + m_dmac->out_iow_callback<1>().set_log("Write DMA CH2"); + m_dmac->in_ior_callback<2>().set(m_hgdc, FUNC(upd7220_device::dack_r)); + m_dmac->out_iow_callback<2>().set(m_hgdc, FUNC(upd7220_device::dack_w)); + m_dmac->in_ior_callback<3>().set(m_fdc, FUNC(i8272a_device::mdma_r)); + m_dmac->out_iow_callback<3>().set(m_fdc, FUNC(i8272a_device::mdma_w)); + m_dmac->out_dack_callback<3>().set(FUNC(dmv_state::dmac_dack3)); MCFG_I8272A_ADD( "i8272", true ) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, dmv_state, fdc_irq)) diff --git a/src/mame/drivers/docastle.cpp b/src/mame/drivers/docastle.cpp index 37cc08a423b..25075d579bd 100644 --- a/src/mame/drivers/docastle.cpp +++ b/src/mame/drivers/docastle.cpp @@ -609,19 +609,19 @@ MACHINE_CONFIG_START(docastle_state::docastle) MCFG_DEVICE_ADD("cpu3", Z80, XTAL(4'000'000)) MCFG_DEVICE_PROGRAM_MAP(docastle_map3) - MCFG_DEVICE_ADD("inp1", TMS1025, 0) - MCFG_TMS1025_READ_PORT_CB(PORT1, IOPORT("DSW2")) - MCFG_TMS1025_READ_PORT_CB(PORT2, IOPORT("DSW1")) - MCFG_TMS1025_READ_PORT_CB(PORT3, IOPORT("JOYS")) - MCFG_TMS1025_READ_PORT_CB(PORT5, IOPORT("BUTTONS")) - MCFG_TMS1025_READ_PORT_CB(PORT7, IOPORT("SYSTEM")) - - MCFG_DEVICE_ADD("inp2", TMS1025, 0) - MCFG_TMS1025_READ_PORT_CB(PORT1, IOPORT("DSW2")) MCFG_DEVCB_RSHIFT(4) - MCFG_TMS1025_READ_PORT_CB(PORT2, IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_TMS1025_READ_PORT_CB(PORT3, IOPORT("JOYS")) MCFG_DEVCB_RSHIFT(4) - MCFG_TMS1025_READ_PORT_CB(PORT5, IOPORT("BUTTONS")) MCFG_DEVCB_RSHIFT(4) - MCFG_TMS1025_READ_PORT_CB(PORT7, IOPORT("SYSTEM")) MCFG_DEVCB_RSHIFT(4) + TMS1025(config, m_inp[0]); + m_inp[0]->read_port1_callback().set_ioport("DSW2"); + m_inp[0]->read_port2_callback().set_ioport("DSW1"); + m_inp[0]->read_port3_callback().set_ioport("JOYS"); + m_inp[0]->read_port5_callback().set_ioport("BUTTONS"); + m_inp[0]->read_port7_callback().set_ioport("SYSTEM"); + + TMS1025(config, m_inp[1]); + m_inp[1]->read_port1_callback().set_ioport("DSW2").rshift(4); + m_inp[1]->read_port2_callback().set_ioport("DSW1").rshift(4); + m_inp[1]->read_port3_callback().set_ioport("JOYS").rshift(4); + m_inp[1]->read_port5_callback().set_ioport("BUTTONS").rshift(4); + m_inp[1]->read_port7_callback().set_ioport("SYSTEM").rshift(4); MCFG_WATCHDOG_ADD("watchdog") @@ -686,11 +686,9 @@ MACHINE_CONFIG_START(docastle_state::idsoccer) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(idsoccer_map) - MCFG_DEVICE_MODIFY("inp1") - MCFG_TMS1025_READ_PORT_CB(PORT4, IOPORT("JOYS_RIGHT")) + m_inp[0]->read_port4_callback().set_ioport("JOYS_RIGHT"); - MCFG_DEVICE_MODIFY("inp2") - MCFG_TMS1025_READ_PORT_CB(PORT4, IOPORT("JOYS_RIGHT")) MCFG_DEVCB_RSHIFT(4) + m_inp[1]->read_port4_callback().set_ioport("JOYS_RIGHT").rshift(4); /* video hardware */ MCFG_VIDEO_START_OVERRIDE(docastle_state,dorunrun) diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp index aa3e95dc5be..3f49a441e61 100644 --- a/src/mame/drivers/dragon.cpp +++ b/src/mame/drivers/dragon.cpp @@ -252,10 +252,10 @@ MACHINE_CONFIG_START(dragon_state::dragon32) MCFG_RAM_EXTRA_OPTIONS("64K") // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), dragon_cart, "dragon_fdc")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); MACHINE_CONFIG_END MACHINE_CONFIG_START(dragon64_state::dragon64) @@ -265,10 +265,10 @@ MACHINE_CONFIG_START(dragon64_state::dragon64) MCFG_RAM_DEFAULT_SIZE("64K") // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, "dragon_fdc") - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), dragon_cart, "dragon_fdc")); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); // acia MCFG_DEVICE_ADD("acia", MOS6551, 0) @@ -320,10 +320,10 @@ MACHINE_CONFIG_START(dragon_alpha_state::dgnalpha) MCFG_RAM_DEFAULT_SIZE("64K") // cartridge - MCFG_COCO_CARTRIDGE_ADD(CARTRIDGE_TAG, dragon_cart, nullptr) - MCFG_COCO_CARTRIDGE_CART_CB(WRITELINE(*this, coco_state, cart_w)) - MCFG_COCO_CARTRIDGE_NMI_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_NMI)) - MCFG_COCO_CARTRIDGE_HALT_CB(INPUTLINE(MAINCPU_TAG, INPUT_LINE_HALT)) + cococart_slot_device &cartslot(COCOCART_SLOT(config, CARTRIDGE_TAG, DERIVED_CLOCK(1, 1), dragon_cart, nullptr)); + cartslot.cart_callback().set([this] (int state) { cart_w(state != 0); }); // lambda because name is overloaded + cartslot.nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + cartslot.halt_callback().set_inputline(m_maincpu, INPUT_LINE_HALT); // acia MCFG_DEVICE_ADD("acia", MOS6551, 0) diff --git a/src/mame/drivers/dragrace.cpp b/src/mame/drivers/dragrace.cpp index 2c4c246707e..add002df6fc 100644 --- a/src/mame/drivers/dragrace.cpp +++ b/src/mame/drivers/dragrace.cpp @@ -303,28 +303,28 @@ MACHINE_CONFIG_START(dragrace_state::dragrace) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - MCFG_DEVICE_ADD("latch_f5", F9334, 0) // F5 - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, dragrace_state, speed1_w)) MCFG_DEVCB_MASK(0x1f) // set 3SPEED1-7SPEED1 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Explosion1 enable - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Screech1 enable - - MCFG_DEVICE_ADD("latch_a5", F9334, 0) // A5 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // KLEXPL1 enable - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Motor1 enable - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Attract enable - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // LoTone enable - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led0")) // Player 1 Start Lamp - - MCFG_DEVICE_ADD("latch_h5", F9334, 0) // H5 - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, dragrace_state, speed2_w)) MCFG_DEVCB_MASK(0x1f) // set 3SPEED2-7SPEED2 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Explosion2 enable - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Screech2 enable - - MCFG_DEVICE_ADD("latch_e5", F9334, 0) // E5 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // KLEXPL2 enable - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // Motor2 enable - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // HiTone enable - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led1")) // Player 2 Start Lamp + f9334_device &latch_f5(F9334(config, "latch_f5")); // F5 + latch_f5.parallel_out_cb().set(FUNC(dragrace_state::speed1_w)).mask(0x1f); // set 3SPEED1-7SPEED1 + latch_f5.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line)); // Explosion1 enable + latch_f5.q_out_cb<6>().set(m_discrete, FUNC(discrete_device::write_line)); // Screech1 enable + + f9334_device &latch_a5(F9334(config, "latch_a5")); // A5 + latch_a5.q_out_cb<1>().set(m_discrete, FUNC(discrete_device::write_line)); // KLEXPL1 enable + latch_a5.q_out_cb<3>().set(m_discrete, FUNC(discrete_device::write_line)); // Motor1 enable + latch_a5.q_out_cb<4>().set(m_discrete, FUNC(discrete_device::write_line)); // Attract enable + latch_a5.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line)); // LoTone enable + latch_a5.q_out_cb<7>().set_output("led0"); // Player 1 Start Lamp + + f9334_device &latch_h5(F9334(config, "latch_h5")); // H5 + latch_h5.parallel_out_cb().set(FUNC(dragrace_state::speed2_w)).mask(0x1f); // set 3SPEED2-7SPEED2 + latch_h5.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line)); // Explosion2 enable + latch_h5.q_out_cb<6>().set(m_discrete, FUNC(discrete_device::write_line)); // Screech2 enable + + f9334_device &latch_e5(F9334(config, "latch_e5")); // E5 + latch_e5.q_out_cb<1>().set(m_discrete, FUNC(discrete_device::write_line)); // KLEXPL2 enable + latch_e5.q_out_cb<3>().set(m_discrete, FUNC(discrete_device::write_line)); // Motor2 enable + latch_e5.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line)); // HiTone enable + latch_e5.q_out_cb<7>().set_output("led1"); // Player 2 Start Lamp MACHINE_CONFIG_END diff --git a/src/mame/drivers/dreambal.cpp b/src/mame/drivers/dreambal.cpp index 1d5898dd323..58ad56e82c8 100644 --- a/src/mame/drivers/dreambal.cpp +++ b/src/mame/drivers/dreambal.cpp @@ -35,8 +35,8 @@ lamps? class dreambal_state : public driver_device { public: - dreambal_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + dreambal_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_deco104(*this, "ioprot104"), m_deco_tilegen1(*this, "tilegen1"), @@ -333,10 +333,10 @@ MACHINE_CONFIG_START(dreambal_state::dreambal) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) // 93lc46b - MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) + DECO104PROT(config, m_deco104, 0); + m_deco104->port_a_cb().set_ioport("INPUTS"); + m_deco104->port_b_cb().set_ioport("SYSTEM"); + m_deco104->port_c_cb().set_ioport("DSW"); MCFG_DEVICE_ADD("tilegen1", DECO16IC, 0) MCFG_DECO16IC_SPLIT(0) diff --git a/src/mame/drivers/dsb46.cpp b/src/mame/drivers/dsb46.cpp index 9c1bdfb8b05..b837f49e93e 100644 --- a/src/mame/drivers/dsb46.cpp +++ b/src/mame/drivers/dsb46.cpp @@ -118,9 +118,9 @@ MACHINE_CONFIG_START(dsb46_state::dsb46) MCFG_MACHINE_RESET_OVERRIDE(dsb46_state, dsb46) /* video hardware */ - MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL(1'843'200)) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc1", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc1", z80ctc_device, trg2)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 1.8432_MHz_XTAL)); + ctc_clock.signal_handler().set("ctc1", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc1", FUNC(z80ctc_device::trg2)); /* Devices */ MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(24'000'000) / 6) @@ -133,12 +133,12 @@ MACHINE_CONFIG_START(dsb46_state::dsb46) MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(24'000'000) / 6) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("sio", z80sio_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txcb_w)) + z80ctc_device &ctc1(Z80CTC(config, "ctc1", 24_MHz_XTAL / 6)); + ctc1.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc1.zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); + ctc1.zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); + ctc1.zc_callback<2>().set("sio", FUNC(z80sio_device::rxcb_w)); + ctc1.zc_callback<2>().append("sio", FUNC(z80sio_device::txcb_w)); MACHINE_CONFIG_END ROM_START( dsb46 ) diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp index ea63a71948c..24936f8b167 100644 --- a/src/mame/drivers/duet16.cpp +++ b/src/mame/drivers/duet16.cpp @@ -371,22 +371,22 @@ MACHINE_CONFIG_START(duet16_state::duet16) MCFG_AM9517A_OUT_IOW_0_CB(WRITE8("fdc", upd765a_device, mdma_w)) MCFG_AM9517A_OUT_EOP_CB(WRITELINE("fdc", upd765a_device, tc_line_w)) - MCFG_DEVICE_ADD("bgpit", PIT8253, 0) - MCFG_PIT8253_CLK0(8_MHz_XTAL / 13) - MCFG_PIT8253_CLK1(8_MHz_XTAL / 13) - MCFG_PIT8253_CLK2(8_MHz_XTAL / 13) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("sio", upd7201_new_device, txca_w)) // TODO: selected through LS153 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", upd7201_new_device, rxca_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("sio", upd7201_new_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", upd7201_new_device, rxcb_w)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("kbusart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("kbusart", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("itm", PTM6840, 0) - MCFG_PTM6840_EXTERNAL_CLOCKS(0.0, 0.0, (8_MHz_XTAL / 8).dvalue()) // C3 = 1MHz - MCFG_PTM6840_O3_CB(WRITELINE("itm", ptm6840_device, set_c1)) // C1 = C2 = O3 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("itm", ptm6840_device, set_c2)) - MCFG_PTM6840_IRQ_CB(WRITELINE("tmint", input_merger_device, in_w<0>)) + pit8253_device &bgpit(PIT8253(config, "bgpit", 0)); + bgpit.set_clk<0>(8_MHz_XTAL / 13); + bgpit.set_clk<1>(8_MHz_XTAL / 13); + bgpit.set_clk<2>(8_MHz_XTAL / 13); + bgpit.out_handler<0>().set("sio", FUNC(upd7201_new_device::txca_w)); // TODO: selected through LS153 + bgpit.out_handler<0>().append("sio", FUNC(upd7201_new_device::rxca_w)); + bgpit.out_handler<1>().set("sio", FUNC(upd7201_new_device::txcb_w)); + bgpit.out_handler<1>().append("sio", FUNC(upd7201_new_device::rxcb_w)); + bgpit.out_handler<2>().set("kbusart", FUNC(i8251_device::write_txc)); + bgpit.out_handler<2>().append("kbusart", FUNC(i8251_device::write_rxc)); + + ptm6840_device &itm(PTM6840(config, "itm", 0)); + itm.set_external_clocks(0.0, 0.0, (8_MHz_XTAL / 8).dvalue()); // C3 = 1MHz + itm.o3_callback().set("itm", FUNC(ptm6840_device::set_c1)); // C1 = C2 = O3 + itm.o3_callback().append("itm", FUNC(ptm6840_device::set_c2)); + itm.irq_callback().set(m_tmint, FUNC(input_merger_device::in_w<0>)); MCFG_DEVICE_ADD("sio", UPD7201_NEW, 8_MHz_XTAL / 2) MCFG_Z80SIO_OUT_INT_CB(WRITELINE("pic", pic8259_device, ir1_w)) // INT5 diff --git a/src/mame/drivers/dynamoah.cpp b/src/mame/drivers/dynamoah.cpp index 95fcd2a3cba..a3046fba105 100644 --- a/src/mame/drivers/dynamoah.cpp +++ b/src/mame/drivers/dynamoah.cpp @@ -73,21 +73,22 @@ void dynamoah_state::i8031_ext_mem(address_map &map) map(0x0000, 0xffff).rw(FUNC(dynamoah_state::ext_r), FUNC(dynamoah_state::ext_w)); } -MACHINE_CONFIG_START(dynamoah_state::dynamoah) - MCFG_DEVICE_ADD("maincpu", I80C31, 6'144'000) // SC80C31BCCN40 +void dynamoah_state::dynamoah(machine_config &config) +{ + i80c31_device &maincpu(I80C31(config, "maincpu", 6'144'000)); // SC80C31BCCN40 // clock needs verification, being the XTAL value from a different board - MCFG_DEVICE_PROGRAM_MAP(i8031_mem) - MCFG_DEVICE_IO_MAP(i8031_ext_mem) - MCFG_MCS51_PORT_P1_IN_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_INPUT(CONSTANT(0x7f)) - MCFG_MCS51_PORT_P1_OUT_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITE8(*this, dynamoah_state, p1_w)) MCFG_DEVCB_MASK(0x1f) - MCFG_MCS51_PORT_P3_OUT_CB(WRITE8(*this, dynamoah_state, p3_w)) - - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) -MACHINE_CONFIG_END + maincpu.set_addrmap(AS_PROGRAM, &dynamoah_state::i8031_mem); + maincpu.set_addrmap(AS_IO, &dynamoah_state::i8031_ext_mem); + maincpu.port_in_cb<1>().set("eeprom", FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + maincpu.port_in_cb<1>().append_constant(0x7f).mask(0x7f); + maincpu.port_out_cb<1>().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(7); + maincpu.port_out_cb<1>().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(6); + maincpu.port_out_cb<1>().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + maincpu.port_out_cb<1>().append(FUNC(dynamoah_state::p1_w)).mask(0x1f); + maincpu.port_out_cb<3>().set(FUNC(dynamoah_state::p3_w)); + + EEPROM_SERIAL_93C46_16BIT(config, "eeprom"); +} static INPUT_PORTS_START(dynamoah) INPUT_PORTS_END diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp index 9fadb6e3b8d..4b202833365 100644 --- a/src/mame/drivers/dynax.cpp +++ b/src/mame/drivers/dynax.cpp @@ -4262,15 +4262,15 @@ MACHINE_CONFIG_START(dynax_state::hanamai) MCFG_DEVICE_ADD("mainirq", RST_POS_BUFFER, 0) MCFG_RST_BUFFER_INT_CALLBACK(INPUTLINE("maincpu", 0)) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE("msm", msm5205_device, reset_w)) MCFG_DEVCB_INVERT // MSM5205 reset - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, dynax_state, adpcm_reset_kludge_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, dynax_state, flipscreen_w)) // Flip Screen - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, dynax_state, coincounter_0_w)) // Coin Counters - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, dynax_state, coincounter_1_w)) // - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, dynax_state, blitter_ack_w)) // Blitter IRQ Ack - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, dynax_state, blit_palbank_w)) // Layers Palettes (High Bit) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, dynax_state, layer_half_w)) // half of the interleaved layer to write to + LS259(config, m_mainlatch); + m_mainlatch->q_out_cb<0>().set(m_msm, FUNC(msm5205_device::reset_w)).invert(); // MSM5205 reset + m_mainlatch->q_out_cb<0>().append(FUNC(dynax_state::adpcm_reset_kludge_w)); + m_mainlatch->q_out_cb<1>().set(FUNC(dynax_state::flipscreen_w)); // Flip Screen + m_mainlatch->q_out_cb<2>().set(FUNC(dynax_state::coincounter_0_w)); // Coin Counters + m_mainlatch->q_out_cb<3>().set(FUNC(dynax_state::coincounter_1_w)); // + m_mainlatch->q_out_cb<4>().set(FUNC(dynax_state::blitter_ack_w)); // Blitter IRQ Ack + m_mainlatch->q_out_cb<6>().set(FUNC(dynax_state::blit_palbank_w)); // Layers Palettes (High Bit) + m_mainlatch->q_out_cb<7>().set(FUNC(dynax_state::layer_half_w)); // half of the interleaved layer to write to /* video hardware */ MCFG_SCREEN_ADD(m_screen, RASTER) @@ -4815,12 +4815,10 @@ MACHINE_CONFIG_START(dynax_state::mjelctrn) MCFG_DEVICE_REMOVE("mainirq") - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)).invert(); - MCFG_DEVICE_MODIFY("blitter") - MCFG_DYNAX_BLITTER_REV2_READY_CB(WRITELINE("maincpu", tmpz84c015_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("maincpu", tmpz84c015_device, trg2)) + m_blitter->ready_cb().set(m_maincpu, FUNC(tmpz84c015_device::trg1)); + m_blitter->ready_cb().append(m_maincpu, FUNC(tmpz84c015_device::trg2)); MCFG_VIDEO_START_OVERRIDE(dynax_state,mjelctrn) MACHINE_CONFIG_END @@ -4901,13 +4899,13 @@ MACHINE_CONFIG_START(dynax_state::tenkai) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 10C on Ougon no Hai - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, dynax_state, flipscreen_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, dynax_state, layer_half_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, dynax_state, layer_half2_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, dynax_state, tenkai_6c_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, dynax_state, tenkai_70_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, dynax_state, tenkai_blitter_ack_w)) + LS259(config, m_mainlatch); // 10C on Ougon no Hai + m_mainlatch->q_out_cb<0>().set(FUNC(dynax_state::flipscreen_w)).invert(); + m_mainlatch->q_out_cb<1>().set(FUNC(dynax_state::layer_half_w)); + m_mainlatch->q_out_cb<2>().set(FUNC(dynax_state::layer_half2_w)); + m_mainlatch->q_out_cb<3>().set(FUNC(dynax_state::tenkai_6c_w)); + m_mainlatch->q_out_cb<4>().set(FUNC(dynax_state::tenkai_70_w)); + m_mainlatch->q_out_cb<7>().set(FUNC(dynax_state::tenkai_blitter_ack_w)); /* video hardware */ MCFG_SCREEN_ADD(m_screen, RASTER) diff --git a/src/mame/drivers/dynduke.cpp b/src/mame/drivers/dynduke.cpp index 343f1165d81..f6bb951a762 100644 --- a/src/mame/drivers/dynduke.cpp +++ b/src/mame/drivers/dynduke.cpp @@ -333,17 +333,17 @@ MACHINE_CONFIG_START(dynduke_state::dynduke) MCFG_QUANTUM_TIME(attotime::from_hz(3600)) // video hardware - MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(dynduke_state, screen_update) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, dynduke_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + BUFFERED_SPRITERAM16(config, m_spriteram); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_size(32*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(dynduke_state::screen_update)); + screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.screen_vblank().append(FUNC(dynduke_state::vblank_irq)); + screen.set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dynduke) diff --git a/src/mame/drivers/einstein.cpp b/src/mame/drivers/einstein.cpp index 8c002b3b8d9..e7d3b4072a2 100644 --- a/src/mame/drivers/einstein.cpp +++ b/src/mame/drivers/einstein.cpp @@ -602,10 +602,10 @@ MACHINE_CONFIG_START(einstein_state::einstein) MCFG_Z80CTC_ZC1_CB(WRITELINE(IC_I060, i8251_device, write_rxc)) MCFG_Z80CTC_ZC2_CB(WRITELINE(IC_I058, z80ctc_device, trg3)) - MCFG_CLOCK_ADD("ctc_trigger", XTAL_X002 / 4) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(IC_I058, z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(IC_I058, z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(IC_I058, z80ctc_device, trg2)) + clock_device &ctc_trigger(CLOCK(config, "ctc_trigger", XTAL_X002 / 4)); + ctc_trigger.signal_handler().set(IC_I058, FUNC(z80ctc_device::trg0)); + ctc_trigger.signal_handler().append(IC_I058, FUNC(z80ctc_device::trg1)); + ctc_trigger.signal_handler().append(IC_I058, FUNC(z80ctc_device::trg2)); /* Einstein daisy chain support for non-Z80 devices */ MCFG_Z80DAISY_GENERIC_ADD("keyboard_daisy", 0xf7) diff --git a/src/mame/drivers/eti660.cpp b/src/mame/drivers/eti660.cpp index e298606cb5a..dd82f324952 100644 --- a/src/mame/drivers/eti660.cpp +++ b/src/mame/drivers/eti660.cpp @@ -311,7 +311,7 @@ MACHINE_CONFIG_START(eti660_state::eti660) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(8'867'238)/5) MCFG_DEVICE_PROGRAM_MAP(mem_map) MCFG_DEVICE_IO_MAP(io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, eti660_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, eti660_state, ef2_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, eti660_state, ef4_r)) @@ -324,16 +324,16 @@ MACHINE_CONFIG_START(eti660_state::eti660) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(8'867'238)/5, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, eti660_state, rdata_r), READLINE(*this, eti660_state, bdata_r), READLINE(*this, eti660_state, gdata_r)) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(8'867'238)/5, CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, eti660_state, rdata_r), READLINE(*this, eti660_state, bdata_r), READLINE(*this, eti660_state, gdata_r)) MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(4.7), RES_K(4.7)) // R7, R5, R6, R4 MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_DEVICE_ADD(MC6821_TAG, PIA6821, 0) - MCFG_PIA_READPA_HANDLER(READ8(*this, eti660_state, pia_pa_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, eti660_state, pia_pa_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) MCFG_DEVCB_INVERT - MCFG_PIA_IRQB_HANDLER(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT)) MCFG_DEVCB_INVERT + PIA6821(config, m_pia, 0); + m_pia->readpa_handler().set(FUNC(eti660_state::pia_pa_r)); + m_pia->writepa_handler().set(FUNC(eti660_state::pia_pa_w)); + m_pia->irqa_handler().set_inputline(m_maincpu, COSMAC_INPUT_LINE_INT).invert(); // FIXME: use an input merger for these lines + m_pia->irqb_handler().set_inputline(m_maincpu, COSMAC_INPUT_LINE_INT).invert(); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED) diff --git a/src/mame/drivers/exterm.cpp b/src/mame/drivers/exterm.cpp index 587a1504c37..8adb0b29721 100644 --- a/src/mame/drivers/exterm.cpp +++ b/src/mame/drivers/exterm.cpp @@ -391,17 +391,11 @@ MACHINE_CONFIG_START(exterm_state::exterm) MCFG_TMS340X0_TO_SHIFTREG_CB(exterm_state, to_shiftreg_slave) MCFG_TMS340X0_FROM_SHIFTREG_CB(exterm_state, from_shiftreg_slave) - MCFG_DEVICE_ADD(m_audiocpu, M6502, 2000000) - MCFG_DEVICE_PROGRAM_MAP(sound_master_map) + M6502(config, m_audiocpu, 2000000).set_addrmap(AS_PROGRAM, &exterm_state::sound_master_map); + M6502(config, m_audioslave, 2000000).set_addrmap(AS_PROGRAM, &exterm_state::sound_slave_map); - MCFG_DEVICE_ADD(m_audioslave, M6502, 2000000) - MCFG_DEVICE_PROGRAM_MAP(sound_slave_map) - - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch[0]) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, M6502_IRQ_LINE)) - - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch[1]) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audioslave, M6502_IRQ_LINE)) + GENERIC_LATCH_8(config, m_soundlatch[0]).data_pending_callback().set_inputline(m_audiocpu, M6502_IRQ_LINE); + GENERIC_LATCH_8(config, m_soundlatch[1]).data_pending_callback().set_inputline(m_audioslave, M6502_IRQ_LINE); MCFG_QUANTUM_TIME(attotime::from_hz(6000)) diff --git a/src/mame/drivers/f1gp.cpp b/src/mame/drivers/f1gp.cpp index 9634e1f98f7..5ca58d73376 100644 --- a/src/mame/drivers/f1gp.cpp +++ b/src/mame/drivers/f1gp.cpp @@ -437,9 +437,9 @@ MACHINE_CONFIG_START(f1gp_state::f1gp) MCFG_ACIA6850_IRQ_HANDLER(INPUTLINE("sub", M68K_IRQ_3)) MCFG_ACIA6850_TXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) // loopback for now - MCFG_DEVICE_ADD("acia_clock", CLOCK, 1000000) // guessed - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 1000000)); // guessed + acia_clock.signal_handler().set(m_acia, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -511,9 +511,9 @@ MACHINE_CONFIG_START(f1gp_state::f1gpb) MCFG_ACIA6850_IRQ_HANDLER(INPUTLINE("sub", M68K_IRQ_3)) MCFG_ACIA6850_TXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) // loopback for now - MCFG_DEVICE_ADD("acia_clock", CLOCK, 1000000) // guessed - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 1000000)); // guessed + acia_clock.signal_handler().set(m_acia, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/fanucspmg.cpp b/src/mame/drivers/fanucspmg.cpp index 2d8e59ba8d7..77a503c283b 100644 --- a/src/mame/drivers/fanucspmg.cpp +++ b/src/mame/drivers/fanucspmg.cpp @@ -1008,12 +1008,12 @@ MACHINE_CONFIG_START(fanucspmg_state::fanucspmg) MCFG_DEVICE_ADD(PIC0_TAG, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, fanucspmg_state, get_slave_ack)) MCFG_DEVICE_ADD(PIC1_TAG, PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(PIC0_TAG, pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_UPD765A_ADD(FDC_TAG, true, true) MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(PIC0_TAG, pic8259_device, ir3_w)) diff --git a/src/mame/drivers/fc100.cpp b/src/mame/drivers/fc100.cpp index 9fe28d2645d..44690eb1a6c 100644 --- a/src/mame/drivers/fc100.cpp +++ b/src/mame/drivers/fc100.cpp @@ -547,11 +547,11 @@ MACHINE_CONFIG_START(fc100_state::fc100) MCFG_CASSETTE_FORMATS(fc100_cassette_formats) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_DISABLED | CASSETTE_SPEAKER_ENABLED) - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(*this, fc100_state, txdata_callback)) - MCFG_DEVICE_ADD("uart_clock", CLOCK, XTAL(4'915'200)/16/16) // gives 19200 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + I8251(config, m_uart, 0); + m_uart->txd_handler().set(FUNC(fc100_state::txdata_callback)); + clock_device &uart_clock(CLOCK(config, "uart_clock", XTAL(4'915'200)/16/16)); // gives 19200 + uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_c", fc100_state, timer_c, attotime::from_hz(4800)) // cass write MCFG_TIMER_DRIVER_ADD_PERIODIC("timer_p", fc100_state, timer_p, attotime::from_hz(40000)) // cass read diff --git a/src/mame/drivers/firefox.cpp b/src/mame/drivers/firefox.cpp index ed6e52dedcd..e67036614bb 100644 --- a/src/mame/drivers/firefox.cpp +++ b/src/mame/drivers/firefox.cpp @@ -664,25 +664,25 @@ MACHINE_CONFIG_START(firefox_state::firefox) MCFG_ADC0808_IN0_CB(IOPORT("PITCH")) MCFG_ADC0808_IN1_CB(IOPORT("YAW")) - MCFG_DEVICE_ADD("latch0", LS259, 0) // 7F - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE("nvram_1c", x2212_device, recall)) // NVRECALL - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("nvram_1d", x2212_device, recall)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, firefox_state, sound_reset_w)) // RSTSOUND - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("nvram_1c", x2212_device, store)) // NVRSTORE - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("nvram_1d", x2212_device, store)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, firefox_state, firefox_disc_lock_w)) // LOCK - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, firefox_state, audio_enable_right_w)) // SWDSKR - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, firefox_state, audio_enable_left_w)) // SWDSKL - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, firefox_state, firefox_disc_reset_w)) // RSTDSK - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, firefox_state, firefox_disc_write_w)) // WRDSK - - MCFG_DEVICE_ADD("latch1", LS259, 0) // 1F - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, firefox_state, coin_counter_right_w)) // COIN COUNTERR - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, firefox_state, coin_counter_left_w)) // COIN COUNTERL - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led3")) MCFG_DEVCB_INVERT + ls259_device &latch0(LS259(config, "latch0")); // 7F + latch0.q_out_cb<0>().set(m_nvram_1c, FUNC(x2212_device::recall)); // NVRECALL + latch0.q_out_cb<0>().append(m_nvram_1d, FUNC(x2212_device::recall)); + latch0.q_out_cb<1>().set(FUNC(firefox_state::sound_reset_w)); // RSTSOUND + latch0.q_out_cb<2>().set(m_nvram_1c, FUNC(x2212_device::store)); // NVRSTORE + latch0.q_out_cb<2>().append(m_nvram_1d, FUNC(x2212_device::store)); + latch0.q_out_cb<3>().set(FUNC(firefox_state::firefox_disc_lock_w)); // LOCK + latch0.q_out_cb<4>().set(FUNC(firefox_state::audio_enable_right_w)); // SWDSKR + latch0.q_out_cb<5>().set(FUNC(firefox_state::audio_enable_left_w)); // SWDSKL + latch0.q_out_cb<6>().set(FUNC(firefox_state::firefox_disc_reset_w)); // RSTDSK + latch0.q_out_cb<7>().set(FUNC(firefox_state::firefox_disc_write_w)); // WRDSK + + ls259_device &latch1(LS259(config, "latch1")); // 1F + latch1.q_out_cb<0>().set(FUNC(firefox_state::coin_counter_right_w)); // COIN COUNTERR + latch1.q_out_cb<1>().set(FUNC(firefox_state::coin_counter_left_w)); // COIN COUNTERL + latch1.q_out_cb<4>().set_output("led0").invert(); + latch1.q_out_cb<5>().set_output("led1").invert(); + latch1.q_out_cb<6>().set_output("led2").invert(); + latch1.q_out_cb<7>().set_output("led3").invert(); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_hz(MASTER_XTAL/8/16/16/16/16)) diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index 20de8512052..be2cc9706c4 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -2812,12 +2812,12 @@ MACHINE_CONFIG_START(towns_state::towns_base) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, towns_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("fdc", MB8877, 8'000'000 / 4) // clock unknown MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, towns_state,mb8877a_irq_w)) diff --git a/src/mame/drivers/ft68m.cpp b/src/mame/drivers/ft68m.cpp index 35e414d4829..dfeb86ae78e 100644 --- a/src/mame/drivers/ft68m.cpp +++ b/src/mame/drivers/ft68m.cpp @@ -96,13 +96,13 @@ MACHINE_CONFIG_START(ft68m_state::ft68m) MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs232b", rs232_port_device, write_txd)) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", M68K_IRQ_5)) - MCFG_DEVICE_ADD("stc", AM9513A, XTAL(19'660'800) / 8) - MCFG_AM9513_OUT2_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_6)) - MCFG_AM9513_OUT3_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_7)) - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("mpsc", upd7201_new_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mpsc", upd7201_new_device, txca_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("mpsc", upd7201_new_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mpsc", upd7201_new_device, txcb_w)) + am9513_device &stc(AM9513A(config, "stc", XTAL(19'660'800) / 8)); + stc.out2_cb().set_inputline(m_maincpu, M68K_IRQ_6); + stc.out3_cb().set_inputline(m_maincpu, M68K_IRQ_7); + stc.out4_cb().set("mpsc", FUNC(upd7201_new_device::rxca_w)); + stc.out4_cb().append("mpsc", FUNC(upd7201_new_device::txca_w)); + stc.out5_cb().set("mpsc", FUNC(upd7201_new_device::rxcb_w)); + stc.out5_cb().append("mpsc", FUNC(upd7201_new_device::txcb_w)); MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE("mpsc", upd7201_new_device, rxa_w)) diff --git a/src/mame/drivers/gaelco.cpp b/src/mame/drivers/gaelco.cpp index 705e8170f73..e84e7e250a5 100644 --- a/src/mame/drivers/gaelco.cpp +++ b/src/mame/drivers/gaelco.cpp @@ -637,11 +637,11 @@ MACHINE_CONFIG_START(gaelco_state::bigkarnk) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, gaelco_state, coin1_lockout_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, gaelco_state, coin2_lockout_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, gaelco_state, coin1_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, gaelco_state, coin2_counter_w)) + LS259(config, m_outlatch); + m_outlatch->q_out_cb<0>().set(FUNC(gaelco_state::coin1_lockout_w)).invert(); + m_outlatch->q_out_cb<1>().set(FUNC(gaelco_state::coin2_lockout_w)).invert(); + m_outlatch->q_out_cb<2>().set(FUNC(gaelco_state::coin1_counter_w)); + m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -710,12 +710,12 @@ MACHINE_CONFIG_START(gaelco_state::squash) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("outlatch", LS259, 0) // B8 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, gaelco_state, coin1_lockout_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, gaelco_state, coin2_lockout_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, gaelco_state, coin1_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, gaelco_state, coin2_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(NOOP) // used + LS259(config, m_outlatch); // B8 + m_outlatch->q_out_cb<0>().set(FUNC(gaelco_state::coin1_lockout_w)).invert(); + m_outlatch->q_out_cb<1>().set(FUNC(gaelco_state::coin2_lockout_w)).invert(); + m_outlatch->q_out_cb<2>().set(FUNC(gaelco_state::coin1_counter_w)); + m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); + m_outlatch->q_out_cb<4>().set_nop(); // used /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -749,12 +749,12 @@ MACHINE_CONFIG_START(gaelco_state::thoop) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("outlatch", LS259, 0) // B8 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, gaelco_state, coin1_lockout_w)) // not inverted - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, gaelco_state, coin2_lockout_w)) // not inverted - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, gaelco_state, coin1_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, gaelco_state, coin2_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(NOOP) // used + LS259(config, m_outlatch); // B8 + m_outlatch->q_out_cb<0>().set(FUNC(gaelco_state::coin1_lockout_w)); // not inverted + m_outlatch->q_out_cb<1>().set(FUNC(gaelco_state::coin2_lockout_w)); // not inverted + m_outlatch->q_out_cb<2>().set(FUNC(gaelco_state::coin1_counter_w)); + m_outlatch->q_out_cb<3>().set(FUNC(gaelco_state::coin2_counter_w)); + m_outlatch->q_out_cb<4>().set_nop(); // used /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp index acb102b858b..22d147800ef 100644 --- a/src/mame/drivers/gaelco3d.cpp +++ b/src/mame/drivers/gaelco3d.cpp @@ -967,8 +967,7 @@ MACHINE_CONFIG_START(gaelco3d_state::gaelco3d) MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, gaelco3d_state, analog_port_latch_w)) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(m_serial, gaelco_serial_device, unknown_w)) - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_adsp, ADSP2115_IRQ2)) + GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_adsp, ADSP2115_IRQ2); /* video hardware */ MCFG_SCREEN_ADD(m_screen, RASTER) diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp index 065dfc3cd93..abf369bb1ba 100644 --- a/src/mame/drivers/gaiden.cpp +++ b/src/mame/drivers/gaiden.cpp @@ -1053,15 +1053,15 @@ MACHINE_CONFIG_START(gaiden_state::mastninj) MCFG_DEVICE_ADD("adpcm_select2", LS157, 0) MCFG_74157_OUT_CB(WRITE8("msm2", msm5205_device, data_w)) - MCFG_DEVICE_ADD("msm1", MSM5205, 384000) - MCFG_MSM5205_VCK_CALLBACK(WRITELINE("msm2", msm5205_device, vclk_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, gaiden_state, vck_flipflop_w)) - MCFG_MSM5205_PRESCALER_SELECTOR(S96_4B) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - - MCFG_DEVICE_ADD("msm2", MSM5205, 384000) - MCFG_MSM5205_PRESCALER_SELECTOR(SEX_4B) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + MSM5205(config, m_msm[0], 384000); + m_msm[0]->vck_callback().set(m_msm[1], FUNC(msm5205_device::vclk_w)); + m_msm[0]->vck_callback().append(FUNC(gaiden_state::vck_flipflop_w)); + m_msm[0]->set_prescaler_selector(msm5205_device::S96_4B); + m_msm[0]->add_route(ALL_OUTPUTS, "mono", 0.20); + + MSM5205(config, m_msm[1], 384000); + m_msm[1]->set_prescaler_selector(msm5205_device::SEX_4B); + m_msm[1]->add_route(ALL_OUTPUTS, "mono", 0.20); MACHINE_CONFIG_END /*************************************************************************** diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp index 5820019be79..20814ae6c7c 100644 --- a/src/mame/drivers/galaga.cpp +++ b/src/mame/drivers/galaga.cpp @@ -1597,12 +1597,12 @@ MACHINE_CONFIG_START(bosco_state::bosco) MCFG_DEVICE_ADD("sub2", Z80, MASTER_CLOCK/6) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(bosco_map) - MCFG_DEVICE_ADD("misclatch", LS259, 0) // 3C on CPU board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, galaga_state, irq1_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, galaga_state, irq2_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, galaga_state, nmion_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &misclatch(LS259(config, "misclatch")); // 3C on CPU board + misclatch.q_out_cb<0>().set(FUNC(galaga_state::irq1_clear_w)); + misclatch.q_out_cb<1>().set(FUNC(galaga_state::irq2_clear_w)); + misclatch.q_out_cb<2>().set(FUNC(galaga_state::nmion_w)); + misclatch.q_out_cb<3>().set_inputline("sub", INPUT_LINE_RESET).invert(); + misclatch.q_out_cb<3>().append_inputline("sub2", INPUT_LINE_RESET).invert(); MCFG_NAMCO_50XX_ADD("50xx_1", MASTER_CLOCK/6/2) /* 1.536 MHz */ MCFG_NAMCO_50XX_ADD("50xx_2", MASTER_CLOCK/6/2) /* 1.536 MHz */ @@ -1643,11 +1643,11 @@ MACHINE_CONFIG_START(bosco_state::bosco) MCFG_NAMCO_06XX_WRITE_0_CB(WRITE8("50xx_2", namco_50xx_device, write)) MCFG_NAMCO_06XX_WRITE_1_CB(WRITE8("52xx", namco_52xx_device, write)) - MCFG_DEVICE_ADD("videolatch", LS259, 0) // 1B on video board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, galaga_state, flip_screen_w)) MCFG_DEVCB_INVERT + LS259(config, m_videolatch); // 1B on video board + m_videolatch->q_out_cb<0>().set(FUNC(galaga_state::flip_screen_w)).invert(); // Q4-Q5 to 05XX for starfield blink - //MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(DEVWRITE("50xx_2", namco_50xx_device, reset_w)) - //MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITE("52xx", namco_52xx_device, reset_w)) + //m_videolatch->q_out_cb<7>().set("50xx_2", FUNC(namco_50xx_device::reset_w)); + //m_videolatch->q_out_cb<7>().append("52xx", FUNC(namco_52xx_device, reset_w)); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 8) @@ -1655,12 +1655,12 @@ MACHINE_CONFIG_START(bosco_state::bosco) /* synchronization of the CPUs */ /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 288, 264, 16, 224+16) - MCFG_SCREEN_UPDATE_DRIVER(bosco_state, screen_update_bosco) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, bosco_state, screen_vblank_bosco)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, galaga_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 16, 224+16); + m_screen->set_screen_update(FUNC(bosco_state::screen_update_bosco)); + m_screen->screen_vblank().set(FUNC(bosco_state::screen_vblank_bosco)); + m_screen->screen_vblank().append(FUNC(galaga_state::vblank_irq)); + m_screen->set_palette("palette"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bosco) MCFG_PALETTE_ADD("palette", 64*4+64*4+4+64) @@ -1692,12 +1692,12 @@ MACHINE_CONFIG_START(galaga_state::galaga) MCFG_DEVICE_ADD("sub2", Z80, MASTER_CLOCK/6) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(galaga_map) - MCFG_DEVICE_ADD("misclatch", LS259, 0) // 3C on CPU board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, galaga_state, irq1_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, galaga_state, irq2_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, galaga_state, nmion_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &misclatch(LS259(config, "misclatch")); // 3C on CPU board + misclatch.q_out_cb<0>().set(FUNC(galaga_state::irq1_clear_w)); + misclatch.q_out_cb<1>().set(FUNC(galaga_state::irq2_clear_w)); + misclatch.q_out_cb<2>().set(FUNC(galaga_state::nmion_w)); + misclatch.q_out_cb<3>().set_inputline("sub", INPUT_LINE_RESET).invert(); + misclatch.q_out_cb<3>().append_inputline("sub2", INPUT_LINE_RESET).invert(); MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */ MCFG_NAMCO_51XX_SCREEN("screen") @@ -1718,9 +1718,9 @@ MACHINE_CONFIG_START(galaga_state::galaga) MCFG_NAMCO_06XX_WRITE_0_CB(WRITE8("51xx", namco_51xx_device, write)) MCFG_NAMCO_06XX_WRITE_3_CB(WRITE8("54xx", namco_54xx_device, write)) - MCFG_DEVICE_ADD("videolatch", LS259, 0) // 5K on video board + LS259(config, m_videolatch); // 5K on video board // Q0-Q5 to 05XX for starfield control - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, galaga_state, flip_screen_w)) + m_videolatch->q_out_cb<7>().set(FUNC(galaga_state::flip_screen_w)); MCFG_WATCHDOG_ADD("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 8) @@ -1728,12 +1728,12 @@ MACHINE_CONFIG_START(galaga_state::galaga) /* synchronization of the CPUs */ /* video hardware */ - MCFG_SCREEN_ADD(m_screen, RASTER) - MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224) - MCFG_SCREEN_UPDATE_DRIVER(galaga_state, screen_update_galaga) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, galaga_state, screen_vblank_galaga)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, galaga_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(MASTER_CLOCK/3, 384, 0, 288, 264, 0, 224); + m_screen->set_screen_update(FUNC(galaga_state::screen_update_galaga)); + m_screen->screen_vblank().set(FUNC(galaga_state::screen_vblank_galaga)); + m_screen->screen_vblank().append(FUNC(galaga_state::vblank_irq)); + m_screen->set_palette("palette"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaga) MCFG_PALETTE_ADD("palette", 64*4+64*4+64) @@ -1795,12 +1795,12 @@ MACHINE_CONFIG_START(xevious_state::xevious) MCFG_DEVICE_ADD("sub2", Z80, MASTER_CLOCK/6) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(xevious_map) - MCFG_DEVICE_ADD("misclatch", LS259, 0) // 5K - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, galaga_state, irq1_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, galaga_state, irq2_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, galaga_state, nmion_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &misclatch(LS259(config, "misclatch")); // 5K + misclatch.q_out_cb<0>().set(FUNC(galaga_state::irq1_clear_w)); + misclatch.q_out_cb<1>().set(FUNC(galaga_state::irq2_clear_w)); + misclatch.q_out_cb<2>().set(FUNC(galaga_state::nmion_w)); + misclatch.q_out_cb<3>().set_inputline("sub", INPUT_LINE_RESET).invert(); + misclatch.q_out_cb<3>().append_inputline("sub2", INPUT_LINE_RESET).invert(); MCFG_NAMCO_50XX_ADD("50xx", MASTER_CLOCK/6/2) /* 1.536 MHz */ @@ -1873,9 +1873,7 @@ MACHINE_CONFIG_START(battles_state::battles) MCFG_DEVICE_ADD("sub3", Z80, MASTER_CLOCK/6) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(battles_mem4) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, galaga_state, vblank_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, battles_state, interrupt_4)) + m_screen->screen_vblank().append(FUNC(battles_state::interrupt_4)); MCFG_TIMER_DRIVER_ADD("nmi", battles_state, nmi_generate) @@ -1900,12 +1898,12 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_DEVICE_ADD("sub2", Z80, MASTER_CLOCK/6) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(digdug_map) - MCFG_DEVICE_ADD("misclatch", LS259, 0) // 8R - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, galaga_state, irq1_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, galaga_state, irq2_clear_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, galaga_state, nmion_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &misclatch(LS259(config, "misclatch")); // 8R + misclatch.q_out_cb<0>().set(FUNC(galaga_state::irq1_clear_w)); + misclatch.q_out_cb<1>().set(FUNC(galaga_state::irq2_clear_w)); + misclatch.q_out_cb<2>().set(FUNC(galaga_state::nmion_w)); + misclatch.q_out_cb<3>().set_inputline("sub", INPUT_LINE_RESET).invert(); + misclatch.q_out_cb<3>().append_inputline("sub2", INPUT_LINE_RESET).invert(); // Q5-Q7 also used (see below) MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */ @@ -1917,15 +1915,15 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_NAMCO_51XX_OUTPUT_0_CB(WRITE8(*this, galaga_state,out_0)) MCFG_NAMCO_51XX_OUTPUT_1_CB(WRITE8(*this, galaga_state,out_1)) - MCFG_NAMCO_53XX_ADD("53xx", MASTER_CLOCK/6/2) /* 1.536 MHz */ - MCFG_NAMCO_53XX_K_CB(READLINE("misclatch", ls259_device, q7_r)) MCFG_DEVCB_BIT(3) // MOD 2 = K3 - MCFG_DEVCB_CHAIN_INPUT(READLINE("misclatch", ls259_device, q6_r)) MCFG_DEVCB_BIT(2) // MOD 1 = K2 - MCFG_DEVCB_CHAIN_INPUT(READLINE("misclatch", ls259_device, q5_r)) MCFG_DEVCB_BIT(1) // MOD 0 = K1 + namco_53xx_device &n53xx(NAMCO_53XX(config, "53xx", MASTER_CLOCK/6/2)); /* 1.536 MHz */ + n53xx.k_port_callback().set("misclatch", FUNC(ls259_device::q7_r)).lshift(3); // MOD 2 = K3 + n53xx.k_port_callback().append("misclatch", FUNC(ls259_device::q6_r)).lshift(2); // MOD 1 = K2 + n53xx.k_port_callback().append("misclatch", FUNC(ls259_device::q5_r)).lshift(1); // MOD 0 = K1 // K0 is left unconnected - MCFG_NAMCO_53XX_INPUT_0_CB(IOPORT("DSWA")) MCFG_DEVCB_MASK(0x0f) - MCFG_NAMCO_53XX_INPUT_1_CB(IOPORT("DSWA")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f) - MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWB")) MCFG_DEVCB_RSHIFT(4) + n53xx.input_callback<0>().set_ioport("DSWA").mask(0x0f); + n53xx.input_callback<1>().set_ioport("DSWA").rshift(4); + n53xx.input_callback<2>().set_ioport("DSWB").mask(0x0f); + n53xx.input_callback<3>().set_ioport("DSWB").rshift(4); MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/6/64) MCFG_NAMCO_06XX_MAINCPU("maincpu") @@ -1934,11 +1932,11 @@ MACHINE_CONFIG_START(digdug_state::digdug) MCFG_NAMCO_06XX_READ_1_CB(READ8("53xx", namco_53xx_device, read)) MCFG_NAMCO_06XX_READ_REQUEST_1_CB(WRITELINE("53xx", namco_53xx_device, read_request)) - MCFG_DEVICE_ADD("videolatch", LS259, 0) // 5R - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, digdug_state, bg_select_w)) MCFG_DEVCB_MASK(0x33) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, digdug_state, tx_color_mode_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, digdug_state, bg_disable_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, digdug_state, flip_screen_w)) + LS259(config, m_videolatch); // 5R + m_videolatch->parallel_out_cb().set(FUNC(digdug_state::bg_select_w)).mask(0x33); + m_videolatch->q_out_cb<2>().set(FUNC(digdug_state::tx_color_mode_w)); + m_videolatch->q_out_cb<3>().set(FUNC(digdug_state::bg_disable_w)); + m_videolatch->q_out_cb<7>().set(FUNC(digdug_state::flip_screen_w)); MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - an high value to ensure proper */ /* synchronization of the CPUs */ diff --git a/src/mame/drivers/galastrm.cpp b/src/mame/drivers/galastrm.cpp index 1f66067c340..ee01322e53f 100644 --- a/src/mame/drivers/galastrm.cpp +++ b/src/mame/drivers/galastrm.cpp @@ -213,14 +213,14 @@ MACHINE_CONFIG_START(galastrm_state::galastrm) MCFG_ADC0808_IN0_CB(IOPORT("STICKX")) MCFG_ADC0808_IN1_CB(IOPORT("STICKY")) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, galastrm_state, coin_word_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_2_callback().set_ioport("IN0"); + tc0510nio.read_3_callback().set_ioport("IN1"); + tc0510nio.write_3_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(galastrm_state::coin_word_w)); + tc0510nio.read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/galaxold.cpp b/src/mame/drivers/galaxold.cpp index ad0d27851fd..79fed8a495a 100644 --- a/src/mame/drivers/galaxold.cpp +++ b/src/mame/drivers/galaxold.cpp @@ -745,7 +745,7 @@ void galaxold_state::drivfrcg_io(address_map &map) } -void galaxold_state::racknrol(address_map &map) +void galaxold_state::racknrol_map(address_map &map) { map(0x0000, 0x0fff).rom(); map(0x1400, 0x143f).mirror(0x6000).ram().w(FUNC(galaxold_state::galaxold_attributesram_w)).share("attributesram"); @@ -2575,11 +2575,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(galaxold_state::racknrol) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", S2650, PIXEL_CLOCK/2) - MCFG_DEVICE_PROGRAM_MAP(racknrol) - MCFG_DEVICE_IO_MAP(racknrol_io) + s2650_device &maincpu(S2650(config, m_maincpu, PIXEL_CLOCK/2)); + maincpu.set_addrmap(AS_PROGRAM, &galaxold_state::racknrol_map); + maincpu.set_addrmap(AS_IO, &galaxold_state::racknrol_io); + maincpu.sense_handler().set(m_screen, FUNC(screen_device::vblank)).invert(); // ??? + device = &maincpu; // FIXME: kill the following line - convert to a screen vblank callback MCFG_DEVICE_VBLANK_INT_DRIVER("screen", galaxold_state, hunchbks_vh_interrupt) - MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_DEVCB_INVERT // ??? /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxian) @@ -2603,11 +2604,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(galaxold_state::hexpoola) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", S2650, PIXEL_CLOCK/2) - MCFG_DEVICE_PROGRAM_MAP(racknrol) - MCFG_DEVICE_IO_MAP(hexpoola_io) - MCFG_DEVICE_DATA_MAP(hexpoola_data) - MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_DEVCB_INVERT // ??? + s2650_device &maincpu(S2650(config, m_maincpu, PIXEL_CLOCK/2)); + maincpu.set_addrmap(AS_PROGRAM, &galaxold_state::racknrol_map); + maincpu.set_addrmap(AS_IO, &galaxold_state::hexpoola_io); + maincpu.set_addrmap(AS_DATA, &galaxold_state::hexpoola_data); + maincpu.sense_handler().set(m_screen, FUNC(screen_device::vblank)).invert(); // ??? + device = &maincpu; // FIXME: kill the following line - convert to a screen vblank callback MCFG_DEVICE_VBLANK_INT_DRIVER("screen", galaxold_state, hunchbks_vh_interrupt) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxian) diff --git a/src/mame/drivers/gaplus.cpp b/src/mame/drivers/gaplus.cpp index b003000e91d..af559f86c70 100644 --- a/src/mame/drivers/gaplus.cpp +++ b/src/mame/drivers/gaplus.cpp @@ -538,15 +538,15 @@ MACHINE_CONFIG_START(gaplus_base_state::gaplus_base) //MCFG_NAMCO_62XX_OUTPUT_1_CB(WRITE8(*this, gaplus_base_state,out_1)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60.606060) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(36 * 8, 28 * 8) - MCFG_SCREEN_VISIBLE_AREA(0 * 8, 36 * 8 - 1, 0 * 8, 28 * 8 - 1) - MCFG_SCREEN_UPDATE_DRIVER(gaplus_base_state, screen_update) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, gaplus_base_state, screen_vblank)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, gaplus_base_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60.606060); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0)); + m_screen->set_size(36 * 8, 28 * 8); + m_screen->set_visarea(0 * 8, 36 * 8 - 1, 0 * 8, 28 * 8 - 1); + m_screen->set_screen_update(FUNC(gaplus_base_state::screen_update)); + m_screen->screen_vblank().set(FUNC(gaplus_base_state::screen_vblank)); + m_screen->screen_vblank().append(FUNC(gaplus_base_state::vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaplus) MCFG_PALETTE_ADD("palette", 64 * 4 + 64 * 8) @@ -604,9 +604,8 @@ MACHINE_CONFIG_START(gapluso_state::gapluso) gaplus_base(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("screen") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, gaplus_base_state, screen_vblank)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, gapluso_state, vblank_irq)) + m_screen->screen_vblank().set(FUNC(gaplus_base_state::screen_vblank)); + m_screen->screen_vblank().append(FUNC(gapluso_state::vblank_irq)); MCFG_DEVICE_ADD("namcoio_1", NAMCO_56XX, 0) MCFG_NAMCO56XX_IN_0_CB(IOPORT("COINS")) diff --git a/src/mame/drivers/gimix.cpp b/src/mame/drivers/gimix.cpp index 9cb7cf0f043..3f5a33108b6 100644 --- a/src/mame/drivers/gimix.cpp +++ b/src/mame/drivers/gimix.cpp @@ -611,11 +611,11 @@ MACHINE_CONFIG_START(gimix_state::gimix) MCFG_RS232_RXD_HANDLER(WRITELINE("acia4",acia6850_device,write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia4",acia6850_device,write_cts)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia2", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia2", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 153600)); + acia_clock.signal_handler().set(m_acia1, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia1, FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia2, FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia2, FUNC(acia6850_device::write_rxc)); /* banking */ MCFG_ADDRESS_BANK("bank1") diff --git a/src/mame/drivers/gladiatr.cpp b/src/mame/drivers/gladiatr.cpp index 19c968f1889..54a46c9b2c2 100644 --- a/src/mame/drivers/gladiatr.cpp +++ b/src/mame/drivers/gladiatr.cpp @@ -1028,18 +1028,18 @@ MACHINE_CONFIG_START(gladiatr_state::gladiatr) MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) // shadowed by aforementioned hack MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, gladiatr_state, flipscreen_w)) - MCFG_DEVICE_ADD("cctl", I8741, 12_MHz_XTAL/2) /* verified on pcb */ - MCFG_MCS48_PORT_T0_IN_CB(IOPORT("COINS")) MCFG_DEVCB_RSHIFT(3) - MCFG_MCS48_PORT_T1_IN_CB(IOPORT("COINS")) MCFG_DEVCB_RSHIFT(2) - MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, gladiatr_state, cctl_p1_r)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, gladiatr_state, cctl_p2_r)) - - MCFG_DEVICE_ADD("ccpu", I8741, 12_MHz_XTAL/2) /* verified on pcb */ - MCFG_MCS48_PORT_P1_IN_CB(IOPORT("IN0")) - MCFG_MCS48_PORT_P2_IN_CB(IOPORT("IN1")) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, gladiatr_state, ccpu_p2_w)) - MCFG_MCS48_PORT_T0_IN_CB(IOPORT("COINS")) MCFG_DEVCB_RSHIFT(1) - MCFG_MCS48_PORT_T1_IN_CB(IOPORT("COINS")) MCFG_DEVCB_RSHIFT(0) + I8741(config, m_cctl, 12_MHz_XTAL/2); /* verified on pcb */ + m_cctl->t0_in_cb().set_ioport("COINS").bit(3); + m_cctl->t1_in_cb().set_ioport("COINS").bit(2); + m_cctl->p1_in_cb().set(FUNC(gladiatr_state::cctl_p1_r)); + m_cctl->p2_in_cb().set(FUNC(gladiatr_state::cctl_p2_r)); + + I8741(config, m_ccpu, 12_MHz_XTAL/2); /* verified on pcb */ + m_ccpu->p1_in_cb().set_ioport("IN0"); + m_ccpu->p2_in_cb().set_ioport("IN1"); + m_ccpu->p2_out_cb().set(FUNC(gladiatr_state::ccpu_p2_w)); + m_ccpu->t0_in_cb().set_ioport("COINS").bit(1); + m_ccpu->t1_in_cb().set_ioport("COINS").bit(0); MCFG_DEVICE_ADD("ucpu", I8741, 12_MHz_XTAL/2) /* verified on pcb */ MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, gladiatr_state, ucpu_p1_r)) diff --git a/src/mame/drivers/gng.cpp b/src/mame/drivers/gng.cpp index 2ed772784d0..690d88dca4f 100644 --- a/src/mame/drivers/gng.cpp +++ b/src/mame/drivers/gng.cpp @@ -41,16 +41,6 @@ WRITE8_MEMBER(gng_state::gng_bankswitch_w) membank("bank1")->set_entry((data & 0x03)); } -WRITE_LINE_MEMBER(gng_state::coin_counter_1_w) -{ - machine().bookkeeping().coin_counter_w(0, state); -} - -WRITE_LINE_MEMBER(gng_state::coin_counter_2_w) -{ - machine().bookkeeping().coin_counter_w(1, state); -} - WRITE_LINE_MEMBER(gng_state::ym_reset_w) { if (!state) @@ -399,12 +389,12 @@ MACHINE_CONFIG_START(gng_state::gng) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(gng_state, irq0_line_hold, 4*60) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 9B on A board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, gng_state, flipscreen_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, gng_state, ym_reset_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, gng_state, coin_counter_1_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, gng_state, coin_counter_2_w)) + ls259_device &mainlatch(LS259(config, "mainlatch")); // 9B on A board + mainlatch.q_out_cb<0>().set(FUNC(gng_state::flipscreen_w)); + mainlatch.q_out_cb<1>().set_inputline("audiocpu", INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<1>().append(FUNC(gng_state::ym_reset_w)); + mainlatch.q_out_cb<2>().set([this] (int state) { machine().bookkeeping().coin_counter_w(0, state); }); + mainlatch.q_out_cb<3>().set([this] (int state) { machine().bookkeeping().coin_counter_w(1, state); }); /* video hardware */ MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) diff --git a/src/mame/drivers/gotcha.cpp b/src/mame/drivers/gotcha.cpp index fe2d838609b..6a946514a9a 100644 --- a/src/mame/drivers/gotcha.cpp +++ b/src/mame/drivers/gotcha.cpp @@ -270,21 +270,20 @@ MACHINE_CONFIG_START(gotcha_state::gotcha) MCFG_DEVICE_PROGRAM_MAP(sound_map) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(55) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(40*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) - MCFG_SCREEN_UPDATE_DRIVER(gotcha_state, screen_update_gotcha) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", M68K_IRQ_6)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("audiocpu", INPUT_LINE_NMI)) // ? + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(55); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(40*8, 32*8); + screen.set_visarea(0*8, 40*8-1, 1*8, 31*8-1); + screen.set_screen_update(FUNC(gotcha_state::screen_update_gotcha)); + screen.set_palette("palette"); + screen.screen_vblank().set_inputline(m_maincpu, M68K_IRQ_6, HOLD_LINE); + screen.screen_vblank().append_inputline(m_audiocpu, INPUT_LINE_NMI); // ? MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gotcha) MCFG_PALETTE_ADD("palette", 768) MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) - MCFG_DEVICE_ADD("spritegen", DECO_SPRITE, 0) MCFG_DECO_SPRITE_GFX_REGION(1) MCFG_DECO_SPRITE_ISBOOTLEG(true) diff --git a/src/mame/drivers/groundfx.cpp b/src/mame/drivers/groundfx.cpp index a9d95e2a663..a27d9d81e4d 100644 --- a/src/mame/drivers/groundfx.cpp +++ b/src/mame/drivers/groundfx.cpp @@ -251,15 +251,15 @@ MACHINE_CONFIG_START(groundfx_state::groundfx) MCFG_ADC0808_IN2_CB(IOPORT("WHEEL")) MCFG_ADC0808_IN3_CB(IOPORT("ACCEL")) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_2_CB(IOPORT("BUTTONS")) - MCFG_TC0510NIO_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_INPUT(READLINE(*this, groundfx_state, frame_counter_r)) MCFG_DEVCB_BIT(0) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, groundfx_state, coin_word_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("SYSTEM")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_2_callback().set_ioport("BUTTONS"); + tc0510nio.read_3_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + tc0510nio.read_3_callback().append(FUNC(groundfx_state::frame_counter_r)).lshift(0); + tc0510nio.write_3_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(groundfx_state::coin_word_w)); + tc0510nio.read_7_callback().set_ioport("SYSTEM"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/gstriker.cpp b/src/mame/drivers/gstriker.cpp index 86af212e71f..38874c6ea3d 100644 --- a/src/mame/drivers/gstriker.cpp +++ b/src/mame/drivers/gstriker.cpp @@ -502,14 +502,14 @@ MACHINE_CONFIG_START(gstriker_state::gstriker) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_IO_MAP(sound_io_map) - MCFG_DEVICE_ADD("io", VS9209, 0) - MCFG_VS9209_IN_PORTA_CB(IOPORT("P1")) - MCFG_VS9209_IN_PORTB_CB(IOPORT("P2")) - MCFG_VS9209_IN_PORTC_CB(IOPORT("SYSTEM")) - MCFG_VS9209_IN_PORTD_CB(IOPORT("DSW1")) - MCFG_VS9209_IN_PORTE_CB(IOPORT("DSW2")) - MCFG_VS9209_IN_PORTH_CB(READLINE("soundlatch", generic_latch_8_device, pending_r)) MCFG_DEVCB_BIT(0) - MCFG_VS9209_OUT_PORTH_CB(WRITELINE("watchdog", mb3773_device, write_line_ck)) MCFG_DEVCB_BIT(3) + vs9209_device &io(VS9209(config, "io", 0)); + io.porta_input_cb().set_ioport("P1"); + io.portb_input_cb().set_ioport("P2"); + io.portc_input_cb().set_ioport("SYSTEM"); + io.portd_input_cb().set_ioport("DSW1"); + io.porte_input_cb().set_ioport("DSW2"); + io.porth_input_cb().set(m_soundlatch, FUNC(generic_latch_8_device::pending_r)).lshift(0); + io.porth_output_cb().set("watchdog", FUNC(mb3773_device::write_line_ck)).bit(3); MCFG_DEVICE_ADD("watchdog", MB3773, 0) @@ -569,9 +569,7 @@ MACHINE_CONFIG_START(gstriker_state::twc94) MCFG_DEVICE_PROGRAM_MAP(twcup94_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", gstriker_state, irq1_line_hold) - MCFG_DEVICE_MODIFY("io") - MCFG_VS9209_OUT_PORTH_CB(WRITE8(*this, gstriker_state, twcup94_prot_reg_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("watchdog", mb3773_device, write_line_ck)) MCFG_DEVCB_BIT(3) + subdevice("io")->porth_output_cb().append(FUNC(gstriker_state::twcup94_prot_reg_w)); MCFG_DEVICE_REMOVE("acia") MACHINE_CONFIG_END diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp index 934529b46cd..02c4d71f35a 100644 --- a/src/mame/drivers/gsword.cpp +++ b/src/mame/drivers/gsword.cpp @@ -859,14 +859,14 @@ MACHINE_CONFIG_START(josvolly_state::josvolly) MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, josvolly_state, mcu1_p2_r)) MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, josvolly_state, mcu1_p2_w)) - MCFG_DEVICE_ADD("mcu2", I8741, 12000000/2) /* ? */ - MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, josvolly_state, mcu2_p1_r)) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, josvolly_state, mcu2_p1_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, josvolly_state, mcu2_p2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, josvolly_state, mcu2_p2_w)) + i8741_device &mcu2(I8741(config, "mcu2", 12000000/2)); /* ? */ + mcu2.p1_in_cb().set(FUNC(josvolly_state::mcu2_p1_r)); + mcu2.p1_out_cb().set(FUNC(josvolly_state::mcu2_p1_w)); + mcu2.p2_in_cb().set(FUNC(josvolly_state::mcu2_p2_r)); + mcu2.p2_out_cb().set(FUNC(josvolly_state::mcu2_p2_w)); // TEST0 and TEST1 are driven by P20 and P21 on the other MCU - MCFG_MCS48_PORT_T0_IN_CB(READ8("mcu1", i8741_device, p2_r)) MCFG_DEVCB_RSHIFT(0) - MCFG_MCS48_PORT_T1_IN_CB(READ8("mcu1", i8741_device, p2_r)) MCFG_DEVCB_RSHIFT(1) + mcu2.t0_in_cb().set("mcu1", FUNC(i8741_device::p2_r)).bit(0); + mcu2.t1_in_cb().set("mcu1", FUNC(i8741_device::p2_r)).bit(1); MCFG_DEVICE_ADD("aa_007", I8255, 0) MCFG_I8255_IN_PORTA_CB(IOPORT("IN1")) // 1PL diff --git a/src/mame/drivers/guab.cpp b/src/mame/drivers/guab.cpp index e3fc569a2cd..fbb2a924614 100644 --- a/src/mame/drivers/guab.cpp +++ b/src/mame/drivers/guab.cpp @@ -539,9 +539,9 @@ MACHINE_CONFIG_START(guab_state::guab) MCFG_RS232_CTS_HANDLER(WRITELINE("acia6850_1", acia6850_device, write_cts)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("keyboard", acia_1_rs232_defaults) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) // source? the ptm doesn't seem to output any common baud values - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia6850_1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 153600)); // source? the ptm doesn't seem to output any common baud values + acia_clock.signal_handler().set("acia6850_1", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia6850_1", FUNC(acia6850_device::write_rxc)); MCFG_DEVICE_ADD("acia6850_2", ACIA6850, 0) diff --git a/src/mame/drivers/gunbustr.cpp b/src/mame/drivers/gunbustr.cpp index 212752a03a6..9db657775f0 100644 --- a/src/mame/drivers/gunbustr.cpp +++ b/src/mame/drivers/gunbustr.cpp @@ -237,15 +237,15 @@ MACHINE_CONFIG_START(gunbustr_state::gunbustr) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("EXTRA")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("INPUTS")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("SPECIAL")) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, gunbustr_state, coin_word_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("SYSTEM")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_0_callback().set_ioport("EXTRA"); + tc0510nio.read_2_callback().set_ioport("INPUTS"); + tc0510nio.read_3_callback().set_ioport("SPECIAL"); + tc0510nio.write_3_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(gunbustr_state::coin_word_w)); + tc0510nio.read_7_callback().set_ioport("SYSTEM"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/h8.cpp b/src/mame/drivers/h8.cpp index f6300ed07c2..ea1d710a28a 100644 --- a/src/mame/drivers/h8.cpp +++ b/src/mame/drivers/h8.cpp @@ -329,12 +329,12 @@ MACHINE_CONFIG_START(h8_state::h8) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(*this, h8_state, txdata_callback)) + I8251(config, m_uart, 0); + m_uart->txd_handler().set(FUNC(h8_state::txdata_callback)); - MCFG_DEVICE_ADD("cassette_clock", CLOCK, 4800) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &cassette_clock(CLOCK(config, "cassette_clock", 4800)); + cassette_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + cassette_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MCFG_CASSETTE_ADD("cassette") MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_PLAY | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_ENABLED) diff --git a/src/mame/drivers/harriet.cpp b/src/mame/drivers/harriet.cpp index feae77ae14c..c5da86323e3 100644 --- a/src/mame/drivers/harriet.cpp +++ b/src/mame/drivers/harriet.cpp @@ -104,9 +104,9 @@ MACHINE_CONFIG_START(harriet_state::harriet) MCFG_DEVICE_ADD("timekpr", M48T02, 0) MCFG_NVRAM_ADD_0FILL("zpram") // MK48Z02 - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("mfp", mc68901_device, write_rx)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mfp", mc68901_device, tbi_w)) + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set("mfp", FUNC(mc68901_device::write_rx)); + rs232.rxd_handler().append("mfp", FUNC(mc68901_device::tbi_w)); //MCFG_DEVICE_ADD("wdca", WD33C93, 40_MHz_XTAL / 4) //MCFG_DEVICE_ADD("wdcb", WD33C93, 40_MHz_XTAL / 4) diff --git a/src/mame/drivers/hazelgr.cpp b/src/mame/drivers/hazelgr.cpp index 7ffe08d743b..9fa626940b0 100644 --- a/src/mame/drivers/hazelgr.cpp +++ b/src/mame/drivers/hazelgr.cpp @@ -79,14 +79,14 @@ MACHINE_CONFIG_START(haze_state::haze) MCFG_DEVICE_IO_MAP(io_map) MCFG_Z80_DAISY_CHAIN(daisy_chain) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 1'000'000) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc1", z80ctc_device, trg3)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc2", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc2", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc2", z80ctc_device, trg2)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc2", z80ctc_device, trg3)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc3", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc3", z80ctc_device, trg1)) + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 1'000'000)); + ctc_clock.signal_handler().set("ctc1", FUNC(z80ctc_device::trg3)); + ctc_clock.signal_handler().append("ctc2", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc2", FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append("ctc2", FUNC(z80ctc_device::trg2)); + ctc_clock.signal_handler().append("ctc2", FUNC(z80ctc_device::trg3)); + ctc_clock.signal_handler().append("ctc3", FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append("ctc3", FUNC(z80ctc_device::trg1)); MCFG_DEVICE_ADD("ctc1", Z80CTC, 1'000'000 ) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp index 2c2d726baab..3a9c9ba1495 100644 --- a/src/mame/drivers/hazeltin.cpp +++ b/src/mame/drivers/hazeltin.cpp @@ -716,9 +716,9 @@ MACHINE_CONFIG_START(hazl1500_state::hazl1500) MCFG_PALETTE_ADD_MONOCHROME("palette") MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hazl1500) - MCFG_DEVICE_ADD(BAUDGEN_TAG, COM8116, XTAL(5'068'800)) - MCFG_COM8116_FR_HANDLER(WRITELINE("uart", ay51013_device, write_tcp)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", ay51013_device, write_rcp)) + com8116_device &baudgen(COM8116(config, BAUDGEN_TAG, XTAL(5'068'800))); + baudgen.fr_handler().set(m_uart, FUNC(ay51013_device::write_tcp)); + baudgen.fr_handler().append(m_uart, FUNC(ay51013_device::write_rcp)); MCFG_DEVICE_ADD(UART_TAG, AY51013, 0) MCFG_AY51013_WRITE_DAV_CB(WRITELINE("mainint", input_merger_device, in_w<0>)) diff --git a/src/mame/drivers/hnayayoi.cpp b/src/mame/drivers/hnayayoi.cpp index 5dbccbd5a13..629de9fc02d 100644 --- a/src/mame/drivers/hnayayoi.cpp +++ b/src/mame/drivers/hnayayoi.cpp @@ -555,11 +555,11 @@ MACHINE_CONFIG_START(hnayayoi_state::hnayayoi) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, hnayayoi_state, coin_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("msm", msm5205_device, reset_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("msm", msm5205_device, vclk_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, hnayayoi_state, nmi_enable_w)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set(FUNC(hnayayoi_state::coin_counter_w)); + mainlatch.q_out_cb<2>().set(m_msm, FUNC(msm5205_device::reset_w)).invert(); + mainlatch.q_out_cb<3>().set(m_msm, FUNC(msm5205_device::vclk_w)); + mainlatch.q_out_cb<4>().set(FUNC(hnayayoi_state::nmi_enable_w)).invert(); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -608,11 +608,11 @@ MACHINE_CONFIG_START(hnayayoi_state::untoucha) MCFG_DEVICE_PROGRAM_MAP(untoucha_map) MCFG_DEVICE_IO_MAP(untoucha_io_map) - MCFG_DEVICE_MODIFY("mainlatch") - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE("msm", msm5205_device, vclk_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, hnayayoi_state, nmi_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("msm", msm5205_device, reset_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(NOOP) // ? + ls259_device &mainlatch(*subdevice("mainlatch")); + mainlatch.q_out_cb<1>().set(m_msm, FUNC(msm5205_device::vclk_w)); + mainlatch.q_out_cb<2>().set(FUNC(hnayayoi_state::nmi_enable_w)); + mainlatch.q_out_cb<3>().set(m_msm, FUNC(msm5205_device::reset_w)).invert(); + mainlatch.q_out_cb<4>().set_nop(); // ? MCFG_DEVICE_MODIFY("crtc") MCFG_MC6845_UPDATE_ROW_CB(hnayayoi_state, untoucha_update_row) diff --git a/src/mame/drivers/holeland.cpp b/src/mame/drivers/holeland.cpp index 87bb3d32e64..66d190f5f5a 100644 --- a/src/mame/drivers/holeland.cpp +++ b/src/mame/drivers/holeland.cpp @@ -282,11 +282,11 @@ MACHINE_CONFIG_START(holeland_state::holeland) MCFG_DEVICE_IO_MAP(io_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", holeland_state, irq0_line_hold) - MCFG_DEVICE_ADD("latch", LS259, 0) // 3J - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, holeland_state, pal_offs_w)) MCFG_DEVCB_MASK(0x03) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, holeland_state, coin_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, holeland_state, flipscreen_x_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, holeland_state, flipscreen_y_w)) + LS259(config, m_latch); // 3J + m_latch->parallel_out_cb().set(FUNC(holeland_state::pal_offs_w)).mask(0x03); + m_latch->q_out_cb<5>().set(FUNC(holeland_state::coin_counter_w)); + m_latch->q_out_cb<6>().set(FUNC(holeland_state::flipscreen_x_w)); + m_latch->q_out_cb<7>().set(FUNC(holeland_state::flipscreen_y_w)); MCFG_WATCHDOG_ADD("watchdog") @@ -365,9 +365,9 @@ MACHINE_CONFIG_START(holeland_state::crzrally) MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_DEVICE_ADD("latch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, holeland_state, pal_offs_w)) MCFG_DEVCB_MASK(0x03) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, holeland_state, coin_counter_w)) + LS259(config, m_latch); + m_latch->parallel_out_cb().set(FUNC(holeland_state::pal_offs_w)).mask(0x03); + m_latch->q_out_cb<5>().set(FUNC(holeland_state::coin_counter_w)); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/hp16500.cpp b/src/mame/drivers/hp16500.cpp index b025eb3c835..a8a05fb2873 100644 --- a/src/mame/drivers/hp16500.cpp +++ b/src/mame/drivers/hp16500.cpp @@ -476,21 +476,20 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(hp16500_state::hp16500) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68EC030, 25000000) - MCFG_DEVICE_PROGRAM_MAP(hp16500_map) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_UPDATE_DRIVER(hp16500_state, screen_update_hp16500) - MCFG_SCREEN_SIZE(576,384) - MCFG_SCREEN_VISIBLE_AREA(0, 576-1, 0, 384-1) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, hp16500_state, vsync_changed)) - // FIXME: Where is the AP line connected to? The MLC documentation recommends - // connecting it to VBLANK - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mlc", hp_hil_mlc_device, ap_w)) - - MCFG_DEVICE_ADD("mlc", HP_HIL_MLC, XTAL(15'920'000)/2) - MCFG_HP_HIL_INT_CALLBACK(WRITELINE(*this, hp16500_state, irq_2)) + M68EC030(config, m_maincpu, 25'000'000); + m_maincpu->set_addrmap(AS_PROGRAM, &hp16500_state::hp16500_map); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_screen_update(FUNC(hp16500_state::screen_update_hp16500)); + screen.set_size(576,384); + screen.set_visarea(0, 576-1, 0, 384-1); + screen.set_refresh_hz(60); + screen.screen_vblank().set(FUNC(hp16500_state::vsync_changed)); + // FIXME: Where is the AP line connected to? The MLC documentation recommends connecting it to VBLANK + screen.screen_vblank().append(m_mlc, FUNC(hp_hil_mlc_device::ap_w)); + + HP_HIL_MLC(config, m_mlc, XTAL(15'920'000)/2); + m_mlc->int_callback().set(FUNC(hp16500_state::irq_2)); // TODO: for now hook up the ipc hil keyboard - this might be replaced // later with a 16500b specific keyboard implementation diff --git a/src/mame/drivers/i7000.cpp b/src/mame/drivers/i7000.cpp index 49983802f63..99eecfad917 100644 --- a/src/mame/drivers/i7000.cpp +++ b/src/mame/drivers/i7000.cpp @@ -383,8 +383,8 @@ MACHINE_CONFIG_START(i7000_state::i7000) MCFG_DEVICE_ADD("i8279", I8279, 4000000) /* guessed value. TODO: verify on PCB */ MCFG_I8279_OUT_SL_CB(WRITE8(*this, i7000_state, i7000_scanlines_w)) // scan SL lines MCFG_I8279_IN_RL_CB(READ8(*this, i7000_state, i7000_kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // TODO: Shift key - MCFG_I8279_IN_CTRL_CB(VCC) // TODO: Ctrl key + MCFG_I8279_IN_SHIFT_CB(CONSTANT(1)) // TODO: Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(1)) // TODO: Ctrl key /* Cartridge slot */ MCFG_GENERIC_CARTSLOT_ADD("cardslot", generic_romram_plain_slot, "i7000_card") diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp index 1a171c959ca..02f34f0a597 100644 --- a/src/mame/drivers/ibm6580.cpp +++ b/src/mame/drivers/ibm6580.cpp @@ -914,11 +914,11 @@ MACHINE_CONFIG_START(ibm6580_state::ibm6580) MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_DEVICE_ADD("kbd", DW_KEYBOARD, 0) - MCFG_DW_KEYBOARD_OUT_DATA_HANDLER(WRITELINE(*this, ibm6580_state, kb_data_w)) - MCFG_DW_KEYBOARD_OUT_CLOCK_HANDLER(WRITELINE(*this, ibm6580_state, kb_clock_w)) - MCFG_DW_KEYBOARD_OUT_STROBE_HANDLER(WRITELINE(*this, ibm6580_state, kb_strobe_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ppi8255", i8255_device, pc4_w)) + DW_KEYBOARD(config, m_kbd, 0); + m_kbd->out_data_handler().set(FUNC(ibm6580_state::kb_data_w)); + m_kbd->out_clock_handler().set(FUNC(ibm6580_state::kb_clock_w)); + m_kbd->out_strobe_handler().set(FUNC(ibm6580_state::kb_strobe_w)); + m_kbd->out_strobe_handler().append(m_ppi8255, FUNC(i8255_device::pc4_w)); MCFG_DEVICE_ADD("dma8257", I8257, XTAL(14'745'600)/3) MCFG_I8257_OUT_HRQ_CB(WRITELINE(*this, ibm6580_state, hrq_w)) diff --git a/src/mame/drivers/igs017.cpp b/src/mame/drivers/igs017.cpp index ad25462b36b..c7a45dc6489 100644 --- a/src/mame/drivers/igs017.cpp +++ b/src/mame/drivers/igs017.cpp @@ -163,22 +163,22 @@ void igs_bitswap_device::set_val_xor(uint16_t val_xor) } #define MCFG_IGS_BITSWAP_IN_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_in_pa_callback(DEVCB_##_devcb); + downcast(*device).set_in_pa_callback(DEVCB_##_devcb); #define MCFG_IGS_BITSWAP_IN_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_in_pb_callback(DEVCB_##_devcb); + downcast(*device).set_in_pb_callback(DEVCB_##_devcb); #define MCFG_IGS_BITSWAP_IN_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_in_pc_callback(DEVCB_##_devcb); + downcast(*device).set_in_pc_callback(DEVCB_##_devcb); #define MCFG_IGS_BITSWAP_OUT_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_out_pa_callback(DEVCB_##_devcb); + downcast(*device).set_out_pa_callback(DEVCB_##_devcb); #define MCFG_IGS_BITSWAP_OUT_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_out_pb_callback(DEVCB_##_devcb); + downcast(*device).set_out_pb_callback(DEVCB_##_devcb); #define MCFG_IGS_BITSWAP_OUT_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_out_pc_callback(DEVCB_##_devcb); + downcast(*device).set_out_pc_callback(DEVCB_##_devcb); // note: b3 seems fixed to ~15, it may go away in the future #define MCFG_IGS_BITSWAP_M3_0_BITS(_b0, _b1, _b2, _b3) \ diff --git a/src/mame/drivers/imds2.cpp b/src/mame/drivers/imds2.cpp index 40076ec6ffe..4d4663b398f 100644 --- a/src/mame/drivers/imds2.cpp +++ b/src/mame/drivers/imds2.cpp @@ -767,11 +767,11 @@ MACHINE_CONFIG_START(imds2_state::imds2) MCFG_DEVICE_ADD("ipcsyspic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, imds2_state, imds2_ipc_intr)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_DEVICE_ADD("ipclocpic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("ipcsyspic", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(VCC) // ??? + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) // ??? MCFG_DEVICE_ADD("ipctimer" , PIT8253 , 0) MCFG_PIT8253_CLK0(IPC_XTAL_Y1 / 16) diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp index c7c9a629b80..00782c004ad 100644 --- a/src/mame/drivers/imolagp.cpp +++ b/src/mame/drivers/imolagp.cpp @@ -94,8 +94,8 @@ www.andys-arcade.com class imolagp_state : public driver_device { public: - imolagp_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + imolagp_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_slavecpu(*this, "slave"), m_steer_pot_timer(*this, "pot"), @@ -524,12 +524,12 @@ MACHINE_CONFIG_START(imolagp_state::imolagp) MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("ppi8255", I8255A, 0) + i8255_device &ppi(I8255A(config, "ppi8255", 0)); // mode $91 - ports A & C-lower as input, ports B & C-upper as output - MCFG_I8255_IN_PORTA_CB(IOPORT("IN0")) - MCFG_I8255_IN_PORTB_CB(LOGGER("PPI8255 - unmapped read port B")) - MCFG_I8255_OUT_PORTB_CB(LOGGER("PPI8255 - unmapped write port B")) - MCFG_I8255_IN_PORTC_CB(IOPORT("IN1")) + ppi.in_pa_callback().set_ioport("IN0"); + ppi.in_pb_callback().set_log("PPI8255 - unmapped read port B"); + ppi.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ppi.in_pc_callback().set_ioport("IN1"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/imsai.cpp b/src/mame/drivers/imsai.cpp index 8ab9ee5266f..c9b545b112f 100644 --- a/src/mame/drivers/imsai.cpp +++ b/src/mame/drivers/imsai.cpp @@ -120,12 +120,12 @@ MACHINE_CONFIG_START(imsai_state::imsai) /* Devices */ MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(6'000'000) / 3) /* Timer 0: baud rate gen for 8251 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_PIT8253_CLK1(XTAL(6'000'000) / 3) /* Timer 1: user */ - MCFG_PIT8253_CLK2(XTAL(6'000'000) / 3) /* Timer 2: user */ + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(6_MHz_XTAL / 3); // Timer 0: baud rate gen for 8251 + m_pit->out_handler<0>().set("uart", FUNC(i8251_device::write_txc)); + m_pit->out_handler<0>().append("uart", FUNC(i8251_device::write_rxc)); + m_pit->set_clk<1>(6_MHz_XTAL / 3); // Timer 1: user + m_pit->set_clk<2>(6_MHz_XTAL / 3); // Timer 2: user MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/inder.cpp b/src/mame/drivers/inder.cpp index d5d154e8364..20650f2ab10 100644 --- a/src/mame/drivers/inder.cpp +++ b/src/mame/drivers/inder.cpp @@ -1434,12 +1434,11 @@ MACHINE_CONFIG_START(inder_state::inder) /* Sound */ genpin_audio(config); SPEAKER(config, "msmvol").front_center(); - MCFG_DEVICE_ADD("msm", MSM5205, XTAL(384'000)) - MCFG_MSM5205_VCK_CALLBACK(WRITELINE("9a", ttl7474_device, clock_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("9b", ttl7474_device, clock_w)) // order of writes is sensitive - - MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) /* 4KHz 4-bit */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "msmvol", 1.0) + MSM5205(config, m_msm, 384_kHz_XTAL); + m_msm->vck_callback().set(m_9a, FUNC(ttl7474_device::clock_w)); + m_msm->vck_callback().append(m_9b, FUNC(ttl7474_device::clock_w)); // order of writes is sensitive + m_msm->set_prescaler_selector(msm5205_device::S48_4B); // 4KHz 4-bit + m_msm->add_route(ALL_OUTPUTS, "msmvol", 1.0); /* Devices */ MCFG_DEVICE_ADD("ppi60", I8255A, 0 ) diff --git a/src/mame/drivers/interpro.cpp b/src/mame/drivers/interpro.cpp index fdc8d961d88..2e4f69e5d23 100644 --- a/src/mame/drivers/interpro.cpp +++ b/src/mame/drivers/interpro.cpp @@ -790,12 +790,12 @@ void interpro_state::interpro_cdrom(device_t *device) } MACHINE_CONFIG_START(interpro_state::ioga) - MCFG_DEVICE_MODIFY(INTERPRO_IOGA_TAG) - MCFG_INTERPRO_IOGA_NMI_CB(INPUTLINE(m_maincpu, INPUT_LINE_NMI)) - MCFG_INTERPRO_IOGA_IRQ_CB(INPUTLINE(m_maincpu, INPUT_LINE_IRQ0)) - MCFG_INTERPRO_IOGA_IVEC_CB(WRITE8(m_maincpu, clipper_device, set_ivec)) + m_ioga->out_nmi_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_ioga->out_irq_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ioga->out_irq_vector_callback().set(m_maincpu, FUNC(clipper_device::set_ivec)); // ioga dma and serial dma channels + MCFG_DEVICE_MODIFY(INTERPRO_IOGA_TAG); //MCFG_INTERPRO_IOGA_DMA_CB(0, unknown) // plotter MCFG_INTERPRO_IOGA_DMA_CB(1, READ8(INTERPRO_SCSI_DEVICE_TAG, ncr53c90a_device, mdma_r), WRITE8(INTERPRO_SCSI_DEVICE_TAG, ncr53c90a_device, mdma_w)) MCFG_INTERPRO_IOGA_DMA_CB(2, READ8(m_fdc, upd765_family_device, mdma_r), WRITE8(m_fdc, upd765_family_device, mdma_w)) diff --git a/src/mame/drivers/ipc.cpp b/src/mame/drivers/ipc.cpp index 846aab5ac7e..339ce3e5a92 100644 --- a/src/mame/drivers/ipc.cpp +++ b/src/mame/drivers/ipc.cpp @@ -94,41 +94,42 @@ void ipc_state::machine_reset() } -MACHINE_CONFIG_START(ipc_state::ipc) +void ipc_state::ipc(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8085A, XTAL(19'660'800) / 4) - MCFG_DEVICE_PROGRAM_MAP(ipc_mem) - MCFG_DEVICE_IO_MAP(ipc_io) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(19'660'800) / 16) - MCFG_PIT8253_CLK1(XTAL(19'660'800) / 16) - MCFG_PIT8253_CLK2(XTAL(19'660'800) / 16) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart2", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("uart1", I8251, 0) // 8 data bits, no parity, 1 stop bit, 9600 baud - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232a", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart1", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart1", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart1", i8251_device, write_cts)) - - MCFG_DEVICE_ADD("uart2", I8251, 0) // 8 data bits, no parity, 2 stop bits, 2400 baud - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232b", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("uart2", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart2", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart2", i8251_device, write_cts)) -MACHINE_CONFIG_END + I8085A(config, m_maincpu, XTAL(19'660'800) / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &ipc_state::ipc_mem); + m_maincpu->set_addrmap(AS_IO, &ipc_state::ipc_io); + + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(XTAL(19'660'800) / 16); + pit.set_clk<1>(XTAL(19'660'800) / 16); + pit.set_clk<2>(XTAL(19'660'800) / 16); + pit.out_handler<0>().set("uart1", FUNC(i8251_device::write_txc)); + pit.out_handler<0>().append("uart1", FUNC(i8251_device::write_rxc)); + pit.out_handler<1>().set("uart2", FUNC(i8251_device::write_txc)); + pit.out_handler<1>().append("uart2", FUNC(i8251_device::write_rxc)); + + i8251_device &uart1(I8251(config, "uart1", 0)); // 8 data bits, no parity, 1 stop bit, 9600 baud + uart1.txd_handler().set("rs232a", FUNC(rs232_port_device::write_txd)); + uart1.dtr_handler().set("rs232a", FUNC(rs232_port_device::write_dtr)); + uart1.rts_handler().set("rs232a", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal")); + rs232a.rxd_handler().set("uart1", FUNC(i8251_device::write_rxd)); + rs232a.dsr_handler().set("uart1", FUNC(i8251_device::write_dsr)); + rs232a.cts_handler().set("uart1", FUNC(i8251_device::write_cts)); + + i8251_device &uart2(I8251(config, "uart2", 0)); // 8 data bits, no parity, 2 stop bits, 2400 baud + uart2.txd_handler().set("rs232b", FUNC(rs232_port_device::write_txd)); + uart2.dtr_handler().set("rs232b", FUNC(rs232_port_device::write_dtr)); + uart2.rts_handler().set("rs232b", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232b(RS232_PORT(config, "rs232b", default_rs232_devices, nullptr)); + rs232b.rxd_handler().set("uart2", FUNC(i8251_device::write_rxd)); + rs232b.dsr_handler().set("uart2", FUNC(i8251_device::write_dsr)); + rs232b.cts_handler().set("uart2", FUNC(i8251_device::write_cts)); +} /* ROM definition */ ROM_START( ipb ) diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp index 71f54b853bd..725b16c2d5c 100644 --- a/src/mame/drivers/irisha.cpp +++ b/src/mame/drivers/irisha.cpp @@ -391,14 +391,14 @@ MACHINE_CONFIG_START(irisha_state::irisha) /* Devices */ MCFG_DEVICE_ADD("uart", I8251, 0) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000) / 9) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(16'000'000) / 9 / 8 / 8) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_PIT8253_CLK2(XTAL(16'000'000) / 9) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, irisha_state, speaker_w)) + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(16_MHz_XTAL / 9); + m_pit->out_handler<0>().set("pic8259", FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(16_MHz_XTAL / 9 / 8 / 8); + m_pit->out_handler<1>().set("uart", FUNC(i8251_device::write_txc)); + m_pit->out_handler<1>().append("uart", FUNC(i8251_device::write_rxc)); + m_pit->set_clk<2>(16_MHz_XTAL / 9); + m_pit->out_handler<2>().set(FUNC(irisha_state::speaker_w)); MCFG_DEVICE_ADD("ppi8255", I8255, 0) MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, irisha_state, irisha_8255_porta_w)) diff --git a/src/mame/drivers/isbc.cpp b/src/mame/drivers/isbc.cpp index 46d8354e137..b187183d0a2 100644 --- a/src/mame/drivers/isbc.cpp +++ b/src/mame/drivers/isbc.cpp @@ -48,7 +48,6 @@ public: , m_statuslatch(*this, "statuslatch") , m_bios(*this, "user1") , m_biosram(*this, "biosram") - , m_leds(*this, "led%u", 0U) { } void isbc2861(machine_config &config); @@ -73,12 +72,8 @@ private: DECLARE_WRITE8_MEMBER(edge_intr_clear_w); DECLARE_WRITE8_MEMBER(status_register_w); DECLARE_WRITE_LINE_MEMBER(nmi_mask_w); - DECLARE_WRITE_LINE_MEMBER(override_w); DECLARE_WRITE_LINE_MEMBER(bus_intr_out1_w); DECLARE_WRITE_LINE_MEMBER(bus_intr_out2_w); - DECLARE_WRITE_LINE_MEMBER(led_ds1_w); - DECLARE_WRITE_LINE_MEMBER(led_ds3_w); - DECLARE_WRITE_LINE_MEMBER(megabyte_select_w); void isbc2861_mem(address_map &map); void isbc286_io(address_map &map); void isbc286_mem(address_map &map); @@ -89,7 +84,6 @@ private: void rpc86_io(address_map &map); void rpc86_mem(address_map &map); - virtual void machine_start() override { m_leds.resolve(); } virtual void machine_reset() override; required_device m_maincpu; @@ -103,7 +97,6 @@ private: optional_device m_statuslatch; optional_memory_region m_bios; optional_shared_ptr m_biosram; - output_finder<2> m_leds; bool m_upperen; offs_t m_megabyte_page; @@ -323,12 +316,6 @@ WRITE_LINE_MEMBER(isbc_state::nmi_mask_w) m_nmi_enable = state; } -WRITE_LINE_MEMBER(isbc_state::override_w) -{ - // 1 = access onboard dual-port RAM - m_override = state; -} - WRITE_LINE_MEMBER(isbc_state::bus_intr_out1_w) { // Multibus interrupt request (active high) @@ -339,21 +326,6 @@ WRITE_LINE_MEMBER(isbc_state::bus_intr_out2_w) // Multibus interrupt request (active high) } -WRITE_LINE_MEMBER(isbc_state::led_ds1_w) -{ - m_leds[0] = state ? 0 : 1; -} - -WRITE_LINE_MEMBER(isbc_state::led_ds3_w) -{ - m_leds[1] = state ? 0 : 1; -} - -WRITE_LINE_MEMBER(isbc_state::megabyte_select_w) -{ - m_megabyte_enable = !state; -} - MACHINE_CONFIG_START(isbc_state::isbc86) /* basic machine hardware */ MCFG_DEVICE_ADD("maincpu", I8086, XTAL(5'000'000)) @@ -445,16 +417,16 @@ MACHINE_CONFIG_START(isbc_state::isbc8630) MCFG_DEVICE_ADD("isbc_215g", ISBC_215G, 0x100, "maincpu") MCFG_ISBC_215_IRQ(WRITELINE("pic_0", pic8259_device, ir5_w)) - MCFG_DEVICE_ADD("statuslatch", LS259, 0) // U14 -// MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE("pit", pit8253_device, write_gate0)) -// MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE("pit", pit8253_device, write_gate1)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, isbc_state, nmi_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, isbc_state, override_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, isbc_state, bus_intr_out1_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, isbc_state, bus_intr_out2_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, isbc_state, led_ds1_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, isbc_state, led_ds3_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, isbc_state, megabyte_select_w)) + LS259(config, m_statuslatch); // U14 +// m_statuslatch->q_out_cb<0>().set("pit", FUNC(pit8253_device::write_gate0)); +// m_statuslatch->q_out_cb<1>().set("pit", FUNC(pit8253_device::write_gate1)); + m_statuslatch->q_out_cb<2>().set(FUNC(isbc_state::nmi_mask_w)); + m_statuslatch->q_out_cb<3>().set([this] (int state) { m_override = state; }); // 1 = access onboard dual-port RAM + m_statuslatch->q_out_cb<4>().set(FUNC(isbc_state::bus_intr_out1_w)); + m_statuslatch->q_out_cb<5>().set(FUNC(isbc_state::bus_intr_out2_w)); + m_statuslatch->q_out_cb<5>().append_output("led0").invert(); // ds1 + m_statuslatch->q_out_cb<6>().set_output("led1").invert(); // ds3 + m_statuslatch->q_out_cb<7>().set([this] (int state) { m_megabyte_enable = !state; }); MACHINE_CONFIG_END MACHINE_CONFIG_START(isbc_state::isbc286) @@ -466,12 +438,12 @@ MACHINE_CONFIG_START(isbc_state::isbc286) MCFG_DEVICE_ADD("pic_0", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, isbc_state, get_slave_ack)) MCFG_DEVICE_ADD("pic_1", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic_0", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("pit", PIT8254, 0) MCFG_PIT8253_CLK0(XTAL(22'118'400)/18) diff --git a/src/mame/drivers/isbc8030.cpp b/src/mame/drivers/isbc8030.cpp index 0cb5c28371f..4f7cc6d2ed6 100644 --- a/src/mame/drivers/isbc8030.cpp +++ b/src/mame/drivers/isbc8030.cpp @@ -37,12 +37,6 @@ X Examine and modify CPU registers #include "machine/i8251.h" #include "bus/rs232/rs232.h" -#define I8259A_TAG "pic8259" -#define I8253_TAG "pit8253" -#define I8255A_TAG "ppi8255" -#define I8251A_TAG "usart" -#define I8251A_BAUD_TAG "usart_baud" -#define RS232_TAG "rs232" class isbc8030_state : public driver_device { @@ -50,11 +44,11 @@ public: isbc8030_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_usart(*this, I8251A_TAG) - , m_ppi(*this, I8255A_TAG) - , m_pic(*this, I8259A_TAG) - , m_pit(*this, I8253_TAG) - , m_rs232(*this, RS232_TAG) + , m_usart(*this, "usart") + , m_ppi(*this, "ppi8255") + , m_pic(*this, "pic8259") + , m_pit(*this, "pit8253") + , m_rs232(*this, "rs232") { } void isbc8030(machine_config &config); @@ -92,35 +86,35 @@ void isbc8030_state::isbc8030_io(address_map &map) static INPUT_PORTS_START( isbc8030 ) INPUT_PORTS_END -MACHINE_CONFIG_START(isbc8030_state::isbc8030) - /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", I8085A, XTAL(22'118'400) / 4) - MCFG_DEVICE_PROGRAM_MAP(isbc8030_mem) - MCFG_DEVICE_IO_MAP(isbc8030_io) - - MCFG_DEVICE_ADD(I8259A_TAG, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - - MCFG_DEVICE_ADD(I8253_TAG, PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(22'118'400) / 18) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(I8259A_TAG, pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(XTAL(22'118'400) / 18) - MCFG_PIT8253_CLK2(XTAL(22'118'400) / 18) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(I8251A_TAG, i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(I8251A_TAG, i8251_device, write_txc)) - - MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) - - MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE(I8251A_TAG, i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE(I8251A_TAG, i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE(I8251A_TAG, i8251_device, write_cts)) -MACHINE_CONFIG_END +void isbc8030_state::isbc8030(machine_config &config) +{ + I8085A(config, m_maincpu, XTAL(22'118'400) / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &isbc8030_state::isbc8030_mem); + m_maincpu->set_addrmap(AS_IO, &isbc8030_state::isbc8030_io); + + PIC8259(config, m_pic, 0); + m_pic->out_int_callback().set_inputline(m_maincpu, 0); + + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(XTAL(22'118'400) / 18); + m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); + m_pit->set_clk<1>(XTAL(22'118'400) / 18); + m_pit->set_clk<2>(XTAL(22'118'400) / 18); + m_pit->out_handler<2>().set(m_usart, FUNC(i8251_device::write_rxc)); + m_pit->out_handler<2>().append(m_usart, FUNC(i8251_device::write_txc)); + + I8251(config, m_usart, 0); + m_usart->txd_handler().set(m_rs232, FUNC(rs232_port_device::write_txd)); + m_usart->dtr_handler().set(m_rs232, FUNC(rs232_port_device::write_dtr)); + m_usart->rts_handler().set(m_rs232, FUNC(rs232_port_device::write_rts)); + + I8255A(config, m_ppi, 0); + + RS232_PORT(config, m_rs232, default_rs232_devices, "terminal"); + m_rs232->rxd_handler().set(m_usart, FUNC(i8251_device::write_rxd)); + m_rs232->dsr_handler().set(m_usart, FUNC(i8251_device::write_dsr)); + m_rs232->cts_handler().set(m_usart, FUNC(i8251_device::write_cts)); +} /* ROM definition */ ROM_START( isbc8030 ) diff --git a/src/mame/drivers/iteagle.cpp b/src/mame/drivers/iteagle.cpp index 663fc550d03..343e3c43426 100644 --- a/src/mame/drivers/iteagle.cpp +++ b/src/mame/drivers/iteagle.cpp @@ -173,15 +173,13 @@ MACHINE_CONFIG_START(iteagle_state::iteagle) MCFG_DEVICE_ADD(PCI_ID_NILE, VRC4373, 0, m_maincpu) MCFG_VRC4373_SET_RAM(0x00800000) MCFG_VRC4373_SET_SIMM0(0x02000000) - MCFG_DEVICE_ADD( PCI_ID_PERIPH, ITEAGLE_PERIPH, 0) - MCFG_DEVICE_ADD( PCI_ID_IDE, IDE_PCI, 0, 0x1080C693, 0x00, 0x0) - MCFG_IDE_PCI_IRQ_HANDLER( INPUTLINE(m_maincpu, MIPS3_IRQ2)) - - MCFG_DEVICE_ADD( PCI_ID_FPGA, ITEAGLE_FPGA, 0, "screen", m_maincpu, MIPS3_IRQ1, MIPS3_IRQ4) - MCFG_DEVICE_ADD( PCI_ID_SOUND, ES1373, 0) - MCFG_SOUND_ROUTE(0, PCI_ID_SOUND":lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, PCI_ID_SOUND":rspeaker", 1.0) - MCFG_ES1373_IRQ_HANDLER( INPUTLINE(m_maincpu, MIPS3_IRQ3)) + ITEAGLE_PERIPH(config, PCI_ID_PERIPH, 0); + IDE_PCI(config, PCI_ID_IDE, 0, 0x1080C693, 0x00, 0x0).irq_handler().set_inputline(m_maincpu, MIPS3_IRQ2); + + ITEAGLE_FPGA(config, PCI_ID_FPGA, 0, "screen", m_maincpu, MIPS3_IRQ1, MIPS3_IRQ4); + es1373_device &pci_sound(ES1373(config, PCI_ID_SOUND, 0)); + pci_sound.add_route(0, PCI_ID_SOUND":lspeaker", 1.0).add_route(1, PCI_ID_SOUND":rspeaker", 1.0); + pci_sound.irq_handler().set_inputline(m_maincpu, MIPS3_IRQ3); MCFG_DEVICE_ADD(PCI_ID_VIDEO, VOODOO_3_PCI, 0, m_maincpu, "screen") MCFG_VOODOO_PCI_FBMEM(16) diff --git a/src/mame/drivers/jade.cpp b/src/mame/drivers/jade.cpp index 12f99d56acd..41e619fb7a6 100644 --- a/src/mame/drivers/jade.cpp +++ b/src/mame/drivers/jade.cpp @@ -70,14 +70,13 @@ MACHINE_CONFIG_START(jade_state::jade) MCFG_DEVICE_PROGRAM_MAP(mem_map) MCFG_DEVICE_IO_MAP(io_map) - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(4'000'000)) + Z80CTC(config, "ctc1", 4_MHz_XTAL); - MCFG_DEVICE_ADD("ctc2", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) + z80ctc_device &ctc2(Z80CTC(config, "ctc2", 4_MHz_XTAL)); + ctc2.zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); + ctc2.zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); - MCFG_DEVICE_ADD("trg0", CLOCK, XTAL(4'000'000) / 2) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc2", z80ctc_device, trg0)) + CLOCK(config, "trg0", 4_MHz_XTAL / 2).signal_handler().set("ctc2", FUNC(z80ctc_device::trg0)); /* Devices */ MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(4'000'000)) diff --git a/src/mame/drivers/jp.cpp b/src/mame/drivers/jp.cpp index 41faf918895..be2e3fe5400 100644 --- a/src/mame/drivers/jp.cpp +++ b/src/mame/drivers/jp.cpp @@ -340,33 +340,33 @@ MACHINE_CONFIG_START(jp_state::jp) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("latch0", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, disp_data_w)) MCFG_DEVCB_INVERT + LS259(config, m_latch[0]); + m_latch[0]->q_out_cb<1>().set(FUNC(jp_state::disp_data_w)).invert(); - MCFG_DEVICE_ADD("latch1", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, disp_clock_w)) MCFG_DEVCB_INVERT + LS259(config, m_latch[1]); + m_latch[1]->q_out_cb<1>().set(FUNC(jp_state::disp_clock_w)).invert(); - MCFG_DEVICE_ADD("latch2", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, disp_strobe_w)) MCFG_DEVCB_INVERT + LS259(config, m_latch[2]); + m_latch[2]->q_out_cb<1>().set(FUNC(jp_state::disp_strobe_w)).invert(); - MCFG_DEVICE_ADD("latch3", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, row_w)) + LS259(config, m_latch[3]); + m_latch[3]->q_out_cb<1>().set(FUNC(jp_state::row_w)); - MCFG_DEVICE_ADD("latch4", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, row_w)) + LS259(config, m_latch[4]); + m_latch[4]->q_out_cb<1>().set(FUNC(jp_state::row_w)); - MCFG_DEVICE_ADD("latch5", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, row_w)) + LS259(config, m_latch[5]); + m_latch[5]->q_out_cb<1>().set(FUNC(jp_state::row_w)); - MCFG_DEVICE_ADD("latch6", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, row_w)) + LS259(config, m_latch[6]); + m_latch[6]->q_out_cb<1>().set(FUNC(jp_state::row_w)); - MCFG_DEVICE_ADD("latch7", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, jp_state, row_w)) + LS259(config, m_latch[7]); + m_latch[7]->q_out_cb<1>().set(FUNC(jp_state::row_w)); - MCFG_DEVICE_ADD("latch8", LS259, 0) + LS259(config, m_latch[8]); - MCFG_DEVICE_ADD("latch9", LS259, 0) + LS259(config, m_latch[9]); /* Video */ MCFG_DEFAULT_LAYOUT(layout_jp) diff --git a/src/mame/drivers/jpmsys5.cpp b/src/mame/drivers/jpmsys5.cpp index 9d93ed80713..c59942041d5 100644 --- a/src/mame/drivers/jpmsys5.cpp +++ b/src/mame/drivers/jpmsys5.cpp @@ -35,6 +35,7 @@ #include "includes/jpmsys5.h" #include "machine/clock.h" +#include "machine/input_merger.h" #include "sound/saa1099.h" #include "screen.h" #include "speaker.h" @@ -537,11 +538,6 @@ WRITE_LINE_MEMBER(jpmsys5_state::u26_o1_callback) * *************************************/ -WRITE_LINE_MEMBER(jpmsys5_state::acia_irq) -{ - m_maincpu->set_input_line(INT_6850ACIA, state ? ASSERT_LINE : CLEAR_LINE); -} - WRITE_LINE_MEMBER(jpmsys5_state::a0_tx_w) { m_a0_data_out = state; @@ -588,28 +584,30 @@ void jpmsys5v_state::machine_reset() *************************************/ MACHINE_CONFIG_START(jpmsys5v_state::jpmsys5v) - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(8'000'000)) - MCFG_DEVICE_PROGRAM_MAP(m68000_map) + M68000(config, m_maincpu, 8_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &jpmsys5v_state::m68000_map); + + INPUT_MERGER_ANY_HIGH(config, "acia_irq").output_handler().set_inputline(m_maincpu, INT_6850ACIA); - MCFG_DEVICE_ADD("acia6850_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5v_state, a0_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5v_state, acia_irq)) + ACIA6850(config, m_acia6850[0], 0); + m_acia6850[0]->txd_handler().set(FUNC(jpmsys5v_state::a0_tx_w)); + m_acia6850[0]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD("acia6850_1", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5v_state, a1_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5v_state, acia_irq)) + ACIA6850(config, m_acia6850[1], 0); + m_acia6850[1]->txd_handler().set(FUNC(jpmsys5v_state::a1_tx_w)); + m_acia6850[1]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<1>)); - MCFG_DEVICE_ADD("acia6850_2", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5v_state, a2_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5v_state, acia_irq)) + ACIA6850(config, m_acia6850[2], 0); + m_acia6850[2]->txd_handler().set(FUNC(jpmsys5v_state::a2_tx_w)); + m_acia6850[2]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<2>)); - MCFG_DEVICE_ADD("acia_clock", CLOCK, 10000) // What are the correct ACIA clocks ? - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia6850_0", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_0", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 10000)); // What are the correct ACIA clocks ? + acia_clock.signal_handler().set(m_acia6850[0], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[0], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_rxc)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -807,29 +805,30 @@ void jpmsys5_state::machine_reset() // later (incompatible with earlier revision) motherboards used a YM2413 MACHINE_CONFIG_START(jpmsys5_state::jpmsys5_ym) - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(8'000'000)) + M68000(config, m_maincpu, 8_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &jpmsys5_state::m68000_awp_map); - MCFG_DEVICE_PROGRAM_MAP(m68000_awp_map) + INPUT_MERGER_ANY_HIGH(config, "acia_irq").output_handler().set_inputline(m_maincpu, INT_6850ACIA); - MCFG_DEVICE_ADD("acia6850_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a0_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) + ACIA6850(config, m_acia6850[0], 0); + m_acia6850[0]->txd_handler().set(FUNC(jpmsys5_state::a0_tx_w)); + m_acia6850[0]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<0>)); - MCFG_DEVICE_ADD("acia6850_1", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a1_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) + ACIA6850(config, m_acia6850[1], 0); + m_acia6850[1]->txd_handler().set(FUNC(jpmsys5_state::a1_tx_w)); + m_acia6850[1]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<1>)); - MCFG_DEVICE_ADD("acia6850_2", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a2_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) + ACIA6850(config, m_acia6850[2], 0); + m_acia6850[2]->txd_handler().set(FUNC(jpmsys5_state::a2_tx_w)); + m_acia6850[2]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<2>)); - MCFG_DEVICE_ADD("acia_clock", CLOCK, 10000) // What are the correct ACIA clocks ? - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia6850_0", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_0", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 10000)); // What are the correct ACIA clocks ? + acia_clock.signal_handler().set(m_acia6850[0], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[0], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_rxc)); MCFG_NVRAM_ADD_0FILL("nvram") MCFG_S16LF01_ADD("vfd",0) @@ -864,28 +863,30 @@ MACHINE_CONFIG_END // the first rev PCB used an SAA1099 MACHINE_CONFIG_START(jpmsys5_state::jpmsys5) - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(8'000'000)) - MCFG_DEVICE_PROGRAM_MAP(m68000_awp_map_saa) - - MCFG_DEVICE_ADD("acia6850_0", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a0_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) - - MCFG_DEVICE_ADD("acia6850_1", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a1_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) - - MCFG_DEVICE_ADD("acia6850_2", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(*this, jpmsys5_state, a2_tx_w)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, jpmsys5_state, acia_irq)) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, 10000) // What are the correct ACIA clocks ? - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia6850_0", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_0", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_1", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia6850_2", acia6850_device, write_rxc)) + M68000(config, m_maincpu, 8_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &jpmsys5_state::m68000_awp_map_saa); + + INPUT_MERGER_ANY_HIGH(config, "acia_irq").output_handler().set_inputline(m_maincpu, INT_6850ACIA); + + ACIA6850(config, m_acia6850[0], 0); + m_acia6850[0]->txd_handler().set(FUNC(jpmsys5_state::a0_tx_w)); + m_acia6850[0]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<0>)); + + ACIA6850(config, m_acia6850[1], 0); + m_acia6850[1]->txd_handler().set(FUNC(jpmsys5_state::a1_tx_w)); + m_acia6850[1]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<1>)); + + ACIA6850(config, m_acia6850[2], 0); + m_acia6850[2]->txd_handler().set(FUNC(jpmsys5_state::a2_tx_w)); + m_acia6850[2]->irq_handler().set("acia_irq", FUNC(input_merger_device::in_w<2>)); + + clock_device &acia_clock(CLOCK(config, "acia_clock", 10000)); // What are the correct ACIA clocks ? + acia_clock.signal_handler().set(m_acia6850[0], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[0], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[1], FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append(m_acia6850[2], FUNC(acia6850_device::write_rxc)); MCFG_NVRAM_ADD_0FILL("nvram") MCFG_S16LF01_ADD("vfd",0) diff --git a/src/mame/drivers/kaypro.cpp b/src/mame/drivers/kaypro.cpp index 9bf3fb191ce..24ec3ce48bf 100644 --- a/src/mame/drivers/kaypro.cpp +++ b/src/mame/drivers/kaypro.cpp @@ -226,25 +226,25 @@ MACHINE_CONFIG_START(kaypro_state::kayproii) /* devices */ MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) - MCFG_DEVICE_ADD("kbd", KAYPRO_10_KEYBOARD, 0) - MCFG_KAYPRO10KBD_RXD_CB(WRITELINE("sio", z80sio_device, rxb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, syncb_w)) + kaypro_10_keyboard_device &kbd(KAYPRO_10_KEYBOARD(config, "kbd")); + kbd.rxd_cb().set("sio", FUNC(z80sio_device::rxb_w)); + kbd.rxd_cb().append("sio", FUNC(z80sio_device::syncb_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, kaypro_state, write_centronics_busy)) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("serial", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, synca_w)) // TODO: confirm this is connected - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("sio", z80sio_device, dcda_w)) + rs232_port_device &serial(RS232_PORT(config, "serial", default_rs232_devices, nullptr)); + serial.rxd_handler().set("sio", FUNC(z80sio_device::rxa_w)); + serial.rxd_handler().append("sio", FUNC(z80sio_device::synca_w)); // TODO: confirm this is connected + serial.cts_handler().set("sio", FUNC(z80sio_device::ctsa_w)); + serial.dcd_handler().set("sio", FUNC(z80sio_device::dcda_w)); - MCFG_DEVICE_ADD("brg", COM8116, XTAL(5'068'800)) // WD1943, SMC8116 - MCFG_COM8116_FT_HANDLER(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_COM8116_FR_HANDLER(WRITELINE("sio", z80sio_device, rxtxcb_w)) + com8116_device &brg(COM8116(config, "brg", XTAL(5'068'800))); // WD1943, SMC8116 + brg.ft_handler().set("sio", FUNC(z80sio_device::rxca_w)); + brg.ft_handler().append("sio", FUNC(z80sio_device::txca_w)); + brg.fr_handler().set("sio", FUNC(z80sio_device::rxtxcb_w)); MCFG_DEVICE_ADD("z80pio_g", Z80PIO, 20_MHz_XTAL / 8) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) @@ -322,28 +322,27 @@ MACHINE_CONFIG_START(kaypro_state::kaypro484) MCFG_QUICKLOAD_ADD("quickload", kaypro_state, kaypro, "com,cpm", 3) - MCFG_DEVICE_ADD("kbd", KAYPRO_10_KEYBOARD, 0) - MCFG_KAYPRO10KBD_RXD_CB(WRITELINE("sio_1", z80sio_device, rxb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio_1", z80sio_device, syncb_w)) + kaypro_10_keyboard_device &kbd(KAYPRO_10_KEYBOARD(config, "kbd")); + kbd.rxd_cb().set("sio_1", FUNC(z80sio_device::rxb_w)); + kbd.rxd_cb().append("sio_1", FUNC(z80sio_device::syncb_w)); - MCFG_CLOCK_ADD("kbdtxrxc", 4800) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio_1", z80sio_device, rxtxcb_w)) + CLOCK(config, "kbdtxrxc", 4800).signal_handler().set("sio_1", FUNC(z80sio_device::rxtxcb_w)); MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, kaypro_state, write_centronics_busy)) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_DEVICE_ADD("modem", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("sio_1", z80sio_device, rxa_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio_1", z80sio_device, synca_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio_1", z80sio_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("sio_1", z80sio_device, dcda_w)) + rs232_port_device &modem(RS232_PORT(config, "modem", default_rs232_devices, nullptr)); + modem.rxd_handler().set("sio_1", FUNC(z80sio_device::rxa_w)); + modem.rxd_handler().append("sio_1", FUNC(z80sio_device::synca_w)); + modem.cts_handler().set("sio_1", FUNC(z80sio_device::ctsa_w)); + modem.dcd_handler().set("sio_1", FUNC(z80sio_device::dcda_w)); - MCFG_DEVICE_ADD("serprn", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("sio_2", z80sio_device, rxa_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio_2", z80sio_device, synca_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio_2", z80sio_device, ctsa_w)) + rs232_port_device &serprn(RS232_PORT(config, "serprn", default_rs232_devices, nullptr)); + serprn.rxd_handler().set("sio_2", FUNC(z80sio_device::rxa_w)); + serprn.rxd_handler().append("sio_2", FUNC(z80sio_device::synca_w)); + serprn.cts_handler().set("sio_2", FUNC(z80sio_device::ctsa_w)); MCFG_DEVICE_ADD("sio_1", Z80SIO, 16_MHz_XTAL / 4) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // FIXME: use a combiner @@ -356,11 +355,11 @@ MACHINE_CONFIG_START(kaypro_state::kaypro484) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // FIXME: use a combiner MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("serprn", rs232_port_device, write_txd)) - MCFG_DEVICE_ADD("brg", COM8116, XTAL(5'068'800)) // WD1943, SMC8116 - MCFG_COM8116_FR_HANDLER(WRITELINE("sio_1", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio_1", z80sio_device, txca_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE("sio_2", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio_2", z80sio_device, txca_w)) + com8116_device &brg(COM8116(config, "brg", XTAL(5'068'800))); // WD1943, SMC8116 + brg.fr_handler().set("sio_1", FUNC(z80sio_device::rxca_w)); + brg.fr_handler().append("sio_1", FUNC(z80sio_device::txca_w)); + brg.ft_handler().set("sio_2", FUNC(z80sio_device::rxca_w)); + brg.ft_handler().append("sio_2", FUNC(z80sio_device::txca_w)); MCFG_DEVICE_ADD("fdc", FD1793, 16_MHz_XTAL / 16) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, kaypro_state, fdc_intrq_w)) diff --git a/src/mame/drivers/kdt6.cpp b/src/mame/drivers/kdt6.cpp index 8aeb0c48814..9be939079ad 100644 --- a/src/mame/drivers/kdt6.cpp +++ b/src/mame/drivers/kdt6.cpp @@ -654,41 +654,41 @@ MACHINE_CONFIG_START(kdt6_state::psi98) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(*this, kdt6_state, io_w)) // jumper J3 allows selection of 16MHz / 8 instead - MCFG_CLOCK_ADD("uart_clk", XTAL(9'830'400) / 8) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc1", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc1", z80ctc_device, trg2)) - - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, txca_w)) - - MCFG_DEVICE_ADD("ctc2", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("speaker", speaker_sound_device, level_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc2", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(16'000'000) / 4) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs232a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE(*this, kdt6_state, siob_tx_w)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs232b", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("sio", z80sio_device, dcda_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("sio", z80sio_device, synca_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) MCFG_DEVCB_XOR(1) - - MCFG_DEVICE_ADD("rs232b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(*this, kdt6_state, rs232b_rx_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("sio", z80sio_device, dcdb_w)) - MCFG_RS232_DSR_HANDLER(WRITELINE("sio", z80sio_device, syncb_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsb_w)) MCFG_DEVCB_XOR(1) + clock_device &uart_clk(CLOCK(config, "uart_clk", XTAL(9'830'400) / 8)); + uart_clk.signal_handler().set("ctc1", FUNC(z80ctc_device::trg1)); + uart_clk.signal_handler().append("ctc1", FUNC(z80ctc_device::trg2)); + + z80ctc_device &ctc1(Z80CTC(config, "ctc1", XTAL(16'000'000) / 4)); + ctc1.intr_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + ctc1.zc_callback<1>().set(m_sio, FUNC(z80sio_device::rxtxcb_w)); + ctc1.zc_callback<2>().set(m_sio, FUNC(z80sio_device::rxca_w)); + ctc1.zc_callback<2>().append(m_sio, FUNC(z80sio_device::txca_w)); + + z80ctc_device &ctc2(Z80CTC(config, "ctc2", XTAL(16'000'000) / 4)); + ctc2.intr_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + ctc2.zc_callback<0>().set("speaker", FUNC(speaker_sound_device::level_w)); + ctc2.zc_callback<2>().set("ctc2", FUNC(z80ctc_device::trg3)); + + Z80SIO(config, m_sio, XTAL(16'000'000) / 4); + m_sio->out_int_callback().set_inputline(m_cpu, INPUT_LINE_IRQ0); + m_sio->out_txda_callback().set("rs232a", FUNC(rs232_port_device::write_txd)); + m_sio->out_dtra_callback().set("rs232a", FUNC(rs232_port_device::write_dtr)); + m_sio->out_rtsa_callback().set("rs232a", FUNC(rs232_port_device::write_rts)); + m_sio->out_txdb_callback().set(FUNC(kdt6_state::siob_tx_w)); + m_sio->out_dtrb_callback().set(m_rs232b, FUNC(rs232_port_device::write_dtr)); + m_sio->out_rtsb_callback().set(m_rs232b, FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, nullptr)); + rs232a.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)); + rs232a.dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)); + rs232a.dsr_handler().set(m_sio, FUNC(z80sio_device::synca_w)); + rs232a.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)).invert(); + + RS232_PORT(config, m_rs232b, default_rs232_devices, nullptr); + m_rs232b->rxd_handler().set(FUNC(kdt6_state::rs232b_rx_w)); + m_rs232b->dcd_handler().set(m_sio, FUNC(z80sio_device::dcdb_w)); + m_rs232b->dsr_handler().set(m_sio, FUNC(z80sio_device::syncb_w)); + m_rs232b->cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w)).invert(); MCFG_DEVICE_ADD("pio", Z80PIO, XTAL(16'000'000) / 4) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/kingobox.cpp b/src/mame/drivers/kingobox.cpp index 5f7ff56bf8c..7244289575e 100644 --- a/src/mame/drivers/kingobox.cpp +++ b/src/mame/drivers/kingobox.cpp @@ -465,28 +465,27 @@ void kingofb_state::machine_reset() MACHINE_CONFIG_START(kingofb_state::kingofb) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(kingobox_map) + Z80(config, m_maincpu, 4000000); // 4.0 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &kingofb_state::kingobox_map); - MCFG_DEVICE_ADD("video", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(kingobox_video_map) + Z80(config, m_video_cpu, 4000000); // 4.0 MHz + m_video_cpu->set_addrmap(AS_PROGRAM, &kingofb_state::kingobox_video_map); - MCFG_DEVICE_ADD("sprite", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(kingobox_sprite_map) + Z80(config, m_sprite_cpu, 4000000); // 4.0 MHz + m_sprite_cpu->set_addrmap(AS_PROGRAM, &kingofb_state::kingobox_sprite_map); - MCFG_INPUT_MERGER_ALL_HIGH("nmigate") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("video", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sprite", INPUT_LINE_NMI)) + INPUT_MERGER_ALL_HIGH(config, m_nmigate); + m_nmigate->output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_nmigate->output_handler().append_inputline(m_video_cpu, INPUT_LINE_NMI); + m_nmigate->output_handler().append_inputline(m_sprite_cpu, INPUT_LINE_NMI); - MCFG_DEVICE_ADD("audiocpu", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(kingobox_sound_map) - MCFG_DEVICE_IO_MAP(kingobox_sound_io_map) + Z80(config, m_audiocpu, 4000000); // 4.0 MHz + m_audiocpu->set_addrmap(AS_PROGRAM, &kingofb_state::kingobox_sound_map); + m_audiocpu->set_addrmap(AS_IO, &kingofb_state::kingobox_sound_io_map); - MCFG_DEVICE_ADD("soundnmi", CLOCK, 6000) /* Hz */ - MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + CLOCK(config, "soundnmi", 6000).signal_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI); - MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* We really need heavy synching among the processors */ + MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // We really need heavy synching among the processors /* video hardware */ @@ -524,28 +523,27 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(kingofb_state::ringking) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(ringking_map) + Z80(config, m_maincpu, 4000000); // 4.0 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &kingofb_state::ringking_map); - MCFG_DEVICE_ADD("video", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(ringking_video_map) + Z80(config, m_video_cpu, 4000000); // 4.0 MHz + m_video_cpu->set_addrmap(AS_PROGRAM, &kingofb_state::ringking_video_map); - MCFG_DEVICE_ADD("sprite", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(ringking_sprite_map) + Z80(config, m_sprite_cpu, 4000000); // 4.0 MHz + m_sprite_cpu->set_addrmap(AS_PROGRAM, &kingofb_state::ringking_sprite_map); - MCFG_INPUT_MERGER_ALL_HIGH("nmigate") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("video", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sprite", INPUT_LINE_NMI)) + INPUT_MERGER_ALL_HIGH(config, m_nmigate); + m_nmigate->output_handler().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_nmigate->output_handler().append_inputline(m_video_cpu, INPUT_LINE_NMI); + m_nmigate->output_handler().append_inputline(m_sprite_cpu, INPUT_LINE_NMI); - MCFG_DEVICE_ADD("audiocpu", Z80, 4000000) /* 4.0 MHz */ - MCFG_DEVICE_PROGRAM_MAP(kingobox_sound_map) - MCFG_DEVICE_IO_MAP(ringking_sound_io_map) + Z80(config, m_audiocpu, 4000000); // 4.0 MHz + m_audiocpu->set_addrmap(AS_PROGRAM, &kingofb_state::kingobox_sound_map); + m_audiocpu->set_addrmap(AS_IO, &kingofb_state::ringking_sound_io_map); - MCFG_DEVICE_ADD("soundnmi", CLOCK, 6000) /* Hz */ - MCFG_CLOCK_SIGNAL_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + CLOCK(config, "soundnmi", 6000).signal_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI); - MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* We really need heavy synching among the processors */ + MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // We really need heavy synching among the processors /* video hardware */ diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp index 2115fc25dd7..8a40c968940 100644 --- a/src/mame/drivers/kinst.cpp +++ b/src/mame/drivers/kinst.cpp @@ -727,9 +727,8 @@ MACHINE_CONFIG_START(kinst_state::kinst) MCFG_DEVICE_PROGRAM_MAP(main_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", kinst_state, irq0_start) - MCFG_ATA_INTERFACE_ADD("ata", ata_devices, "hdd", nullptr, true) - MCFG_ATA_INTERFACE_IRQ_HANDLER(INPUTLINE(m_maincpu, 1)) + MCFG_ATA_INTERFACE_IRQ_HANDLER(INPUTLINE("maincpu", 1)) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/konin.cpp b/src/mame/drivers/konin.cpp index 82e0a43ec90..07671e183ce 100644 --- a/src/mame/drivers/konin.cpp +++ b/src/mame/drivers/konin.cpp @@ -141,24 +141,24 @@ MACHINE_CONFIG_START(konin_state::konin) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("intlatch", i8212_device, inta_cb) MCFG_DEVICE_ADD("intlatch", I8212, 0) - MCFG_I8212_MD_CALLBACK(GND) + MCFG_I8212_MD_CALLBACK(CONSTANT(0)) MCFG_I8212_DI_CALLBACK(READ8("picu", i8214_device, vector_r)) MCFG_I8212_INT_CALLBACK(INPUTLINE("maincpu", I8085_INTR_LINE)) MCFG_DEVICE_ADD("picu", I8214, XTAL(4'000'000)) MCFG_I8214_INT_CALLBACK(WRITELINE("intlatch", i8212_device, stb_w)) - MCFG_DEVICE_ADD("mainpit", PIT8253, 0) + pit8253_device &mainpit(PIT8253(config, "mainpit", 0)); // wild guess at UART clock and source - MCFG_PIT8253_CLK0(1536000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + mainpit.set_clk<0>(1536000); + mainpit.out_handler<0>().set("uart", FUNC(i8251_device::write_txc)); + mainpit.out_handler<0>().append("uart", FUNC(i8251_device::write_rxc)); - MCFG_DEVICE_ADD("mainppi", I8255, 0) + I8255(config, "mainppi", 0); - MCFG_DEVICE_ADD("iopit", PIT8253, 0) + PIT8253(config, m_iopit, 0); - MCFG_DEVICE_ADD("ioppi", I8255, 0) + I8255(config, m_ioppi, 0); MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/kopunch.cpp b/src/mame/drivers/kopunch.cpp index 8fbacc46d01..249bcd57a5a 100644 --- a/src/mame/drivers/kopunch.cpp +++ b/src/mame/drivers/kopunch.cpp @@ -247,24 +247,24 @@ MACHINE_CONFIG_START(kopunch_state::kopunch) MCFG_I8255_IN_PORTB_CB(READ8(*this, kopunch_state, sensors1_r)) MCFG_I8255_IN_PORTC_CB(READ8(*this, kopunch_state, sensors2_r)) - MCFG_DEVICE_ADD("ppi8255_1", I8255A, 0) + i8255_device &ppi1(I8255A(config, "ppi8255_1", 0)); // $34 - always $80 (PPI mode 0, ports A & B & C as output) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, kopunch_state, coin_w)) - MCFG_I8255_OUT_PORTB_CB(LOGGER("PPI8255 - unmapped write port B")) - MCFG_I8255_OUT_PORTC_CB(LOGGER("PPI8255 - unmapped write port C")) + ppi1.out_pa_callback().set(FUNC(kopunch_state::coin_w)); + ppi1.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ppi1.out_pc_callback().set_log("PPI8255 - unmapped write port C"); - MCFG_DEVICE_ADD("ppi8255_2", I8255A, 0) + i8255_device &ppi2(I8255A(config, "ppi8255_2", 0)); // $38 - always $89 (PPI mode 0, ports A & B as output, port C as input) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, kopunch_state, lamp_w)) - MCFG_I8255_OUT_PORTB_CB(LOGGER("PPI8255 - unmapped write port B")) - MCFG_I8255_IN_PORTC_CB(IOPORT("DSW")) + ppi2.out_pa_callback().set(FUNC(kopunch_state::lamp_w)); + ppi2.out_pb_callback().set_log("PPI8255 - unmapped write port B"); + ppi2.in_pc_callback().set_ioport("DSW"); - MCFG_DEVICE_ADD("ppi8255_3", I8255A, 0) + i8255_device &ppi3(I8255A(config, "ppi8255_3", 0)); // $3c - always $88 (PPI mode 0, ports A & B & lower C as output, upper C as input) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, kopunch_state, scroll_x_w)) - MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, kopunch_state, scroll_y_w)) - MCFG_I8255_IN_PORTC_CB(IOPORT("P2")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, kopunch_state, gfxbank_w)) + ppi3.out_pa_callback().set(FUNC(kopunch_state::scroll_x_w)); + ppi3.out_pb_callback().set(FUNC(kopunch_state::scroll_y_w)); + ppi3.in_pc_callback().set_ioport("P2"); + ppi3.out_pc_callback().set(FUNC(kopunch_state::gfxbank_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/kyugo.cpp b/src/mame/drivers/kyugo.cpp index c4174157658..49f42ac102e 100644 --- a/src/mame/drivers/kyugo.cpp +++ b/src/mame/drivers/kyugo.cpp @@ -534,10 +534,10 @@ MACHINE_CONFIG_START(kyugo_state::kyugo_base) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, kyugo_state, nmi_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, kyugo_state, flipscreen_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set(FUNC(kyugo_state::nmi_mask_w)); + mainlatch.q_out_cb<1>().set(FUNC(kyugo_state::flipscreen_w)); + mainlatch.q_out_cb<2>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/liberatr.cpp b/src/mame/drivers/liberatr.cpp index 9cff2742c9e..9ed5915adc9 100644 --- a/src/mame/drivers/liberatr.cpp +++ b/src/mame/drivers/liberatr.cpp @@ -429,15 +429,15 @@ MACHINE_CONFIG_START(liberatr_state::liberatr) MCFG_DEVICE_ADD("earom", ER2055, 0) - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // START LED1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // START LED2 - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // TBSWP - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(NOOP) // SPARE - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, liberatr_state, trackball_reset_w)) // CTRLD - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, liberatr_state, coin_counter_right_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, liberatr_state, coin_counter_left_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, liberatr_state, planet_select_w)) + LS259(config, m_outlatch); + m_outlatch->q_out_cb<0>().set_output("led0").invert(); // START LED1 + m_outlatch->q_out_cb<1>().set_output("led1").invert(); // START LED2 + m_outlatch->q_out_cb<2>().set_nop(); // TBSWP + m_outlatch->q_out_cb<3>().set_nop(); // SPARE + m_outlatch->q_out_cb<4>().set(FUNC(liberatr_state::trackball_reset_w)); // CTRLD + m_outlatch->q_out_cb<5>().set(FUNC(liberatr_state::coin_counter_right_w)); + m_outlatch->q_out_cb<6>().set(FUNC(liberatr_state::coin_counter_left_w)); + m_outlatch->q_out_cb<7>().set([this] (int state) { m_planet_select = state; }); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/m24.cpp b/src/mame/drivers/m24.cpp index 0b494adce18..4dc916ddf52 100644 --- a/src/mame/drivers/m24.cpp +++ b/src/mame/drivers/m24.cpp @@ -297,7 +297,7 @@ MACHINE_CONFIG_START(m24_state::olivetti) MCFG_DEVICE_MODIFY("mb:dma8237") MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, m24_state, dma_hrq_w)) MCFG_DEVICE_MODIFY("mb:pic8259") - devcb = &downcast(*device).set_out_int_callback(DEVCB_WRITELINE(*this, m24_state, int_w)); + downcast(*device).set_out_int_callback(DEVCB_WRITELINE(*this, m24_state, int_w)); /* software lists */ MCFG_SOFTWARE_LIST_ADD("disk_list","ibm5150") diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp index a4287e8e44a..d39720ed3b3 100644 --- a/src/mame/drivers/m79152pc.cpp +++ b/src/mame/drivers/m79152pc.cpp @@ -144,9 +144,9 @@ MACHINE_CONFIG_START(m79152pc_state::m79152pc) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_m79152pc) MCFG_PALETTE_ADD_MONOCHROME("palette") - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", z80sio_device, rxca_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set(m_uart, FUNC(z80sio_device::txca_w)); + uart_clock.signal_handler().append(m_uart, FUNC(z80sio_device::rxca_w)); MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'000'000)) //MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/magmax.cpp b/src/mame/drivers/magmax.cpp index 65cb698f624..726d2219e8b 100644 --- a/src/mame/drivers/magmax.cpp +++ b/src/mame/drivers/magmax.cpp @@ -366,9 +366,9 @@ MACHINE_CONFIG_START(magmax_state::magmax) MCFG_DEVICE_ADD(m_ay[2], AY8910, XTAL(20'000'000)/16) /* verified on pcb */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40) - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, 0)) - MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); + m_soundlatch->set_separate_acknowledge(true); MACHINE_CONFIG_END diff --git a/src/mame/drivers/mappy.cpp b/src/mame/drivers/mappy.cpp index 58cf22ed556..6c948e7a9b3 100644 --- a/src/mame/drivers/mappy.cpp +++ b/src/mame/drivers/mappy.cpp @@ -1333,22 +1333,21 @@ MACHINE_CONFIG_START(mappy_state::superpac_common) MCFG_DEVICE_ADD("sub", MC6809E, PIXEL_CLOCK/4) /* 1.536 MHz */ MCFG_DEVICE_PROGRAM_MAP(superpac_cpu2_map) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 2M on CPU board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, mappy_state, int_on_2_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, mappy_state, int_on_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("namco", namco_15xx_device, sound_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("namcoio_1", namcoio_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namcoio_2", namcoio_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); // 2M on CPU board + mainlatch.q_out_cb<0>().set(FUNC(mappy_state::int_on_2_w)); + mainlatch.q_out_cb<1>().set(FUNC(mappy_state::int_on_w)); + mainlatch.q_out_cb<3>().set(m_namco_15xx, FUNC(namco_15xx_device::sound_enable_w)); + mainlatch.q_out_cb<4>().set(m_namcoio[0], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<4>().append(m_namcoio[1], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<5>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); MCFG_WATCHDOG_ADD("watchdog") 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_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per frame - an high value to ensure proper synchronization of the CPUs - MCFG_DEVICE_ADD("dipmux", LS157, 0) - MCFG_74157_A_IN_CB(IOPORT("DSW2")) - MCFG_74157_B_IN_CB(IOPORT("DSW2")) MCFG_DEVCB_RSHIFT(4) + ls157_device &dipmux(LS157(config, "dipmux")); + dipmux.a_in_callback().set_ioport("DSW2"); + dipmux.b_in_callback().set_ioport("DSW2").rshift(4); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superpac) @@ -1373,60 +1372,60 @@ MACHINE_CONFIG_START(mappy_state::superpac_common) MACHINE_CONFIG_END -MACHINE_CONFIG_START(mappy_state::superpac) - +void mappy_state::superpac(machine_config &config) +{ superpac_common(config); - MCFG_DEVICE_ADD("namcoio_1", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("BUTTONS")) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO56XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(mappy_state::pacnpal) + NAMCO_56XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + + NAMCO_56XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); +} +void mappy_state::pacnpal(machine_config &config) +{ superpac_common(config); - MCFG_DEVICE_ADD("namcoio_1", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("BUTTONS")) - MCFG_NAMCO56XX_OUT_0_CB(WRITE8(*this, mappy_state, out_lamps)) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_59XX, 0) - MCFG_NAMCO59XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO59XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO59XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO59XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO59XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) -MACHINE_CONFIG_END + NAMCO_56XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + m_namcoio[0]->out_callback<0>().set(FUNC(mappy_state::out_lamps)); + + NAMCO_59XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); +} MACHINE_CONFIG_START(mappy_state::grobda) superpac_common(config); - MCFG_DEVICE_ADD("namcoio_1", NAMCO_58XX, 0) - MCFG_NAMCO58XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO58XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO58XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO58XX_IN_3_CB(IOPORT("BUTTONS")) + NAMCO_58XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); - MCFG_DEVICE_ADD("namcoio_2", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO56XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) + NAMCO_56XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); /* sound hardware */ MCFG_DEVICE_ADD("dac", DAC_4BIT_BINARY_WEIGHTED, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.275) // alternate route to 15XX-related DAC? @@ -1447,36 +1446,36 @@ MACHINE_CONFIG_START(mappy_state::phozon) MCFG_DEVICE_ADD("sub2", MC6809E, PIXEL_CLOCK/4) /* SUB CPU */ MCFG_DEVICE_PROGRAM_MAP(phozon_cpu3_map) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 5C - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, mappy_state, int_on_2_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, mappy_state, int_on_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, mappy_state, int_on_3_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("namco", namco_15xx_device, sound_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("namcoio_1", namco58xx_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namcoio_2", namco56xx_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); // 5C + mainlatch.q_out_cb<0>().set(FUNC(mappy_state::int_on_2_w)); + mainlatch.q_out_cb<1>().set(FUNC(mappy_state::int_on_w)); + mainlatch.q_out_cb<2>().set(FUNC(mappy_state::int_on_3_w)); + mainlatch.q_out_cb<3>().set(m_namco_15xx, FUNC(namco_15xx_device::sound_enable_w)); + mainlatch.q_out_cb<4>().set(m_namcoio[0], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<4>().append(m_namcoio[1], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<5>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<6>().set_inputline(m_subcpu2, INPUT_LINE_RESET).invert(); MCFG_WATCHDOG_ADD("watchdog") 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_DEVICE_ADD("namcoio_1", NAMCO_58XX, 0) - MCFG_NAMCO58XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO58XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO58XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO58XX_IN_3_CB(IOPORT("BUTTONS")) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO56XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) - - MCFG_DEVICE_ADD("dipmux", LS157, 0) - MCFG_74157_A_IN_CB(IOPORT("DSW2")) - MCFG_74157_B_IN_CB(IOPORT("DSW2")) MCFG_DEVCB_RSHIFT(4) + MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per frame - an high value to ensure proper synchronization of the CPUs + + NAMCO_58XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + + NAMCO_56XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); + + ls157_device &dipmux(LS157(config, "dipmux")); + dipmux.a_in_callback().set_ioport("DSW2"); + dipmux.b_in_callback().set_ioport("DSW2").rshift(4); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_phozon) @@ -1510,23 +1509,22 @@ MACHINE_CONFIG_START(mappy_state::mappy_common) MCFG_DEVICE_ADD("sub", MC6809E, PIXEL_CLOCK/4) /* 1.536 MHz */ MCFG_DEVICE_PROGRAM_MAP(mappy_cpu2_map) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 2M on CPU board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, mappy_state, int_on_2_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, mappy_state, int_on_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, mappy_state, mappy_flip_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("namco", namco_15xx_device, sound_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("namcoio_1", namcoio_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namcoio_2", namcoio_device, set_reset_line)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); // 2M on CPU board + mainlatch.q_out_cb<0>().set(FUNC(mappy_state::int_on_2_w)); + mainlatch.q_out_cb<1>().set(FUNC(mappy_state::int_on_w)); + mainlatch.q_out_cb<2>().set(FUNC(mappy_state::mappy_flip_w)); + mainlatch.q_out_cb<3>().set(m_namco_15xx, FUNC(namco_15xx_device::sound_enable_w)); + mainlatch.q_out_cb<4>().set(m_namcoio[0], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<4>().append(m_namcoio[1], FUNC(namcoio_device::set_reset_line)).invert(); + mainlatch.q_out_cb<5>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); MCFG_WATCHDOG_ADD("watchdog") 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_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per frame - an high value to ensure proper synchronization of the CPUs - MCFG_DEVICE_ADD("dipmux", LS157, 0) - MCFG_74157_A_IN_CB(IOPORT("DSW2")) - MCFG_74157_B_IN_CB(IOPORT("DSW2")) MCFG_DEVCB_RSHIFT(4) + ls157_device &dipmux(LS157(config, "dipmux")); + dipmux.a_in_callback().set_ioport("DSW2"); + dipmux.b_in_callback().set_ioport("DSW2").rshift(4); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mappy) @@ -1550,23 +1548,23 @@ MACHINE_CONFIG_START(mappy_state::mappy_common) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0) MACHINE_CONFIG_END -MACHINE_CONFIG_START(mappy_state::mappy) - +void mappy_state::mappy(machine_config &config) +{ mappy_common(config); - MCFG_DEVICE_ADD("namcoio_1", NAMCO_58XX, 0) - MCFG_NAMCO58XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO58XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO58XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO58XX_IN_3_CB(IOPORT("BUTTONS")) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_58XX, 0) - MCFG_NAMCO58XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO58XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO58XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO58XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO58XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) -MACHINE_CONFIG_END + NAMCO_58XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + + NAMCO_58XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); +} MACHINE_CONFIG_START(mappy_state::digdug2) @@ -1575,18 +1573,18 @@ MACHINE_CONFIG_START(mappy_state::digdug2) MCFG_WATCHDOG_MODIFY("watchdog") MCFG_WATCHDOG_VBLANK_INIT("screen", 0) - MCFG_DEVICE_ADD("namcoio_1", NAMCO_58XX, 0) - MCFG_NAMCO58XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO58XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO58XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO58XX_IN_3_CB(IOPORT("BUTTONS")) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO56XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) + NAMCO_58XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + + NAMCO_56XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); MACHINE_CONFIG_END MACHINE_CONFIG_START(mappy_state::todruaga) @@ -1598,24 +1596,24 @@ MACHINE_CONFIG_START(mappy_state::todruaga) MCFG_PALETTE_ENTRIES(64*4+64*16) MACHINE_CONFIG_END -MACHINE_CONFIG_START(mappy_state::motos) - +void mappy_state::motos(machine_config &config) +{ mappy_common(config); - MCFG_DEVICE_ADD("namcoio_1", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(IOPORT("COINS")) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("P1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("P2")) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("BUTTONS")) - MCFG_NAMCO56XX_OUT_0_CB(WRITE8(*this, mappy_state, out_lamps)) - - MCFG_DEVICE_ADD("namcoio_2", NAMCO_56XX, 0) - MCFG_NAMCO56XX_IN_0_CB(READ8("dipmux", ls157_device, output_r)) - MCFG_NAMCO56XX_IN_1_CB(IOPORT("DSW1")) - MCFG_NAMCO56XX_IN_2_CB(IOPORT("DSW1")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO56XX_IN_3_CB(IOPORT("DSW0")) - MCFG_NAMCO56XX_OUT_0_CB(WRITELINE("dipmux", ls157_device, select_w)) MCFG_DEVCB_BIT(0) -MACHINE_CONFIG_END + NAMCO_56XX(config, m_namcoio[0], 0); + m_namcoio[0]->in_callback<0>().set_ioport("COINS"); + m_namcoio[0]->in_callback<1>().set_ioport("P1"); + m_namcoio[0]->in_callback<2>().set_ioport("P2"); + m_namcoio[0]->in_callback<3>().set_ioport("BUTTONS"); + m_namcoio[0]->out_callback<0>().set(FUNC(mappy_state::out_lamps)); + + NAMCO_56XX(config, m_namcoio[1], 0); + m_namcoio[1]->in_callback<0>().set("dipmux", FUNC(ls157_device::output_r)); + m_namcoio[1]->in_callback<1>().set_ioport("DSW1"); + m_namcoio[1]->in_callback<2>().set_ioport("DSW1").rshift(4); + m_namcoio[1]->in_callback<3>().set_ioport("DSW0"); + m_namcoio[1]->out_callback<0>().set("dipmux", FUNC(ls157_device::select_w)).bit(0); +} diff --git a/src/mame/drivers/marineb.cpp b/src/mame/drivers/marineb.cpp index 2daba71e7d0..1e2bd737e4b 100644 --- a/src/mame/drivers/marineb.cpp +++ b/src/mame/drivers/marineb.cpp @@ -584,18 +584,18 @@ MACHINE_CONFIG_START(marineb_state::changes) MACHINE_CONFIG_END -MACHINE_CONFIG_START(marineb_state::springer) +void marineb_state::springer(machine_config &config) +{ marineb(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("outlatch") - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, marineb_state, flipscreen_y_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, marineb_state, flipscreen_x_w)) MCFG_DEVCB_INVERT + ls259_device &outlatch(*subdevice("outlatch")); + outlatch.q_out_cb<1>().set(FUNC(marineb_state::flipscreen_y_w)).invert(); + outlatch.q_out_cb<2>().set(FUNC(marineb_state::flipscreen_x_w)).invert(); /* video hardware */ - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(marineb_state, screen_update_springer) -MACHINE_CONFIG_END + subdevice("screen")->set_screen_update(FUNC(marineb_state::screen_update_springer)); +} MACHINE_CONFIG_START(marineb_state::hoccer) @@ -647,14 +647,15 @@ MACHINE_CONFIG_START(marineb_state::hopprobo) MACHINE_CONFIG_END -MACHINE_CONFIG_START(marineb_state::bcruzm12) +void marineb_state::bcruzm12(machine_config &config) +{ wanted(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("outlatch") - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, marineb_state, flipscreen_y_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, marineb_state, flipscreen_x_w)) MCFG_DEVCB_INVERT -MACHINE_CONFIG_END + ls259_device &outlatch(*subdevice("outlatch")); + outlatch.q_out_cb<1>().set(FUNC(marineb_state::flipscreen_y_w)).invert(); + outlatch.q_out_cb<2>().set(FUNC(marineb_state::flipscreen_x_w)).invert(); +} /*************************************************************************** diff --git a/src/mame/drivers/mbee.cpp b/src/mame/drivers/mbee.cpp index 9156369fe11..6324fe929b7 100644 --- a/src/mame/drivers/mbee.cpp +++ b/src/mame/drivers/mbee.cpp @@ -786,13 +786,13 @@ MACHINE_CONFIG_START(mbee_state::mbee56) MCFG_DEVICE_IO_MAP(mbee56_io) MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee56) - MCFG_DEVICE_ADD("fdc", WD2793, 4_MHz_XTAL / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, mbee_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, mbee_state, fdc_drq_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) + WD2793(config, m_fdc, 4_MHz_XTAL / 2); + m_fdc->intrq_wr_callback().set(FUNC(mbee_state::fdc_intrq_w)); + m_fdc->drq_wr_callback().set(FUNC(mbee_state::fdc_drq_w)); + m_fdc->enmf_rd_callback().set_constant(0); + MCFG_FLOPPY_DRIVE_ADD(m_floppy0, mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy1, mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END @@ -814,13 +814,13 @@ MACHINE_CONFIG_START(mbee_state::mbee128p) MCFG_DEVICE_IO_MAP(mbee128_io) MCFG_MACHINE_RESET_OVERRIDE(mbee_state, mbee128) - MCFG_DEVICE_ADD("fdc", WD2793, 4_MHz_XTAL / 2) - MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, mbee_state, fdc_intrq_w)) - MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, mbee_state, fdc_drq_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) + WD2793(config, m_fdc, 4_MHz_XTAL / 2); + m_fdc->intrq_wr_callback().set(FUNC(mbee_state::fdc_intrq_w)); + m_fdc->drq_wr_callback().set(FUNC(mbee_state::fdc_drq_w)); + m_fdc->enmf_rd_callback().set_constant(0); + MCFG_FLOPPY_DRIVE_ADD(m_floppy0, mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy1, mbee_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END @@ -833,9 +833,9 @@ MACHINE_CONFIG_START(mbee_state::mbee256) MCFG_DEVICE_REMOVE("fdc:0") MCFG_DEVICE_REMOVE("fdc:1") - MCFG_FLOPPY_DRIVE_ADD("fdc:0", mbee_floppies, "35dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy0, mbee_floppies, "35dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) - MCFG_FLOPPY_DRIVE_ADD("fdc:1", mbee_floppies, "35dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy1, mbee_floppies, "35dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) MACHINE_CONFIG_END diff --git a/src/mame/drivers/mc8020.cpp b/src/mame/drivers/mc8020.cpp index 22848299345..ac848e7c1f9 100644 --- a/src/mame/drivers/mc8020.cpp +++ b/src/mame/drivers/mc8020.cpp @@ -324,10 +324,10 @@ MACHINE_CONFIG_START(mc8020_state::mc8020) MCFG_DEVICE_ADD("ctc_clock", CLOCK, XTAL(2'457'600) / 64) // guess MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg2)) - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(2'457'600)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg0)) + z80ctc_device &ctc(Z80CTC(config, "ctc", XTAL(2'457'600))); + ctc.intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + ctc.zc_callback<2>().set("ctc", FUNC(z80ctc_device::trg1)); + ctc.zc_callback<2>().append("ctc", FUNC(z80ctc_device::trg0)); MACHINE_CONFIG_END diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp index 4244d12378e..6a12da64087 100644 --- a/src/mame/drivers/mc8030.cpp +++ b/src/mame/drivers/mc8030.cpp @@ -227,9 +227,9 @@ MACHINE_CONFIG_START(mc8030_state::mc8030) // ZC1: to SIO CLK CH B // ZC2: KMBG (??) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("asp_sio", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("asp_sio", z80sio_device, rxca_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("asp_sio", FUNC(z80sio_device::txca_w)); + uart_clock.signal_handler().append("asp_sio", FUNC(z80sio_device::rxca_w)); MCFG_DEVICE_ADD("asp_sio", Z80SIO, 4800) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/mccpm.cpp b/src/mame/drivers/mccpm.cpp index 49fb1a5e083..218a0f34a1d 100644 --- a/src/mame/drivers/mccpm.cpp +++ b/src/mame/drivers/mccpm.cpp @@ -87,9 +87,9 @@ MACHINE_CONFIG_START(mccpm_state::mccpm) MCFG_DEVICE_IO_MAP(mccpm_io) /* Devices */ - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxca_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txca_w)); + uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxca_w)); MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(4'000'000)) MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) diff --git a/src/mame/drivers/meritm.cpp b/src/mame/drivers/meritm.cpp index 05a6222e8da..7364dca26d3 100644 --- a/src/mame/drivers/meritm.cpp +++ b/src/mame/drivers/meritm.cpp @@ -1110,19 +1110,19 @@ MACHINE_CONFIG_START(meritm_state::crt250) MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, meritm_state, crt250_port_b_w)) // used LMP x DRIVE MCFG_I8255_IN_PORTC_CB(READ8(*this, meritm_state, _8255_port_c_r)) - MCFG_DEVICE_ADD(m_z80pio[0], Z80PIO, SYSTEM_CLK/6) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(m_maincpu, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(READ8(*this, meritm_state, audio_pio_port_a_r)) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(*this, meritm_state, audio_pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(READ8(*this, meritm_state, audio_pio_port_b_r)) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(*this, meritm_state, audio_pio_port_b_w)) - - MCFG_DEVICE_ADD(m_z80pio[1], Z80PIO, SYSTEM_CLK/6) - MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(m_maincpu, INPUT_LINE_IRQ0)) - MCFG_Z80PIO_IN_PA_CB(IOPORT("PIO1_PORTA")) - MCFG_Z80PIO_OUT_PA_CB(WRITE8(*this, meritm_state, io_pio_port_a_w)) - MCFG_Z80PIO_IN_PB_CB(IOPORT("PIO1_PORTB")) - MCFG_Z80PIO_OUT_PB_CB(WRITE8(*this, meritm_state, io_pio_port_b_w)) + Z80PIO(config, m_z80pio[0], SYSTEM_CLK/6); + m_z80pio[0]->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_z80pio[0]->in_pa_callback().set(FUNC(meritm_state::audio_pio_port_a_r)); + m_z80pio[0]->out_pa_callback().set(FUNC(meritm_state::audio_pio_port_a_w)); + m_z80pio[0]->in_pb_callback().set(FUNC(meritm_state::audio_pio_port_b_r)); + m_z80pio[0]->out_pb_callback().set(FUNC(meritm_state::audio_pio_port_b_w)); + + Z80PIO(config, m_z80pio[1], SYSTEM_CLK/6); + m_z80pio[1]->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_z80pio[1]->in_pa_callback().set_ioport("PIO1_PORTA"); + m_z80pio[1]->out_pa_callback().set(FUNC(meritm_state::io_pio_port_a_w)); + m_z80pio[1]->in_pb_callback().set_ioport("PIO1_PORTB"); + m_z80pio[1]->out_pb_callback().set(FUNC(meritm_state::io_pio_port_b_w)); MCFG_TIMER_DRIVER_ADD_SCANLINE("vblank_start", meritm_state, vblank_start_tick, "screen", 259, 262) MCFG_TIMER_DRIVER_ADD_SCANLINE("vblank_end", meritm_state, vblank_end_tick, "screen", 262, 262) diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp index 0a443478dcb..a5fb2376707 100644 --- a/src/mame/drivers/metro.cpp +++ b/src/mame/drivers/metro.cpp @@ -1146,7 +1146,7 @@ void metro_state::mouja_okimap(address_map &map) MCFG_DEVICE_ADD(_tag, PUZZLET_IO, 0) #define MCFG_PUZZLET_IO_DATA_CALLBACK(_devcb) \ - devcb = &puzzlet_io_device::set_data_cb(*device, DEVCB_##_devcb); + puzzlet_io_device::set_data_cb(*device, DEVCB_##_devcb); class puzzlet_io_device : public device_t { public: diff --git a/src/mame/drivers/mfabfz.cpp b/src/mame/drivers/mfabfz.cpp index f7f8120f55b..199af8b58ca 100644 --- a/src/mame/drivers/mfabfz.cpp +++ b/src/mame/drivers/mfabfz.cpp @@ -104,14 +104,14 @@ void mfabfz_state::machine_reset() MACHINE_CONFIG_START(mfabfz_state::mfabfz) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8085A, XTAL(4'000'000) / 2) - MCFG_DEVICE_PROGRAM_MAP(mfabfz_mem) - MCFG_DEVICE_IO_MAP(mfabfz_io) + I8085A(config, m_maincpu, 4_MHz_XTAL / 2); + m_maincpu->set_addrmap(AS_PROGRAM, &mfabfz_state::mfabfz_mem); + m_maincpu->set_addrmap(AS_IO, &mfabfz_state::mfabfz_io); // uart1 - terminal - clock hardware unknown - MCFG_DEVICE_ADD("uart1_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) + clock_device &uart1_clock(CLOCK(config, "uart1_clock", 153600)); + uart1_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart1_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart1", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) @@ -124,7 +124,7 @@ MACHINE_CONFIG_START(mfabfz_state::mfabfz) MCFG_RS232_CTS_HANDLER(WRITELINE("uart1", i8251_device, write_cts)) // uart2 - cassette - clock comes from 2MHz through a divider consisting of 4 chips and some jumpers. - MCFG_DEVICE_ADD("uart2", I8251, 0) + I8251(config, "uart2", 0); MACHINE_CONFIG_END static DEVICE_INPUT_DEFAULTS_START( terminal ) @@ -136,17 +136,20 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) DEVICE_INPUT_DEFAULTS_END -MACHINE_CONFIG_START(mfabfz_state::mfabfz85) +void mfabfz_state::mfabfz85(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8085A, XTAL(4'000'000) / 2) - MCFG_DEVICE_PROGRAM_MAP(mfabfz_mem) - MCFG_DEVICE_IO_MAP(mfabfz85_io) - MCFG_I8085A_SID(READLINE("rs232", rs232_port_device, rxd_r)) - MCFG_I8085A_SOD(WRITELINE("rs232", rs232_port_device, write_txd)) MCFG_DEVCB_INVERT - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) - MCFG_DEVICE_ADD("uart2", I8251, 0) -MACHINE_CONFIG_END + i8085a_cpu_device &maincpu(I8085A(config, m_maincpu, 4_MHz_XTAL / 2)); + maincpu.set_addrmap(AS_PROGRAM, &mfabfz_state::mfabfz_mem); + maincpu.set_addrmap(AS_IO, &mfabfz_state::mfabfz85_io); + maincpu.in_sid_func().set("rs232", FUNC(rs232_port_device::rxd_r)); + maincpu.out_sod_func().set("rs232", FUNC(rs232_port_device::write_txd)).invert(); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); + + I8251(config, "uart2", 0); +} /* ROM definition */ diff --git a/src/mame/drivers/mice.cpp b/src/mame/drivers/mice.cpp index 8d21d5c1fbd..b8ef71e8a19 100644 --- a/src/mame/drivers/mice.cpp +++ b/src/mame/drivers/mice.cpp @@ -181,12 +181,12 @@ MACHINE_CONFIG_START(mice_state::mice) MCFG_RS232_CTS_HANDLER(WRITELINE("uart", i8251_device, write_cts)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", mice_terminal) - MCFG_DEVICE_ADD("rpt", I8155, 6.144_MHz_XTAL / 2) - MCFG_I8155_IN_PORTC_CB(IOPORT("BAUD")) - MCFG_I8155_OUT_TIMEROUT_CB(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + i8155_device &rpt(I8155(config, "rpt", 6.144_MHz_XTAL / 2)); + rpt.in_pa_callback().set_ioport("BAUD"); + rpt.out_to_callback().set("uart", FUNC(i8251_device::write_txc)); + rpt.out_to_callback().append("uart", FUNC(i8251_device::write_rxc)); - MCFG_DEVICE_ADD("ppi", I8255, 0) + I8255(config, "ppi", 0); MACHINE_CONFIG_END MACHINE_CONFIG_START(mice_state::mice2) diff --git a/src/mame/drivers/micro3d.cpp b/src/mame/drivers/micro3d.cpp index bf0c61999c2..08768fc7b5c 100644 --- a/src/mame/drivers/micro3d.cpp +++ b/src/mame/drivers/micro3d.cpp @@ -322,9 +322,9 @@ MACHINE_CONFIG_START(micro3d_state::micro3d) MCFG_DEVICE_ADD("scc", SCC8530N, 32_MHz_XTAL / 2 / 2) MCFG_Z80SCC_OUT_TXDB_CB(WRITELINE("monitor_drmath", rs232_port_device, write_txd)) - MCFG_DEVICE_ADD("monitor_drmath", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("scc", z80scc_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("scc", z80scc_device, dcdb_w)) MCFG_DEVCB_XOR(1) + rs232_port_device &monitor_drmath(RS232_PORT(config, "monitor_drmath", default_rs232_devices, nullptr)); + monitor_drmath.rxd_handler().set("scc", FUNC(z80scc_device::rxb_w)); + monitor_drmath.dcd_handler().set("scc", FUNC(z80scc_device::dcdb_w)).exor(1); MCFG_DEVICE_ADD("audiocpu", I8051, 11.0592_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(soundmem_prg) diff --git a/src/mame/drivers/microdec.cpp b/src/mame/drivers/microdec.cpp index 65e0d88e879..4093dd1aae6 100644 --- a/src/mame/drivers/microdec.cpp +++ b/src/mame/drivers/microdec.cpp @@ -190,49 +190,48 @@ void microdec_state::init_microdec() membank("bankw0")->configure_entry(0, &main[0x1000]); } -MACHINE_CONFIG_START(microdec_state::microdec) +void microdec_state::microdec(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(16'000'000) / 4) - MCFG_DEVICE_PROGRAM_MAP(microdec_mem) - MCFG_DEVICE_IO_MAP(microdec_io) + Z80(config, m_maincpu, 16_MHz_XTAL / 4); + m_maincpu->set_addrmap(AS_PROGRAM, µdec_state::microdec_mem); + m_maincpu->set_addrmap(AS_IO, µdec_state::microdec_io); /* video hardware */ - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("uart1", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232a", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart1", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart1", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart1", i8251_device, write_cts)) - - MCFG_DEVICE_ADD("uart2", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232b", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("uart2", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart2", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart2", i8251_device, write_cts)) - - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_UPD765_INTRQ_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) - //MCFG_FLOPPY_DRIVE_ADD("fdc:1", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats) - //MCFG_FLOPPY_DRIVE_SOUND(true) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_rxc)); + + i8251_device &uart1(I8251(config, "uart1", 0)); + uart1.txd_handler().set("rs232a", FUNC(rs232_port_device::write_txd)); + uart1.dtr_handler().set("rs232a", FUNC(rs232_port_device::write_dtr)); + uart1.rts_handler().set("rs232a", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal")); + rs232a.rxd_handler().set("uart1", FUNC(i8251_device::write_rxd)); + rs232a.dsr_handler().set("uart1", FUNC(i8251_device::write_dsr)); + rs232a.cts_handler().set("uart1", FUNC(i8251_device::write_cts)); + + i8251_device &uart2(I8251(config, "uart2", 0)); + uart2.txd_handler().set("rs232b", FUNC(rs232_port_device::write_txd)); + uart2.dtr_handler().set("rs232b", FUNC(rs232_port_device::write_dtr)); + uart2.rts_handler().set("rs232b", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232b(RS232_PORT(config, "rs232b", default_rs232_devices, nullptr)); + rs232b.rxd_handler().set("uart2", FUNC(i8251_device::write_rxd)); + rs232b.dsr_handler().set("uart2", FUNC(i8251_device::write_dsr)); + rs232b.cts_handler().set("uart2", FUNC(i8251_device::write_cts)); + + UPD765A(config, m_fdc, true, true); + m_fdc->intrq_wr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + FLOPPY_CONNECTOR(config, "fdc:0", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats).enable_sound(true); + //FLOPPY_CONNECTOR(config, "fdc:1", microdec_floppies, "525hd", floppy_image_device::default_floppy_formats).enable_sound(true); // software lists - MCFG_SOFTWARE_LIST_ADD("flop_list", "md2_flop") -MACHINE_CONFIG_END + SOFTWARE_LIST(config, "flop_list").set_original("md2_flop"); +} /* ROM definition */ ROM_START( md2 ) diff --git a/src/mame/drivers/microkit.cpp b/src/mame/drivers/microkit.cpp index 312337dfcb7..a9ce30f7c92 100644 --- a/src/mame/drivers/microkit.cpp +++ b/src/mame/drivers/microkit.cpp @@ -125,7 +125,7 @@ MACHINE_CONFIG_START(microkit_state::microkit) MCFG_DEVICE_ADD("maincpu", CDP1802, 1750000) MCFG_DEVICE_PROGRAM_MAP(microkit_mem) MCFG_DEVICE_IO_MAP(microkit_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, microkit_state, clear_r)) /* video hardware */ diff --git a/src/mame/drivers/microterm.cpp b/src/mame/drivers/microterm.cpp index 8c12b71b689..d8e00c718d5 100644 --- a/src/mame/drivers/microterm.cpp +++ b/src/mame/drivers/microterm.cpp @@ -99,16 +99,15 @@ MACHINE_CONFIG_START(microterm_state::mt420) MCFG_DEVICE_PROGRAM_MAP(mt420_mem_map) MCFG_DEVICE_IO_MAP(mt420_io_map) - MCFG_DEVICE_ADD("duart", SCN2681, XTAL(3'686'400)) // MC2681 - MCFG_MC68681_IRQ_CALLBACK(INPUTLINE("maincpu", 0)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(3) + scn2681_device &duart(SCN2681(config, "duart", XTAL(3'686'400))); // MC2681 + duart.irq_cb().set_inputline(m_maincpu, 0); + duart.outport_cb().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(5); + duart.outport_cb().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + duart.outport_cb().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(3); - MCFG_DEVICE_ADD("aci", MC2661, XTAL(3'686'400)) // SCN2641 + MC2661(config, "aci", XTAL(3'686'400)); // SCN2641 - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_EEPROM_SERIAL_DO_CALLBACK(WRITELINE("duart", scn2681_device, ip6_w)) + EEPROM_SERIAL_93C46_16BIT(config, "eeprom").do_callback().set("duart", FUNC(scn2681_device::ip6_w)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL(9'877'680), 612, 0, 480, 269, 0, 250) @@ -128,20 +127,18 @@ MACHINE_CONFIG_START(microterm_state::mt5510) MCFG_DEVICE_PROGRAM_MAP(mt5510_mem_map) MCFG_DEVICE_IO_MAP(mt5510_io_map) - MCFG_DEVICE_ADD("duart", SCN2681, XTAL(3'686'400)) - MCFG_MC68681_IRQ_CALLBACK(INPUTLINE("maincpu", 0)) - MCFG_MC68681_OUTPORT_CALLBACK(WRITELINE("eeprom1", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom2", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom1", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom2", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom1", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(3) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom2", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(3) + scn2681_device &duart(SCN2681(config, "duart", XTAL(3'686'400))); + duart.irq_cb().set_inputline(m_maincpu, 0); + duart.outport_cb().set("eeprom1", FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + duart.outport_cb().append("eeprom2", FUNC(eeprom_serial_93cxx_device::di_write)).bit(5); + duart.outport_cb().append("eeprom1", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + duart.outport_cb().append("eeprom2", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + duart.outport_cb().append("eeprom1", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(3); + duart.outport_cb().append("eeprom2", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(3); - MCFG_DEVICE_ADD("eeprom1", EEPROM_SERIAL_93C46_16BIT) - MCFG_EEPROM_SERIAL_DO_CALLBACK(WRITELINE("duart", scn2681_device, ip6_w)) + EEPROM_SERIAL_93C46_16BIT(config, "eeprom1").do_callback().set("duart", FUNC(scn2681_device::ip6_w)); - MCFG_DEVICE_ADD("eeprom2", EEPROM_SERIAL_93C46_16BIT) - MCFG_EEPROM_SERIAL_DO_CALLBACK(WRITELINE("duart", scn2681_device, ip5_w)) + EEPROM_SERIAL_93C46_16BIT(config, "eeprom2").do_callback().set("duart", FUNC(scn2681_device::ip5_w)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL(45'830'400) / 2, 1120, 0, 960, 341, 0, 300) // wild guess at resolution diff --git a/src/mame/drivers/milwaukee.cpp b/src/mame/drivers/milwaukee.cpp index 774c6afc3f3..a0017b97413 100644 --- a/src/mame/drivers/milwaukee.cpp +++ b/src/mame/drivers/milwaukee.cpp @@ -52,33 +52,34 @@ void milwaukee_state::mem_map(address_map &map) static INPUT_PORTS_START( milwaukee ) INPUT_PORTS_END -MACHINE_CONFIG_START(milwaukee_state::milwaukee) - MCFG_DEVICE_ADD("maincpu", M6502, XTAL(16'000'000) / 16) - MCFG_DEVICE_PROGRAM_MAP(mem_map) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(16'000'000) / 16 / 4) // 250 kHz - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pit", pit8253_device, write_gate0)) MCFG_DEVCB_INVERT - MCFG_PIT8253_CLK1(XTAL(16'000'000) / 2 / 13 / 2048 / 5) // 60.09 Hz? - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pit", pit8253_device, write_clk2)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("pia1", PIA6821, 0) - MCFG_DEVICE_ADD("pia2", PIA6821, 0) - MCFG_DEVICE_ADD("acia2", ACIA6850, 0) - MCFG_DEVICE_ADD("ssda", MC6852, 0) - - MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL(16'000'000) / 2 / 13 / 4) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_rxc)) - - MCFG_DEVICE_ADD("acia1", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("acia1", acia6850_device, write_rxd)) - MCFG_RS232_CTS_HANDLER(WRITELINE("acia1", acia6850_device, write_cts)) -MACHINE_CONFIG_END +void milwaukee_state::milwaukee(machine_config &config) +{ + M6502(config, m_maincpu, 16_MHz_XTAL / 16); + m_maincpu->set_addrmap(AS_PROGRAM, &milwaukee_state::mem_map); + + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(16_MHz_XTAL / 16 / 4); // 250 kHz + pit.out_handler<0>().set("pit", FUNC(pit8253_device::write_gate0)).invert(); + pit.set_clk<1>(16_MHz_XTAL / 2 / 13 / 2048 / 5); // 60.09 Hz? + pit.out_handler<1>().set("pit", FUNC(pit8253_device::write_clk2)).invert(); + + PIA6821(config, "pia1", 0); + PIA6821(config, "pia2", 0); + ACIA6850(config, "acia2", 0); + MC6852(config, "ssda", 0); + + clock_device &acia_clock(CLOCK(config, "acia_clock", 16_MHz_XTAL / 2 / 13 / 4)); + acia_clock.signal_handler().set("acia1", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia1", FUNC(acia6850_device::write_rxc)); + + acia6850_device &acia1(ACIA6850(config, "acia1", 0)); + acia1.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + acia1.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set("acia1", FUNC(acia6850_device::write_rxd)); + rs232.cts_handler().set("acia1", FUNC(acia6850_device::write_cts)); +} ROM_START( mc1200 ) ROM_REGION( 0x0c00, "roms", 0 ) diff --git a/src/mame/drivers/miniframe.cpp b/src/mame/drivers/miniframe.cpp index e1bc117ca9b..879a80b5d4d 100644 --- a/src/mame/drivers/miniframe.cpp +++ b/src/mame/drivers/miniframe.cpp @@ -248,24 +248,24 @@ MACHINE_CONFIG_START(miniframe_state::miniframe) MCFG_FLOPPY_DRIVE_ADD("wd2797:0", miniframe_floppies, "525dd", floppy_image_device::default_floppy_formats) // 8263s - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(76800) - MCFG_PIT8253_CLK1(76800) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259", pic8259_device, ir4_w)) + pit8253_device &pit8253(PIT8253(config, "pit8253", 0)); + pit8253.set_clk<0>(76800); + pit8253.set_clk<1>(76800); + pit8253.out_handler<0>().set("pic8259", FUNC(pic8259_device::ir4_w)); // FIXME: fighting for IR4 - error, or needs input merger? // chain clock 1 output into clock 2 - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pit8253", pit8253_device, write_clk2)) + pit8253.out_handler<1>().set("pit8253", FUNC(pit8253_device::write_clk2)); // and ir4 on the PIC - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("pic8259", pic8259_device, ir4_w)) + pit8253.out_handler<1>().append("pic8259", FUNC(pic8259_device::ir4_w)); - MCFG_DEVICE_ADD("baudgen", PIT8253, 0) - MCFG_PIT8253_CLK0(1228800) - MCFG_PIT8253_CLK1(1228800) - MCFG_PIT8253_CLK2(1228800) + pit8253_device &baudgen(PIT8253(config, "baudgen", 0)); + baudgen.set_clk<0>(1228800); + baudgen.set_clk<1>(1228800); + baudgen.set_clk<2>(1228800); // PIC8259s MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", M68K_IRQ_4)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/mits680b.cpp b/src/mame/drivers/mits680b.cpp index 7c5e084ba8d..a32c09a1d32 100644 --- a/src/mame/drivers/mits680b.cpp +++ b/src/mame/drivers/mits680b.cpp @@ -70,9 +70,9 @@ MACHINE_CONFIG_START(mits680b_state::mits680b) MCFG_DEVICE_ADD("maincpu", M6800, XTAL(1'000'000) / 2) MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("acia", FUNC(acia6850_device::write_txc)); + uart_clock.signal_handler().append("acia", FUNC(acia6850_device::write_rxc)); MCFG_DEVICE_ADD("acia", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/mk14.cpp b/src/mame/drivers/mk14.cpp index 0e0fc4f22ba..37bf50993fa 100644 --- a/src/mame/drivers/mk14.cpp +++ b/src/mame/drivers/mk14.cpp @@ -205,7 +205,7 @@ MACHINE_CONFIG_START(mk14_state::mk14) /* basic machine hardware */ // IC1 1SP-8A/600 (8060) SC/MP Microprocessor MCFG_DEVICE_ADD("maincpu", INS8060, XTAL(4'433'619)) - MCFG_SCMP_CONFIG(WRITELINE(*this, mk14_state, cass_w), NOOP, READLINE(*this, mk14_state, cass_r), NOOP, READLINE(*this, mk14_state, cass_r), NOOP) + MCFG_SCMP_CONFIG(WRITELINE(*this, mk14_state, cass_w), NOOP, READLINE(*this, mk14_state, cass_r), CONSTANT(0), READLINE(*this, mk14_state, cass_r), NOOP) MCFG_DEVICE_PROGRAM_MAP(mem_map) /* video hardware */ diff --git a/src/mame/drivers/mmd1.cpp b/src/mame/drivers/mmd1.cpp index 0b019468de9..9455b4c2820 100644 --- a/src/mame/drivers/mmd1.cpp +++ b/src/mame/drivers/mmd1.cpp @@ -523,8 +523,8 @@ MACHINE_CONFIG_START(mmd1_state::mmd2) MCFG_I8279_OUT_SL_CB(WRITE8(*this, mmd1_state, mmd2_scanlines_w)) // scan SL lines MCFG_I8279_OUT_DISP_CB(WRITE8(*this, mmd1_state, mmd2_digit_w)) // display A&B MCFG_I8279_IN_RL_CB(READ8(*this, mmd1_state, mmd2_kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) + MCFG_I8279_IN_SHIFT_CB(CONSTANT(1)) // Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(1)) MACHINE_CONFIG_END diff --git a/src/mame/drivers/model1.cpp b/src/mame/drivers/model1.cpp index 1761909668d..257946d3c71 100644 --- a/src/mame/drivers/model1.cpp +++ b/src/mame/drivers/model1.cpp @@ -1710,15 +1710,15 @@ MACHINE_CONFIG_START(model1_state::model1) MCFG_VIDEO_START_OVERRIDE(model1_state,model1) - MCFG_SEGAM1AUDIO_ADD(M1AUDIO_TAG) - MCFG_SEGAM1AUDIO_RXD_HANDLER(WRITELINE("m1uart", i8251_device, write_rxd)) + SEGAM1AUDIO(config, m_m1audio, 0); + m_m1audio->rxd_handler().set(m_m1uart, FUNC(i8251_device::write_rxd)); - MCFG_DEVICE_ADD("m1uart", I8251, 8000000) // uPD71051C, clock unknown - MCFG_I8251_TXD_HANDLER(WRITELINE(M1AUDIO_TAG, segam1audio_device, write_txd)) + I8251(config, m_m1uart, 8000000); // uPD71051C, clock unknown + m_m1uart->txd_handler().set(m_m1audio, FUNC(segam1audio_device::write_txd)); - MCFG_CLOCK_ADD("m1uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("m1uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("m1uart", i8251_device, write_rxc)) + clock_device &m1uart_clock(CLOCK(config, "m1uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + m1uart_clock.signal_handler().set(m_m1uart, FUNC(i8251_device::write_txc)); + m1uart_clock.signal_handler().append(m_m1uart, FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END MACHINE_CONFIG_START(model1_state::model1_hle) @@ -1781,9 +1781,7 @@ MACHINE_CONFIG_START(model1_state::swa) MCFG_SOUND_ROUTE(1, "dright", 1.0) // Apparently m1audio has to filter out commands the DSB shouldn't see - MCFG_DEVICE_MODIFY(M1AUDIO_TAG) - MCFG_SEGAM1AUDIO_RXD_HANDLER(WRITELINE("m1uart", i8251_device, write_rxd)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(DSBZ80_TAG, dsbz80_device, write_txd)) + m_m1audio->rxd_handler().append(m_dsbz80, FUNC(dsbz80_device::write_txd)); MACHINE_CONFIG_END MACHINE_CONFIG_START(model1_state::wingwar) diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp index 704e05808c4..5972bda7232 100644 --- a/src/mame/drivers/model2.cpp +++ b/src/mame/drivers/model2.cpp @@ -2445,13 +2445,13 @@ MACHINE_CONFIG_START(model2_state::model2_scsp) MCFG_SOUND_ROUTE(0, "lspeaker", 2.0) MCFG_SOUND_ROUTE(0, "rspeaker", 2.0) - MCFG_DEVICE_ADD("uart", I8251, 8000000) // uPD71051C, clock unknown -// MCFG_I8251_RXRDY_HANDLER(WRITELINE(*this, model2_state, sound_ready_w)) -// MCFG_I8251_TXRDY_HANDLER(WRITELINE(*this, model2_state, sound_ready_w)) + I8251(config, m_uart, 8000000); // uPD71051C, clock unknown +// m_uart->rxrdy_handler().set(FUNC(model2_state::sound_ready_w)); +// m_uart->txrdy_handler().set(FUNC(model2_state::sound_ready_w)); - MCFG_CLOCK_ADD("uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END /* original Model 2 */ @@ -2494,15 +2494,15 @@ MACHINE_CONFIG_START(model2o_state::model2o) model2_timers(config); model2_screen(config); - MCFG_SEGAM1AUDIO_ADD(M1AUDIO_TAG) - MCFG_SEGAM1AUDIO_RXD_HANDLER(WRITELINE("uart", i8251_device, write_rxd)) + SEGAM1AUDIO(config, m_m1audio, 0); + m_m1audio->rxd_handler().set(m_uart, FUNC(i8251_device::write_rxd)); - MCFG_DEVICE_ADD("uart", I8251, 8000000) // uPD71051C, clock unknown - MCFG_I8251_TXD_HANDLER(WRITELINE(M1AUDIO_TAG, segam1audio_device, write_txd)) + I8251(config, m_uart, 8000000); // uPD71051C, clock unknown + m_uart->txd_handler().set(m_m1audio, FUNC(segam1audio_device::write_txd)); - MCFG_CLOCK_ADD("uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MCFG_M2COMM_ADD("m2comm") MACHINE_CONFIG_END @@ -2544,14 +2544,14 @@ MACHINE_CONFIG_START(model2_state::sj25_0207_01) MCFG_DEVICE_IO_MAP(drive_io_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", model2_state, irq0_line_hold) - MCFG_DEVICE_ADD("driveio1", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, model2_state, driveio_port_w)) - MCFG_315_5296_IN_PORTG_CB(READ8(*this, model2_state, driveio_portg_r)) - MCFG_315_5296_IN_PORTH_CB(READ8(*this, model2_state, driveio_porth_r)) + sega_315_5296_device &driveio1(SEGA_315_5296(config, "driveio1", 0)); // unknown clock + driveio1.out_pd_callback().set(FUNC(model2_state::driveio_port_w)); + driveio1.in_pg_callback().set(FUNC(model2_state::driveio_portg_r)); + driveio1.in_ph_callback().set(FUNC(model2_state::driveio_porth_r)); - MCFG_DEVICE_ADD("driveio2", SEGA_315_5296, 0) // unknown clock + SEGA_315_5296(config, "driveio2", 0); // unknown clock - MCFG_DEVICE_ADD("driveadc", MSM6253, 0) + MSM6253(config, "driveadc", 0); MACHINE_CONFIG_END MACHINE_CONFIG_START(model2o_state::daytona) @@ -2665,11 +2665,11 @@ MACHINE_CONFIG_END // Includes a Model 1 Sound board for additional sounds - Deluxe version only MACHINE_CONFIG_START(model2a_state::manxttdx) manxtt(config); - MCFG_SEGAM1AUDIO_ADD(M1AUDIO_TAG) - MCFG_SEGAM1AUDIO_RXD_HANDLER(WRITELINE("uart", i8251_device, write_rxd)) - MCFG_DEVICE_MODIFY("uart") - MCFG_I8251_TXD_HANDLER(WRITELINE(M1AUDIO_TAG, segam1audio_device, write_txd)) + SEGAM1AUDIO(config, m_m1audio, 0); + m_m1audio->rxd_handler().set(m_uart, FUNC(i8251_device::write_rxd)); + + m_uart->txd_handler().set(m_m1audio, FUNC(segam1audio_device::write_txd)); MACHINE_CONFIG_END MACHINE_CONFIG_START( model2a_state::srallyc ) @@ -2901,8 +2901,7 @@ MACHINE_CONFIG_START( model2c_state::stcc ) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - MCFG_DEVICE_MODIFY("uart") - MCFG_I8251_TXD_HANDLER(WRITELINE(DSBZ80_TAG, dsbz80_device, write_txd)) + m_uart->txd_handler().set(m_dsbz80, FUNC(dsbz80_device::write_txd)); MACHINE_CONFIG_END MACHINE_CONFIG_START( model2c_state::waverunr ) diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp index 8f5500a0778..a127a29b146 100644 --- a/src/mame/drivers/model3.cpp +++ b/src/mame/drivers/model3.cpp @@ -5849,12 +5849,12 @@ MACHINE_CONFIG_START(model3_state::scud) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) - MCFG_DEVICE_ADD("uart", I8251, 8000000) // uPD71051 - MCFG_I8251_TXD_HANDLER(WRITELINE(DSBZ80_TAG, dsbz80_device, write_txd)) + I8251(config, m_uart, 8000000); // uPD71051 + m_uart->txd_handler().set(m_dsbz80, FUNC(dsbz80_device::write_txd)); - MCFG_CLOCK_ADD("uart_clock", 500000) // 16 times 31.25MHz (standard Sega/MIDI sound data rate) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 500000)); // 16 times 31.25MHz (standard Sega/MIDI sound data rate) + uart_clock.signal_handler().set(m_uart, FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append(m_uart, FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END MACHINE_CONFIG_START(model3_state::model3_20) diff --git a/src/mame/drivers/mrflea.cpp b/src/mame/drivers/mrflea.cpp index 1b25d88777c..5678a2bc898 100644 --- a/src/mame/drivers/mrflea.cpp +++ b/src/mame/drivers/mrflea.cpp @@ -270,16 +270,16 @@ MACHINE_CONFIG_START(mrflea_state::mrflea) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("mainppi", I8255, 0) - MCFG_I8255_IN_PORTB_CB(READ8("subppi", i8255_device, pb_r)) - MCFG_I8255_OUT_PORTC_CB(WRITELINE("subppi", i8255_device, pc4_w)) MCFG_DEVCB_BIT(7) // OBFA -> STBA - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("subppi", i8255_device, pc2_w)) MCFG_DEVCB_BIT(1) // IBFB -> ACKB - - MCFG_DEVICE_ADD("subppi", I8255, 0) - MCFG_I8255_IN_PORTA_CB(READ8("mainppi", i8255_device, pa_r)) - MCFG_I8255_OUT_PORTC_CB(WRITELINE("mainppi", i8255_device, pc6_w)) MCFG_DEVCB_BIT(5) // IBFA -> ACKA - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("pic", pic8259_device, ir0_w)) MCFG_DEVCB_BIT(3) // INTRA - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mainppi", i8255_device, pc2_w)) MCFG_DEVCB_BIT(1) // OBFB -> STBB + i8255_device &mainppi(I8255(config, "mainppi", 0)); + mainppi.in_pb_callback().set("subppi", FUNC(i8255_device::pb_r)); + mainppi.out_pc_callback().set("subppi", FUNC(i8255_device::pc4_w)).bit(7); // OBFA -> STBA + mainppi.out_pc_callback().append("subppi", FUNC(i8255_device::pc2_w)).bit(1); // IBFB -> ACKB + + i8255_device &subppi(I8255(config, "subppi", 0)); + subppi.in_pa_callback().set("mainppi", FUNC(i8255_device::pa_r)); + subppi.out_pc_callback().set("mainppi", FUNC(i8255_device::pc6_w)).bit(5); // IBFA -> ACKA + subppi.out_pc_callback().append("pic", FUNC(pic8259_device::ir0_w)).bit(3); // INTRA + subppi.out_pc_callback().append("mainppi", FUNC(i8255_device::pc2_w)).bit(1); // OBFB -> STBB MCFG_DEVICE_ADD("pic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("subcpu", 0)) diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp index 05706b52420..93d34916724 100644 --- a/src/mame/drivers/multi8.cpp +++ b/src/mame/drivers/multi8.cpp @@ -605,9 +605,9 @@ MACHINE_CONFIG_START(multi8_state::multi8) MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, multi8_state, portb_w)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, multi8_state, portc_w)) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart", I8251, 0) // for cassette MCFG_DEVICE_ADD("pit", PIT8253, 0) diff --git a/src/mame/drivers/munchmo.cpp b/src/mame/drivers/munchmo.cpp index f36713eac6b..3e7b92aded3 100644 --- a/src/mame/drivers/munchmo.cpp +++ b/src/mame/drivers/munchmo.cpp @@ -352,8 +352,7 @@ MACHINE_CONFIG_START(munchmo_state::mnchmobl) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(ASSERTLINE(m_audiocpu, 0)) + GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_audiocpu, 0, ASSERT_LINE); /* AY clock speeds confirmed to match known recording */ MCFG_DEVICE_ADD(m_ay8910[0], AY8910, XTAL(15'000'000)/8) diff --git a/src/mame/drivers/mx2178.cpp b/src/mame/drivers/mx2178.cpp index d96d5f8b813..d6ade3f1ba2 100644 --- a/src/mame/drivers/mx2178.cpp +++ b/src/mame/drivers/mx2178.cpp @@ -154,11 +154,11 @@ MACHINE_CONFIG_START(mx2178_state::mx2178) MCFG_MC6845_UPDATE_ROW_CB(mx2178_state, crtc_update_row) MCFG_MC6845_OUT_VSYNC_CB(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, XTAL(18'869'600) / 30) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia2", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia2", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", XTAL(18'869'600) / 30)); + acia_clock.signal_handler().set("acia1", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia1", FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append("acia2", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia2", FUNC(acia6850_device::write_rxc)); MCFG_DEVICE_ADD("acia1", ACIA6850, 0) MCFG_ACIA6850_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/namcos12.cpp b/src/mame/drivers/namcos12.cpp index 6105611f2c2..fedcd9504e3 100644 --- a/src/mame/drivers/namcos12.cpp +++ b/src/mame/drivers/namcos12.cpp @@ -1727,19 +1727,20 @@ void namcos12_state::init_golgo13() MACHINE_CONFIG_START(namcos12_state::namcos12_mobo) /* basic machine hardware */ - MCFG_DEVICE_ADD("sub", H83002, 16934400) // frequency based on research (superctr) + MCFG_DEVICE_ADD(m_sub, H83002, 16934400) // frequency based on research (superctr) MCFG_DEVICE_PROGRAM_MAP(s12h8rwmap) MCFG_DEVICE_IO_MAP(s12h8iomap) MCFG_NAMCO_SETTINGS_ADD("namco_settings") - MCFG_RTC4543_ADD("rtc", XTAL(32'768)) + MCFG_RTC4543_ADD(m_rtc, XTAL(32'768)) MCFG_RTC4543_DATA_CALLBACK(WRITELINE("sub:sci1", h8_sci_device, rx_w)) - MCFG_DEVICE_MODIFY("sub:sci1") - MCFG_H8_SCI_TX_CALLBACK(WRITELINE("namco_settings", namco_settings_device, data_w)) - MCFG_H8_SCI_CLK_CALLBACK(WRITELINE("rtc", rtc4543_device, clk_w)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namco_settings", namco_settings_device, clk_w)) + // FIXME: need better syntax for configuring H8 onboard devices + h8_sci_device &sub_sci1(*m_sub->subdevice("sci1")); + sub_sci1.tx_handler().set(m_settings, FUNC(namco_settings_device::data_w)); + sub_sci1.clk_handler().set(m_rtc, FUNC(rtc4543_device::clk_w)).invert(); + sub_sci1.clk_handler().append(m_settings, FUNC(namco_settings_device::clk_w)); MCFG_DEVICE_ADD("at28c16", AT28C16, 0) diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp index 56f63206b6f..1d30616c4f9 100644 --- a/src/mame/drivers/namcos23.cpp +++ b/src/mame/drivers/namcos23.cpp @@ -3576,13 +3576,13 @@ GFXDECODE_END MACHINE_CONFIG_START(namcos23_state::gorgon) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", R4650BE, BUSCLOCK*4) + MCFG_DEVICE_ADD(m_maincpu, R4650BE, BUSCLOCK*4) MCFG_MIPS3_ICACHE_SIZE(8192) // VERIFIED MCFG_MIPS3_DCACHE_SIZE(8192) // VERIFIED MCFG_DEVICE_PROGRAM_MAP(gorgon_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", namcos23_state, interrupt) - MCFG_DEVICE_ADD("subcpu", H83002, H8CLOCK ) + MCFG_DEVICE_ADD(m_subcpu, H83002, H8CLOCK) MCFG_DEVICE_PROGRAM_MAP( s23h8rwmap ) MCFG_DEVICE_IO_MAP( s23h8iomap ) @@ -3590,7 +3590,7 @@ MACHINE_CONFIG_START(namcos23_state::gorgon) MCFG_DEVICE_MODIFY("subcpu:sci0") MCFG_H8_SCI_SET_EXTERNAL_CLOCK_PERIOD(attotime::from_hz(JVSCLOCK/8)) - MCFG_DEVICE_ADD("iocpu", H83334, JVSCLOCK ) + MCFG_DEVICE_ADD(m_iocpu, H83334, JVSCLOCK ) MCFG_DEVICE_PROGRAM_MAP( s23iobrdmap ) MCFG_DEVICE_IO_MAP( s23iobrdiomap ) @@ -3603,13 +3603,14 @@ MACHINE_CONFIG_START(namcos23_state::gorgon) MCFG_NAMCO_SETTINGS_ADD("namco_settings") - MCFG_RTC4543_ADD("rtc", XTAL(32'768)) + MCFG_RTC4543_ADD(m_rtc, XTAL(32'768)) MCFG_RTC4543_DATA_CALLBACK(WRITELINE("subcpu:sci1", h8_sci_device, rx_w)) - MCFG_DEVICE_MODIFY("subcpu:sci1") - MCFG_H8_SCI_TX_CALLBACK(WRITELINE("namco_settings", namco_settings_device, data_w)) - MCFG_H8_SCI_CLK_CALLBACK(WRITELINE("rtc", rtc4543_device, clk_w)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namco_settings", namco_settings_device, clk_w)) + // FIXME: need better syntax for configuring H8 onboard devices + h8_sci_device &subcpu_sci1(*m_subcpu->subdevice("sci1")); + subcpu_sci1.tx_handler().set(m_settings, FUNC(namco_settings_device::data_w)); + subcpu_sci1.clk_handler().set(m_rtc, FUNC(rtc4543_device::clk_w)).invert(); + subcpu_sci1.clk_handler().append(m_settings, FUNC(namco_settings_device::clk_w)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -3643,13 +3644,13 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(namcos23_state::s23) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", R4650BE, BUSCLOCK*4) + MCFG_DEVICE_ADD(m_maincpu, R4650BE, BUSCLOCK*4) MCFG_MIPS3_ICACHE_SIZE(8192) // VERIFIED MCFG_MIPS3_DCACHE_SIZE(8192) // VERIFIED MCFG_DEVICE_PROGRAM_MAP(s23_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", namcos23_state, interrupt) - MCFG_DEVICE_ADD("subcpu", H83002, H8CLOCK ) + MCFG_DEVICE_ADD(m_subcpu, H83002, H8CLOCK) MCFG_DEVICE_PROGRAM_MAP( s23h8rwmap ) MCFG_DEVICE_IO_MAP( s23h8iomap ) @@ -3657,7 +3658,7 @@ MACHINE_CONFIG_START(namcos23_state::s23) MCFG_DEVICE_MODIFY("subcpu:sci0") MCFG_H8_SCI_SET_EXTERNAL_CLOCK_PERIOD(attotime::from_hz(JVSCLOCK/8)) - MCFG_DEVICE_ADD("iocpu", H83334, JVSCLOCK ) + MCFG_DEVICE_ADD(m_iocpu, H83334, JVSCLOCK ) MCFG_DEVICE_PROGRAM_MAP( s23iobrdmap ) MCFG_DEVICE_IO_MAP( s23iobrdiomap ) @@ -3670,13 +3671,14 @@ MACHINE_CONFIG_START(namcos23_state::s23) MCFG_NAMCO_SETTINGS_ADD("namco_settings") - MCFG_RTC4543_ADD("rtc", XTAL(32'768)) + MCFG_RTC4543_ADD(m_rtc, XTAL(32'768)) MCFG_RTC4543_DATA_CALLBACK(WRITELINE("subcpu:sci1", h8_sci_device, rx_w)) - MCFG_DEVICE_MODIFY("subcpu:sci1") - MCFG_H8_SCI_TX_CALLBACK(WRITELINE("namco_settings", namco_settings_device, data_w)) - MCFG_H8_SCI_CLK_CALLBACK(WRITELINE("rtc", rtc4543_device, clk_w)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namco_settings", namco_settings_device, clk_w)) + // FIXME: need better syntax for configuring H8 onboard devices + h8_sci_device &subcpu_sci1(*m_subcpu->subdevice("sci1")); + subcpu_sci1.tx_handler().set(m_settings, FUNC(namco_settings_device::data_w)); + subcpu_sci1.clk_handler().set(m_rtc, FUNC(rtc4543_device::clk_w)).invert(); + subcpu_sci1.clk_handler().append(m_settings, FUNC(namco_settings_device::clk_w)); MCFG_NVRAM_ADD_0FILL("nvram") @@ -3732,13 +3734,13 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(namcos23_state::ss23) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", R4650BE, BUSCLOCK*5) + MCFG_DEVICE_ADD(m_maincpu, R4650BE, BUSCLOCK*5) MCFG_MIPS3_ICACHE_SIZE(8192) // VERIFIED MCFG_MIPS3_DCACHE_SIZE(8192) // VERIFIED MCFG_DEVICE_PROGRAM_MAP(s23_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", namcos23_state, interrupt) - MCFG_DEVICE_ADD("subcpu", H83002, H8CLOCK ) + MCFG_DEVICE_ADD(m_subcpu, H83002, H8CLOCK) MCFG_DEVICE_PROGRAM_MAP( s23h8rwmap ) MCFG_DEVICE_IO_MAP( s23h8iomap ) @@ -3750,13 +3752,14 @@ MACHINE_CONFIG_START(namcos23_state::ss23) MCFG_NAMCO_SETTINGS_ADD("namco_settings") - MCFG_RTC4543_ADD("rtc", XTAL(32'768)) + MCFG_RTC4543_ADD(m_rtc, XTAL(32'768)) MCFG_RTC4543_DATA_CALLBACK(WRITELINE("subcpu:sci1", h8_sci_device, rx_w)) - MCFG_DEVICE_MODIFY("subcpu:sci1") - MCFG_H8_SCI_TX_CALLBACK(WRITELINE("namco_settings", namco_settings_device, data_w)) - MCFG_H8_SCI_CLK_CALLBACK(WRITELINE("rtc", rtc4543_device, clk_w)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("namco_settings", namco_settings_device, clk_w)) + // FIXME: need better syntax for configuring H8 onboard devices + h8_sci_device &subcpu_sci1(*m_subcpu->subdevice("sci1")); + subcpu_sci1.tx_handler().set(m_settings, FUNC(namco_settings_device::data_w)); + subcpu_sci1.clk_handler().set(m_rtc, FUNC(rtc4543_device::clk_w)).invert(); + subcpu_sci1.clk_handler().append(m_settings, FUNC(namco_settings_device::clk_w)); MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mame/drivers/nbmj9195.cpp b/src/mame/drivers/nbmj9195.cpp index 2767038d9cb..4738f676d50 100644 --- a/src/mame/drivers/nbmj9195.cpp +++ b/src/mame/drivers/nbmj9195.cpp @@ -2527,16 +2527,16 @@ MACHINE_CONFIG_START(nbmj9195_state::NBMJDRV1_base) MCFG_TMPZ84C011_PORTE_WRITE_CB(WRITE8(*this, nbmj9195_state, soundcpu_porte_w)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(1024, 512) /* no way this is correct */ - MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 240-1) - MCFG_SCREEN_UPDATE_DRIVER(nbmj9195_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c011_device, trg1)) MCFG_DEVCB_INVERT - - MCFG_PALETTE_ADD("palette", 256) + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK); + m_screen->set_refresh_hz(60); + m_screen->set_size(1024, 512); /* no way this is correct */ + m_screen->set_visarea(0, 640-1, 0, 240-1); + m_screen->set_screen_update(FUNC(nbmj9195_state::screen_update)); + m_screen->set_palette(m_palette); + m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c011_device::trg1)).invert(); + + MCFG_PALETTE_ADD(m_palette, 256) /* sound hardware */ SPEAKER(config, "speaker").front_center(); diff --git a/src/mame/drivers/nemesis.cpp b/src/mame/drivers/nemesis.cpp index c3d9c9a7de5..2ce71783485 100644 --- a/src/mame/drivers/nemesis.cpp +++ b/src/mame/drivers/nemesis.cpp @@ -1468,17 +1468,17 @@ MACHINE_CONFIG_START(nemesis_state::nemesis) MCFG_DEVICE_ADD("audiocpu", Z80,14318180/4) /* From schematics, should be accurate */ MCFG_DEVICE_PROGRAM_MAP(sound_map) /* fixed */ - MCFG_DEVICE_ADD("outlatch", LS259, 0) // 13J - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, nemesis_state, coin1_lockout_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, nemesis_state, coin2_lockout_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, nemesis_state, sound_irq_w)) + ls259_device &outlatch(LS259(config, "outlatch")); // 13J + outlatch.q_out_cb<0>().set(FUNC(nemesis_state::coin1_lockout_w)); + outlatch.q_out_cb<0>().append(FUNC(nemesis_state::coin2_lockout_w)); + outlatch.q_out_cb<2>().set(FUNC(nemesis_state::sound_irq_w)); - MCFG_DEVICE_ADD("intlatch", LS259, 0) // 11K - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, nemesis_state, irq_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, nemesis_state, gfx_flipx_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, nemesis_state, gfx_flipy_w)) + ls259_device &intlatch(LS259(config, "intlatch")); // 11K + intlatch.q_out_cb<0>().set(FUNC(nemesis_state::irq_enable_w)); + intlatch.q_out_cb<2>().set(FUNC(nemesis_state::gfx_flipx_w)); + intlatch.q_out_cb<3>().set(FUNC(nemesis_state::gfx_flipy_w)); - MCFG_WATCHDOG_ADD("watchdog") + WATCHDOG_TIMER(config, "watchdog", 0); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 49067ee0c27..fcbad852f34 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -1921,17 +1921,17 @@ MACHINE_CONFIG_START(neogeo_base_state::neogeo_base) MCFG_DEVICE_ADD(m_sprgen, NEOGEO_SPRITE_OPTIMZIED, 0) /* audio hardware */ - MCFG_INPUT_MERGER_ALL_HIGH(m_audionmi) - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE(m_audiocpu, INPUT_LINE_NMI)); + INPUT_MERGER_ALL_HIGH(config, m_audionmi); + m_audionmi->output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(false) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(WRITELINE(m_audionmi, input_merger_device, in_w<0>)) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->set_separate_acknowledge(false); + m_soundlatch->data_pending_callback().set(m_audionmi, FUNC(input_merger_device::in_w<0>)); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch2) + GENERIC_LATCH_8(config, m_soundlatch2); - MCFG_DEVICE_ADD(m_ym, YM2610, NEOGEO_YM2610_CLOCK) - MCFG_YM2610_IRQ_HANDLER(INPUTLINE(m_audiocpu, 0)) + YM2610(config, m_ym, NEOGEO_YM2610_CLOCK); + m_ym->irq_handler().set_inputline(m_audiocpu, 0); MACHINE_CONFIG_END diff --git a/src/mame/drivers/neogeocd.cpp b/src/mame/drivers/neogeocd.cpp index fc807da9b08..08b1f225101 100644 --- a/src/mame/drivers/neogeocd.cpp +++ b/src/mame/drivers/neogeocd.cpp @@ -1041,8 +1041,7 @@ MACHINE_CONFIG_START(ngcd_state::neocd) MCFG_DEVICE_PROGRAM_MAP(neocd_audio_map) MCFG_DEVICE_IO_MAP(neocd_audio_io_map) - MCFG_DEVICE_MODIFY("systemlatch") - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(LOGGER("NeoCD: write to regular vector change address?")) // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? + subdevice("systemlatch")->q_out_cb<1>().set_log("NeoCD: write to regular vector change address?"); // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(ngcd_state, screen_update_neocd) diff --git a/src/mame/drivers/ngen.cpp b/src/mame/drivers/ngen.cpp index 02535aad214..f2b0b044568 100644 --- a/src/mame/drivers/ngen.cpp +++ b/src/mame/drivers/ngen.cpp @@ -1039,11 +1039,11 @@ MACHINE_CONFIG_START(ngen_state::ngen) MCFG_WD2010_OUT_INTRQ_CB(WRITELINE("pic",pic8259_device,ir2_w)) MCFG_WD2010_IN_BCS_CB(READ8(*this, ngen_state,hd_buffer_r)) MCFG_WD2010_OUT_BCS_CB(WRITE8(*this, ngen_state,hd_buffer_w)) - MCFG_WD2010_IN_DRDY_CB(VCC) - MCFG_WD2010_IN_INDEX_CB(VCC) - MCFG_WD2010_IN_WF_CB(VCC) - MCFG_WD2010_IN_TK000_CB(VCC) - MCFG_WD2010_IN_SC_CB(VCC) + MCFG_WD2010_IN_DRDY_CB(CONSTANT(1)) + MCFG_WD2010_IN_INDEX_CB(CONSTANT(1)) + MCFG_WD2010_IN_WF_CB(CONSTANT(1)) + MCFG_WD2010_IN_TK000_CB(CONSTANT(1)) + MCFG_WD2010_IN_SC_CB(CONSTANT(1)) MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) MCFG_PIT8253_CLK2(20_MHz_XTAL / 10) // 2MHz MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) @@ -1150,11 +1150,11 @@ MACHINE_CONFIG_START(ngen386_state::ngen386) MCFG_WD2010_OUT_INTRQ_CB(WRITELINE("pic",pic8259_device,ir2_w)) MCFG_WD2010_IN_BCS_CB(READ8(*this, ngen_state,hd_buffer_r)) MCFG_WD2010_OUT_BCS_CB(WRITE8(*this, ngen_state,hd_buffer_w)) - MCFG_WD2010_IN_DRDY_CB(VCC) - MCFG_WD2010_IN_INDEX_CB(VCC) - MCFG_WD2010_IN_WF_CB(VCC) - MCFG_WD2010_IN_TK000_CB(VCC) - MCFG_WD2010_IN_SC_CB(VCC) + MCFG_WD2010_IN_DRDY_CB(CONSTANT(1)) + MCFG_WD2010_IN_INDEX_CB(CONSTANT(1)) + MCFG_WD2010_IN_WF_CB(CONSTANT(1)) + MCFG_WD2010_IN_TK000_CB(CONSTANT(1)) + MCFG_WD2010_IN_SC_CB(CONSTANT(1)) MCFG_DEVICE_ADD("hdc_timer", PIT8253, 0) MCFG_PIT8253_CLK2(20_MHz_XTAL / 10) // 2MHz MCFG_FLOPPY_DRIVE_ADD("fdc:0", ngen_floppies, "525qd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/ninjaw.cpp b/src/mame/drivers/ninjaw.cpp index ae1853c5685..b6cd27bcf4d 100644 --- a/src/mame/drivers/ninjaw.cpp +++ b/src/mame/drivers/ninjaw.cpp @@ -753,13 +753,13 @@ MACHINE_CONFIG_START(ninjaw_state::ninjaw) MCFG_QUANTUM_TIME(attotime::from_hz(16000000/1024)) /* CPU slices */ //MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, ninjaw_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + tc0040ioc_device &tc0040ioc(TC0040IOC(config, "tc0040ioc", 0)); + tc0040ioc.read_0_callback().set_ioport("DSWA"); + tc0040ioc.read_1_callback().set_ioport("DSWB"); + tc0040ioc.read_2_callback().set_ioport("IN0"); + tc0040ioc.read_3_callback().set_ioport("IN1"); + tc0040ioc.write_4_callback().set(FUNC(ninjaw_state::coin_control_w)); + tc0040ioc.read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ninjaw) @@ -869,13 +869,13 @@ MACHINE_CONFIG_START(ninjaw_state::darius2) MCFG_QUANTUM_TIME(attotime::from_hz(16000000/1024)) /* CPU slices */ //MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, ninjaw_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + tc0040ioc_device &tc0040ioc(TC0040IOC(config, "tc0040ioc", 0)); + tc0040ioc.read_0_callback().set_ioport("DSWA"); + tc0040ioc.read_1_callback().set_ioport("DSWB"); + tc0040ioc.read_2_callback().set_ioport("IN0"); + tc0040ioc.read_3_callback().set_ioport("IN1"); + tc0040ioc.write_4_callback().set(FUNC(ninjaw_state::coin_control_w)); + tc0040ioc.read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ninjaw) diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp index c28bb800202..90a29ff2c4c 100644 --- a/src/mame/drivers/norautp.cpp +++ b/src/mame/drivers/norautp.cpp @@ -1249,23 +1249,23 @@ MACHINE_CONFIG_START(norautp_state::noraut_base) MCFG_NVRAM_ADD_0FILL("nvram") /* doesn't work if placed at derivative drivers */ - MCFG_DEVICE_ADD("ppi8255_0", I8255, 0) + I8255(config, m_ppi8255[0], 0); /* (60-63) Mode 0 - Port A set as input */ - MCFG_I8255_IN_PORTA_CB(IOPORT("DSW1")) - MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, norautp_state, mainlamps_w)) - MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, norautp_state, counterlamps_w)) + m_ppi8255[0]->in_pa_callback().set_ioport("DSW1"); + m_ppi8255[0]->out_pb_callback().set(FUNC(norautp_state::mainlamps_w)); + m_ppi8255[0]->out_pc_callback().set(FUNC(norautp_state::counterlamps_w)); - MCFG_DEVICE_ADD("ppi8255_1", I8255, 0) + I8255(config, m_ppi8255[1], 0); /* (a0-a3) Mode 0 - Ports A & B set as input */ - MCFG_I8255_IN_PORTA_CB(IOPORT("IN0")) - MCFG_I8255_IN_PORTB_CB(IOPORT("IN1")) - MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, norautp_state, soundlamps_w)) + m_ppi8255[1]->in_pa_callback().set_ioport("IN0"); + m_ppi8255[1]->in_pb_callback().set_ioport("IN1"); + m_ppi8255[1]->out_pc_callback().set(FUNC(norautp_state::soundlamps_w)); - MCFG_DEVICE_ADD("ppi8255_2", I8255, 0) + I8255(config, m_ppi8255[2], 0); /* (c0-c3) Group A Mode 2 (5-lines handshacked bidirectional port) Group B Mode 0, output; (see below for lines PC0-PC2) */ - MCFG_I8255_IN_PORTC_CB(IOPORT("IN2")) - MCFG_I8255_OUT_PORTC_CB(WRITELINE(*this, norautp_state, ppi2_obf_w)) MCFG_DEVCB_BIT(7) + m_ppi8255[2]->in_pc_callback().set_ioport("IN2"); + m_ppi8255[2]->out_pc_callback().set(FUNC(norautp_state::ppi2_obf_w)).bit(7); /* PPI-2 is configured as mixed mode2 and mode0 output. It means that port A should be bidirectional and port B just as output. Port C as hshk regs, and P0-P2 as input (norautp, norautjp) or output (other sets). */ diff --git a/src/mame/drivers/nss.cpp b/src/mame/drivers/nss.cpp index b8907a845aa..9618457ed66 100644 --- a/src/mame/drivers/nss.cpp +++ b/src/mame/drivers/nss.cpp @@ -871,9 +871,9 @@ MACHINE_CONFIG_START(nss_state::nss) MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, nss_state, nss_vblank_irq)) - MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) - MCFG_SNES_PPU_OPENBUS_CB(READ8(*this, nss_state, snes_open_bus_r)) - MCFG_VIDEO_SET_SCREEN("screen") + SNES_PPU(config, m_ppu, 0); + m_ppu->open_bus_callback().set([this] { return snes_open_bus_r(); }); // lambda because overloaded function name + m_ppu->set_screen("screen"); // NSS MCFG_SCREEN_ADD("osd", RASTER) diff --git a/src/mame/drivers/ob68k1a.cpp b/src/mame/drivers/ob68k1a.cpp index 9fe0ba9e2e9..dba4d185167 100644 --- a/src/mame/drivers/ob68k1a.cpp +++ b/src/mame/drivers/ob68k1a.cpp @@ -182,46 +182,46 @@ void ob68k1a_state::machine_reset() // MACHINE_CONFIG( ob68k1a ) //------------------------------------------------- -MACHINE_CONFIG_START(ob68k1a_state::ob68k1a) +void ob68k1a_state::ob68k1a(machine_config &config) +{ // basic machine hardware - MCFG_DEVICE_ADD(MC68000L10_TAG, M68000, XTAL(10'000'000)) - MCFG_DEVICE_PROGRAM_MAP(ob68k1a_mem) + M68000(config, m_maincpu, 10_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &ob68k1a_state::ob68k1a_mem); // devices - MCFG_DEVICE_ADD(MC6821_0_TAG, PIA6821, 0) - MCFG_DEVICE_ADD(MC6821_1_TAG, PIA6821, 0) - MCFG_DEVICE_ADD(MC6840_TAG, PTM6840, XTAL(10'000'000)/10) - MCFG_PTM6840_EXTERNAL_CLOCKS(0, 0, 0) - - MCFG_DEVICE_ADD(MC6850_0_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD(RS232_A_TAG, RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE(MC6850_0_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MC6850_0_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MC6850_0_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(MC6850_1_TAG, ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD(RS232_B_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(MC6850_1_TAG, acia6850_device, write_rxd)) - MCFG_RS232_DCD_HANDLER(WRITELINE(MC6850_1_TAG, acia6850_device, write_dcd)) - MCFG_RS232_CTS_HANDLER(WRITELINE(MC6850_1_TAG, acia6850_device, write_cts)) - - MCFG_DEVICE_ADD(COM8116_TAG, COM8116, XTAL(5'068'800)) - MCFG_COM8116_FR_HANDLER(WRITELINE(MC6850_0_TAG, acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(MC6850_0_TAG, acia6850_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE(MC6850_1_TAG, acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(MC6850_1_TAG, acia6850_device, write_rxc)) + PIA6821(config, m_pia0, 0); + PIA6821(config, m_pia1, 0); + PTM6840(config, MC6840_TAG, 10_MHz_XTAL/10).set_external_clocks(0, 0, 0); + + ACIA6850(config, m_acia0, 0); + m_acia0->txd_handler().set(m_rs232a, FUNC(rs232_port_device::write_txd)); + m_acia0->rts_handler().set(m_rs232a, FUNC(rs232_port_device::write_rts)); + + RS232_PORT(config, m_rs232a, default_rs232_devices, "terminal"); + m_rs232a->rxd_handler().set(m_acia0, FUNC(acia6850_device::write_rxd)); + m_rs232a->dcd_handler().set(m_acia0, FUNC(acia6850_device::write_dcd)); + m_rs232a->cts_handler().set(m_acia0, FUNC(acia6850_device::write_cts)); + + ACIA6850(config, m_acia1, 0); + m_acia1->txd_handler().set(m_rs232b, FUNC(rs232_port_device::write_txd)); + m_acia1->rts_handler().set(m_rs232b, FUNC(rs232_port_device::write_rts)); + + RS232_PORT(config, m_rs232b, default_rs232_devices, nullptr); + m_rs232b->rxd_handler().set(m_acia1, FUNC(acia6850_device::write_rxd)); + m_rs232b->dcd_handler().set(m_acia1, FUNC(acia6850_device::write_dcd)); + m_rs232b->cts_handler().set(m_acia1, FUNC(acia6850_device::write_cts)); + + COM8116(config, m_dbrg, 5.0688_MHz_XTAL); + m_dbrg->fr_handler().set(m_acia0, FUNC(acia6850_device::write_txc)); + m_dbrg->fr_handler().append(m_acia0, FUNC(acia6850_device::write_rxc)); + m_dbrg->ft_handler().set(m_acia1, FUNC(acia6850_device::write_txc)); + m_dbrg->ft_handler().append(m_acia1, FUNC(acia6850_device::write_rxc)); // internal ram - MCFG_RAM_ADD(RAM_TAG) - MCFG_RAM_DEFAULT_SIZE("32K") - MCFG_RAM_EXTRA_OPTIONS("128K") -MACHINE_CONFIG_END + RAM(config, m_ram, 0); + m_ram->set_default_size("32K"); + m_ram->set_extra_options("128K"); +} diff --git a/src/mame/drivers/octopus.cpp b/src/mame/drivers/octopus.cpp index 195baa448bd..4f08d346331 100644 --- a/src/mame/drivers/octopus.cpp +++ b/src/mame/drivers/octopus.cpp @@ -926,12 +926,12 @@ MACHINE_CONFIG_START(octopus_state::octopus) MCFG_DEVICE_ADD("pic_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, octopus_state, get_slave_ack)) MCFG_DEVICE_ADD("pic_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic_master", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) // RTC (MC146818 via i8255 PPI) MCFG_DEVICE_ADD("ppi", I8255, 0) @@ -983,14 +983,14 @@ MACHINE_CONFIG_START(octopus_state::octopus) MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("serial_a",rs232_port_device, write_rts)) MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("serial_b",rs232_port_device, write_rts)) - MCFG_DEVICE_ADD("serial_a", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("serial",z80sio_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("serial",z80sio_device, ctsa_w)) MCFG_DEVCB_INVERT - //MCFG_RS232_RI_HANDLER(WRITELINE("serial",z80sio_device, ria_w)) MCFG_DEVCB_INVERT - MCFG_DEVICE_ADD("serial_b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("serial",z80sio_device, rxb_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("serial",z80sio_device, ctsb_w)) MCFG_DEVCB_INVERT - //MCFG_RS232_RI_HANDLER(WRITELINE("serial",z80sio_device, rib_w)) MCFG_DEVCB_INVERT + rs232_port_device &serial_a(RS232_PORT(config, "serial_a", default_rs232_devices, nullptr)); + serial_a.rxd_handler().set(m_serial, FUNC(z80sio_device::rxa_w)); + serial_a.cts_handler().set(m_serial, FUNC(z80sio_device::ctsa_w)).invert(); + //serial_a.ri_handler().set(m_serial, FUNC(z80sio_device::ria_w)).invert(); + rs232_port_device &serial_b(RS232_PORT(config, "serial_b", default_rs232_devices, nullptr)); + serial_b.rxd_handler().set(m_serial, FUNC(z80sio_device::rxb_w)); + serial_b.cts_handler().set(m_serial, FUNC(z80sio_device::ctsb_w)).invert(); + //serial_b.ri_handler().set(m_serial, FUNC(z80sio_device::rib_w)).invert(); MCFG_DEVICE_ADD(m_parallel, CENTRONICS, octopus_centronics_devices, "printer") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, octopus_state, parallel_busy_w)) diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp index c97618dc5b8..d21bdbbd038 100644 --- a/src/mame/drivers/okean240.cpp +++ b/src/mame/drivers/okean240.cpp @@ -533,10 +533,10 @@ MACHINE_CONFIG_START(okean240_state::okean240t) MCFG_DEVICE_ADD("ppie", I8255, 0) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK1(3072000) // artificial rate - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<1>(3072000); // artificial rate + pit.out_handler<1>().set("uart", FUNC(i8251_device::write_txc)); + pit.out_handler<1>().append("uart", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("pic", PIC8259, 0) diff --git a/src/mame/drivers/olyboss.cpp b/src/mame/drivers/olyboss.cpp index 34f41399498..ac42030082a 100644 --- a/src/mame/drivers/olyboss.cpp +++ b/src/mame/drivers/olyboss.cpp @@ -448,11 +448,11 @@ MACHINE_CONFIG_START( olyboss_state::olybossd ) MCFG_DEVICE_ADD("uic", AM9519, 0) MCFG_AM9519_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_UPD765A_ADD("fdc", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE("uic", am9519_device, ireq2_w)) MCFG_DEVCB_INVERT - MCFG_UPD765_DRQ_CALLBACK(WRITELINE(I8257_TAG, i8257_device, dreq0_w)) - MCFG_FLOPPY_DRIVE_ADD("fdc:0", bosscd_floppies, "525qd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_SOUND(true) + UPD765A(config, m_fdc, true, true); + m_fdc->intrq_wr_callback().set(m_uic, FUNC(am9519_device::ireq2_w)).invert(); + m_fdc->drq_wr_callback().set(m_dma, FUNC(i8257_device::dreq0_w)); + FLOPPY_CONNECTOR(config, m_fdd0, bosscd_floppies, "525qd", floppy_image_device::default_floppy_formats); + m_fdd0->enable_sound(true); MCFG_DEVICE_ADD(I8257_TAG, I8257, XTAL(4'000'000)) MCFG_I8257_OUT_HRQ_CB(WRITELINE(*this, olyboss_state, hrq_w)) @@ -463,12 +463,12 @@ MACHINE_CONFIG_START( olyboss_state::olybossd ) MCFG_I8257_OUT_IOW_2_CB(WRITE8(*this, olyboss_state, crtcdma_w)) MCFG_I8257_OUT_TC_CB(WRITELINE(*this, olyboss_state, tc_w)) - MCFG_DEVICE_ADD(UPD3301_TAG, UPD3301, XTAL(14'318'181)) - MCFG_UPD3301_CHARACTER_WIDTH(8) - MCFG_UPD3301_DRAW_CHARACTER_CALLBACK_OWNER(olyboss_state, olyboss_display_pixels) - MCFG_UPD3301_DRQ_CALLBACK(WRITELINE(I8257_TAG, i8257_device, dreq2_w)) - MCFG_UPD3301_INT_CALLBACK(WRITELINE("uic", am9519_device, ireq0_w)) MCFG_DEVCB_INVERT - MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) + UPD3301(config, m_crtc, XTAL(14'318'181)); + m_crtc->set_character_width(8); + m_crtc->set_display_callback(FUNC(olyboss_state::olyboss_display_pixels), this); + m_crtc->drq_wr_callback().set(m_dma, FUNC(i8257_device::dreq2_w)); + m_crtc->int_wr_callback().set(m_uic, FUNC(am9519_device::ireq0_w)).invert(); + m_crtc->set_screen(SCREEN_TAG); MCFG_DEVICE_ADD("ppi", I8255, 0) MCFG_I8255_IN_PORTA_CB(READ8(*this, olyboss_state, keyboard_read)) diff --git a/src/mame/drivers/onyx.cpp b/src/mame/drivers/onyx.cpp index b5e77bbfe10..6be6a56b0e3 100644 --- a/src/mame/drivers/onyx.cpp +++ b/src/mame/drivers/onyx.cpp @@ -145,9 +145,9 @@ MACHINE_CONFIG_START(onyx_state::c8002) MCFG_DEVICE_IO_MAP(subio) MCFG_MACHINE_RESET_OVERRIDE(onyx_state, c8002) - MCFG_DEVICE_ADD("sio1_clock", CLOCK, 307200) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio1", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1" ,z80sio_device, txca_w)) + clock_device &sio1_clock(CLOCK(config, "sio1_clock", 307200)); + sio1_clock.signal_handler().set(m_sio1, FUNC(z80sio_device::rxca_w)); + sio1_clock.signal_handler().append(m_sio1, FUNC(z80sio_device::txca_w)); /* peripheral hardware */ MCFG_DEVICE_ADD("pio1", Z80PIO, XTAL(16'000'000)/4) @@ -174,9 +174,9 @@ MACHINE_CONFIG_START(onyx_state::c8002) MCFG_DEVICE_ADD("pio1s", Z80PIO, XTAL(16'000'000)/4) //MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("subcpu", INPUT_LINE_IRQ0)) - MCFG_DEVICE_ADD("sio1s_clock", CLOCK, 614400) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio1s", z80sio_device, rxtxcb_w)) - //MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1s" ,z80sio_device, txca_w)) + clock_device &sio1s_clock(CLOCK(config, "sio1s_clock", 614400)); + sio1s_clock.signal_handler().set("sio1s", FUNC(z80sio_device::rxtxcb_w)); + //sio1s_clock.signal_handler().append("sio1s", FUNC(z80sio_device::txca_w)); MCFG_DEVICE_ADD("sio1s", Z80SIO, XTAL(16'000'000) /4) MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs232s", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp index c6ccbddf714..6cd100a9f19 100644 --- a/src/mame/drivers/osbexec.cpp +++ b/src/mame/drivers/osbexec.cpp @@ -599,17 +599,16 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<2>)) MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_device, in_w<3>)) - MCFG_INPUT_MERGER_ANY_HIGH("mainirq") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE(m_maincpu, 0)) - - MCFG_DEVICE_ADD(m_sio, Z80SIO, MAIN_CLOCK/6) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE(MODEM_PORT_TAG, rs232_port_device, write_txd)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE(MODEM_PORT_TAG, rs232_port_device, write_dtr)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE(MODEM_PORT_TAG, rs232_port_device, write_rts)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_txd)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_dtr)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE(PRINTER_PORT_TAG, rs232_port_device, write_rts)) MCFG_DEVCB_INVERT - MCFG_Z80SIO_OUT_INT_CB(WRITELINE("mainirq", input_merger_device, in_w<4>)) + INPUT_MERGER_ANY_HIGH(config, "mainirq").output_handler().set_inputline(m_maincpu, 0); + + Z80SIO(config, m_sio, MAIN_CLOCK/6); + m_sio->out_txda_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_txd)).invert(); + m_sio->out_dtra_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_dtr)).invert(); + m_sio->out_rtsa_callback().set(MODEM_PORT_TAG, FUNC(rs232_port_device::write_rts)).invert(); + m_sio->out_txdb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_txd)).invert(); + m_sio->out_dtrb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_dtr)).invert(); + m_sio->out_rtsb_callback().set(PRINTER_PORT_TAG, FUNC(rs232_port_device::write_rts)).invert(); + m_sio->out_int_callback().set("mainirq", FUNC(input_merger_device::in_w<4>)); MCFG_DEVICE_ADD("ctc", PIT8253, 0) MCFG_PIT8253_CLK0(MAIN_CLOCK / 13) // divided by 74S161 @ UC25 @@ -619,17 +618,17 @@ MACHINE_CONFIG_START(osbexec_state::osbexec) MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_sio, z80sio_device, rxtxcb_w)) //MCFG_PIT8253_OUT2_HANDLER(WRITELINE(*this, osbexec_state, spindle_clk_w)) - MCFG_DEVICE_ADD(MODEM_PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(m_sio, z80sio_device, rxa_w)) MCFG_DEVCB_INVERT - MCFG_RS232_DCD_HANDLER(WRITELINE(m_sio, z80sio_device, dcda_w)) MCFG_DEVCB_INVERT - MCFG_RS232_DSR_HANDLER(WRITELINE(*this, osbexec_state, modem_dsr_w)) - MCFG_RS232_RI_HANDLER(WRITELINE(*this, osbexec_state, modem_ri_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE(m_sio, z80sio_device, ctsa_w)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD(PRINTER_PORT_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(m_sio, z80sio_device, rxb_w)) MCFG_DEVCB_INVERT - MCFG_RS232_DCD_HANDLER(WRITELINE(m_sio, z80sio_device, dcdb_w)) MCFG_DEVCB_INVERT - MCFG_RS232_CTS_HANDLER(WRITELINE(m_sio, z80sio_device, ctsb_w)) MCFG_DEVCB_INVERT + rs232_port_device &modem_port(RS232_PORT(config, MODEM_PORT_TAG, default_rs232_devices, nullptr)); + modem_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxa_w)).invert(); + modem_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcda_w)).invert(); + modem_port.dsr_handler().set(FUNC(osbexec_state::modem_dsr_w)); + modem_port.ri_handler().set(FUNC(osbexec_state::modem_ri_w)); + modem_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsa_w)).invert(); + + rs232_port_device &printer_port(RS232_PORT(config, PRINTER_PORT_TAG, default_rs232_devices, nullptr)); + printer_port.rxd_handler().set(m_sio, FUNC(z80sio_device::rxb_w)).invert(); + printer_port.dcd_handler().set(m_sio, FUNC(z80sio_device::dcdb_w)).invert(); + printer_port.cts_handler().set(m_sio, FUNC(z80sio_device::ctsb_w)).invert(); MCFG_DEVICE_ADD("mb8877", MB8877, MAIN_CLOCK/24) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(m_pia_1, pia6821_device, cb1_w)) diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp index 5514da5af93..b0790562582 100644 --- a/src/mame/drivers/othello.cpp +++ b/src/mame/drivers/othello.cpp @@ -411,7 +411,7 @@ MACHINE_CONFIG_START(othello_state::othello) MCFG_DEVICE_IO_MAP(audio_portmap) MCFG_DEVICE_ADD(m_n7751, N7751, XTAL(6'000'000)) - MCFG_MCS48_PORT_T1_IN_CB(GND) // labelled as "TEST", connected to ground + MCFG_MCS48_PORT_T1_IN_CB(CONSTANT(0)) // labelled as "TEST", connected to ground MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, othello_state, n7751_command_r)) MCFG_MCS48_PORT_BUS_IN_CB(READ8(*this, othello_state, n7751_rom_r)) MCFG_MCS48_PORT_P1_OUT_CB(WRITE8("dac", dac_byte_interface, data_w)) diff --git a/src/mame/drivers/othunder.cpp b/src/mame/drivers/othunder.cpp index 9168c1af617..c58d7da7125 100644 --- a/src/mame/drivers/othunder.cpp +++ b/src/mame/drivers/othunder.cpp @@ -622,14 +622,14 @@ MACHINE_CONFIG_START(othunder_state::othunder) MCFG_ADC0808_IN2_CB(IOPORT("P2X")) MCFG_ADC0808_IN3_CB(IOPORT("P2Y")) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_TC0220IOC_WRITE_3_CB(WRITE8(*this, othunder_state, eeprom_w)) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, othunder_state, coins_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + m_tc0220ioc->write_3_callback().set(FUNC(othunder_state::eeprom_w)); + m_tc0220ioc->write_4_callback().set(FUNC(othunder_state::coins_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/p8k.cpp b/src/mame/drivers/p8k.cpp index 8429206dffd..cadcf6628f9 100644 --- a/src/mame/drivers/p8k.cpp +++ b/src/mame/drivers/p8k.cpp @@ -432,9 +432,9 @@ MACHINE_CONFIG_START(p8k_state::p8k) MCFG_Z80DMA_IN_IORQ_CB(READ8(*this, p8k_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(*this, p8k_state, io_write_byte)) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 307200) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio", z80sio_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxcb_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 307200)); + uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txcb_w)); + uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxcb_w)); MCFG_DEVICE_ADD("ctc0", Z80CTC, 1229000) /* 1.22MHz clock */ // to implement: callbacks! @@ -494,9 +494,9 @@ MACHINE_CONFIG_START(p8k_state::p8k_16) MCFG_DEVICE_ADD("p8k_16_daisy", P8K_16_DAISY, 0) MCFG_Z80_DAISY_CHAIN(p8k_16_daisy_chain) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 307200) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio", z80sio_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxcb_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 307200)); + uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txcb_w)); + uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxcb_w)); /* peripheral hardware */ MCFG_DEVICE_ADD("ctc0", Z80CTC, XTAL(4'000'000)) diff --git a/src/mame/drivers/pacman.cpp b/src/mame/drivers/pacman.cpp index 207868f8383..cf7f985c557 100644 --- a/src/mame/drivers/pacman.cpp +++ b/src/mame/drivers/pacman.cpp @@ -3781,10 +3781,10 @@ MACHINE_CONFIG_START(pacman_state::s2650games) pacman(config); /* basic machine hardware */ - MCFG_DEVICE_REPLACE("maincpu", S2650, MASTER_CLOCK/6/2) /* 2H */ - MCFG_DEVICE_PROGRAM_MAP(s2650games_map) - MCFG_DEVICE_DATA_MAP(s2650games_dataport) - MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_DEVCB_INVERT + s2650_device &maincpu(S2650(config.replace(), m_maincpu, MASTER_CLOCK/6/2)); /* 2H */ + maincpu.set_addrmap(AS_PROGRAM, &pacman_state::s2650games_map); + maincpu.set_addrmap(AS_DATA, &pacman_state::s2650games_dataport); + maincpu.sense_handler().set("screen", FUNC(screen_device::vblank)).invert(); MCFG_DEVICE_MODIFY("mainlatch") MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) diff --git a/src/mame/drivers/pandoras.cpp b/src/mame/drivers/pandoras.cpp index 0a1d1884792..dff8388cdc9 100644 --- a/src/mame/drivers/pandoras.cpp +++ b/src/mame/drivers/pandoras.cpp @@ -326,14 +326,14 @@ MACHINE_CONFIG_START(pandoras_state::pandoras) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - needed for correct synchronization of the sound CPUs */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // C3 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, pandoras_state, cpua_irq_enable_w)) // ENA - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(NOOP) // OFSET - unknown - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, pandoras_state, coin_counter_1_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, pandoras_state, coin_counter_2_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, pandoras_state, flipscreen_w)) // FLIP - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, pandoras_state, cpub_irq_enable_w)) // ENB - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // RESETB + ls259_device &mainlatch(LS259(config, "mainlatch")); // C3 + mainlatch.q_out_cb<0>().set(FUNC(pandoras_state::cpua_irq_enable_w)); // ENA + mainlatch.q_out_cb<1>().set_nop(); // OFSET - unknown + mainlatch.q_out_cb<2>().set(FUNC(pandoras_state::coin_counter_1_w)); + mainlatch.q_out_cb<3>().set(FUNC(pandoras_state::coin_counter_2_w)); + mainlatch.q_out_cb<5>().set(FUNC(pandoras_state::flipscreen_w)); // FLIP + mainlatch.q_out_cb<6>().set(FUNC(pandoras_state::cpub_irq_enable_w)); // ENB + mainlatch.q_out_cb<7>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); // RESETB MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/pc100.cpp b/src/mame/drivers/pc100.cpp index 773576d06d9..8d802d3322c 100644 --- a/src/mame/drivers/pc100.cpp +++ b/src/mame/drivers/pc100.cpp @@ -660,7 +660,7 @@ MACHINE_CONFIG_START(pc100_state::pc100) MCFG_DEVICE_ADD("pic8259", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(GND) // ??? + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) // ??? MCFG_DEVICE_ADD("uart8251", I8251, 0) //MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp index eb5bfaf8244..ddf04b74783 100644 --- a/src/mame/drivers/pc88va.cpp +++ b/src/mame/drivers/pc88va.cpp @@ -1633,12 +1633,12 @@ MACHINE_CONFIG_START(pc88va_state::pc88va) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, pc88va_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("dmac", AM9517A, 8000000) /* ch2 is FDC, ch0/3 are "user". ch1 is unused */ MCFG_AM9517A_OUT_HREQ_CB(WRITELINE(*this, pc88va_state, pc88va_hlda_w)) diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp index baa2cb7063d..fc849cd28fa 100644 --- a/src/mame/drivers/pc9801.cpp +++ b/src/mame/drivers/pc9801.cpp @@ -2306,13 +2306,13 @@ MACHINE_CONFIG_START(pc9801_state::pc9801_ide) MACHINE_CONFIG_END MACHINE_CONFIG_START(pc9801_state::pc9801_common) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) - MCFG_PIT8253_CLK0(MAIN_CLOCK_X1) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir0_w)) - MCFG_PIT8253_CLK1(MAIN_CLOCK_X1) /* Memory Refresh */ - MCFG_PIT8253_CLK2(MAIN_CLOCK_X1) /* RS-232c */ - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(UPD8251_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(UPD8251_TAG, i8251_device, write_rxc)) + PIT8253(config, m_pit8253, 0); + m_pit8253->set_clk<0>(MAIN_CLOCK_X1); // heartbeat IRQ + m_pit8253->out_handler<0>().set(m_pic1, FUNC(pic8259_device::ir0_w)); + m_pit8253->set_clk<1>(MAIN_CLOCK_X1); // Memory Refresh + m_pit8253->set_clk<2>(MAIN_CLOCK_X1); // RS-232C + m_pit8253->out_handler<2>().set(m_sio, FUNC(i8251_device::write_txc)); + m_pit8253->out_handler<2>().append(m_sio, FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("i8237", AM9517A, 5000000) // unknown clock, TODO: check channels 0 - 1 MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, pc9801_state, dma_hrq_changed)) @@ -2328,12 +2328,12 @@ MACHINE_CONFIG_START(pc9801_state::pc9801_common) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, pc9801_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) // TODO: Check ir7_w - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("ppi8255_sys", I8255, 0) MCFG_I8255_IN_PORTA_CB(IOPORT("DSW2")) @@ -2351,11 +2351,11 @@ MACHINE_CONFIG_START(pc9801_state::pc9801_common) MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) - MCFG_UPD765A_ADD("upd765_2hd", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE("pic8259_slave", pic8259_device, ir3_w)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("i8237", am9517a_device, dreq2_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", pc9801_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", pc9801_state::floppy_formats) + UPD765A(config, m_fdc_2hd, true, true); + m_fdc_2hd->intrq_wr_callback().set(m_pic2, FUNC(pic8259_device::ir3_w)); + m_fdc_2hd->drq_wr_callback().set(m_dmac, FUNC(am9517a_device::dreq2_w)).invert(); + FLOPPY_CONNECTOR(config, "upd765_2hd:0", pc9801_floppies, "525hd", pc9801_state::floppy_formats); + FLOPPY_CONNECTOR(config, "upd765_2hd:1", pc9801_floppies, "525hd", pc9801_state::floppy_formats); MCFG_DEVICE_ADD("ppi8255_fdd", I8255, 0) MCFG_I8255_IN_PORTA_CB(CONSTANT(0xff)) @@ -2403,11 +2403,11 @@ MACHINE_CONFIG_START(pc9801_state::pc9801) MCFG_RAM_DEFAULT_SIZE("640K") MCFG_RAM_EXTRA_OPTIONS("128K,256K,384K,512K") - MCFG_UPD765A_ADD("upd765_2dd", false, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, pc9801_state, fdc_2dd_irq)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("i8237", am9517a_device, dreq3_w)) MCFG_DEVCB_INVERT - MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:0", pc9801_floppies, "525dd", pc9801_state::floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765_2dd:1", pc9801_floppies, "525dd", pc9801_state::floppy_formats) + UPD765A(config, m_fdc_2dd, false, true); + m_fdc_2dd->intrq_wr_callback().set(FUNC(pc9801_state::fdc_2dd_irq)); + m_fdc_2dd->drq_wr_callback().set(m_dmac, FUNC(am9517a_device::dreq3_w)).invert(); + FLOPPY_CONNECTOR(config, "upd765_2dd:0", pc9801_floppies, "525dd", pc9801_state::floppy_formats); + FLOPPY_CONNECTOR(config, "upd765_2dd:1", pc9801_floppies, "525dd", pc9801_state::floppy_formats); pc9801_sasi(config); MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL(32'768), NOOP, NOOP) diff --git a/src/mame/drivers/pcd.cpp b/src/mame/drivers/pcd.cpp index f32bdfc5de2..0587c223a16 100644 --- a/src/mame/drivers/pcd.cpp +++ b/src/mame/drivers/pcd.cpp @@ -524,7 +524,7 @@ MACHINE_CONFIG_START(pcd_state::pcd) MCFG_DEVICE_ADD("fdc", WD2793, 16_MHz_XTAL / 8) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE("pic1", pic8259_device, ir6_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE("maincpu", i80186_cpu_device, drq1_w)) - MCFG_WD_FDC_ENMF_CALLBACK(GND) + MCFG_WD_FDC_ENMF_CALLBACK(CONSTANT(0)) // floppy drives MCFG_FLOPPY_DRIVE_ADD("fdc:0", pcd_floppies, "55f", pcd_state::floppy_formats) diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp index 881cbc481ee..58c9b3449ac 100644 --- a/src/mame/drivers/pcm.cpp +++ b/src/mame/drivers/pcm.cpp @@ -295,15 +295,15 @@ MACHINE_CONFIG_START(pcm_state::pcm) MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(10'000'000) /4) - MCFG_DEVICE_ADD("ctc_u", Z80CTC, XTAL(10'000'000) /4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - - MCFG_DEVICE_ADD("ctc_s", Z80CTC, XTAL(10'000'000) /4) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio", z80sio_device, rxtxcb_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE(*this, pcm_state, pcm_82_w)) // speaker + Z80CTC(config, m_ctc_u, 10_MHz_XTAL / 4); + m_ctc_u->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + + Z80CTC(config, m_ctc_s, 10_MHz_XTAL / 4); + m_ctc_s->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc_s->zc_callback<0>().set("sio", FUNC(z80sio_device::rxca_w)); + m_ctc_s->zc_callback<0>().append("sio", FUNC(z80sio_device::txca_w)); + m_ctc_s->zc_callback<1>().set("sio", FUNC(z80sio_device::rxtxcb_w)); + m_ctc_s->zc_callback<2>().set(FUNC(pcm_state::pcm_82_w)); // speaker MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/pecom.cpp b/src/mame/drivers/pecom.cpp index 2e60b208dbf..ac5d4b2228d 100644 --- a/src/mame/drivers/pecom.cpp +++ b/src/mame/drivers/pecom.cpp @@ -175,7 +175,7 @@ MACHINE_CONFIG_START(pecom_state::pecom64) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, cdp1869_device::DOT_CLK_PAL/3) MCFG_DEVICE_PROGRAM_MAP(pecom64_mem) MCFG_DEVICE_IO_MAP(pecom64_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, pecom_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, pecom_state, ef2_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, pecom_state, q_w)) diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp index 073f2c4205e..06cc28e0a5b 100644 --- a/src/mame/drivers/peoplepc.cpp +++ b/src/mame/drivers/peoplepc.cpp @@ -261,12 +261,12 @@ MACHINE_CONFIG_START(peoplepc_state::olypeopl) MCFG_DEVICE_ADD("pic8259_0", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, peoplepc_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_1", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_0", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("ppi8255", I8255, 0) diff --git a/src/mame/drivers/peyper.cpp b/src/mame/drivers/peyper.cpp index 26c326205dd..bcf4ad25e22 100644 --- a/src/mame/drivers/peyper.cpp +++ b/src/mame/drivers/peyper.cpp @@ -630,8 +630,8 @@ MACHINE_CONFIG_START(peyper_state::peyper) MCFG_I8279_OUT_SL_CB(WRITE8(*this, peyper_state, col_w)) // scan SL lines MCFG_I8279_OUT_DISP_CB(WRITE8(*this, peyper_state, disp_w)) // display A&B MCFG_I8279_IN_RL_CB(READ8(*this, peyper_state, sw_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) + MCFG_I8279_IN_SHIFT_CB(CONSTANT(1)) // Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(1)) MACHINE_CONFIG_END // Not allowed to set up an array all at once, so we have this mess diff --git a/src/mame/drivers/pg685.cpp b/src/mame/drivers/pg685.cpp index 320d384025a..1ea1fd48e77 100644 --- a/src/mame/drivers/pg685.cpp +++ b/src/mame/drivers/pg685.cpp @@ -432,7 +432,7 @@ MACHINE_CONFIG_START(pg685_state::pg675) MCFG_DEVICE_ADD("mainpic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) // i/o cpu @@ -481,7 +481,7 @@ MACHINE_CONFIG_START(pg685_state::pg685) MCFG_DEVICE_ADD("mainpic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) // i/o cpu @@ -532,7 +532,7 @@ MACHINE_CONFIG_START(pg685_state::pg685oua12) MCFG_DEVICE_ADD("mainpic", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) // i/o cpu diff --git a/src/mame/drivers/pimps.cpp b/src/mame/drivers/pimps.cpp index 31335ecb2ed..b93bacbd965 100644 --- a/src/mame/drivers/pimps.cpp +++ b/src/mame/drivers/pimps.cpp @@ -129,39 +129,39 @@ static DEVICE_INPUT_DEFAULTS_START( terminal ) // set up terminal to default to DEVICE_INPUT_DEFAULTS( "RS232_STOPBITS", 0xff, RS232_STOPBITS_2 ) DEVICE_INPUT_DEFAULTS_END -MACHINE_CONFIG_START(pimps_state::pimps) - /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8085A, XTAL(2'000'000)) - MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_IO_MAP(io_map) - - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_rxc)) - - MCFG_DEVICE_ADD("uart1", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232a", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart1", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart1", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart1", i8251_device, write_cts)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) // must be exactly here - - MCFG_DEVICE_ADD("uart2", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232b", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("uart2", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart2", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart2", i8251_device, write_cts)) -MACHINE_CONFIG_END +void pimps_state::pimps(machine_config &config) +{ + I8085A(config, m_maincpu, 2_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &pimps_state::mem_map); + m_maincpu->set_addrmap(AS_IO, &pimps_state::io_map); + + clock_device &uart_clock(CLOCK(config, "uart_clock", 153'600)); + uart_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_rxc)); + + i8251_device &uart1(I8251(config, "uart1", 0)); + uart1.txd_handler().set("rs232a", FUNC(rs232_port_device::write_txd)); + uart1.dtr_handler().set("rs232a", FUNC(rs232_port_device::write_dtr)); + uart1.rts_handler().set("rs232a", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal")); + rs232a.rxd_handler().set("uart1", FUNC(i8251_device::write_rxd)); + rs232a.dsr_handler().set("uart1", FUNC(i8251_device::write_dsr)); + rs232a.cts_handler().set("uart1", FUNC(i8251_device::write_cts)); + rs232a.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(terminal)); // must be exactly here + + i8251_device &uart2(I8251(config, "uart2", 0)); + uart2.txd_handler().set("rs232b", FUNC(rs232_port_device::write_txd)); + uart2.dtr_handler().set("rs232b", FUNC(rs232_port_device::write_dtr)); + uart2.rts_handler().set("rs232b", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232b(RS232_PORT(config, "rs232b", default_rs232_devices, nullptr)); + rs232b.rxd_handler().set("uart2", FUNC(i8251_device::write_rxd)); + rs232b.dsr_handler().set("uart2", FUNC(i8251_device::write_dsr)); + rs232b.cts_handler().set("uart2", FUNC(i8251_device::write_cts)); +} /* ROM definition */ ROM_START( pimps ) diff --git a/src/mame/drivers/pktgaldx.cpp b/src/mame/drivers/pktgaldx.cpp index 1e061c2e6cb..164fdece3ab 100644 --- a/src/mame/drivers/pktgaldx.cpp +++ b/src/mame/drivers/pktgaldx.cpp @@ -378,11 +378,11 @@ MACHINE_CONFIG_START(pktgaldx_state::pktgaldx) MCFG_DECO_SPRITE_GFX_REGION(2) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot104") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE(8,9, 4,5,6,7 ,1,0,3,2) // hopefully this is correct, nothing else uses this arrangement! + DECO104PROT(config, m_deco104, 0); + m_deco104->port_a_cb().set_ioport("INPUTS"); + m_deco104->port_b_cb().set_ioport("SYSTEM"); + m_deco104->port_c_cb().set_ioport("DSW"); + m_deco104->set_interface_scramble(8,9, 4,5,6,7, 1,0,3,2); // hopefully this is correct, nothing else uses this arrangement! /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/play_2.cpp b/src/mame/drivers/play_2.cpp index 6d4ac1a001f..12865da25cd 100644 --- a/src/mame/drivers/play_2.cpp +++ b/src/mame/drivers/play_2.cpp @@ -370,7 +370,7 @@ MACHINE_CONFIG_START(play_2_state::play_2) MCFG_DEVICE_ADD("maincpu", CDP1802, XTAL(2'950'000)) MCFG_DEVICE_PROGRAM_MAP(play_2_map) MCFG_DEVICE_IO_MAP(play_2_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, play_2_state, clear_r)) MCFG_COSMAC_EF1_CALLBACK(READLINE(*this, play_2_state, ef1_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, play_2_state, ef4_r)) @@ -388,13 +388,13 @@ MACHINE_CONFIG_START(play_2_state::play_2) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, play_2_state, clock2_w)) // This is actually a 4013 chip (has 2 RS flipflops) - MCFG_DEVICE_ADD("4013a", TTL7474, 0) - MCFG_7474_COMP_OUTPUT_CB(WRITELINE("4013a", ttl7474_device, d_w)) - MCFG_7474_OUTPUT_CB(WRITELINE(*this, play_2_state, q4013a_w)) + TTL7474(config, m_4013a, 0); + m_4013a->comp_output_cb().set(m_4013a, FUNC(ttl7474_device::d_w)); + m_4013a->output_cb().set(FUNC(play_2_state::q4013a_w)); - MCFG_DEVICE_ADD("4013b", TTL7474, 0) - MCFG_7474_OUTPUT_CB(WRITELINE("maincpu", cosmac_device, ef2_w)) - MCFG_7474_COMP_OUTPUT_CB(WRITELINE("maincpu", cosmac_device, int_w)) MCFG_DEVCB_INVERT // int is reversed in mame + TTL7474(config, m_4013b, 0); + m_4013b->output_cb().set(m_maincpu, FUNC(cosmac_device::ef2_w)); + m_4013b->comp_output_cb().set(m_maincpu, FUNC(cosmac_device::int_w)).invert(); // int is reversed in mame /* Sound */ genpin_audio(config); diff --git a/src/mame/drivers/play_3.cpp b/src/mame/drivers/play_3.cpp index aaf00424e82..5c56395a9f2 100644 --- a/src/mame/drivers/play_3.cpp +++ b/src/mame/drivers/play_3.cpp @@ -480,7 +480,7 @@ MACHINE_CONFIG_START(play_3_state::play_3) MCFG_DEVICE_ADD("maincpu", CDP1802, XTAL(3'579'545)) MCFG_DEVICE_PROGRAM_MAP(play_3_map) MCFG_DEVICE_IO_MAP(play_3_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, play_3_state, clear_r)) MCFG_COSMAC_EF1_CALLBACK(READLINE(*this, play_3_state, ef1_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, play_3_state, ef4_r)) @@ -499,13 +499,13 @@ MACHINE_CONFIG_START(play_3_state::play_3) MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, play_3_state, clock2_w)) // This is actually a 4013 chip (has 2 RS flipflops) - MCFG_DEVICE_ADD("4013a", TTL7474, 0) - MCFG_7474_OUTPUT_CB(WRITELINE(*this, play_3_state, q4013a_w)) - MCFG_7474_COMP_OUTPUT_CB(WRITELINE("4013a", ttl7474_device, d_w)) + TTL7474(config, m_4013a, 0); + m_4013a->output_cb().set(FUNC(play_3_state::q4013a_w)); + m_4013a->comp_output_cb().set(m_4013a, FUNC(ttl7474_device::d_w)); - MCFG_DEVICE_ADD("4013b", TTL7474, 0) - MCFG_7474_OUTPUT_CB(WRITELINE("maincpu", cosmac_device, ef2_w)) MCFG_DEVCB_INVERT // inverted - MCFG_7474_COMP_OUTPUT_CB(WRITELINE("maincpu", cosmac_device, int_w)) MCFG_DEVCB_INVERT // inverted + TTL7474(config, m_4013b, 0); + m_4013b->output_cb().set(m_maincpu, FUNC(cosmac_device::ef2_w)).invert(); // inverted + m_4013b->comp_output_cb().set(m_maincpu, FUNC(cosmac_device::int_w)).invert(); // inverted /* Sound */ genpin_audio(config); @@ -513,7 +513,7 @@ MACHINE_CONFIG_START(play_3_state::play_3) MCFG_DEVICE_ADD("audiocpu", CDP1802, XTAL(3'579'545)) MCFG_DEVICE_PROGRAM_MAP(play_3_audio_map) MCFG_DEVICE_IO_MAP(play_3_audio_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, play_3_state, clear_a_r)) SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp index e4766016db5..5c1106e2b8d 100644 --- a/src/mame/drivers/playch10.cpp +++ b/src/mame/drivers/playch10.cpp @@ -646,27 +646,27 @@ WRITE_LINE_MEMBER(playch10_state::vblank_irq) MACHINE_CONFIG_START(playch10_state::playch10) // basic machine hardware - MCFG_DEVICE_ADD("maincpu", Z80, 8000000/2) // 4 MHz - MCFG_DEVICE_PROGRAM_MAP(bios_map) - MCFG_DEVICE_IO_MAP(bios_io_map) - - MCFG_DEVICE_ADD("cart", N2A03, NTSC_APU_CLOCK) - MCFG_DEVICE_PROGRAM_MAP(cart_map) - - MCFG_DEVICE_ADD("outlatch1", LS259, 0) // 7D - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, playch10_state, sdcs_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, playch10_state, cntrl_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, playch10_state, disp_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, playch10_state, sound_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(INPUTLINE("cart", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // GAMERES - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE("cart", INPUT_LINE_HALT)) MCFG_DEVCB_INVERT // GAMESTOP - - MCFG_DEVICE_ADD("outlatch2", LS259, 0) // 7E - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, playch10_state, nmi_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, playch10_state, dog_di_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, playch10_state, ppu_reset_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, playch10_state, up8w_w)) - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(WRITE8(*this, playch10_state, cart_sel_w)) MCFG_DEVCB_MASK(0x78) MCFG_DEVCB_RSHIFT(-3) + Z80(config, m_maincpu, 8000000/2); // 4 MHz + m_maincpu->set_addrmap(AS_PROGRAM, &playch10_state::bios_map); + m_maincpu->set_addrmap(AS_IO, &playch10_state::bios_io_map); + + N2A03(config, m_cartcpu, NTSC_APU_CLOCK); + m_cartcpu->set_addrmap(AS_PROGRAM, &playch10_state::cart_map); + + ls259_device &outlatch1(LS259(config, "outlatch1")); // 7D + outlatch1.q_out_cb<0>().set(FUNC(playch10_state::sdcs_w)); + outlatch1.q_out_cb<1>().set(FUNC(playch10_state::cntrl_mask_w)); + outlatch1.q_out_cb<2>().set(FUNC(playch10_state::disp_mask_w)); + outlatch1.q_out_cb<3>().set(FUNC(playch10_state::sound_mask_w)); + outlatch1.q_out_cb<4>().set_inputline(m_cartcpu, INPUT_LINE_RESET).invert(); // GAMERES + outlatch1.q_out_cb<5>().set_inputline(m_cartcpu, INPUT_LINE_HALT).invert(); // GAMESTOP + + ls259_device &outlatch2(LS259(config, "outlatch2")); // 7E + outlatch2.q_out_cb<0>().set(FUNC(playch10_state::nmi_enable_w)); + outlatch2.q_out_cb<1>().set(FUNC(playch10_state::dog_di_w)); + outlatch2.q_out_cb<2>().set(FUNC(playch10_state::ppu_reset_w)); + outlatch2.q_out_cb<7>().set(FUNC(playch10_state::up8w_w)); + outlatch2.parallel_out_cb().set(FUNC(playch10_state::cart_sel_w)).rshift(3).mask(0x0f); // video hardware MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_playch10) @@ -687,11 +687,11 @@ MACHINE_CONFIG_START(playch10_state::playch10) MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 30*8-1) MCFG_SCREEN_UPDATE_DRIVER(playch10_state, screen_update_playch10_bottom) - MCFG_PPU2C03B_ADD("ppu") - MCFG_PPU2C0X_SET_SCREEN("bottom") - MCFG_PPU2C0X_CPU("cart") - MCFG_PPU2C0X_INT_CALLBACK(INPUTLINE("cart", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, playch10_state, int_detect_w)) + PPU_2C03B(config, m_ppu, 0); + m_ppu->set_screen("bottom"); + m_ppu->set_cpu_tag("cart"); + m_ppu->int_callback().set_inputline(m_cartcpu, INPUT_LINE_NMI); + m_ppu->int_callback().append(FUNC(playch10_state::int_detect_w)); SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/plus4.cpp b/src/mame/drivers/plus4.cpp index c9b5cb87af6..a2cb4c6e626 100644 --- a/src/mame/drivers/plus4.cpp +++ b/src/mame/drivers/plus4.cpp @@ -919,27 +919,27 @@ MACHINE_CONFIG_START(plus4_state::plus4) // devices MCFG_PLS100_ADD(PLA_TAG) - MCFG_DEVICE_ADD(m_user, PET_USER_PORT, plus4_user_port_cards, nullptr) - MCFG_PET_USER_PORT_4_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p2)) // cassette sense - MCFG_PET_USER_PORT_5_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p3)) - MCFG_PET_USER_PORT_6_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p4)) - MCFG_PET_USER_PORT_7_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p5)) - MCFG_PET_USER_PORT_8_HANDLER(WRITELINE(m_acia, mos6551_device, write_rxc)) - MCFG_PET_USER_PORT_B_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p0)) - MCFG_PET_USER_PORT_C_HANDLER(WRITELINE(m_acia, mos6551_device, write_rxd)) - MCFG_PET_USER_PORT_F_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p7)) - MCFG_PET_USER_PORT_H_HANDLER(WRITELINE(m_acia, mos6551_device, write_dcd)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter - MCFG_PET_USER_PORT_J_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p6)) - MCFG_PET_USER_PORT_K_HANDLER(WRITELINE(m_spi_user, mos6529_device, write_p1)) - MCFG_PET_USER_PORT_L_HANDLER(WRITELINE(m_acia, mos6551_device, write_dsr)) MCFG_DEVCB_XOR(1) // TODO: add missing pull up before inverter - - MCFG_DEVICE_ADD(m_acia, MOS6551, 0) - MCFG_MOS6551_XTAL(XTAL(1'843'200)) - MCFG_MOS6551_RXC_HANDLER(WRITELINE(m_user, pet_user_port_device, write_8)) - MCFG_MOS6551_RTS_HANDLER(WRITELINE(m_user, pet_user_port_device, write_d)) MCFG_DEVCB_XOR(1) - MCFG_MOS6551_DTR_HANDLER(WRITELINE(m_user, pet_user_port_device, write_e)) MCFG_DEVCB_XOR(1) - MCFG_MOS6551_TXD_HANDLER(WRITELINE(m_user, pet_user_port_device, write_m)) - MCFG_MOS6551_IRQ_HANDLER(WRITELINE(*this, plus4_state, acia_irq_w)) + PET_USER_PORT(config, m_user, plus4_user_port_cards, nullptr); + m_user->p4_handler().set(m_spi_user, FUNC(mos6529_device::write_p2)); // cassette sense + m_user->p5_handler().set(m_spi_user, FUNC(mos6529_device::write_p3)); + m_user->p6_handler().set(m_spi_user, FUNC(mos6529_device::write_p4)); + m_user->p7_handler().set(m_spi_user, FUNC(mos6529_device::write_p5)); + m_user->p8_handler().set(m_acia, FUNC(mos6551_device::write_rxc)); + m_user->pb_handler().set(m_spi_user, FUNC(mos6529_device::write_p0)); + m_user->pc_handler().set(m_acia, FUNC(mos6551_device::write_rxd)); + m_user->pf_handler().set(m_spi_user, FUNC(mos6529_device::write_p7)); + m_user->ph_handler().set(m_acia, FUNC(mos6551_device::write_dcd)).invert(); // TODO: add missing pull up before inverter + m_user->pj_handler().set(m_spi_user, FUNC(mos6529_device::write_p6)); + m_user->pk_handler().set(m_spi_user, FUNC(mos6529_device::write_p1)); + m_user->pl_handler().set(m_acia, FUNC(mos6551_device::write_dsr)).invert(); // TODO: add missing pull up before inverter + + MOS6551(config, m_acia, 0); + m_acia->set_xtal(1.8432_MHz_XTAL); + m_acia->rxc_handler().set(m_user, FUNC(pet_user_port_device::write_8)); + m_acia->rts_handler().set(m_user, FUNC(pet_user_port_device::write_d)).invert(); + m_acia->dtr_handler().set(m_user, FUNC(pet_user_port_device::write_e)).invert(); + m_acia->txd_handler().set(m_user, FUNC(pet_user_port_device::write_m)); + m_acia->irq_handler().set(FUNC(plus4_state::acia_irq_w)); MCFG_DEVICE_ADD(m_spi_user, MOS6529, 0) MCFG_MOS6529_P0_HANDLER(WRITELINE(m_user, pet_user_port_device, write_b)) diff --git a/src/mame/drivers/pm68k.cpp b/src/mame/drivers/pm68k.cpp index 142b5829328..c8020e6c8d9 100644 --- a/src/mame/drivers/pm68k.cpp +++ b/src/mame/drivers/pm68k.cpp @@ -71,11 +71,11 @@ MACHINE_CONFIG_START(pm68k_state::pm68k) MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs232b", rs232_port_device, write_dtr)) MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs232b", rs232_port_device, write_rts)) - MCFG_DEVICE_ADD("stc", AM9513, 4000000) - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("mpsc", i8274_new_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mpsc", i8274_new_device, txca_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("mpsc", i8274_new_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mpsc", i8274_new_device, txcb_w)) + am9513_device &stc(AM9513(config, "stc", 4000000)); + stc.out4_cb().set("mpsc", FUNC(i8274_new_device::rxca_w)); + stc.out4_cb().append("mpsc", FUNC(i8274_new_device::txca_w)); + stc.out5_cb().set("mpsc", FUNC(i8274_new_device::rxcb_w)); + stc.out5_cb().append("mpsc", FUNC(i8274_new_device::txcb_w)); MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE("mpsc", i8274_new_device, rxa_w)) diff --git a/src/mame/drivers/pntnpuzl.cpp b/src/mame/drivers/pntnpuzl.cpp index 36528e8994f..104a265b2b1 100644 --- a/src/mame/drivers/pntnpuzl.cpp +++ b/src/mame/drivers/pntnpuzl.cpp @@ -359,12 +359,12 @@ MACHINE_CONFIG_START(pntnpuzl_state::pntnpuzl) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("via", VIA6522, XTAL(12'000'000) / 10) - MCFG_VIA6522_READPA_HANDLER(IOPORT("IN2")) - MCFG_VIA6522_READPB_HANDLER(IOPORT("IN1")) - MCFG_VIA6522_WRITEPB_HANDLER(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(4) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) + VIA6522(config, m_via, 12_MHz_XTAL / 10); + m_via->readpa_handler().set_ioport("IN2"); + m_via->readpb_handler().set_ioport("IN1"); + m_via->writepb_handler().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(4); + m_via->writepb_handler().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(6); + m_via->writepb_handler().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); // CB2 used for serial communication with 8798 MCFG_DEVICE_ADD("mcu", P8098, XTAL(12'000'000)) diff --git a/src/mame/drivers/pokechmp.cpp b/src/mame/drivers/pokechmp.cpp index a2784703321..48f2eec067f 100644 --- a/src/mame/drivers/pokechmp.cpp +++ b/src/mame/drivers/pokechmp.cpp @@ -229,22 +229,22 @@ WRITE_LINE_MEMBER(pokechmp_state::sound_irq) MACHINE_CONFIG_START(pokechmp_state::pokechmp) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M6502, XTAL(4'000'000)/4) - MCFG_DEVICE_PROGRAM_MAP(pokechmp_map) + M6502(config, m_maincpu, 4_MHz_XTAL/4); + m_maincpu->set_addrmap(AS_PROGRAM, &pokechmp_state::pokechmp_map); - MCFG_DEVICE_ADD("audiocpu", M6502, XTAL(4'000'000)/4) - MCFG_DEVICE_PROGRAM_MAP(pokechmp_sound_map) + M6502(config, m_audiocpu, 4_MHz_XTAL/4); + m_audiocpu->set_addrmap(AS_PROGRAM, &pokechmp_state::pokechmp_sound_map); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(pokechmp_state, screen_update_pokechmp) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, pokechmp_state, sound_irq)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(32*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(pokechmp_state::screen_update_pokechmp)); + screen.set_palette("palette"); + screen.screen_vblank().set_inputline(m_maincpu, INPUT_LINE_NMI); + screen.screen_vblank().append(FUNC(pokechmp_state::sound_irq)); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pokechmp) MCFG_PALETTE_ADD("palette", 0x400) diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp index 636ae61685f..f3489d4df0f 100644 --- a/src/mame/drivers/polepos.cpp +++ b/src/mame/drivers/polepos.cpp @@ -862,14 +862,14 @@ MACHINE_CONFIG_START(polepos_state::polepos) MCFG_DEVICE_ADD(m_subcpu2, Z8002, MASTER_CLOCK/8) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(z8002_map_2) - MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ - MCFG_NAMCO_51XX_SCREEN("screen") - MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0")) MCFG_DEVCB_MASK(0x0f) - MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f) - MCFG_NAMCO_51XX_INPUT_3_CB(IOPORT("DSWB")) MCFG_DEVCB_RSHIFT(4) - MCFG_NAMCO_51XX_OUTPUT_0_CB(WRITE8(*this, polepos_state,out_0)) - MCFG_NAMCO_51XX_OUTPUT_1_CB(WRITE8(*this, polepos_state,out_1)) + namco_51xx_device &n51xx(NAMCO_51XX(config, "51xx", MASTER_CLOCK/8/2)); /* 1.536 MHz */ + n51xx.set_screen_tag(m_screen); + n51xx.input_callback<0>().set_ioport("IN0").mask(0x0f); + n51xx.input_callback<1>().set_ioport("IN0").rshift(4); + n51xx.input_callback<2>().set_ioport("DSWB").mask(0x0f); + n51xx.input_callback<3>().set_ioport("DSWB").rshift(4); + n51xx.output_callback<0>().set(FUNC(polepos_state::out_0)); + n51xx.output_callback<1>().set(FUNC(polepos_state::out_1)); MCFG_NAMCO_52XX_ADD("52xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ MCFG_NAMCO_52XX_DISCRETE("discrete") @@ -877,12 +877,12 @@ MACHINE_CONFIG_START(polepos_state::polepos) MCFG_NAMCO_52XX_ROMREAD_CB(READ8(*this, polepos_state,namco_52xx_rom_r)) MCFG_NAMCO_52XX_SI_CB(READ8(*this, polepos_state,namco_52xx_si_r)) - MCFG_NAMCO_53XX_ADD("53xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ - MCFG_NAMCO_53XX_K_CB(READ8(*this, polepos_state,namco_53xx_k_r)) - MCFG_NAMCO_53XX_INPUT_0_CB(READ8(*this, polepos_state,steering_changed_r)) - MCFG_NAMCO_53XX_INPUT_1_CB(READ8(*this, polepos_state,steering_delta_r)) - MCFG_NAMCO_53XX_INPUT_2_CB(IOPORT("DSWA")) MCFG_DEVCB_MASK(0x0f) - MCFG_NAMCO_53XX_INPUT_3_CB(IOPORT("DSWA")) MCFG_DEVCB_RSHIFT(4) + namco_53xx_device &n53xx(NAMCO_53XX(config, "53xx", MASTER_CLOCK/8/2)); /* 1.536 MHz */ + n53xx.k_port_callback().set(FUNC(polepos_state::namco_53xx_k_r)); + n53xx.input_callback<0>().set(FUNC(polepos_state::steering_changed_r)); + n53xx.input_callback<1>().set(FUNC(polepos_state::steering_delta_r)); + n53xx.input_callback<2>().set_ioport("DSWA").mask(0x0f); + n53xx.input_callback<3>().set_ioport("DSWA").rshift(4); MCFG_NAMCO_54XX_ADD("54xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ MCFG_NAMCO_54XX_DISCRETE("discrete") @@ -906,16 +906,16 @@ MACHINE_CONFIG_START(polepos_state::polepos) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", polepos_state, scanline, "screen", 0, 1) - MCFG_DEVICE_ADD(m_latch, LS259, 0) // at 8E on polepos - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(CLEARLINE(m_maincpu, 0)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, polepos_state, iosel_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(m_namco_sound, namco_device, sound_enable_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("polepos", polepos_sound_device, clson_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, polepos_state, gasel_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(INPUTLINE(m_subcpu, INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE(m_subcpu2, INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, polepos_state, sb0_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, polepos_state, chacl_w)) + LS259(config, m_latch); // at 8E on polepos + m_latch->q_out_cb<0>().set_inputline(m_maincpu, 0, CLEAR_LINE).invert(); + m_latch->q_out_cb<1>().set(FUNC(polepos_state::iosel_w)); + m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w)); + m_latch->q_out_cb<2>().set("polepos", FUNC(polepos_sound_device::clson_w)); + m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w)); + m_latch->q_out_cb<4>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); + m_latch->q_out_cb<5>().set_inputline(m_subcpu2, INPUT_LINE_RESET).invert(); + m_latch->q_out_cb<6>().set(FUNC(polepos_state::sb0_w)); + m_latch->q_out_cb<7>().set(FUNC(polepos_state::chacl_w)); /* video hardware */ MCFG_SCREEN_ADD(m_screen, RASTER) @@ -996,12 +996,11 @@ MACHINE_CONFIG_START(polepos_state::topracern) MCFG_DEVICE_ADD(m_subcpu2, Z8002, MASTER_CLOCK/8) /* 3.072 MHz */ MCFG_DEVICE_PROGRAM_MAP(z8002_map_2) - /* TODO, remove these devices too, this bootleg doesn't have them, but the emulation doesn't boot without them.. */ - /* doesn't exist on the bootleg, but required for now or the game only boots in test mode! - they probably simulate some of the logic */ - MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */ - MCFG_NAMCO_51XX_SCREEN("screen") - MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4) + // TODO, remove these devices too, this bootleg doesn't have them, but the emulation doesn't boot without them. + // doesn't exist on the bootleg, but required for now or the game only boots in test mode! they probably simulate some of the logic + namco_51xx_device &n51xx(NAMCO_51XX(config, "51xx", MASTER_CLOCK/8/2)); /* 1.536 MHz */ + n51xx.set_screen_tag(m_screen); + n51xx.input_callback<1>().set_ioport("IN0").rshift(4); MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/8/64) MCFG_NAMCO_06XX_MAINCPU("maincpu") @@ -1017,16 +1016,16 @@ MACHINE_CONFIG_START(polepos_state::topracern) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", polepos_state, scanline, "screen", 0, 1) - MCFG_DEVICE_ADD(m_latch, LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(CLEARLINE(m_maincpu, 0)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, polepos_state, iosel_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(m_namco_sound, namco_device, sound_enable_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("polepos", polepos_sound_device, clson_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, polepos_state, gasel_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(INPUTLINE(m_subcpu, INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE(m_subcpu2, INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, polepos_state, sb0_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, polepos_state, chacl_w)) + LS259(config, m_latch); + m_latch->q_out_cb<0>().set_inputline(m_maincpu, 0, CLEAR_LINE).invert(); + m_latch->q_out_cb<1>().set(FUNC(polepos_state::iosel_w)); + m_latch->q_out_cb<2>().set(m_namco_sound, FUNC(namco_device::sound_enable_w)); + m_latch->q_out_cb<2>().set("polepos", FUNC(polepos_sound_device::clson_w)); + m_latch->q_out_cb<3>().set(FUNC(polepos_state::gasel_w)); + m_latch->q_out_cb<4>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); + m_latch->q_out_cb<5>().set_inputline(m_subcpu2, INPUT_LINE_RESET).invert(); + m_latch->q_out_cb<6>().set(FUNC(polepos_state::sb0_w)); + m_latch->q_out_cb<7>().set(FUNC(polepos_state::chacl_w)); /* video hardware */ MCFG_SCREEN_ADD(m_screen, RASTER) @@ -1063,21 +1062,22 @@ MACHINE_CONFIG_START(polepos_state::topracern) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) MACHINE_CONFIG_END -MACHINE_CONFIG_START(polepos_state::polepos2bi) +void polepos_state::polepos2bi(machine_config &config) +{ topracern(config); - MCFG_DEVICE_ADD(m_sound_z80, Z80, MASTER_CLOCK/8) /*? MHz */ - MCFG_DEVICE_PROGRAM_MAP(sound_z80_bootleg_map) - MCFG_DEVICE_IO_MAP(sound_z80_bootleg_iomap) + Z80(config, m_sound_z80, MASTER_CLOCK/8); /*? MHz */ + m_sound_z80->set_addrmap(AS_PROGRAM, &polepos_state::sound_z80_bootleg_map); + m_sound_z80->set_addrmap(AS_IO, &polepos_state::sound_z80_bootleg_iomap); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_sound_z80, INPUT_LINE_NMI)) - MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_sound_z80, INPUT_LINE_NMI); + m_soundlatch->set_separate_acknowledge(true); - MCFG_DEVICE_ADD("tms", TMS5220, 600000) /* ? Mhz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.80) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 0.80) -MACHINE_CONFIG_END + TMS5220(config, "tms", 600000) /* ? Mhz */ + .add_route(ALL_OUTPUTS, "lspeaker", 0.80) + .add_route(ALL_OUTPUTS, "rspeaker", 0.80); +} diff --git a/src/mame/drivers/polgar.cpp b/src/mame/drivers/polgar.cpp index c0686570977..a935b2a50a8 100644 --- a/src/mame/drivers/polgar.cpp +++ b/src/mame/drivers/polgar.cpp @@ -515,14 +515,14 @@ MACHINE_CONFIG_START(mephisto_risc_state::mrisc) MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_DEVICE_ADD("outlatch", HC259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led100")) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led101")) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led102")) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led103")) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led104")) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led105")) - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(MEMBANK("rombank")) MCFG_DEVCB_MASK(0xc0) MCFG_DEVCB_XOR(0x40) MCFG_DEVCB_RSHIFT(-6) + hc259_device &outlatch(HC259(config, "outlatch")); + outlatch.q_out_cb<0>().set_output("led100"); + outlatch.q_out_cb<1>().set_output("led101"); + outlatch.q_out_cb<2>().set_output("led102"); + outlatch.q_out_cb<3>().set_output("led103"); + outlatch.q_out_cb<4>().set_output("led104"); + outlatch.q_out_cb<5>().set_output("led105"); + outlatch.parallel_out_cb().set_membank("rombank").rshift(6).mask(0x03).exor(0x01); MCFG_RAM_ADD("ram") MCFG_RAM_DEFAULT_SIZE("1M") @@ -548,9 +548,9 @@ MACHINE_CONFIG_START(mephisto_academy_state::academy) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(academy_mem) - MCFG_DEVICE_REPLACE("outlatch", HC259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, mephisto_academy_state, academy_nmi_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("display:beeper", beep_device, set_state)) MCFG_DEVCB_INVERT + hc259_device &outlatch(HC259(config.replace(), "outlatch")); + outlatch.q_out_cb<1>().set(FUNC(mephisto_academy_state::academy_nmi_w)); + outlatch.q_out_cb<2>().set("display:beeper", FUNC(beep_device::set_state)).invert(); MCFG_DEFAULT_LAYOUT(layout_mephisto_academy) MACHINE_CONFIG_END diff --git a/src/mame/drivers/policetr.cpp b/src/mame/drivers/policetr.cpp index e8520cb5b89..5d97a50ed9e 100644 --- a/src/mame/drivers/policetr.cpp +++ b/src/mame/drivers/policetr.cpp @@ -404,13 +404,13 @@ MACHINE_CONFIG_START(policetr_state::policetr) EEPROM_SERIAL_93C66_16BIT(config, m_eeprom); /* video hardware */ - device = &SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); m_screen->set_refresh_hz(60); m_screen->set_size(400, 262); /* needs to be verified */ m_screen->set_visarea(0, 393, 0, 239); m_screen->set_palette(m_palette); - MCFG_SCREEN_UPDATE_DRIVER(policetr_state, screen_update_policetr); + m_screen->set_screen_update(FUNC(policetr_state::screen_update_policetr)); PALETTE(config, m_palette, 256); @@ -424,10 +424,11 @@ MACHINE_CONFIG_START(policetr_state::policetr) MACHINE_CONFIG_END -MACHINE_CONFIG_START(policetr_state::sshooter) +void policetr_state::sshooter(machine_config &config) +{ policetr(config); m_maincpu->set_addrmap(AS_PROGRAM, &policetr_state::sshooter_map); -MACHINE_CONFIG_END +} diff --git a/src/mame/drivers/poly.cpp b/src/mame/drivers/poly.cpp index 0154f503671..0ab407676f1 100644 --- a/src/mame/drivers/poly.cpp +++ b/src/mame/drivers/poly.cpp @@ -344,13 +344,12 @@ MACHINE_CONFIG_START(poly_state::poly) //MCFG_ACIA6850_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) MCFG_ACIA6850_IRQ_HANDLER(WRITELINE("irqs", input_merger_device, in_w<6>)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + CLOCK(config, m_acia_clock, 153600); + m_acia_clock->signal_handler().set(m_acia, FUNC(acia6850_device::write_txc)); + m_acia_clock->signal_handler().append(m_acia, FUNC(acia6850_device::write_rxc)); /* software lists */ - MCFG_SOFTWARE_LIST_ADD("flop_list", "poly_flop") - MCFG_SOFTWARE_LIST_FILTER("flop_list", "POLY1") + SOFTWARE_LIST(config, "flop_list").set_original("poly_flop").set_filter("POLY1"); MACHINE_CONFIG_END diff --git a/src/mame/drivers/prof80.cpp b/src/mame/drivers/prof80.cpp index 4ff164c48b3..2ecc7001fbc 100644 --- a/src/mame/drivers/prof80.cpp +++ b/src/mame/drivers/prof80.cpp @@ -470,25 +470,25 @@ MACHINE_CONFIG_START(prof80_state::prof80) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":3", prof80_floppies, nullptr, floppy_image_device::default_floppy_formats) // DEMUX latches - MCFG_DEVICE_ADD(m_flra, LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(UPD1990A_TAG, upd1990a_device, data_in_w)) // TDI - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(UPD1990A_TAG, upd1990a_device, c0_w)) // C0 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(UPD1990A_TAG, upd1990a_device, c1_w)) // C1 - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(UPD1990A_TAG, upd1990a_device, c2_w)) // C2 - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, prof80_state, ready_w)) // READY - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(UPD1990A_TAG, upd1990a_device, clk_w)) // TCK - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, prof80_state, inuse_w)) // IN USE - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, prof80_state, motor_w)) // _MOTOR - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, prof80_state, select_w)) // SELECT - MCFG_DEVICE_ADD(m_flrb, LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, prof80_state, resf_w)) // RESF - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, prof80_state, mini_w)) // MINI - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(m_rs232a, rs232_port_device, write_rts)) // _RTS - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(m_rs232a, rs232_port_device, write_txd)) // TX - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, prof80_state, mstop_w)) // _MSTOP - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(m_rs232b, rs232_port_device, write_txd)) // TXP - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(UPD1990A_TAG, upd1990a_device, stb_w)) // TSTB - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(m_mmu, prof80_mmu_device, mme_w)) // MME + LS259(config, m_flra); + m_flra->q_out_cb<0>().set(UPD1990A_TAG, FUNC(upd1990a_device::data_in_w)); // TDI + m_flra->q_out_cb<0>().append(UPD1990A_TAG, FUNC(upd1990a_device::c0_w)); // C0 + m_flra->q_out_cb<1>().set(UPD1990A_TAG, FUNC(upd1990a_device::c1_w)); // C1 + m_flra->q_out_cb<2>().set(UPD1990A_TAG, FUNC(upd1990a_device::c2_w)); // C2 + m_flra->q_out_cb<3>().set(FUNC(prof80_state::ready_w)); // READY + m_flra->q_out_cb<4>().set(UPD1990A_TAG, FUNC(upd1990a_device::clk_w)); // TCK + m_flra->q_out_cb<5>().set(FUNC(prof80_state::inuse_w)); // IN USE + m_flra->q_out_cb<6>().set(FUNC(prof80_state::motor_w)); // _MOTOR + m_flra->q_out_cb<7>().set(FUNC(prof80_state::select_w)); // SELECT + LS259(config, m_flrb); + m_flrb->q_out_cb<0>().set(FUNC(prof80_state::resf_w)); // RESF + m_flrb->q_out_cb<1>().set(FUNC(prof80_state::mini_w)); // MINI + m_flrb->q_out_cb<2>().set(m_rs232a, FUNC(rs232_port_device::write_rts)); // _RTS + m_flrb->q_out_cb<3>().set(m_rs232a, FUNC(rs232_port_device::write_txd)); // TX + m_flrb->q_out_cb<4>().set(FUNC(prof80_state::mstop_w)); // _MSTOP + m_flrb->q_out_cb<5>().set(m_rs232b, FUNC(rs232_port_device::write_txd)); // TXP + m_flrb->q_out_cb<6>().set(UPD1990A_TAG, FUNC(upd1990a_device::stb_w)); // TSTB + m_flrb->q_out_cb<7>().set(m_mmu, FUNC(prof80_mmu_device::mme_w)); // MME // ECB bus MCFG_ECBBUS_ADD() @@ -499,8 +499,8 @@ MACHINE_CONFIG_START(prof80_state::prof80) MCFG_ECBBUS_SLOT_ADD(5, "ecb_5", ecbbus_cards, nullptr) // V24 - MCFG_DEVICE_ADD(m_rs232a, RS232_PORT, default_rs232_devices, nullptr) - MCFG_DEVICE_ADD(m_rs232b, RS232_PORT, default_rs232_devices, nullptr) + RS232_PORT(config, m_rs232a, default_rs232_devices, nullptr); + RS232_PORT(config, m_rs232b, default_rs232_devices, nullptr); // internal ram MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mame/drivers/proteus.cpp b/src/mame/drivers/proteus.cpp index a40f94a5cb5..766e41ff829 100644 --- a/src/mame/drivers/proteus.cpp +++ b/src/mame/drivers/proteus.cpp @@ -329,9 +329,9 @@ MACHINE_CONFIG_START(proteus_state::proteus) MCFG_DEVICE_PROGRAM_MAP(proteus_z80_mem) MCFG_DEVICE_IO_MAP(proteus_z80_io) - MCFG_INPUT_MERGER_ANY_HIGH("irqs") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("z80", INPUT_LINE_IRQ0)) + INPUT_MERGER_ANY_HIGH(config, m_irqs); + m_irqs->output_handler().set_inputline(m_maincpu, M6809_IRQ_LINE); + m_irqs->output_handler().append_inputline(m_z80, INPUT_LINE_IRQ0); /* fdc */ MCFG_DEVICE_ADD("fdc", FD1771, 4_MHz_XTAL / 2) @@ -380,9 +380,9 @@ MACHINE_CONFIG_START(proteus_state::proteus) MCFG_RS232_RXD_HANDLER(WRITELINE("acia0", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia0", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia0_clock", CLOCK, 4_MHz_XTAL / 2 / 13) // TODO: this is set using jumpers - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia0", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia0", acia6850_device, write_rxc)) + clock_device &acia0_clock(CLOCK(config, "acia0_clock", 4_MHz_XTAL / 2 / 13)); // TODO: this is set using jumpers + acia0_clock.signal_handler().set(m_acia[0], FUNC(acia6850_device::write_txc)); + acia0_clock.signal_handler().append(m_acia[0], FUNC(acia6850_device::write_rxc)); /* printer port */ MCFG_DEVICE_ADD("acia1", ACIA6850, 0) @@ -394,9 +394,9 @@ MACHINE_CONFIG_START(proteus_state::proteus) MCFG_RS232_RXD_HANDLER(WRITELINE("acia1", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia1", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia1_clock", CLOCK, 4_MHz_XTAL / 2 / 13) // TODO: this is set using jumpers J2 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_rxc)) + clock_device &acia1_clock(CLOCK(config, "acia1_clock", 4_MHz_XTAL / 2 / 13)); // TODO: this is set using jumpers J2 + acia1_clock.signal_handler().set(m_acia[1], FUNC(acia6850_device::write_txc)); + acia1_clock.signal_handler().append(m_acia[1], FUNC(acia6850_device::write_rxc)); /* modem port */ MCFG_DEVICE_ADD("acia2", ACIA6850, 0) @@ -408,9 +408,9 @@ MACHINE_CONFIG_START(proteus_state::proteus) MCFG_RS232_RXD_HANDLER(WRITELINE("acia2", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia2", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia2_clock", CLOCK, 4_MHz_XTAL / 2 / 13) // TODO: this is set using jumpers J1 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia2", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia2", acia6850_device, write_rxc)) + clock_device &acia2_clock(CLOCK(config, "acia2_clock", 4_MHz_XTAL / 2 / 13)); // TODO: this is set using jumpers J1 + acia2_clock.signal_handler().set(m_acia[2], FUNC(acia6850_device::write_txc)); + acia2_clock.signal_handler().append(m_acia[2], FUNC(acia6850_device::write_rxc)); /* software lists */ MCFG_SOFTWARE_LIST_ADD("flop_list", "poly_flop") diff --git a/src/mame/drivers/pulsar.cpp b/src/mame/drivers/pulsar.cpp index 844858f4ddd..0f0f425da38 100644 --- a/src/mame/drivers/pulsar.cpp +++ b/src/mame/drivers/pulsar.cpp @@ -234,12 +234,12 @@ MACHINE_CONFIG_START(pulsar_state::pulsar) MCFG_RS232_CTS_HANDLER(WRITELINE("dart", z80dart_device, ctsa_w)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) - MCFG_DEVICE_ADD("brg", COM8116, 5.0688_MHz_XTAL) + com8116_device &brg(COM8116(config, "brg", 5.0688_MHz_XTAL)); // Schematic has the labels for FT and FR the wrong way around, but the pin numbers are correct. - MCFG_COM8116_FR_HANDLER(WRITELINE("dart", z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart", z80dart_device, rxca_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE("dart", z80dart_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart", z80dart_device, rxcb_w)) + brg.fr_handler().set("dart", FUNC(z80dart_device::txca_w)); + brg.fr_handler().append("dart", FUNC(z80dart_device::rxca_w)); + brg.ft_handler().set("dart", FUNC(z80dart_device::txcb_w)); + brg.ft_handler().append("dart", FUNC(z80dart_device::rxcb_w)); MCFG_DEVICE_ADD("fdc", FD1797, 4_MHz_XTAL / 2) MCFG_FLOPPY_DRIVE_ADD("fdc:0", pulsar_floppies, "525hd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/punchout.cpp b/src/mame/drivers/punchout.cpp index 9fd885c9c83..4242cd10c15 100644 --- a/src/mame/drivers/punchout.cpp +++ b/src/mame/drivers/punchout.cpp @@ -649,15 +649,15 @@ MACHINE_CONFIG_START(punchout_state::punchout) MCFG_PALETTE_ADD("palette", 0x200) MCFG_DEFAULT_LAYOUT(layout_dualhovu) - MCFG_SCREEN_ADD("top", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(punchout_state, screen_update_punchout_top) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, punchout_state, vblank_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + screen_device &top(SCREEN(config, "top", SCREEN_TYPE_RASTER)); + top.set_refresh_hz(60); + top.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + top.set_size(32*8, 32*8); + top.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + top.set_screen_update(FUNC(punchout_state::screen_update_punchout_top)); + top.set_palette(m_palette); + top.screen_vblank().set(FUNC(punchout_state::vblank_irq)); + top.screen_vblank().append_inputline(m_audiocpu, INPUT_LINE_NMI); MCFG_SCREEN_ADD("bottom", RASTER) MCFG_SCREEN_REFRESH_RATE(60) diff --git a/src/mame/drivers/pve500.cpp b/src/mame/drivers/pve500.cpp index 3376205f388..2342cf415d1 100644 --- a/src/mame/drivers/pve500.cpp +++ b/src/mame/drivers/pve500.cpp @@ -362,14 +362,14 @@ WRITE8_MEMBER(pve500_state::io_sel_w) MACHINE_CONFIG_START(pve500_state::pve500) /* Main CPU */ - MCFG_DEVICE_ADD("maincpu", TMPZ84C015, 12_MHz_XTAL / 2) /* TMPZ84C015BF-6 */ - MCFG_DEVICE_PROGRAM_MAP(maincpu_prg) - MCFG_DEVICE_IO_MAP(maincpu_io) - MCFG_Z80_DAISY_CHAIN(maincpu_daisy_chain) - MCFG_TMPZ84C015_OUT_DTRA_CB(WRITELINE(*this, pve500_state, GPI_w)) - MCFG_TMPZ84C015_OUT_DTRB_CB(WRITELINE("buzzer", beep_device, set_state)) MCFG_DEVCB_INVERT - MCFG_TMPZ84C015_OUT_TXDA_CB(WRITELINE("recorder", rs232_port_device, write_txd)) - MCFG_TMPZ84C015_OUT_TXDB_CB(WRITELINE("player1", rs232_port_device, write_txd)) + TMPZ84C015(config, m_maincpu, 12_MHz_XTAL / 2); // TMPZ84C015BF-6 + m_maincpu->set_addrmap(AS_PROGRAM, &pve500_state::maincpu_prg); + m_maincpu->set_addrmap(AS_IO, &pve500_state::maincpu_io); + m_maincpu->set_daisy_config(maincpu_daisy_chain); + m_maincpu->out_dtra_callback().set(FUNC(pve500_state::GPI_w)); + m_maincpu->out_dtrb_callback().set(m_buzzer, FUNC(beep_device::set_state)).invert(); + m_maincpu->out_txda_callback().set("recorder", FUNC(rs232_port_device::write_txd)); + m_maincpu->out_txdb_callback().set("player1", FUNC(rs232_port_device::write_txd)); MCFG_DEVICE_ADD("external_ctc", Z80CTC, 12_MHz_XTAL / 2) MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) @@ -429,15 +429,15 @@ MACHINE_CONFIG_START(pve500_state::pve500) MCFG_DEVICE_ADD("serial_mixer", RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE("subcpu", tmpz84c015_device, rxb_w)) - MCFG_DEVICE_ADD("clk1", CLOCK, 12_MHz_XTAL / 20) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("maincpu", tmpz84c015_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("maincpu", tmpz84c015_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("maincpu", tmpz84c015_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("maincpu", tmpz84c015_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("subcpu", tmpz84c015_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("subcpu", tmpz84c015_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("subcpu", tmpz84c015_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("subcpu", tmpz84c015_device, txcb_w)) + clock_device &clk1(CLOCK(config, "clk1", 12_MHz_XTAL / 20)); + clk1.signal_handler().set(m_maincpu, FUNC(tmpz84c015_device::rxca_w)); + clk1.signal_handler().append(m_maincpu, FUNC(tmpz84c015_device::txca_w)); + clk1.signal_handler().append(m_maincpu, FUNC(tmpz84c015_device::rxcb_w)); + clk1.signal_handler().append(m_maincpu, FUNC(tmpz84c015_device::txcb_w)); + clk1.signal_handler().append(m_subcpu, FUNC(tmpz84c015_device::rxca_w)); + clk1.signal_handler().append(m_subcpu, FUNC(tmpz84c015_device::txca_w)); + clk1.signal_handler().append(m_subcpu, FUNC(tmpz84c015_device::rxcb_w)); + clk1.signal_handler().append(m_subcpu, FUNC(tmpz84c015_device::txcb_w)); /* ICF5: 2kbytes of RAM shared between the two CPUs (dual-port RAM)*/ MCFG_DEVICE_ADD("mb8421", MB8421, 0) diff --git a/src/mame/drivers/qtsbc.cpp b/src/mame/drivers/qtsbc.cpp index 75109e511b2..4a937b3bebb 100644 --- a/src/mame/drivers/qtsbc.cpp +++ b/src/mame/drivers/qtsbc.cpp @@ -486,12 +486,12 @@ MACHINE_CONFIG_START(qtsbc_state::qtsbc) MCFG_DEVICE_IO_MAP(io_map) /* video hardware */ - MCFG_DEVICE_ADD("pit", PIT8253, 0) // U9 - MCFG_PIT8253_CLK0(4_MHz_XTAL / 2) /* Timer 0: baud rate gen for 8251 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("usart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("usart", i8251_device, write_rxc)) - MCFG_PIT8253_CLK1(4_MHz_XTAL / 2) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("pit", pit8253_device, write_clk2)) + PIT8253(config, m_pit, 0); // U9 + m_pit->set_clk<0>(4_MHz_XTAL / 2); /* Timer 0: baud rate gen for 8251 */ + m_pit->out_handler<0>().set(m_usart, FUNC(i8251_device::write_txc)); + m_pit->out_handler<0>().append(m_usart, FUNC(i8251_device::write_rxc)); + m_pit->set_clk<1>(4_MHz_XTAL / 2); + m_pit->out_handler<1>().set(m_pit, FUNC(pit8253_device::write_clk2)); MCFG_DEVICE_ADD("usart", I8251, 0) // U8 MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/qvt6800.cpp b/src/mame/drivers/qvt6800.cpp index d78330beb51..3c44d039870 100644 --- a/src/mame/drivers/qvt6800.cpp +++ b/src/mame/drivers/qvt6800.cpp @@ -83,9 +83,9 @@ MACHINE_CONFIG_START(qvt6800_state::qvt102) MCFG_Z80CTC_ZC0_CB(WRITELINE("acia", acia6850_device, write_txc)) MCFG_Z80CTC_ZC1_CB(WRITELINE("acia", acia6850_device, write_rxc)) - MCFG_DEVICE_ADD("ctcclk", CLOCK, XTAL(16'669'800) / 18) // OR of CRTC CLK and Ï•1 - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) + clock_device &ctcclk(CLOCK(config, "ctcclk", 16.6698_MHz_XTAL / 18)); // OR of CRTC CLK and Ï•1 + ctcclk.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); + ctcclk.signal_handler().append("ctc", FUNC(z80ctc_device::trg1)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(XTAL(16'669'800), 882, 0, 720, 315, 0, 300) diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp index 29fd95593bb..5e4513a552b 100644 --- a/src/mame/drivers/qx10.cpp +++ b/src/mame/drivers/qx10.cpp @@ -769,12 +769,12 @@ MACHINE_CONFIG_START(qx10_state::qx10) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, qx10_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("upd7201", UPD7201, MAIN_CLK/4) // channel b clock set by pit2 channel 2 // Channel A: Keyboard @@ -809,9 +809,9 @@ MACHINE_CONFIG_START(qx10_state::qx10) MCFG_DEVICE_ADD("rtc", MC146818, 32.768_kHz_XTAL) MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir2_w)) - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(*this, qx10_state, qx10_upd765_interrupt)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("8237dma_1", am9517a_device, dreq0_w)) MCFG_DEVCB_INVERT + UPD765A(config, m_fdc, true, true); + m_fdc->intrq_wr_callback().set(FUNC(qx10_state::qx10_upd765_interrupt)); + m_fdc->drq_wr_callback().set(m_dma_1, FUNC(am9517a_device::dreq0_w)).invert(); MCFG_FLOPPY_DRIVE_ADD("upd765:0", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("upd765:1", qx10_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/raiden.cpp b/src/mame/drivers/raiden.cpp index a421a5b928b..11b317ddbc2 100644 --- a/src/mame/drivers/raiden.cpp +++ b/src/mame/drivers/raiden.cpp @@ -350,17 +350,17 @@ MACHINE_CONFIG_START(raiden_state::raiden) MCFG_QUANTUM_TIME(attotime::from_hz(12000)) /* video hardware */ - MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(59.60) /* verified on pcb */ - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(raiden_state, screen_update_raiden) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, raiden_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + BUFFERED_SPRITERAM16(config, m_spriteram); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(59.60); // verified on pcb */ + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_size(32*8, 32*8); + screen.set_visarea(0*8, 32*8-1, 2*8, 30*8-1); + screen.set_screen_update(FUNC(raiden_state::screen_update_raiden)); + screen.screen_vblank().set(m_spriteram, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + screen.screen_vblank().append(FUNC(raiden_state::vblank_irq)); + screen.set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_raiden) MCFG_PALETTE_ADD("palette", 2048) diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp index 369e453094d..c3c87549a8f 100644 --- a/src/mame/drivers/rainbow.cpp +++ b/src/mame/drivers/rainbow.cpp @@ -3286,10 +3286,10 @@ MACHINE_CONFIG_START(rainbow_state::rainbow) MCFG_WD2010_IN_WF_CB(READLINE(*this, rainbow_state, hdc_write_fault)) // WRITE FAULT (set to GND if not serviced) MCFG_WD2010_IN_DRDY_CB(READLINE(*this, rainbow_state, hdc_drive_ready)) // DRIVE_READY (set to VCC if not serviced) - MCFG_WD2010_IN_SC_CB(VCC) // SEEK COMPLETE (set to VCC if not serviced) + MCFG_WD2010_IN_SC_CB(CONSTANT(1)) // SEEK COMPLETE (set to VCC if not serviced) - MCFG_WD2010_IN_TK000_CB(VCC) // CURRENTLY NOT EVALUATED WITHIN 'WD2010' - MCFG_WD2010_IN_INDEX_CB(VCC) // " + MCFG_WD2010_IN_TK000_CB(CONSTANT(1)) // CURRENTLY NOT EVALUATED WITHIN 'WD2010' + MCFG_WD2010_IN_INDEX_CB(CONSTANT(1)) // " MCFG_HARDDISK_ADD("decharddisk1") /// ******************************** / HARD DISK CONTROLLER **************************************** diff --git a/src/mame/drivers/rc702.cpp b/src/mame/drivers/rc702.cpp index 1c4b2143bb0..83aab9020f4 100644 --- a/src/mame/drivers/rc702.cpp +++ b/src/mame/drivers/rc702.cpp @@ -340,14 +340,13 @@ MACHINE_CONFIG_START(rc702_state::rc702) MCFG_MACHINE_RESET_OVERRIDE(rc702_state, rc702) - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 614000) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, rc702_state, clock_w)) + CLOCK(config, "ctc_clock", 614000).signal_handler().set(FUNC(rc702_state::clock_w)); - MCFG_DEVICE_ADD("ctc1", Z80CTC, XTAL(8'000'000) / 2) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio1", z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1", z80dart_device, rxca_w)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("sio1", z80dart_device, rxtxcb_w)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80CTC(config, m_ctc1, 8_MHz_XTAL / 2); + m_ctc1->zc_callback<0>().set("sio1", FUNC(z80dart_device::txca_w)); + m_ctc1->zc_callback<0>().append("sio1", FUNC(z80dart_device::rxca_w)); + m_ctc1->zc_callback<1>().set("sio1", FUNC(z80dart_device::rxtxcb_w)); + m_ctc1->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); MCFG_DEVICE_ADD("sio1", Z80DART, XTAL(8'000'000) / 2) MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) @@ -388,12 +387,12 @@ MACHINE_CONFIG_START(rc702_state::rc702) MCFG_SCREEN_VISIBLE_AREA(0, 272*2-1, 0, 200-1) MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update) - MCFG_DEVICE_ADD("crtc", I8275, 11640000/7) - MCFG_I8275_CHARACTER_WIDTH(7) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(rc702_state, display_pixels) - MCFG_I8275_IRQ_CALLBACK(WRITELINE("7474", ttl7474_device, clear_w)) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc1", z80ctc_device, trg2)) - MCFG_I8275_DRQ_CALLBACK(WRITELINE(*this, rc702_state, crtc_drq_w)) + i8275_device &crtc(I8275(config, "crtc", 11640000/7)); + crtc.set_character_width(7); + crtc.set_display_callback(FUNC(rc702_state::display_pixels), this); + crtc.irq_wr_callback().set(m_7474, FUNC(ttl7474_device::clear_w)).invert(); + crtc.irq_wr_callback().append(m_ctc1, FUNC(z80ctc_device::trg2)); + crtc.drq_wr_callback().set(FUNC(rc702_state::crtc_drq_w)); MCFG_PALETTE_ADD("palette", 2) /* sound hardware */ diff --git a/src/mame/drivers/retofinv.cpp b/src/mame/drivers/retofinv.cpp index 0259a6940b6..3ff3ca9652b 100644 --- a/src/mame/drivers/retofinv.cpp +++ b/src/mame/drivers/retofinv.cpp @@ -432,13 +432,13 @@ MACHINE_CONFIG_START(retofinv_state::retofinv) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* 100 CPU slices per frame - enough for the sound CPU to read all commands */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // IC72 - probably shared between CPUs - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, retofinv_state, irq0_ack_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, retofinv_state, coinlockout_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("68705", taito68705_mcu_device, reset_w)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, retofinv_state, irq1_ack_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); // IC72 - probably shared between CPUs + mainlatch.q_out_cb<0>().set(FUNC(retofinv_state::irq0_ack_w)); + mainlatch.q_out_cb<1>().set(FUNC(retofinv_state::coinlockout_w)); + mainlatch.q_out_cb<2>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<3>().set(m_68705, FUNC(taito68705_mcu_device::reset_w)).invert(); + mainlatch.q_out_cb<4>().set(FUNC(retofinv_state::irq1_ack_w)); + mainlatch.q_out_cb<5>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/rmnimbus.cpp b/src/mame/drivers/rmnimbus.cpp index e745ae96a5c..262f3799d3c 100644 --- a/src/mame/drivers/rmnimbus.cpp +++ b/src/mame/drivers/rmnimbus.cpp @@ -188,8 +188,8 @@ MACHINE_CONFIG_START(rmnimbus_state::nimbus) MCFG_VIA6522_CA2_HANDLER(WRITELINE(m_centronics, centronics_device, write_strobe)) MCFG_VIA6522_IRQ_HANDLER(WRITELINE(m_maincpu, i80186_cpu_device, int3_w)) - MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(VIA_TAG, via6522_device, write_ca1)) MCFG_DEVCB_INVERT + CENTRONICS(config, m_centronics, centronics_devices, "printer"); + m_centronics->ack_handler().set(m_via, FUNC(via6522_device::write_ca1)).invert(); MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") diff --git a/src/mame/drivers/rohga.cpp b/src/mame/drivers/rohga.cpp index 87704621b15..4a99049c2f1 100644 --- a/src/mame/drivers/rohga.cpp +++ b/src/mame/drivers/rohga.cpp @@ -938,11 +938,11 @@ MACHINE_CONFIG_START(rohga_state::rohga) MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(INPUTLINE("audiocpu", 0)) + DECO104PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("INPUTS"); + m_ioprot->port_b_cb().set_ioport("SYSTEM"); + m_ioprot->port_c_cb().set_ioport("DSW"); + m_ioprot->soundlatch_irq_cb().set_inputline("audiocpu", 0); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); @@ -1030,12 +1030,12 @@ MACHINE_CONFIG_START(rohga_state::wizdfire) MCFG_DECO_SPRITE_GFX_REGION(4) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(INPUTLINE("audiocpu", 0)) - MCFG_DECO146_SET_INTERFACE_SCRAMBLE_REVERSE + DECO104PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("INPUTS"); + m_ioprot->port_b_cb().set_ioport("SYSTEM"); + m_ioprot->port_c_cb().set_ioport("DSW"); + m_ioprot->soundlatch_irq_cb().set_inputline("audiocpu", 0); + m_ioprot->set_interface_scramble_reverse(); MCFG_VIDEO_START_OVERRIDE(rohga_state, wizdfire) @@ -1219,11 +1219,11 @@ MACHINE_CONFIG_START(rohga_state::schmeisr) MCFG_DECO_SPRITE_GFX_REGION(3) MCFG_DECO_SPRITE_GFXDECODE("gfxdecode") - MCFG_DECO104_ADD("ioprot") - MCFG_DECO146_IN_PORTA_CB(IOPORT("INPUTS")) - MCFG_DECO146_IN_PORTB_CB(IOPORT("SYSTEM")) - MCFG_DECO146_IN_PORTC_CB(IOPORT("DSW")) - MCFG_DECO146_SOUNDLATCH_IRQ_CB(INPUTLINE("audiocpu", 0)) + DECO104PROT(config, m_ioprot, 0); + m_ioprot->port_a_cb().set_ioport("INPUTS"); + m_ioprot->port_b_cb().set_ioport("SYSTEM"); + m_ioprot->port_c_cb().set_ioport("DSW"); + m_ioprot->soundlatch_irq_cb().set_inputline("audiocpu", 0); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp index bfdd6aa8d60..839f16fef12 100644 --- a/src/mame/drivers/royalmah.cpp +++ b/src/mame/drivers/royalmah.cpp @@ -3662,13 +3662,12 @@ MACHINE_CONFIG_START(royalmah_state::janptr96) MCFG_TMPZ84C015_OUT_PB_CB(WRITE8(*this, royalmah_state, janptr96_dswsel_w)) // internal CTC channels 0 & 1 have falling edge triggers - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_VISIBLE_AREA(0, 255, 8, 255-8) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("maincpu", tmpz84c015_device, trg0)) MCFG_DEVCB_INVERT + screen_device &screen(*subdevice("screen")); + screen.set_visarea(0, 255, 8, 255-8); + screen.screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::trg0)).invert(); /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(WRITELINE("maincpu", tmpz84c015_device, trg1)) MCFG_DEVCB_INVERT + MSM6242(config, m_rtc, 32.768_kHz_XTAL).out_int_handler().set(m_maincpu, FUNC(tmpz84c015_device::trg1)).invert(); MACHINE_CONFIG_END @@ -3722,8 +3721,7 @@ MACHINE_CONFIG_START(royalmah_state::mjtensin) MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_IRQ1)) + MSM6242(config, m_rtc, 32.768_kHz_XTAL).out_int_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ1); MACHINE_CONFIG_END MACHINE_CONFIG_START(royalmah_state::cafetime) @@ -3738,8 +3736,7 @@ MACHINE_CONFIG_START(royalmah_state::cafetime) MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_IRQ1)) + MSM6242(config, m_rtc, 32.768_kHz_XTAL).out_int_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ1); MACHINE_CONFIG_END MACHINE_CONFIG_START(royalmah_state::mjvegasa) @@ -3755,8 +3752,7 @@ MACHINE_CONFIG_START(royalmah_state::mjvegasa) MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) /* devices */ - MCFG_DEVICE_ADD("rtc", MSM6242, XTAL(32'768)) - MCFG_MSM6242_OUT_INT_HANDLER(INPUTLINE("maincpu", INPUT_LINE_IRQ1)) + MSM6242(config, m_rtc, 32.768_kHz_XTAL).out_int_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ1); MACHINE_CONFIG_END diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp index 023d33fcb6d..90f42152651 100644 --- a/src/mame/drivers/runaway.cpp +++ b/src/mame/drivers/runaway.cpp @@ -351,14 +351,14 @@ MACHINE_CONFIG_START(runaway_state::runaway) MCFG_DEVICE_ADD("maincpu", M6502, 12096000 / 8) /* ? */ MCFG_DEVICE_PROGRAM_MAP(runaway_map) - MCFG_DEVICE_ADD("mainlatch", LS259) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // coin counter? - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(NOOP) // coin counter? - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, runaway_state, tile_bank_w)) - - MCFG_DEVICE_ADD("earom", ER2055) + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_nop(); // coin counter? + mainlatch.q_out_cb<1>().set_nop(); // coin counter? + mainlatch.q_out_cb<3>().set_output("led0").invert(); + mainlatch.q_out_cb<4>().set_output("led1").invert(); + mainlatch.q_out_cb<5>().set(FUNC(runaway_state::tile_bank_w)); + + ER2055(config, m_earom); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/s7.cpp b/src/mame/drivers/s7.cpp index c9b50fb2603..d88b3f32cc3 100644 --- a/src/mame/drivers/s7.cpp +++ b/src/mame/drivers/s7.cpp @@ -505,15 +505,15 @@ MACHINE_CONFIG_START(s7_state::s7) MCFG_DEVICE_ADD("hc55516", HC55516, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech", 1.00) - MCFG_DEVICE_ADD("pias", PIA6821, 0) - MCFG_PIA_READPB_HANDLER(READ8(*this, s7_state, sound_r)) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_WRITEPB_HANDLER(NOOP) - MCFG_PIA_READCA1_HANDLER(VCC) - MCFG_PIA_CA2_HANDLER(WRITELINE("hc55516", hc55516_device, digit_w)) - MCFG_PIA_CB2_HANDLER(WRITELINE("hc55516", hc55516_device, clock_w)) - MCFG_PIA_IRQA_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) - MCFG_PIA_IRQB_HANDLER(INPUTLINE("audiocpu", M6808_IRQ_LINE)) + PIA6821(config, m_pias, 0); + m_pias->readpb_handler().set(FUNC(s7_state::sound_r)); + m_pias->writepa_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pias->writepb_handler().set_nop(); + m_pias->readca1_handler().set_constant(1); + m_pias->ca2_handler().set(m_hc55516, FUNC(hc55516_device::digit_w)); + m_pias->cb2_handler().set(m_hc55516, FUNC(hc55516_device::clock_w)); + m_pias->irqa_handler().set_inputline(m_audiocpu, M6808_IRQ_LINE); // FIXME: needs an input merger + m_pias->irqb_handler().set_inputline(m_audiocpu, M6808_IRQ_LINE); MACHINE_CONFIG_END diff --git a/src/mame/drivers/sbrain.cpp b/src/mame/drivers/sbrain.cpp index 986fa8f2207..f7b6abc302b 100644 --- a/src/mame/drivers/sbrain.cpp +++ b/src/mame/drivers/sbrain.cpp @@ -573,15 +573,15 @@ MACHINE_CONFIG_START(sbrain_state::sbrain) MCFG_I8255_IN_PORTC_CB(READ8(*this, sbrain_state, ppi_pc_r)) MCFG_I8255_OUT_PORTC_CB(WRITE8(*this, sbrain_state, ppi_pc_w)) - MCFG_DEVICE_ADD("uart0", I8251, 0) + I8251(config, m_u0, 0); - MCFG_DEVICE_ADD("uart1", I8251, 0) + I8251(config, m_u1, 0); - MCFG_DEVICE_ADD("brg", COM8116, 5.0688_MHz_XTAL) // BR1941L - MCFG_COM8116_FR_HANDLER(WRITELINE("uart0", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart0", i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) + com8116_device &brg(COM8116(config, "brg", 5.0688_MHz_XTAL)); // BR1941L + brg.fr_handler().set(m_u0, FUNC(i8251_device::write_txc)); + brg.fr_handler().append(m_u0, FUNC(i8251_device::write_rxc)); + brg.ft_handler().set(m_u1, FUNC(i8251_device::write_txc)); + brg.ft_handler().append(m_u1, FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("fdc", FD1791, 16_MHz_XTAL / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp index 19fd78c9e7c..a4f68428d88 100644 --- a/src/mame/drivers/sbrkout.cpp +++ b/src/mame/drivers/sbrkout.cpp @@ -559,16 +559,16 @@ GFXDECODE_END MACHINE_CONFIG_START(sbrkout_state::sbrkout) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M6502,MAIN_CLOCK/16) /* 375 KHz? Should be 750KHz? */ - MCFG_DEVICE_PROGRAM_MAP(main_map) - - MCFG_DEVICE_ADD("outlatch", F9334, 0) // H8 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // SERV LED (active low) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("lamp0")) // LAMP1 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("lamp1")) // LAMP2 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, sbrkout_state, pot_mask1_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, sbrkout_state, pot_mask2_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, sbrkout_state, coincount_w)) + M6502(config, m_maincpu, MAIN_CLOCK/16); // 375 KHz? Should be 750KHz? + m_maincpu->set_addrmap(AS_PROGRAM, &sbrkout_state::main_map); + + F9334(config, m_outlatch); // H8 + m_outlatch->q_out_cb<1>().set_output("led0").invert(); // SERV LED (active low) + m_outlatch->q_out_cb<3>().set_output("lamp0"); // LAMP1 + m_outlatch->q_out_cb<4>().set_output("lamp1"); // LAMP2 + m_outlatch->q_out_cb<5>().set(FUNC(sbrkout_state::pot_mask1_w)); + m_outlatch->q_out_cb<6>().set(FUNC(sbrkout_state::pot_mask2_w)); + m_outlatch->q_out_cb<7>().set(FUNC(sbrkout_state::coincount_w)); // Note that connecting pin 15 to a pullup, as shown on the schematics, may result in spurious // coin counter activity as stated in Atari bulletin B-0054 (which recommends tying it to the // CPU reset line instead). @@ -594,12 +594,12 @@ MACHINE_CONFIG_START(sbrkout_state::sbrkout) MACHINE_CONFIG_END -MACHINE_CONFIG_START(sbrkoutct_state::sbrkoutct) +void sbrkoutct_state::sbrkoutct(machine_config &config) +{ sbrkout(config); - MCFG_DEVICE_MODIFY("outlatch") - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // 2nd serve LED -MACHINE_CONFIG_END + subdevice("outlatch")->q_out_cb<2>().set_output("led1").invert(); // 2nd serve LED +} /************************************* * diff --git a/src/mame/drivers/scopus.cpp b/src/mame/drivers/scopus.cpp index 7d30e10fa9c..762ad4368e7 100644 --- a/src/mame/drivers/scopus.cpp +++ b/src/mame/drivers/scopus.cpp @@ -197,9 +197,9 @@ MACHINE_CONFIG_START(sagitta180_state::sagitta180) MCFG_RS232_CTS_HANDLER(WRITELINE("uart", i8251_device, write_cts)) MCFG_RS232_DSR_HANDLER(WRITELINE("uart", i8251_device, write_dsr)) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 19218) // 19218 / 19222 ? guesses... - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 19218)); // 19218 / 19222 ? guesses... + uart_clock.signal_handler().set("uart", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart", FUNC(i8251_device::write_rxc)); // MCFG_DEVICE_ADD("intlatch", I8212, 0) // MCFG_I8212_MD_CALLBACK(GND) // guessed ! diff --git a/src/mame/drivers/sdk85.cpp b/src/mame/drivers/sdk85.cpp index 346b8c5ee74..43ef2643343 100644 --- a/src/mame/drivers/sdk85.cpp +++ b/src/mame/drivers/sdk85.cpp @@ -167,13 +167,13 @@ MACHINE_CONFIG_START(sdk85_state::sdk85) MCFG_DEFAULT_LAYOUT(layout_sdk85) /* Devices */ - MCFG_DEVICE_ADD("kdc", I8279, 6.144_MHz_XTAL / 2) // Keyboard/Display Controller (A13) + MCFG_DEVICE_ADD("kdc", I8279, 6.144_MHz_XTAL / 2) // Keyboard/Display Controller (A13) MCFG_I8279_OUT_IRQ_CB(INPUTLINE("maincpu", I8085_RST55_LINE)) // irq - MCFG_I8279_OUT_SL_CB(WRITE8(*this, sdk85_state, scanlines_w)) // scan SL lines - MCFG_I8279_OUT_DISP_CB(WRITE8(*this, sdk85_state, digit_w)) // display A&B - MCFG_I8279_IN_RL_CB(READ8(*this, sdk85_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) + MCFG_I8279_OUT_SL_CB(WRITE8(*this, sdk85_state, scanlines_w)) // scan SL lines + MCFG_I8279_OUT_DISP_CB(WRITE8(*this, sdk85_state, digit_w)) // display A&B + MCFG_I8279_IN_RL_CB(READ8(*this, sdk85_state, kbd_r)) // kbd RL lines + MCFG_I8279_IN_SHIFT_CB(CONSTANT(1)) // Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(1)) MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/sdk86.cpp b/src/mame/drivers/sdk86.cpp index f43f0932ad5..fba2a060f41 100644 --- a/src/mame/drivers/sdk86.cpp +++ b/src/mame/drivers/sdk86.cpp @@ -166,16 +166,16 @@ MACHINE_CONFIG_START(sdk86_state::sdk86) MCFG_RS232_DSR_HANDLER(WRITELINE(I8251_TAG, i8251_device, write_dsr)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) - MCFG_DEVICE_ADD("usart_clock", CLOCK, XTAL(14'745'600)/3/16) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(I8251_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(I8251_TAG, i8251_device, write_rxc)) + clock_device &usart_clock(CLOCK(config, "usart_clock", XTAL(14'745'600)/3/16)); + usart_clock.signal_handler().set(I8251_TAG, FUNC(i8251_device::write_txc)); + usart_clock.signal_handler().append(I8251_TAG, FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("i8279", I8279, 2500000) // based on divider MCFG_I8279_OUT_SL_CB(WRITE8(*this, sdk86_state, scanlines_w)) // scan SL lines MCFG_I8279_OUT_DISP_CB(WRITE8(*this, sdk86_state, digit_w)) // display A&B MCFG_I8279_IN_RL_CB(READ8(*this, sdk86_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(GND) // Shift key - MCFG_I8279_IN_CTRL_CB(GND) + MCFG_I8279_IN_SHIFT_CB(CONSTANT(0)) // Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(0)) MCFG_DEVICE_ADD("port1", I8255A, 0) MCFG_DEVICE_ADD("port2", I8255A, 0) diff --git a/src/mame/drivers/seattle.cpp b/src/mame/drivers/seattle.cpp index 37abdb7a0e4..27ac8f4f7be 100644 --- a/src/mame/drivers/seattle.cpp +++ b/src/mame/drivers/seattle.cpp @@ -1905,9 +1905,9 @@ MACHINE_CONFIG_START(seattle_state::seattle_common) MCFG_GT64XXX_SET_CS(3, seattle_state::seattle_cs3_map) MCFG_GT64XX_SET_SIMM0(0x00800000) - MCFG_DEVICE_ADD(PCI_ID_IDE, IDE_PCI, 0, 0x100b0002, 0x01, 0x0) - MCFG_IDE_PCI_IRQ_HANDLER(INPUTLINE(m_maincpu, IDE_IRQ_NUM)) - MCFG_IDE_PCI_SET_LEGACY_TOP(0x0a0) + ide_pci_device &ide(IDE_PCI(config, PCI_ID_IDE, 0, 0x100b0002, 0x01, 0x0)); + ide.irq_handler().set_inputline(m_maincpu, IDE_IRQ_NUM); + ide.set_legacy_top(0x0a0); MCFG_DEVICE_ADD(PCI_ID_VIDEO, VOODOO_1_PCI, 0, m_maincpu, m_screen) MCFG_VOODOO_PCI_FBMEM(2) diff --git a/src/mame/drivers/seattlecmp.cpp b/src/mame/drivers/seattlecmp.cpp index 4cd8cc944fa..dc68997df5b 100644 --- a/src/mame/drivers/seattlecmp.cpp +++ b/src/mame/drivers/seattlecmp.cpp @@ -111,20 +111,20 @@ MACHINE_CONFIG_START(seattle_comp_state::seattle) MCFG_DEVICE_IO_MAP(io_map) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic1", pic8259_device, inta_cb) - MCFG_DEVICE_ADD("pic1", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_INT0)) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, seattle_comp_state, pic_slave_ack)) - - MCFG_DEVICE_ADD("pic2", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic1", pic8259_device, ir1_w)) - - MCFG_DEVICE_ADD("stc", AM9513, XTAL(4'000'000)) // dedicated XTAL - MCFG_AM9513_OUT2_CALLBACK(WRITELINE("pic2", pic8259_device, ir0_w)) - MCFG_AM9513_OUT3_CALLBACK(WRITELINE("pic2", pic8259_device, ir4_w)) - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("pic2", pic8259_device, ir7_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_AM9513_FOUT_CALLBACK(WRITELINE("stc", am9513_device, source1_w)) + PIC8259(config, m_pic[0], 0); + m_pic[0]->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_INT0); + m_pic[0]->read_slave_ack_callback().set(FUNC(seattle_comp_state::pic_slave_ack)); + + PIC8259(config, m_pic[1], 0); + m_pic[1]->out_int_callback().set(m_pic[0], FUNC(pic8259_device::ir1_w)); + + am9513_device &stc(AM9513(config, "stc", 4_MHz_XTAL)); // dedicated XTAL + stc.out2_cb().set(m_pic[1], FUNC(pic8259_device::ir0_w)); + stc.out3_cb().set(m_pic[1], FUNC(pic8259_device::ir4_w)); + stc.out4_cb().set(m_pic[1], FUNC(pic8259_device::ir7_w)); + stc.out5_cb().set("uart", FUNC(i8251_device::write_txc)); + stc.out5_cb().append("uart", FUNC(i8251_device::write_rxc)); + stc.fout_cb().set("stc", FUNC(am9513_device::source1_w)); // FOUT not shown on schematics, which inexplicably have Source 1 tied to Gate 5 MCFG_DEVICE_ADD("uart", I8251, XTAL(24'000'000) / 12) // CLOCK on line 49 diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp index 4f1298afce1..8bbea1998d8 100644 --- a/src/mame/drivers/segac2.cpp +++ b/src/mame/drivers/segac2.cpp @@ -1553,15 +1553,15 @@ MACHINE_CONFIG_START(segac2_state::segac) MCFG_MACHINE_RESET_OVERRIDE(segac2_state,segac2) MCFG_NVRAM_ADD_1FILL("nvram") // borencha requires 0xff fill or there is no sound (it lacks some of the init code of the borench set) - MCFG_DEVICE_ADD("io", SEGA_315_5296, XL2_CLOCK/6) // clock divider guessed - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2")) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, segac2_state, io_portc_r)) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segac2_state, io_portd_w)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) - MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) - MCFG_315_5296_OUT_PORTH_CB(WRITE8(*this, segac2_state, io_porth_w)) + sega_315_5296_device &io(SEGA_315_5296(config, "io", XL2_CLOCK/6)); // clock divider guessed + io.in_pa_callback().set_ioport("P1"); + io.in_pb_callback().set_ioport("P2"); + io.in_pc_callback().set(FUNC(segac2_state::io_portc_r)); + io.out_pd_callback().set(FUNC(segac2_state::io_portd_w)); + io.in_pe_callback().set_ioport("SERVICE"); + io.in_pf_callback().set_ioport("COINAGE"); + io.in_pg_callback().set_ioport("DSW"); + io.out_ph_callback().set(FUNC(segac2_state::io_porth_w)); /* video hardware */ MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, XL2_CLOCK, "maincpu") @@ -1596,17 +1596,16 @@ MACHINE_CONFIG_START(segac2_state::segac) MACHINE_CONFIG_END -MACHINE_CONFIG_START(segac2_state::segac2) +void segac2_state::segac2(machine_config &config) +{ segac(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_OUT_CNT1_CB(WRITELINE("upd", upd7759_device, reset_w)) + subdevice("io")->out_cnt1_callback().set(m_upd7759, FUNC(upd7759_device::reset_w)); /* sound hardware */ - MCFG_DEVICE_ADD("upd", UPD7759, XL1_CLOCK) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END + UPD7759(config, m_upd7759, XL1_CLOCK).add_route(ALL_OUTPUTS, "mono", 0.50); +} diff --git a/src/mame/drivers/segae.cpp b/src/mame/drivers/segae.cpp index e596a7a71bb..e589974dd6d 100644 --- a/src/mame/drivers/segae.cpp +++ b/src/mame/drivers/segae.cpp @@ -932,13 +932,13 @@ MACHINE_CONFIG_START(systeme_state::ridleofp) MCFG_UPD4701_PORTX("PAD1") MCFG_UPD4701_PORTY("PAD2") - MCFG_DEVICE_MODIFY("ppi") - MCFG_I8255_IN_PORTA_CB(READ8("upd4701", upd4701_device, d_r)) - MCFG_I8255_OUT_PORTC_CB(WRITELINE("upd4701", upd4701_device, cs_w)) MCFG_DEVCB_BIT(4) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, xy_w)) MCFG_DEVCB_BIT(3) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, ul_w)) MCFG_DEVCB_BIT(2) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, resetx_w)) MCFG_DEVCB_BIT(1) // or possibly bit 0 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, resety_w)) MCFG_DEVCB_BIT(0) // or possibly bit 1 + i8255_device &ppi(*subdevice("ppi")); + ppi.in_pa_callback().set("upd4701", FUNC(upd4701_device::d_r)); + ppi.out_pc_callback().set("upd4701", FUNC(upd4701_device::cs_w)).bit(4); + ppi.out_pc_callback().append("upd4701", FUNC(upd4701_device::xy_w)).bit(3); + ppi.out_pc_callback().append("upd4701", FUNC(upd4701_device::ul_w)).bit(2); + ppi.out_pc_callback().append("upd4701", FUNC(upd4701_device::resetx_w)).bit(1); // or possibly bit 0 + ppi.out_pc_callback().append("upd4701", FUNC(upd4701_device::resety_w)).bit(0); // or possibly bit 1 MACHINE_CONFIG_END MACHINE_CONFIG_START(systeme_state::systemex) diff --git a/src/mame/drivers/segajw.cpp b/src/mame/drivers/segajw.cpp index 93d49389d33..75910127bf2 100644 --- a/src/mame/drivers/segajw.cpp +++ b/src/mame/drivers/segajw.cpp @@ -384,19 +384,19 @@ MACHINE_CONFIG_START(segajw_state::segajw) MCFG_NVRAM_ADD_NO_FILL("nvram") - MCFG_DEVICE_ADD("io1a", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_OUT_PORTA_CB(WRITE8(*this, segajw_state, coin_counter_w)) - MCFG_315_5296_OUT_PORTB_CB(WRITE8(*this, segajw_state, lamps1_w)) - MCFG_315_5296_OUT_PORTC_CB(WRITE8(*this, segajw_state, lamps2_w)) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segajw_state, hopper_w)) - MCFG_315_5296_IN_PORTF_CB(READ8(*this, segajw_state, coin_counter_r)) - - MCFG_DEVICE_ADD("io1c", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTA_CB(IOPORT("IN0")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("IN1")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("IN2")) - MCFG_315_5296_IN_PORTD_CB(IOPORT("IN3")) - MCFG_315_5296_OUT_PORTG_CB(WRITE8(*this, segajw_state, coinlockout_w)) + sega_315_5296_device &io1a(SEGA_315_5296(config, "io1a", 0)); // unknown clock + io1a.out_pa_callback().set(FUNC(segajw_state::coin_counter_w)); + io1a.out_pb_callback().set(FUNC(segajw_state::lamps1_w)); + io1a.out_pc_callback().set(FUNC(segajw_state::lamps2_w)); + io1a.out_pd_callback().set(FUNC(segajw_state::hopper_w)); + io1a.in_pf_callback().set(FUNC(segajw_state::coin_counter_r)); + + sega_315_5296_device &io1c(SEGA_315_5296(config, "io1c", 0)); // unknown clock + io1c.in_pa_callback().set_ioport("IN0"); + io1c.in_pb_callback().set_ioport("IN1"); + io1c.in_pc_callback().set_ioport("IN2"); + io1c.in_pd_callback().set_ioport("IN3"); + io1c.out_pg_callback().set(FUNC(segajw_state::coinlockout_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/segam1.cpp b/src/mame/drivers/segam1.cpp index 958f6e4a4f3..0d8faf3d455 100644 --- a/src/mame/drivers/segam1.cpp +++ b/src/mame/drivers/segam1.cpp @@ -362,16 +362,16 @@ MACHINE_CONFIG_START(segam1_state::segam1) MCFG_DEVICE_ADD("m1comm", Z80, 4000000) // unknown clock MCFG_DEVICE_PROGRAM_MAP(segam1_comms_map) - MCFG_DEVICE_ADD("io1", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTA_CB(IOPORT("INA")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("INB")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("INC")) - MCFG_315_5296_IN_PORTD_CB(IOPORT("IND")) - MCFG_315_5296_IN_PORTE_CB(IOPORT("INE")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("INF")) - - MCFG_DEVICE_ADD("io2", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTG_CB(IOPORT("ING")) + sega_315_5296_device &io1(SEGA_315_5296(config, "io1", 0)); // unknown clock + io1.in_pa_callback().set_ioport("INA"); + io1.in_pb_callback().set_ioport("INB"); + io1.in_pc_callback().set_ioport("INC"); + io1.in_pd_callback().set_ioport("IND"); + io1.in_pe_callback().set_ioport("INE"); + io1.in_pf_callback().set_ioport("INF"); + + sega_315_5296_device &io2(SEGA_315_5296(config, "io2", 0)); // unknown clock + io2.in_pg_callback().set_ioport("ING"); MCFG_DEVICE_ADD("uart", I8251, 4000000) // unknown clock diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp index 0bd7a81e63d..495e4db3d62 100644 --- a/src/mame/drivers/segas16a.cpp +++ b/src/mame/drivers/segas16a.cpp @@ -1975,7 +1975,7 @@ MACHINE_CONFIG_START(segas16a_state::system16a) MCFG_DEVICE_ADD("n7751", N7751, 6000000) MCFG_MCS48_PORT_BUS_IN_CB(READ8(*this, segas16a_state, n7751_rom_r)) - MCFG_MCS48_PORT_T1_IN_CB(GND) // labelled as "TEST", connected to ground + MCFG_MCS48_PORT_T1_IN_CB(CONSTANT(0)) // labelled as "TEST", connected to ground MCFG_MCS48_PORT_P1_OUT_CB(WRITE8("dac", dac_byte_interface, data_w)) MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, segas16a_state, n7751_p2_r)) MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, segas16a_state, n7751_p2_w)) diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp index 4a6087927ff..3fc4f25d355 100644 --- a/src/mame/drivers/segas16b.cpp +++ b/src/mame/drivers/segas16b.cpp @@ -3813,11 +3813,12 @@ MACHINE_CONFIG_END // same as the above, but with custom Sega ICs -MACHINE_CONFIG_START(segas16b_state::rom_5797_fragment) - MCFG_SEGA_315_5248_MULTIPLIER_ADD("multiplier") - MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_1") - MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_2") -MACHINE_CONFIG_END +void segas16b_state::rom_5797_fragment(machine_config &config) +{ + SEGA_315_5248_MULTIPLIER(config, m_multiplier, 0); + SEGA_315_5250_COMPARE_TIMER(config, m_cmptimer_1, 0); + SEGA_315_5250_COMPARE_TIMER(config, m_cmptimer_2, 0); +} MACHINE_CONFIG_START(segas16b_state::system16b_5797) system16b(config); diff --git a/src/mame/drivers/segas18.cpp b/src/mame/drivers/segas18.cpp index c775aad6cc6..e87bba96026 100644 --- a/src/mame/drivers/segas18.cpp +++ b/src/mame/drivers/segas18.cpp @@ -1325,17 +1325,17 @@ MACHINE_CONFIG_START(segas18_state::system18) MCFG_SEGA_315_5195_MAPPER_HANDLER(segas18_state, memory_mapper) MCFG_SEGA_315_5195_PBF_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI)) - MCFG_DEVICE_ADD("io", SEGA_315_5296, 16000000) - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("P3")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas18_state, misc_outputs_w)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) - MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) - MCFG_315_5296_OUT_PORTH_CB(WRITE8(*this, segas18_state, rom_5874_bank_w)) - MCFG_315_5296_OUT_CNT1_CB(WRITELINE("segaic16vid", segaic16_video_device, set_display_enable)) - MCFG_315_5296_OUT_CNT2_CB(WRITELINE(*this, segas18_state, set_vdp_enable)) + SEGA_315_5296(config, m_io, 16000000); + m_io->in_pa_callback().set_ioport("P1"); + m_io->in_pb_callback().set_ioport("P2"); + m_io->in_pc_callback().set_ioport("P3"); + m_io->out_pd_callback().set(FUNC(segas18_state::misc_outputs_w)); + m_io->in_pe_callback().set_ioport("SERVICE"); + m_io->in_pf_callback().set_ioport("COINAGE"); + m_io->in_pg_callback().set_ioport("DSW"); + m_io->out_ph_callback().set(FUNC(segas18_state::rom_5874_bank_w)); + m_io->out_cnt1_callback().set(m_segaic16vid, FUNC(segaic16_video_device::set_display_enable)); + m_io->out_cnt2_callback().set(FUNC(segas18_state::set_vdp_enable)); MCFG_DEVICE_ADD("gen_vdp", SEGA315_5313, 15000000, "maincpu") // ??? Frequency is a complete guess MCFG_SEGA315_5313_IS_PAL(false) @@ -1389,21 +1389,21 @@ MACHINE_CONFIG_START(segas18_state::system18_fd1094) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", segas18_state, irq4_line_hold) MACHINE_CONFIG_END -MACHINE_CONFIG_START(segas18_state::lghost_fd1094) +void segas18_state::lghost_fd1094(machine_config &config) +{ system18_fd1094(config); // basic machine hardware - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_OUT_PORTC_CB(WRITE8(*this, segas18_state, lghost_gun_recoil_w)) -MACHINE_CONFIG_END + m_io->out_pc_callback().set(FUNC(segas18_state::lghost_gun_recoil_w)); +} -MACHINE_CONFIG_START(segas18_state::lghost) +void segas18_state::lghost(machine_config &config) +{ system18(config); // basic machine hardware - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_OUT_PORTC_CB(WRITE8(*this, segas18_state, lghost_gun_recoil_w)) -MACHINE_CONFIG_END + m_io->out_pc_callback().set(FUNC(segas18_state::lghost_gun_recoil_w)); +} MACHINE_CONFIG_START(segas18_state::wwally_fd1094) system18_fd1094(config); diff --git a/src/mame/drivers/segas24.cpp b/src/mame/drivers/segas24.cpp index 43c5e6e99e4..29a998b7728 100644 --- a/src/mame/drivers/segas24.cpp +++ b/src/mame/drivers/segas24.cpp @@ -1873,17 +1873,17 @@ MACHINE_CONFIG_START(segas24_state::system24) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("io", SEGA_315_5296, VIDEO_CLOCK/2) - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("P3")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas24_state, hotrod_lamps_w)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("COINAGE")) - MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW")) - MCFG_315_5296_OUT_PORTH_CB(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_315_5296_OUT_CNT1_CB(WRITELINE(*this, segas24_state, cnt1)) - MCFG_315_5296_OUT_CNT2_CB(WRITELINE("ymsnd", ym2151_device, reset_w)) + sega_315_5296_device &io(SEGA_315_5296(config, "io", VIDEO_CLOCK/2)); + io.in_pa_callback().set_ioport("P1"); + io.in_pb_callback().set_ioport("P2"); + io.in_pc_callback().set_ioport("P3"); + io.out_pd_callback().set(FUNC(segas24_state::hotrod_lamps_w)); + io.in_pe_callback().set_ioport("SERVICE"); + io.in_pf_callback().set_ioport("COINAGE"); + io.in_pg_callback().set_ioport("DSW"); + io.out_ph_callback().set("dac", FUNC(dac_byte_interface::data_w)); + io.out_cnt1_callback().set(FUNC(segas24_state::cnt1)); + io.out_cnt2_callback().set("ymsnd", FUNC(ym2151_device::reset_w)); MCFG_TIMER_DRIVER_ADD("irq_timer", segas24_state, irq_timer_cb) MCFG_TIMER_DRIVER_ADD("irq_timer_clear", segas24_state, irq_timer_clear_cb) @@ -1916,13 +1916,14 @@ MACHINE_CONFIG_START(segas24_state::system24) MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT) MACHINE_CONFIG_END -MACHINE_CONFIG_START(segas24_state::mahmajn) +void segas24_state::mahmajn(machine_config &config) +{ system24(config); - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_IN_PORTA_CB(READ8(*this, segas24_state, mahmajn_input_line_r)) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, segas24_state, mahmajn_inputs_r)) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas24_state, mahmajn_mux_w)) -MACHINE_CONFIG_END + sega_315_5296_device &io(*subdevice("io")); + io.in_pa_callback().set(FUNC(segas24_state::mahmajn_input_line_r)); + io.in_pc_callback().set(FUNC(segas24_state::mahmajn_inputs_r)); + io.out_pd_callback().set(FUNC(segas24_state::mahmajn_mux_w)); +} MACHINE_CONFIG_START(segas24_state::system24_floppy) system24(config); @@ -1972,19 +1973,21 @@ MACHINE_CONFIG_START(segas24_state::system24_floppy_fd_upd) MCFG_UPD4701_PORTY("DIAL2") MACHINE_CONFIG_END -MACHINE_CONFIG_START(segas24_state::dcclub) +void segas24_state::dcclub(machine_config &config) +{ system24(config); - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_IN_PORTA_CB(READ8(*this, segas24_state, dcclub_p1_r)) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, segas24_state, dcclub_p3_r)) -MACHINE_CONFIG_END + sega_315_5296_device &io(*subdevice("io")); + io.in_pa_callback().set(FUNC(segas24_state::dcclub_p1_r)); + io.in_pc_callback().set(FUNC(segas24_state::dcclub_p3_r)); +} -MACHINE_CONFIG_START(segas24_state::system24_floppy_dcclub) +void segas24_state::system24_floppy_dcclub(machine_config &config) +{ system24_floppy_fd1094(config); - MCFG_DEVICE_MODIFY("io") - MCFG_315_5296_IN_PORTA_CB(READ8(*this, segas24_state, dcclub_p1_r)) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, segas24_state, dcclub_p3_r)) -MACHINE_CONFIG_END + sega_315_5296_device &io(*subdevice("io")); + io.in_pa_callback().set(FUNC(segas24_state::dcclub_p1_r)); + io.in_pc_callback().set(FUNC(segas24_state::dcclub_p3_r)); +} /************************************* diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp index 1ad0169693c..33f91ab8279 100644 --- a/src/mame/drivers/segas32.cpp +++ b/src/mame/drivers/segas32.cpp @@ -2207,26 +2207,26 @@ MACHINE_CONFIG_START(segas32_state::device_add_mconfig) MCFG_DEVICE_PROGRAM_MAP(system32_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", segas32_state, start_of_vblank_int) - MCFG_DEVICE_ADD("soundcpu", Z80, MASTER_CLOCK/4) - MCFG_DEVICE_PROGRAM_MAP(system32_sound_map) - MCFG_DEVICE_IO_MAP(system32_sound_portmap) - - MCFG_DEVICE_ADD("io_chip", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1_A")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2_A")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("PORTC_A")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas32_state, misc_output_0_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(6) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE12_A")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("SERVICE34_A")) - MCFG_315_5296_OUT_PORTG_CB(WRITE8(*this, segas32_state, sw2_output_0_w)) - MCFG_315_5296_OUT_PORTH_CB(WRITE8(*this, segas32_state, tilebank_external_w)) - MCFG_315_5296_OUT_CNT1_CB(WRITELINE(*this, segas32_state, display_enable_0_w)) - MCFG_315_5296_OUT_CNT2_CB(INPUTLINE("soundcpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) + Z80(config, m_soundcpu, MASTER_CLOCK/4); + m_soundcpu->set_addrmap(AS_PROGRAM, &segas32_state::system32_sound_map); + m_soundcpu->set_addrmap(AS_IO, &segas32_state::system32_sound_portmap); + + sega_315_5296_device &io_chip(SEGA_315_5296(config, "io_chip", 0)); // unknown clock + io_chip.in_pa_callback().set_ioport("P1_A"); + io_chip.in_pb_callback().set_ioport("P2_A"); + io_chip.in_pc_callback().set_ioport("PORTC_A"); + io_chip.out_pd_callback().set(FUNC(segas32_state::misc_output_0_w)); + io_chip.out_pd_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(7); + io_chip.out_pd_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(5); + io_chip.out_pd_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(6); + io_chip.in_pe_callback().set_ioport("SERVICE12_A"); + io_chip.in_pf_callback().set_ioport("SERVICE34_A"); + io_chip.out_pg_callback().set(FUNC(segas32_state::sw2_output_0_w)); + io_chip.out_ph_callback().set(FUNC(segas32_state::tilebank_external_w)); + io_chip.out_cnt1_callback().set(FUNC(segas32_state::display_enable_0_w)); + io_chip.out_cnt2_callback().set_inputline(m_soundcpu, INPUT_LINE_RESET).invert(); + + EEPROM_SERIAL_93C46_16BIT(config, "eeprom"); MCFG_TIMER_DRIVER_ADD("v60_irq0", segas32_state, signal_v60_irq_callback) MCFG_TIMER_DRIVER_ADD("v60_irq1", segas32_state, signal_v60_irq_callback) @@ -2524,32 +2524,32 @@ MACHINE_CONFIG_START(sega_multi32_state::device_add_mconfig) MCFG_DEVICE_PROGRAM_MAP(multi32_sound_map) MCFG_DEVICE_IO_MAP(multi32_sound_portmap) - MCFG_DEVICE_ADD("io_chip_0", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1_A")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2_A")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("PORTC_A")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas32_state, misc_output_0_w)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE12_A")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("SERVICE34_A")) - MCFG_315_5296_OUT_PORTG_CB(WRITE8(*this, segas32_state, sw2_output_0_w)) - MCFG_315_5296_OUT_PORTH_CB(WRITE8(*this, segas32_state, tilebank_external_w)) - MCFG_315_5296_OUT_CNT1_CB(WRITELINE(*this, segas32_state, display_enable_0_w)) - MCFG_315_5296_OUT_CNT2_CB(INPUTLINE("soundcpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("io_chip_1", SEGA_315_5296, 0) // unknown clock - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1_B")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("P2_B")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("PORTC_B")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segas32_state, misc_output_1_w)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("SERVICE12_B")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("SERVICE34_B")) - MCFG_315_5296_OUT_PORTG_CB(WRITE8(*this, segas32_state, sw2_output_1_w)) - MCFG_315_5296_OUT_PORTH_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(6) - MCFG_315_5296_OUT_CNT1_CB(WRITELINE(*this, segas32_state, display_enable_1_w)) - - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) + sega_315_5296_device &io_chip_0(SEGA_315_5296(config, "io_chip_0", 0)); // unknown clock + io_chip_0.in_pa_callback().set_ioport("P1_A"); + io_chip_0.in_pb_callback().set_ioport("P2_A"); + io_chip_0.in_pc_callback().set_ioport("PORTC_A"); + io_chip_0.out_pd_callback().set(FUNC(segas32_state::misc_output_0_w)); + io_chip_0.in_pe_callback().set_ioport("SERVICE12_A"); + io_chip_0.in_pf_callback().set_ioport("SERVICE34_A"); + io_chip_0.out_pg_callback().set(FUNC(segas32_state::sw2_output_0_w)); + io_chip_0.out_ph_callback().set(FUNC(segas32_state::tilebank_external_w)); + io_chip_0.out_cnt1_callback().set(FUNC(segas32_state::display_enable_0_w)); + io_chip_0.out_cnt2_callback().set_inputline(m_soundcpu, INPUT_LINE_RESET).invert(); + + sega_315_5296_device &io_chip_1(SEGA_315_5296(config, "io_chip_1", 0)); // unknown clock + io_chip_1.in_pa_callback().set_ioport("P1_B"); + io_chip_1.in_pb_callback().set_ioport("P2_B"); + io_chip_1.in_pc_callback().set_ioport("PORTC_B"); + io_chip_1.out_pd_callback().set(FUNC(segas32_state::misc_output_1_w)); + io_chip_1.in_pe_callback().set_ioport("SERVICE12_B"); + io_chip_1.in_pf_callback().set_ioport("SERVICE34_B"); + io_chip_1.out_pg_callback().set(FUNC(segas32_state::sw2_output_1_w)); + io_chip_1.out_ph_callback().set("eeprom", FUNC(eeprom_serial_93cxx_device::di_write)).bit(7); + io_chip_1.out_ph_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::cs_write)).bit(5); + io_chip_1.out_ph_callback().append("eeprom", FUNC(eeprom_serial_93cxx_device::clk_write)).bit(6); + io_chip_1.out_cnt1_callback().set(FUNC(segas32_state::display_enable_1_w)); + + EEPROM_SERIAL_93C46_16BIT(config, "eeprom"); MCFG_TIMER_DRIVER_ADD("v60_irq0", segas32_state, signal_v60_irq_callback) MCFG_TIMER_DRIVER_ADD("v60_irq1", segas32_state, signal_v60_irq_callback) diff --git a/src/mame/drivers/segaufo.cpp b/src/mame/drivers/segaufo.cpp index 71107b00e43..5b3a66a9085 100644 --- a/src/mame/drivers/segaufo.cpp +++ b/src/mame/drivers/segaufo.cpp @@ -780,31 +780,31 @@ void ufo_state::machine_start() MACHINE_CONFIG_START(ufo_state::newufo) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(16'000'000)/2) - MCFG_DEVICE_PROGRAM_MAP(ufo_map) - MCFG_DEVICE_IO_MAP(ufo_portmap) + Z80(config, m_maincpu, XTAL(16'000'000)/2); + m_maincpu->set_addrmap(AS_PROGRAM, &ufo_state::ufo_map); + m_maincpu->set_addrmap(AS_IO, &ufo_state::ufo_portmap); MCFG_TIMER_DRIVER_ADD_PERIODIC("motor_timer", ufo_state, simulate_xyz, attotime::from_hz(MOTOR_SPEED)) MCFG_TIMER_DRIVER_ADD_PERIODIC("update_timer", ufo_state, update_info, attotime::from_hz(60)) - MCFG_DEVICE_ADD("io1", SEGA_315_5296, XTAL(16'000'000)) + SEGA_315_5296(config, m_io1, XTAL(16'000'000)); // all ports set to input - MCFG_315_5296_IN_PORTA_CB(READ8(*this, ufo_state, crane_limits_r)) - MCFG_315_5296_IN_PORTB_CB(READ8(*this, ufo_state, crane_limits_r)) - MCFG_315_5296_IN_PORTE_CB(IOPORT("IN1")) - MCFG_315_5296_IN_PORTF_CB(IOPORT("DSW1")) - MCFG_315_5296_IN_PORTG_CB(IOPORT("DSW2")) - MCFG_315_5296_IN_PORTH_CB(IOPORT("IN2")) - - MCFG_DEVICE_ADD("io2", SEGA_315_5296, XTAL(16'000'000)) + m_io1->in_pa_callback().set(FUNC(ufo_state::crane_limits_r)); + m_io1->in_pb_callback().set(FUNC(ufo_state::crane_limits_r)); + m_io1->in_pe_callback().set_ioport("IN1"); + m_io1->in_pf_callback().set_ioport("DSW1"); + m_io1->in_pg_callback().set_ioport("DSW2"); + m_io1->in_ph_callback().set_ioport("IN2"); + + SEGA_315_5296(config, m_io2, XTAL(16'000'000)); // all ports set to output - MCFG_315_5296_OUT_PORTA_CB(WRITE8(*this, ufo_state, stepper_w)) - MCFG_315_5296_OUT_PORTB_CB(WRITE8(*this, ufo_state, cp_lamps_w)) - MCFG_315_5296_OUT_PORTC_CB(WRITE8(*this, ufo_state, cp_digits_w)) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, ufo_state, cp_digits_w)) - MCFG_315_5296_OUT_PORTE_CB(WRITE8(*this, ufo_state, crane_xyz_w)) - MCFG_315_5296_OUT_PORTF_CB(WRITE8(*this, ufo_state, crane_xyz_w)) - MCFG_315_5296_OUT_PORTG_CB(WRITE8(*this, ufo_state, ufo_lamps_w)) + m_io2->out_pa_callback().set(FUNC(ufo_state::stepper_w)); + m_io2->out_pb_callback().set(FUNC(ufo_state::cp_lamps_w)); + m_io2->out_pc_callback().set(FUNC(ufo_state::cp_digits_w)); + m_io2->out_pd_callback().set(FUNC(ufo_state::cp_digits_w)); + m_io2->out_pe_callback().set(FUNC(ufo_state::crane_xyz_w)); + m_io2->out_pf_callback().set(FUNC(ufo_state::crane_xyz_w)); + m_io2->out_pg_callback().set(FUNC(ufo_state::ufo_lamps_w)); MCFG_DEVICE_ADD("pit", PIT8254, XTAL(16'000'000)/2) // uPD71054C, configuration is unknown MCFG_PIT8253_CLK0(XTAL(16'000'000)/2/256) @@ -825,69 +825,65 @@ MACHINE_CONFIG_START(ufo_state::newufo) MCFG_SOUND_ROUTE(1, "mono", 0.40) MACHINE_CONFIG_END -MACHINE_CONFIG_START(ufo_state::ufomini) +void ufo_state::ufomini(machine_config &config) +{ newufo(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("io1") - MCFG_315_5296_IN_PORTC_CB(IOPORT("IN1")) - MCFG_315_5296_IN_PORTE_CB(NOOP) - MCFG_315_5296_IN_PORTH_CB(NOOP) -MACHINE_CONFIG_END + m_io1->in_pc_callback().set_ioport("IN1"); + m_io1->in_pe_callback().set_constant(0); + m_io1->in_ph_callback().set_constant(0); +} -MACHINE_CONFIG_START(ufo_state::ufo21) +void ufo_state::ufo21(machine_config &config) +{ newufo(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_IO_MAP(ex_ufo21_portmap) - - MCFG_DEVICE_MODIFY("io1") - MCFG_315_5296_IN_PORTA_CB(READ8(*this, ufo_state, ex_crane_limits_r)) - MCFG_315_5296_IN_PORTB_CB(READ8(*this, ufo_state, ex_crane_limits_r)) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, ufo_state, ex_crane_open_r)) - - MCFG_DEVICE_MODIFY("io2") - MCFG_315_5296_OUT_PORTA_CB(WRITE8(*this, ufo_state, ex_stepper_w)) - MCFG_315_5296_OUT_PORTB_CB(WRITE8(*this, ufo_state, ex_cp_lamps_w)) - MCFG_315_5296_OUT_PORTE_CB(WRITE8(*this, ufo_state, ex_crane_xyz_w)) - MCFG_315_5296_OUT_PORTF_CB(WRITE8(*this, ufo_state, ex_crane_xyz_w)) - MCFG_315_5296_OUT_PORTG_CB(NOOP) - - MCFG_DEVICE_ADD("io3", SEGA_315_5338A, 0) - MCFG_315_5338A_OUT_PA_CB(WRITE8(*this, ufo_state, ex_upd_start_w)) - MCFG_315_5338A_IN_PB_CB(READ8(*this, ufo_state, ex_upd_busy_r)) - MCFG_315_5338A_OUT_PE_CB(WRITE8(*this, ufo_state, ex_ufo21_lamps1_w)) - MCFG_315_5338A_OUT_PF_CB(WRITE8(*this, ufo_state, ex_ufo21_lamps2_w)) + m_maincpu->set_addrmap(AS_IO, &ufo_state::ex_ufo21_portmap); + + m_io1->in_pa_callback().set(FUNC(ufo_state::ex_crane_limits_r)); + m_io1->in_pb_callback().set(FUNC(ufo_state::ex_crane_limits_r)); + m_io1->in_pc_callback().set(FUNC(ufo_state::ex_crane_open_r)); + + m_io2->out_pa_callback().set(FUNC(ufo_state::ex_stepper_w)); + m_io2->out_pb_callback().set(FUNC(ufo_state::ex_cp_lamps_w)); + m_io2->out_pe_callback().set(FUNC(ufo_state::ex_crane_xyz_w)); + m_io2->out_pf_callback().set(FUNC(ufo_state::ex_crane_xyz_w)); + m_io2->out_pg_callback().set_nop(); + + sega_315_5338a_device &io3(SEGA_315_5338A(config, "io3", 0)); + io3.out_pa_callback().set(FUNC(ufo_state::ex_upd_start_w)); + io3.in_pb_callback().set(FUNC(ufo_state::ex_upd_busy_r)); + io3.out_pe_callback().set(FUNC(ufo_state::ex_ufo21_lamps1_w)); + io3.out_pf_callback().set(FUNC(ufo_state::ex_ufo21_lamps2_w)); /* sound hardware */ - MCFG_DEVICE_ADD("upd", UPD7759) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.75) -MACHINE_CONFIG_END + UPD7759(config, m_upd); + m_upd->add_route(ALL_OUTPUTS, "mono", 0.75); +} -MACHINE_CONFIG_START(ufo_state::ufo800) +void ufo_state::ufo800(machine_config &config) +{ newufo(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_IO_MAP(ex_ufo800_portmap) - - MCFG_DEVICE_MODIFY("io1") - MCFG_315_5296_IN_PORTA_CB(READ8(*this, ufo_state, ex_crane_limits_r)) - MCFG_315_5296_IN_PORTB_CB(IOPORT("IN2")) - MCFG_315_5296_IN_PORTC_CB(READ8(*this, ufo_state, ex_crane_open_r)) - MCFG_315_5296_IN_PORTD_CB(IOPORT("IN1")) - MCFG_315_5296_IN_PORTE_CB(NOOP) - MCFG_315_5296_IN_PORTH_CB(NOOP) - - MCFG_DEVICE_MODIFY("io2") - MCFG_315_5296_OUT_PORTA_CB(WRITE8(*this, ufo_state, ex_stepper_w)) - MCFG_315_5296_OUT_PORTB_CB(WRITE8(*this, ufo_state, ex_cp_lamps_w)) - MCFG_315_5296_OUT_PORTE_CB(WRITE8(*this, ufo_state, ex_crane_xyz_w)) - MCFG_315_5296_OUT_PORTF_CB(WRITE8(*this, ufo_state, ex_ufo800_lamps_w)) - MCFG_315_5296_OUT_PORTG_CB(NOOP) -MACHINE_CONFIG_END + m_maincpu->set_addrmap(AS_IO, &ufo_state::ex_ufo800_portmap); + + m_io1->in_pa_callback().set(FUNC(ufo_state::ex_crane_limits_r)); + m_io1->in_pb_callback().set_ioport("IN2"); + m_io1->in_pc_callback().set(FUNC(ufo_state::ex_crane_open_r)); + m_io1->in_pd_callback().set_ioport("IN1"); + m_io1->in_pe_callback().set_constant(0); + m_io1->in_ph_callback().set_constant(0); + + m_io2->out_pa_callback().set(FUNC(ufo_state::ex_stepper_w)); + m_io2->out_pb_callback().set(FUNC(ufo_state::ex_cp_lamps_w)); + m_io2->out_pe_callback().set(FUNC(ufo_state::ex_crane_xyz_w)); + m_io2->out_pf_callback().set(FUNC(ufo_state::ex_ufo800_lamps_w)); + m_io2->out_pg_callback().set_nop(); +} diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp index ba8901fe663..30c04711044 100644 --- a/src/mame/drivers/segaxbd.cpp +++ b/src/mame/drivers/segaxbd.cpp @@ -929,7 +929,7 @@ void segaxbd_state::main_map(address_map &map) map(0x0d0000, 0x0d0fff).mirror(0x00f000).rw("segaic16vid", FUNC(segaic16_video_device::textram_r), FUNC(segaic16_video_device::textram_w)).share("textram"); map(0x0e0000, 0x0e0007).mirror(0x003ff8).rw("multiplier_main", FUNC(sega_315_5248_multiplier_device::read), FUNC(sega_315_5248_multiplier_device::write)); map(0x0e4000, 0x0e401f).mirror(0x003fe0).rw("divider_main", FUNC(sega_315_5249_divider_device::read), FUNC(sega_315_5249_divider_device::write)); - map(0x0e8000, 0x0e801f).mirror(0x003fe0).rw("cmptimer_main", FUNC(sega_315_5250_compare_timer_device::read), FUNC(sega_315_5250_compare_timer_device::write)); + map(0x0e8000, 0x0e801f).mirror(0x003fe0).rw(m_cmptimer_1, FUNC(sega_315_5250_compare_timer_device::read), FUNC(sega_315_5250_compare_timer_device::write)); map(0x100000, 0x100fff).mirror(0x00f000).ram().share("sprites"); map(0x110000, 0x11ffff).w("sprites", FUNC(sega_xboard_sprite_device::draw_write)); map(0x120000, 0x123fff).mirror(0x00c000).ram().w(FUNC(segaxbd_state::paletteram_w)).share("paletteram"); @@ -993,7 +993,7 @@ void segaxbd_state::sound_portmap(address_map &map) map.unmap_value_high(); map.global_mask(0xff); map(0x00, 0x01).mirror(0x3e).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); - map(0x40, 0x40).mirror(0x3f).r("cmptimer_main", FUNC(sega_315_5250_compare_timer_device::zread)); + map(0x40, 0x40).mirror(0x3f).r(m_cmptimer_1, FUNC(sega_315_5250_compare_timer_device::zread)); } @@ -1017,7 +1017,7 @@ void segaxbd_state::smgp_sound2_portmap(address_map &map) { map.unmap_value_high(); map.global_mask(0xff); - map(0x40, 0x40).mirror(0x3f).r("cmptimer_main", FUNC(sega_315_5250_compare_timer_device::zread)); + map(0x40, 0x40).mirror(0x3f).r(m_cmptimer_1, FUNC(sega_315_5250_compare_timer_device::zread)); } @@ -1685,11 +1685,11 @@ MACHINE_CONFIG_START(segaxbd_state::xboard_base_mconfig ) MCFG_SEGA_315_5249_DIVIDER_ADD("divider_main") MCFG_SEGA_315_5249_DIVIDER_ADD("divider_subx") - MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_main") - MCFG_SEGA_315_5250_68KINT_CALLBACK(WRITELINE(*this, segaxbd_state, timer_irq_w)) - MCFG_SEGA_315_5250_ZINT_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI)) + SEGA_315_5250_COMPARE_TIMER(config, m_cmptimer_1, 0); + m_cmptimer_1->m68kint_callback().set(FUNC(segaxbd_state::timer_irq_w)); + m_cmptimer_1->zint_callback().set_inputline(m_soundcpu, INPUT_LINE_NMI); - MCFG_SEGA_315_5250_COMPARE_TIMER_ADD("cmptimer_subx") + SEGA_315_5250_COMPARE_TIMER(config, "cmptimer_subx", 0); MCFG_DEVICE_ADD("iochip_0", CXD1095, 0) // IC160 MCFG_CXD1095_IN_PORTA_CB(IOPORT("IO0PORTA")) @@ -1900,9 +1900,7 @@ MACHINE_CONFIG_START(segaxbd_smgp_fd1094_state::device_add_mconfig) MCFG_DEVICE_PROGRAM_MAP(smgp_airdrive_map) MCFG_DEVICE_IO_MAP(smgp_airdrive_portmap) - MCFG_DEVICE_MODIFY("cmptimer_main") - MCFG_SEGA_315_5250_ZINT_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("soundcpu2", INPUT_LINE_NMI)) + m_cmptimer_1->zint_callback().append_inputline(m_soundcpu2, INPUT_LINE_NMI); MCFG_DEVICE_MODIFY("iochip_0") MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, smgp_motor_r)) @@ -1946,9 +1944,7 @@ MACHINE_CONFIG_START(segaxbd_smgp_state::device_add_mconfig) MCFG_DEVICE_PROGRAM_MAP(smgp_airdrive_map) MCFG_DEVICE_IO_MAP(smgp_airdrive_portmap) - MCFG_DEVICE_MODIFY("cmptimer_main") - MCFG_SEGA_315_5250_ZINT_CALLBACK(INPUTLINE("soundcpu", INPUT_LINE_NMI)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("soundcpu2", INPUT_LINE_NMI)) + m_cmptimer_1->zint_callback().append_inputline(m_soundcpu2, INPUT_LINE_NMI); MCFG_DEVICE_MODIFY("iochip_0") MCFG_CXD1095_IN_PORTA_CB(READ8(*this, segaxbd_state, smgp_motor_r)) diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp index 51e0a9e4d1c..c28e78354c4 100644 --- a/src/mame/drivers/segaybd.cpp +++ b/src/mame/drivers/segaybd.cpp @@ -1292,15 +1292,15 @@ MACHINE_CONFIG_START(segaybd_state::yboard) MCFG_MB3773_ADD("watchdog") // IC95 - MCFG_DEVICE_ADD("io", SEGA_315_5296, MASTER_CLOCK/8) - MCFG_315_5296_IN_PORTA_CB(IOPORT("P1")) - MCFG_315_5296_IN_PORTB_CB(IOPORT("GENERAL")) - MCFG_315_5296_IN_PORTC_CB(IOPORT("LIMITSW")) - MCFG_315_5296_OUT_PORTD_CB(WRITE8(*this, segaybd_state, output1_w)) - MCFG_315_5296_OUT_PORTE_CB(WRITE8(*this, segaybd_state, misc_output_w)) - MCFG_315_5296_IN_PORTF_CB(IOPORT("DSW")) - MCFG_315_5296_IN_PORTG_CB(IOPORT("COINAGE")) - MCFG_315_5296_OUT_PORTH_CB(WRITE8(*this, segaybd_state, output2_w)) + sega_315_5296_device &io(SEGA_315_5296(config, "io", MASTER_CLOCK/8)); + io.in_pa_callback().set_ioport("P1"); + io.in_pb_callback().set_ioport("GENERAL"); + io.in_pc_callback().set_ioport("LIMITSW"); + io.out_pd_callback().set(FUNC(segaybd_state::output1_w)); + io.out_pe_callback().set(FUNC(segaybd_state::misc_output_w)); + io.in_pf_callback().set_ioport("DSW"); + io.in_pg_callback().set_ioport("COINAGE"); + io.out_ph_callback().set(FUNC(segaybd_state::output2_w)); // FMCS and CKOT connect to CS and OSC IN on MSM6253 below MCFG_DEVICE_ADD("adc", MSM6253, 0) diff --git a/src/mame/drivers/selz80.cpp b/src/mame/drivers/selz80.cpp index 04d2385cda2..655bc7269d5 100644 --- a/src/mame/drivers/selz80.cpp +++ b/src/mame/drivers/selz80.cpp @@ -228,9 +228,9 @@ MACHINE_CONFIG_START(selz80_state::selz80) MCFG_DEFAULT_LAYOUT(layout_selz80) /* Devices */ - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) + CLOCK(config, m_clock, 153600); + m_clock->signal_handler().set("uart", FUNC(i8251_device::write_txc)); + m_clock->signal_handler().append("uart", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) @@ -246,8 +246,8 @@ MACHINE_CONFIG_START(selz80_state::selz80) MCFG_I8279_OUT_SL_CB(WRITE8(*this, selz80_state, scanlines_w)) // scan SL lines MCFG_I8279_OUT_DISP_CB(WRITE8(*this, selz80_state, digit_w)) // display A&B MCFG_I8279_IN_RL_CB(READ8(*this, selz80_state, kbd_r)) // kbd RL lines - MCFG_I8279_IN_SHIFT_CB(VCC) // Shift key - MCFG_I8279_IN_CTRL_CB(VCC) + MCFG_I8279_IN_SHIFT_CB(CONSTANT(1)) // Shift key + MCFG_I8279_IN_CTRL_CB(CONSTANT(1)) MACHINE_CONFIG_END MACHINE_CONFIG_START(selz80_state::dagz80) diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp index 4b6d9ce70d9..0bb9e676196 100644 --- a/src/mame/drivers/seta.cpp +++ b/src/mame/drivers/seta.cpp @@ -8026,10 +8026,10 @@ MACHINE_CONFIG_START(seta_state::usclssic) MCFG_UPD4701_PORTX("TRACKX") MCFG_UPD4701_PORTY("TRACKY") - MCFG_DEVICE_ADD("buttonmux", HC157, 0) - MCFG_74157_OUT_CB(WRITELINE("upd4701", upd4701_device, middle_w)) MCFG_DEVCB_BIT(0) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, right_w)) MCFG_DEVCB_BIT(1) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("upd4701", upd4701_device, left_w)) MCFG_DEVCB_BIT(2) + HC157(config, m_buttonmux, 0); + m_buttonmux->out_callback().set(m_upd4701, FUNC(upd4701_device::middle_w)).bit(0); + m_buttonmux->out_callback().append(m_upd4701, FUNC(upd4701_device::right_w)).bit(1); + m_buttonmux->out_callback().append(m_upd4701, FUNC(upd4701_device::left_w)).bit(2); MCFG_MACHINE_START_OVERRIDE(seta_state,usclssic) MCFG_MACHINE_RESET_OVERRIDE(seta_state,calibr50) diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp index efd21ca2000..7fb2fb8694e 100644 --- a/src/mame/drivers/seta2.cpp +++ b/src/mame/drivers/seta2.cpp @@ -728,7 +728,7 @@ void seta2_state::telpacfl_map(address_map &map) MCFG_DEVICE_ADD( _tag, FUNCUBE_TOUCHSCREEN, _clock ) #define MCFG_FUNCUBE_TOUCHSCREEN_TX_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_tx_cb(DEVCB_##_devcb); + downcast(*device).set_tx_cb(DEVCB_##_devcb); class funcube_touchscreen_device : public device_t, public device_serial_interface diff --git a/src/mame/drivers/sfcbox.cpp b/src/mame/drivers/sfcbox.cpp index 98c54a167ad..d9be50fe51f 100644 --- a/src/mame/drivers/sfcbox.cpp +++ b/src/mame/drivers/sfcbox.cpp @@ -492,9 +492,9 @@ MACHINE_CONFIG_START(sfcbox_state::sfcbox) MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC) MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) - MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) - MCFG_SNES_PPU_OPENBUS_CB(READ8(*this, sfcbox_state, snes_open_bus_r)) - MCFG_VIDEO_SET_SCREEN("screen") + SNES_PPU(config, m_ppu, 0); + m_ppu->open_bus_callback().set([this] { return snes_open_bus_r(); }); // lambda because overloaded function name + m_ppu->set_screen("screen"); // SFCBOX MCFG_SCREEN_ADD("osd", RASTER) diff --git a/src/mame/drivers/shangkid.cpp b/src/mame/drivers/shangkid.cpp index a29db7ce2ba..c771985ddcb 100644 --- a/src/mame/drivers/shangkid.cpp +++ b/src/mame/drivers/shangkid.cpp @@ -378,40 +378,40 @@ void shangkid_state::sound_portmap(address_map &map) MACHINE_CONFIG_START(shangkid_state::chinhero) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", Z80, XTAL(18'432'000)/6) /* verified on pcb */ + MCFG_DEVICE_ADD(m_maincpu, Z80, XTAL(18'432'000)/6) /* verified on pcb */ MCFG_DEVICE_PROGRAM_MAP(chinhero_main_map) - MCFG_DEVICE_ADD("bbx", Z80, XTAL(18'432'000)/6) /* verified on pcb */ + MCFG_DEVICE_ADD(m_bbx, Z80, XTAL(18'432'000)/6) /* verified on pcb */ MCFG_DEVICE_PROGRAM_MAP(chinhero_bbx_map) MCFG_DEVICE_IO_MAP(chinhero_bbx_portmap) - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(18'432'000)/6) /* verified on pcb */ + MCFG_DEVICE_ADD(m_audiocpu, Z80, XTAL(18'432'000)/6) /* verified on pcb */ MCFG_DEVICE_PROGRAM_MAP(chinhero_sound_map) MCFG_DEVICE_IO_MAP(sound_portmap) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(INPUTLINE("bbx", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // RESET2 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // RESET3 - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, shangkid_state, sound_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, shangkid_state, int_enable_1_w)) // INTE1 - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, shangkid_state, int_enable_2_w)) // INTE2 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, shangkid_state, nmi_enable_1_w)) // NMIE1 - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, shangkid_state, nmi_enable_2_w)) // NMIE2 - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, shangkid_state, coin_counter_1_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, shangkid_state, coin_counter_2_w)) + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_inputline(m_bbx, INPUT_LINE_RESET).invert(); // RESET2 + mainlatch.q_out_cb<1>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); // RESET3 + mainlatch.q_out_cb<1>().append(FUNC(shangkid_state::sound_enable_w)); + mainlatch.q_out_cb<2>().set(FUNC(shangkid_state::int_enable_1_w)); // INTE1 + mainlatch.q_out_cb<3>().set(FUNC(shangkid_state::int_enable_2_w)); // INTE2 + mainlatch.q_out_cb<4>().set(FUNC(shangkid_state::nmi_enable_1_w)); // NMIE1 + mainlatch.q_out_cb<5>().set(FUNC(shangkid_state::nmi_enable_2_w)); // NMIE2 + mainlatch.q_out_cb<6>().set(FUNC(shangkid_state::coin_counter_1_w)); + mainlatch.q_out_cb<7>().set(FUNC(shangkid_state::coin_counter_2_w)); MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(40*8, 28*8) - MCFG_SCREEN_VISIBLE_AREA(16, 319-16, 0, 223) - MCFG_SCREEN_UPDATE_DRIVER(shangkid_state, screen_update_shangkid) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, shangkid_state, irq_1_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, shangkid_state, irq_2_w)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_size(40*8, 28*8); + screen.set_visarea(16, 319-16, 0, 223); + screen.set_screen_update(FUNC(shangkid_state::screen_update_shangkid)); + screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(shangkid_state::irq_1_w)); + screen.screen_vblank().append(FUNC(shangkid_state::irq_2_w)); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chinhero) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) @@ -435,20 +435,17 @@ MACHINE_CONFIG_START(shangkid_state::shangkid) chinhero(config); /* basic machine hardware */ - MCFG_DEVICE_MODIFY("maincpu") - MCFG_DEVICE_PROGRAM_MAP(shangkid_main_map) + m_maincpu->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_main_map); - MCFG_DEVICE_MODIFY("bbx") - MCFG_DEVICE_PROGRAM_MAP(shangkid_bbx_map) - MCFG_DEVICE_IO_MAP(shangkid_bbx_portmap) + m_bbx->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_bbx_map); + m_bbx->set_addrmap(AS_IO, &shangkid_state::shangkid_bbx_portmap); - MCFG_DEVICE_MODIFY("audiocpu") - MCFG_DEVICE_PROGRAM_MAP(shangkid_sound_map) + m_audiocpu->set_addrmap(AS_PROGRAM, &shangkid_state::shangkid_sound_map); - MCFG_DEVICE_MODIFY("mainlatch") + ls259_device &mainlatch(*subdevice("mainlatch")); // Q1 should *not* reset the AY-3-8910 here, or else banking writes will be lost! - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(MEMBANK("bank1")) + mainlatch.q_out_cb<1>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<7>().set_membank("bank1"); MCFG_MACHINE_RESET_OVERRIDE(shangkid_state,shangkid) diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp index 7ff83a5da3a..ae4f0db2e5e 100644 --- a/src/mame/drivers/shougi.cpp +++ b/src/mame/drivers/shougi.cpp @@ -92,8 +92,8 @@ PROM : Type MB7051 class shougi_state : public driver_device { public: - shougi_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + shougi_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_alpha_8201(*this, "alpha_8201"), @@ -383,13 +383,13 @@ MACHINE_CONFIG_START(shougi_state::shougi) MCFG_DEVICE_ADD("alpha_8201", ALPHA_8201, XTAL(10'000'000)/4/8) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // 0: sharedram = sub, 1: sharedram = main (TODO!) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, shougi_state, nmi_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // ? - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("alpha_8201", alpha_8201_device, mcu_start_w)) // start/halt ALPHA-8201 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("alpha_8201", alpha_8201_device, bus_dir_w)) MCFG_DEVCB_INVERT // ALPHA-8201 shared RAM bus direction: 0: mcu, 1: maincpu - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(NOOP) // nothing? connected to +5v via resistor + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_nop(); // 0: sharedram = sub, 1: sharedram = main (TODO!) + mainlatch.q_out_cb<1>().set(FUNC(shougi_state::nmi_enable_w)); + mainlatch.q_out_cb<2>().set_nop(); // ? + mainlatch.q_out_cb<3>().set("alpha_8201", FUNC(alpha_8201_device::mcu_start_w)); // start/halt ALPHA-8201 + mainlatch.q_out_cb<4>().set("alpha_8201", FUNC(alpha_8201_device::bus_dir_w)).invert(); // ALPHA-8201 shared RAM bus direction: 0: mcu, 1: maincpu + mainlatch.q_out_cb<7>().set_nop(); // nothing? connected to +5v via resistor MCFG_QUANTUM_PERFECT_CPU("maincpu") diff --git a/src/mame/drivers/slapfght.cpp b/src/mame/drivers/slapfght.cpp index 272421e9329..36381227645 100644 --- a/src/mame/drivers/slapfght.cpp +++ b/src/mame/drivers/slapfght.cpp @@ -909,17 +909,17 @@ MACHINE_CONFIG_START(slapfght_state::perfrman) MCFG_QUANTUM_PERFECT_CPU("maincpu") /* video hardware */ - MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 32*8-1) - MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_perfrman) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, slapfght_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + BUFFERED_SPRITERAM8(config, m_spriteram); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + m_screen->set_size(64*8, 32*8); + m_screen->set_visarea(0*8, 32*8-1, 2*8, 32*8-1); + m_screen->set_screen_update(FUNC(slapfght_state::screen_update_perfrman)); + m_screen->screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising)); + m_screen->screen_vblank().append(FUNC(slapfght_state::vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_perfrman) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) @@ -961,17 +961,17 @@ MACHINE_CONFIG_START(slapfght_state::tigerh) MCFG_QUANTUM_PERFECT_CPU("maincpu") /* video hardware */ - MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8-1, 32*8-1-1) - MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_slapfight) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, slapfght_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + BUFFERED_SPRITERAM8(config, m_spriteram); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + m_screen->set_size(64*8, 32*8); + m_screen->set_visarea(1*8, 36*8-1, 2*8-1, 32*8-1-1); + m_screen->set_screen_update(FUNC(slapfght_state::screen_update_slapfight)); + m_screen->screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising)); + m_screen->screen_vblank().append(FUNC(slapfght_state::vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapfght) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) @@ -1034,17 +1034,17 @@ MACHINE_CONFIG_START(slapfght_state::slapfigh) MCFG_QUANTUM_PERFECT_CPU("maincpu") /* video hardware */ - MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(64*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(1*8, 36*8-1, 2*8-1, 32*8-1-1) - MCFG_SCREEN_UPDATE_DRIVER(slapfght_state, screen_update_slapfight) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, slapfght_state, vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + BUFFERED_SPRITERAM8(config, m_spriteram); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(60); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + m_screen->set_size(64*8, 32*8); + m_screen->set_visarea(1*8, 36*8-1, 2*8-1, 32*8-1-1); + m_screen->set_screen_update(FUNC(slapfght_state::screen_update_slapfight)); + m_screen->screen_vblank().set(m_spriteram, FUNC(buffered_spriteram8_device::vblank_copy_rising)); + m_screen->screen_vblank().append(FUNC(slapfght_state::vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapfght) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp index 1d784f00c58..8eb5782d864 100644 --- a/src/mame/drivers/slapshot.cpp +++ b/src/mame/drivers/slapshot.cpp @@ -453,12 +453,12 @@ MACHINE_CONFIG_START(slapshot_state::slapshot) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COINS")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("BUTTONS")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("SYSTEM")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, slapshot_state, coin_control_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("JOY")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_1_callback().set_ioport("COINS"); + m_tc0640fio->read_2_callback().set_ioport("BUTTONS"); + m_tc0640fio->read_3_callback().set_ioport("SYSTEM"); + m_tc0640fio->write_4_callback().set(FUNC(slapshot_state::coin_control_w)); + m_tc0640fio->read_7_callback().set_ioport("JOY"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -522,12 +522,12 @@ MACHINE_CONFIG_START(slapshot_state::opwolf3) MCFG_ADC0808_IN2_CB(IOPORT("GUN2X")) MCFG_ADC0808_IN3_CB(IOPORT("GUN2Y")) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COINS")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("BUTTONS")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("SYSTEM")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, slapshot_state, coin_control_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("JOY")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_1_callback().set_ioport("COINS"); + m_tc0640fio->read_2_callback().set_ioport("BUTTONS"); + m_tc0640fio->read_3_callback().set_ioport("SYSTEM"); + m_tc0640fio->write_4_callback().set(FUNC(slapshot_state::coin_control_w)); + m_tc0640fio->read_7_callback().set_ioport("JOY"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/snes.cpp b/src/mame/drivers/snes.cpp index 99fc2a521be..646d3f68748 100644 --- a/src/mame/drivers/snes.cpp +++ b/src/mame/drivers/snes.cpp @@ -1352,9 +1352,9 @@ MACHINE_CONFIG_START(snes_console_state::snes) MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC * 2, SNES_HTOTAL * 2, 0, SNES_SCR_WIDTH * 2, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC) MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) - MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) - MCFG_SNES_PPU_OPENBUS_CB(READ8(*this, snes_console_state, snes_open_bus_r)) - MCFG_VIDEO_SET_SCREEN("screen") + SNES_PPU(config, m_ppu, 0); + m_ppu->open_bus_callback().set([this] { return snes_open_bus_r(); }); // lambda because overloaded function name + m_ppu->set_screen("screen"); MCFG_SNES_CONTROL_PORT_ADD("ctrl1", snes_control_port_devices, "joypad") MCFG_SNESCTRL_ONSCREEN_CB(snes_console_state, onscreen_cb) diff --git a/src/mame/drivers/snesb.cpp b/src/mame/drivers/snesb.cpp index 6226babf68e..102aa8798ad 100644 --- a/src/mame/drivers/snesb.cpp +++ b/src/mame/drivers/snesb.cpp @@ -716,9 +716,9 @@ MACHINE_CONFIG_START(snesb_state::kinstb) MCFG_SCREEN_RAW_PARAMS(DOTCLK_NTSC, SNES_HTOTAL, 0, SNES_SCR_WIDTH, SNES_VTOTAL_NTSC, 0, SNES_SCR_HEIGHT_NTSC) MCFG_SCREEN_UPDATE_DRIVER( snes_state, screen_update ) - MCFG_DEVICE_ADD("ppu", SNES_PPU, 0) - MCFG_SNES_PPU_OPENBUS_CB(READ8(*this, snesb_state, snes_open_bus_r)) - MCFG_VIDEO_SET_SCREEN("screen") + SNES_PPU(config, m_ppu, 0); + m_ppu->open_bus_callback().set([this] { return snes_open_bus_r(); }); // lambda because overloaded function name + m_ppu->set_screen("screen"); /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); diff --git a/src/mame/drivers/splash.cpp b/src/mame/drivers/splash.cpp index f4af04c878e..874ac35b008 100644 --- a/src/mame/drivers/splash.cpp +++ b/src/mame/drivers/splash.cpp @@ -559,11 +559,11 @@ MACHINE_CONFIG_START(splash_state::roldfrog) MCFG_DEVICE_IO_MAP(roldfrog_sound_io_map) MCFG_DEVICE_VBLANK_INT_DRIVER("screen", splash_state, roldfrog_interrupt) - MCFG_DEVICE_ADD("outlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, splash_state, coin1_lockout_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, splash_state, coin2_lockout_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, splash_state, coin1_counter_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, splash_state, coin2_counter_w)) + LS259(config, m_outlatch); + m_outlatch->q_out_cb<1>().set(FUNC(splash_state::coin1_lockout_w)); + m_outlatch->q_out_cb<1>().append(FUNC(splash_state::coin2_lockout_w)); + m_outlatch->q_out_cb<2>().set(FUNC(splash_state::coin1_counter_w)); + m_outlatch->q_out_cb<3>().set(FUNC(splash_state::coin2_counter_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/stargame.cpp b/src/mame/drivers/stargame.cpp index 2a8c005e115..e7cd7a4ab6a 100644 --- a/src/mame/drivers/stargame.cpp +++ b/src/mame/drivers/stargame.cpp @@ -132,18 +132,17 @@ MACHINE_CONFIG_START(stargame_state::stargame) MCFG_DEVICE_ADD("ay", AY8910, 15000000 / 8) // clock line marked as CK2 and derived from 15MHz crystal MCFG_SOUND_ROUTE(ALL_OUTPUTS, "aysnd", 0.25) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // DADIS - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(NOOP) // DAPRI - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // RJUEGO - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(NOOP) // RFLIPPER - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(NOOP) // to AUXILLIAR socket - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(NOOP) // RFDIS - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // SRESET - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(NOOP) // MAKRES - - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", INPUT_LINE_NMI)) + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set_nop(); // DADIS + mainlatch.q_out_cb<1>().set_nop(); // DAPRI + mainlatch.q_out_cb<2>().set_nop(); // RJUEGO + mainlatch.q_out_cb<3>().set_nop(); // RFLIPPER + mainlatch.q_out_cb<4>().set_nop(); // to AUXILLIAR socket + mainlatch.q_out_cb<5>().set_nop(); // RFDIS + mainlatch.q_out_cb<6>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); // SRESET + mainlatch.q_out_cb<7>().set_nop(); // MAKRES + + GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); MCFG_WATCHDOG_ADD("watchdog") MACHINE_CONFIG_END diff --git a/src/mame/drivers/starwars.cpp b/src/mame/drivers/starwars.cpp index ba82217ef7b..f71b7dda782 100644 --- a/src/mame/drivers/starwars.cpp +++ b/src/mame/drivers/starwars.cpp @@ -325,15 +325,15 @@ MACHINE_CONFIG_START(starwars_state::starwars) MCFG_X2212_ADD_AUTOSAVE("x2212") /* nvram */ - MCFG_DEVICE_ADD("outlatch", LS259, 0) // 9L/M - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, starwars_state, coin1_counter_w)) // Coin counter 1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, starwars_state, coin2_counter_w)) // Coin counter 2 - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT // LED 3 - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // LED 2 - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(MEMBANK("bank1")) // bank switch - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, starwars_state, prng_reset_w)) // reset PRNG - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // LED 1 - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, starwars_state, recall_w)) // NVRAM array recall + ls259_device &outlatch(LS259(config, "outlatch")); // 9L/M + outlatch.q_out_cb<0>().set(FUNC(starwars_state::coin1_counter_w)); // Coin counter 1 + outlatch.q_out_cb<1>().set(FUNC(starwars_state::coin2_counter_w)); // Coin counter 2 + outlatch.q_out_cb<2>().set_output("led2").invert(); // LED 3 + outlatch.q_out_cb<3>().set_output("led1").invert(); // LED 2 + outlatch.q_out_cb<4>().set_membank("bank1"); // bank switch + outlatch.q_out_cb<5>().set(FUNC(starwars_state::prng_reset_w)); // reset PRNG + outlatch.q_out_cb<6>().set_output("led0").invert(); // LED 1 + outlatch.q_out_cb<7>().set(FUNC(starwars_state::recall_w)); // NVRAM array recall /* video hardware */ MCFG_VECTOR_ADD("vector") @@ -349,41 +349,32 @@ MACHINE_CONFIG_START(starwars_state::starwars) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("pokey1", POKEY, MASTER_CLOCK / 8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + POKEY(config, m_pokey[0], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.20); + POKEY(config, m_pokey[1], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.20); + POKEY(config, m_pokey[2], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.20); + POKEY(config, m_pokey[3], MASTER_CLOCK / 8).add_route(ALL_OUTPUTS, "mono", 0.20); - MCFG_DEVICE_ADD("pokey2", POKEY, MASTER_CLOCK / 8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + TMS5220(config, m_tms, MASTER_CLOCK/2/9).add_route(ALL_OUTPUTS, "mono", 0.50); - MCFG_DEVICE_ADD("pokey3", POKEY, MASTER_CLOCK / 8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set(m_riot, FUNC(riot6532_device::pa7_w)); + m_soundlatch->data_pending_callback().append(FUNC(starwars_state::boost_interleave_hack)); - MCFG_DEVICE_ADD("pokey4", POKEY, MASTER_CLOCK / 8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.20) - - MCFG_DEVICE_ADD("tms", TMS5220, MASTER_CLOCK/2/9) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) - - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(WRITELINE("riot", riot6532_device, pa7_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, starwars_state, boost_interleave_hack)) - - MCFG_GENERIC_LATCH_8_ADD("mainlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(WRITELINE("riot", riot6532_device, pa6_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, starwars_state, boost_interleave_hack)) + GENERIC_LATCH_8(config, m_mainlatch); + m_mainlatch->data_pending_callback().set(m_riot, FUNC(riot6532_device::pa6_w)); + m_mainlatch->data_pending_callback().append(FUNC(starwars_state::boost_interleave_hack)); MACHINE_CONFIG_END MACHINE_CONFIG_START(starwars_state::esb) starwars(config); + MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_PROGRAM_MAP(esb_main_map) MCFG_DEVICE_ADD("slapstic", SLAPSTIC, 101, false) - MCFG_DEVICE_MODIFY("outlatch") - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(MEMBANK("bank1")) - MCFG_DEVCB_CHAIN_OUTPUT(MEMBANK("bank2")) + subdevice("outlatch")->q_out_cb<4>().append_membank("bank2"); MACHINE_CONFIG_END diff --git a/src/mame/drivers/studio2.cpp b/src/mame/drivers/studio2.cpp index c3c87676086..e8a7abd6705 100644 --- a/src/mame/drivers/studio2.cpp +++ b/src/mame/drivers/studio2.cpp @@ -652,7 +652,7 @@ MACHINE_CONFIG_START(studio2_state::studio2) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, 1760000) /* the real clock is derived from an oscillator circuit */ MCFG_DEVICE_PROGRAM_MAP(studio2_map) MCFG_DEVICE_IO_MAP(studio2_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, studio2_state, clear_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, studio2_state, ef3_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, studio2_state, ef4_r)) @@ -679,7 +679,7 @@ MACHINE_CONFIG_START(visicom_state::visicom) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(3'579'545)/2) MCFG_DEVICE_PROGRAM_MAP(visicom_map) MCFG_DEVICE_IO_MAP(visicom_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, visicom_state, clear_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, visicom_state, ef3_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, visicom_state, ef4_r)) @@ -711,7 +711,7 @@ MACHINE_CONFIG_START(mpt02_state::mpt02) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, CDP1864_CLOCK) MCFG_DEVICE_PROGRAM_MAP(mpt02_map) MCFG_DEVICE_IO_MAP(mpt02_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, mpt02_state, clear_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, mpt02_state, ef3_r)) MCFG_COSMAC_EF4_CALLBACK(READLINE(*this, mpt02_state, ef4_r)) @@ -727,7 +727,7 @@ MACHINE_CONFIG_START(mpt02_state::mpt02) MCFG_DEVICE_ADD("beeper", BEEP, 300) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, mpt02_state, rdata_r), READLINE(*this, mpt02_state, bdata_r), READLINE(*this, mpt02_state, gdata_r)) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, CDP1864_CLOCK, CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, mpt02_state, rdata_r), READLINE(*this, mpt02_state, bdata_r), READLINE(*this, mpt02_state, gdata_r)) MCFG_CDP1864_CHROMINANCE(RES_K(4.7), RES_K(8.2), RES_K(4.7), RES_K(22)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/subs.cpp b/src/mame/drivers/subs.cpp index d4fde819fbd..335b71b7293 100644 --- a/src/mame/drivers/subs.cpp +++ b/src/mame/drivers/subs.cpp @@ -212,16 +212,16 @@ MACHINE_CONFIG_START(subs_state::subs) DISCRETE(config, m_discrete, subs_discrete).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); - MCFG_DEVICE_ADD("latch", LS259, 0) // C9 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led0")) MCFG_DEVCB_INVERT // START LAMP 1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // START LAMP 2 - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) + ls259_device &latch(LS259(config, "latch")); // C9 + latch.q_out_cb<0>().set_output("led0").invert(); // START LAMP 1 + latch.q_out_cb<1>().set_output("led1").invert(); // START LAMP 2 + latch.q_out_cb<2>().set(m_discrete, FUNC(discrete_device::write_line)); + latch.q_out_cb<3>().set(m_discrete, FUNC(discrete_device::write_line)); // Schematics show crash and explode reversed. But this is proper. - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, subs_state, invert1_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, subs_state, invert2_w)) + latch.q_out_cb<4>().set(m_discrete, FUNC(discrete_device::write_line)); + latch.q_out_cb<5>().set(m_discrete, FUNC(discrete_device::write_line)); + latch.q_out_cb<6>().set(FUNC(subs_state::invert1_w)); + latch.q_out_cb<7>().set(FUNC(subs_state::invert2_w)); MACHINE_CONFIG_END diff --git a/src/mame/drivers/sun1.cpp b/src/mame/drivers/sun1.cpp index 231b50e43d7..4df00473f42 100644 --- a/src/mame/drivers/sun1.cpp +++ b/src/mame/drivers/sun1.cpp @@ -114,40 +114,41 @@ void sun1_state::machine_reset() } -MACHINE_CONFIG_START(sun1_state::sun1) +void sun1_state::sun1(machine_config &config) +{ /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000) / 2) - MCFG_DEVICE_PROGRAM_MAP(sun1_mem) - - MCFG_DEVICE_ADD("timer", AM9513, XTAL(16'000'000) / 4) - MCFG_AM9513_FOUT_CALLBACK(WRITELINE("timer", am9513_device, gate1_w)) - MCFG_AM9513_OUT1_CALLBACK(NOOP) // Watchdog; generates BERR/Reset - MCFG_AM9513_OUT2_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_6)) // User timer - MCFG_AM9513_OUT3_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_7)) // Refresh timer (2 ms) - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("iouart", upd7201_new_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("iouart", upd7201_new_device, txca_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("iouart", upd7201_new_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("iouart", upd7201_new_device, txcb_w)) - - MCFG_DEVICE_ADD("iouart", UPD7201_NEW, XTAL(16'000'000) / 4) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs232a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs232b", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs232b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs232b", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", M68K_IRQ_5)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("iouart", upd7201_new_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("iouart", upd7201_new_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("iouart", upd7201_new_device, dcda_w)) - - MCFG_DEVICE_ADD("rs232b", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("iouart", upd7201_new_device, rxb_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("iouart", upd7201_new_device, ctsb_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("iouart", upd7201_new_device, dcdb_w)) -MACHINE_CONFIG_END + M68000(config, m_maincpu, 16_MHz_XTAL / 2); + m_maincpu->set_addrmap(AS_PROGRAM, &sun1_state::sun1_mem); + + am9513_device &timer(AM9513(config, "timer", 16_MHz_XTAL / 4)); + timer.fout_cb().set("timer", FUNC(am9513_device::gate1_w)); + timer.out1_cb().set_nop(); // Watchdog; generates BERR/Reset + timer.out2_cb().set_inputline(m_maincpu, M68K_IRQ_6); // User timer + timer.out3_cb().set_inputline(m_maincpu, M68K_IRQ_7); // Refresh timer (2 ms) + timer.out4_cb().set(m_iouart, FUNC(upd7201_new_device::rxca_w)); + timer.out4_cb().append(m_iouart, FUNC(upd7201_new_device::txca_w)); + timer.out5_cb().set(m_iouart, FUNC(upd7201_new_device::rxcb_w)); + timer.out5_cb().append(m_iouart, FUNC(upd7201_new_device::txcb_w)); + + UPD7201_NEW(config, m_iouart, 16_MHz_XTAL / 4); + m_iouart->out_txda_callback().set("rs232a", FUNC(rs232_port_device::write_txd)); + m_iouart->out_dtra_callback().set("rs232a", FUNC(rs232_port_device::write_dtr)); + m_iouart->out_rtsa_callback().set("rs232a", FUNC(rs232_port_device::write_rts)); + m_iouart->out_txdb_callback().set("rs232b", FUNC(rs232_port_device::write_txd)); + m_iouart->out_dtrb_callback().set("rs232b", FUNC(rs232_port_device::write_dtr)); + m_iouart->out_rtsb_callback().set("rs232b", FUNC(rs232_port_device::write_rts)); + m_iouart->out_int_callback().set_inputline(m_maincpu, M68K_IRQ_5); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal")); + rs232a.rxd_handler().set(m_iouart, FUNC(upd7201_new_device::rxa_w)); + rs232a.cts_handler().set(m_iouart, FUNC(upd7201_new_device::ctsa_w)); + rs232a.dcd_handler().set(m_iouart, FUNC(upd7201_new_device::dcda_w)); + + rs232_port_device &rs232b(RS232_PORT(config, "rs232b", default_rs232_devices, nullptr)); + rs232b.rxd_handler().set(m_iouart, FUNC(upd7201_new_device::rxb_w)); + rs232b.cts_handler().set(m_iouart, FUNC(upd7201_new_device::ctsb_w)); + rs232b.dcd_handler().set(m_iouart, FUNC(upd7201_new_device::dcdb_w)); +} /* ROM definition */ ROM_START( sun1 ) diff --git a/src/mame/drivers/super6.cpp b/src/mame/drivers/super6.cpp index ab79c1cce0a..69a284b8ce5 100644 --- a/src/mame/drivers/super6.cpp +++ b/src/mame/drivers/super6.cpp @@ -454,18 +454,18 @@ void super6_state::machine_reset() MACHINE_CONFIG_START(super6_state::super6) // basic machine hardware - MCFG_DEVICE_ADD(Z80_TAG, Z80, 24_MHz_XTAL / 4) + MCFG_DEVICE_ADD(m_maincpu, Z80, 24_MHz_XTAL / 4) MCFG_DEVICE_PROGRAM_MAP(super6_mem) MCFG_DEVICE_IO_MAP(super6_io) MCFG_Z80_DAISY_CHAIN(super6_daisy_chain) // devices - MCFG_DEVICE_ADD(Z80CTC_TAG, Z80CTC, 24_MHz_XTAL / 4) + MCFG_DEVICE_ADD(m_ctc, Z80CTC, 24_MHz_XTAL / 4) MCFG_Z80CTC_INTR_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_TIMER_DRIVER_ADD_PERIODIC("ctc", super6_state, ctc_tick, attotime::from_hz(24_MHz_XTAL / 16)) - MCFG_DEVICE_ADD(Z80DMA_TAG, Z80DMA, 24_MHz_XTAL / 6) + MCFG_DEVICE_ADD(m_dma, Z80DMA, 24_MHz_XTAL / 6) MCFG_Z80DMA_OUT_BUSREQ_CB(INPUTLINE(Z80_TAG, INPUT_LINE_HALT)) MCFG_Z80DMA_OUT_INT_CB(WRITELINE(Z80CTC_TAG, z80ctc_device, trg2)) MCFG_Z80DMA_IN_MREQ_CB(READ8(*this, super6_state, memory_read_byte)) @@ -473,17 +473,17 @@ MACHINE_CONFIG_START(super6_state::super6) MCFG_Z80DMA_IN_IORQ_CB(READ8(*this, super6_state, io_read_byte)) MCFG_Z80DMA_OUT_IORQ_CB(WRITE8(*this, super6_state, io_write_byte)) - MCFG_DEVICE_ADD(Z80PIO_TAG, Z80PIO, 24_MHz_XTAL / 4) + MCFG_DEVICE_ADD(m_pio, Z80PIO, 24_MHz_XTAL / 4) MCFG_Z80PIO_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_DEVICE_ADD(WD2793_TAG, WD2793, 1000000) MCFG_WD_FDC_INTRQ_CALLBACK(WRITELINE(*this, super6_state, fdc_intrq_w)) MCFG_WD_FDC_DRQ_CALLBACK(WRITELINE(*this, super6_state, fdc_drq_w)) - MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":0", super6_floppies, "525dd", floppy_image_device::default_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD(WD2793_TAG":1", super6_floppies, nullptr, floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy0, super6_floppies, "525dd", floppy_image_device::default_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_floppy1, super6_floppies, nullptr, floppy_image_device::default_floppy_formats) - MCFG_DEVICE_ADD(Z80DART_TAG, Z80DART, 24_MHz_XTAL / 4) + MCFG_DEVICE_ADD(m_dart, Z80DART, 24_MHz_XTAL / 4) MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) MCFG_Z80DART_OUT_DTRA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) MCFG_Z80DART_OUT_RTSA_CB(WRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) @@ -493,17 +493,17 @@ MACHINE_CONFIG_START(super6_state::super6) MCFG_Z80DART_OUT_INT_CB(INPUTLINE(Z80_TAG, INPUT_LINE_IRQ0)) MCFG_DEVICE_ADD(RS232_A_TAG, RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxa_w)) + MCFG_RS232_RXD_HANDLER(WRITELINE(m_dart, z80dart_device, rxa_w)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) MCFG_DEVICE_ADD(RS232_B_TAG, RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxb_w)) + MCFG_RS232_RXD_HANDLER(WRITELINE(m_dart, z80dart_device, rxb_w)) - MCFG_DEVICE_ADD(BR1945_TAG, COM8116, 5.0688_MHz_XTAL) - MCFG_COM8116_FR_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_TAG, z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80CTC_TAG, z80ctc_device, trg1)) - MCFG_COM8116_FT_HANDLER(WRITELINE(Z80DART_TAG, z80dart_device, rxtxcb_w)) + COM8116(config, m_brg, 5.0688_MHz_XTAL); + m_brg->fr_handler().set(m_dart, FUNC(z80dart_device::txca_w)); + m_brg->fr_handler().append(m_dart, FUNC(z80dart_device::rxca_w)); + m_brg->fr_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); + m_brg->ft_handler().set(m_dart, FUNC(z80dart_device::rxtxcb_w)); // internal ram MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mame/drivers/superchs.cpp b/src/mame/drivers/superchs.cpp index 3afd6b60ed1..3633faf9df5 100644 --- a/src/mame/drivers/superchs.cpp +++ b/src/mame/drivers/superchs.cpp @@ -244,14 +244,14 @@ MACHINE_CONFIG_START(superchs_state::superchs) MCFG_ADC0808_IN1_CB(IOPORT("ACCEL")) MCFG_ADC0808_IN2_CB(READ8(*this, superchs_state, volume_r)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_1_CB(IOPORT("COINS")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("SWITCHES")) - MCFG_TC0510NIO_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, superchs_state, coin_word_w)) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_1_callback().set_ioport("COINS"); + tc0510nio.read_2_callback().set_ioport("SWITCHES"); + tc0510nio.read_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + tc0510nio.write_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(superchs_state::coin_word_w)); // there are 'vibration' control bits somewhere! /* video hardware */ diff --git a/src/mame/drivers/superslave.cpp b/src/mame/drivers/superslave.cpp index 9e88b3f5377..d1ce0ca6dee 100644 --- a/src/mame/drivers/superslave.cpp +++ b/src/mame/drivers/superslave.cpp @@ -363,7 +363,7 @@ void superslave_state::machine_reset() MACHINE_CONFIG_START(superslave_state::superslave) // basic machine hardware - MCFG_DEVICE_ADD(Z80_TAG, Z80, XTAL(8'000'000)/2) + MCFG_DEVICE_ADD(m_maincpu, Z80, XTAL(8'000'000)/2) MCFG_DEVICE_PROGRAM_MAP(superslave_mem) MCFG_DEVICE_IO_MAP(superslave_io) MCFG_Z80_DAISY_CHAIN(superslave_daisy_chain) @@ -414,13 +414,13 @@ MACHINE_CONFIG_START(superslave_state::superslave) MCFG_RS232_DCD_HANDLER(WRITELINE(Z80DART_1_TAG, z80dart_device, dcdb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE(Z80DART_1_TAG, z80dart_device, ctsb_w)) - MCFG_DEVICE_ADD(BR1941_TAG, COM8116, XTAL(5'068'800)) - MCFG_COM8116_FR_HANDLER(WRITELINE(Z80DART_0_TAG, z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_0_TAG, z80dart_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_1_TAG, z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_1_TAG, z80dart_device, rxca_w)) - MCFG_COM8116_FT_HANDLER(WRITELINE(Z80DART_0_TAG, z80dart_device, rxtxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_1_TAG, z80dart_device, rxtxcb_w)) + COM8116(config, m_dbrg, XTAL(5'068'800)); + m_dbrg->fr_handler().set(Z80DART_0_TAG, FUNC(z80dart_device::txca_w)); + m_dbrg->fr_handler().append(Z80DART_0_TAG, FUNC(z80dart_device::rxca_w)); + m_dbrg->fr_handler().append(Z80DART_1_TAG, FUNC(z80dart_device::txca_w)); + m_dbrg->fr_handler().append(Z80DART_1_TAG, FUNC(z80dart_device::rxca_w)); + m_dbrg->ft_handler().set(Z80DART_0_TAG, FUNC(z80dart_device::rxtxcb_w)); + m_dbrg->ft_handler().append(Z80DART_1_TAG, FUNC(z80dart_device::rxtxcb_w)); // internal ram MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mame/drivers/suprloco.cpp b/src/mame/drivers/suprloco.cpp index 9ce498e6f05..9c801928411 100644 --- a/src/mame/drivers/suprloco.cpp +++ b/src/mame/drivers/suprloco.cpp @@ -183,11 +183,11 @@ MACHINE_CONFIG_START(suprloco_state::suprloco) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(suprloco_state, irq0_line_hold, 4*60) /* NMIs are caused by the main CPU */ - MCFG_DEVICE_ADD("ppi", I8255A, 0) - MCFG_I8255_OUT_PORTB_CB(WRITE8(*this, suprloco_state, control_w)) - MCFG_I8255_TRISTATE_PORTB_CB(CONSTANT(0)) - MCFG_I8255_OUT_PORTC_CB(OUTPUT("lamp0")) MCFG_DEVCB_BIT(0) MCFG_DEVCB_INVERT // set by 8255 bit mode when no credits inserted - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("audiocpu", INPUT_LINE_NMI)) MCFG_DEVCB_BIT(7) MCFG_DEVCB_INVERT + I8255A(config, m_ppi, 0); + m_ppi->out_pb_callback().set(FUNC(suprloco_state::control_w)); + m_ppi->tri_pb_callback().set_constant(0); + m_ppi->out_pc_callback().set_output("lamp0").bit(0).invert(); // set by 8255 bit mode when no credits inserted + m_ppi->out_pc_callback().append_inputline(m_audiocpu, INPUT_LINE_NMI).bit(7).invert(); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/suprslam.cpp b/src/mame/drivers/suprslam.cpp index b91461e27a3..3348666e239 100644 --- a/src/mame/drivers/suprslam.cpp +++ b/src/mame/drivers/suprslam.cpp @@ -278,13 +278,13 @@ MACHINE_CONFIG_START(suprslam_state::suprslam) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_IO_MAP(sound_io_map) - MCFG_DEVICE_ADD("io", VS9209, 0) - MCFG_VS9209_IN_PORTA_CB(IOPORT("P1")) - MCFG_VS9209_IN_PORTB_CB(IOPORT("P2")) - MCFG_VS9209_IN_PORTC_CB(IOPORT("SYSTEM")) - MCFG_VS9209_IN_PORTD_CB(IOPORT("DSW1")) - MCFG_VS9209_IN_PORTE_CB(IOPORT("DSW2")) - MCFG_VS9209_OUT_PORTG_CB(WRITE8(*this, suprslam_state, spr_ctrl_w)) + vs9209_device &io(VS9209(config, "io", 0)); + io.porta_input_cb().set_ioport("P1"); + io.portb_input_cb().set_ioport("P2"); + io.portc_input_cb().set_ioport("SYSTEM"); + io.portd_input_cb().set_ioport("DSW1"); + io.porte_input_cb().set_ioport("DSW2"); + io.porth_output_cb().set(FUNC(suprslam_state::spr_ctrl_w)); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_suprslam) diff --git a/src/mame/drivers/supstarf.cpp b/src/mame/drivers/supstarf.cpp index 7f27eaa3e34..194f8846d35 100644 --- a/src/mame/drivers/supstarf.cpp +++ b/src/mame/drivers/supstarf.cpp @@ -188,11 +188,11 @@ MACHINE_CONFIG_START(supstarf_state::supstarf) MCFG_MCS48_PORT_T1_IN_CB(READLINE(*this, supstarf_state, phase_detect_r)) MCFG_DEVICE_ADD("soundlatch1", I8212, 0) - MCFG_I8212_MD_CALLBACK(GND) + MCFG_I8212_MD_CALLBACK(CONSTANT(0)) MCFG_I8212_INT_CALLBACK(INPUTLINE("maincpu", I8085_RST55_LINE)) MCFG_DEVICE_ADD("soundlatch2", I8212, 0) - MCFG_I8212_MD_CALLBACK(GND) + MCFG_I8212_MD_CALLBACK(CONSTANT(0)) MCFG_I8212_INT_CALLBACK(INPUTLINE("soundcpu", MCS48_INPUT_IRQ)) //MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("maincpu", I8085_READY_LINE)) diff --git a/src/mame/drivers/swtpc.cpp b/src/mame/drivers/swtpc.cpp index 6d6db26618f..b620f32c6e9 100644 --- a/src/mame/drivers/swtpc.cpp +++ b/src/mame/drivers/swtpc.cpp @@ -102,47 +102,47 @@ MACHINE_CONFIG_START(swtpc_state::swtpc) MCFG_DEVICE_ADD("maincpu", M6800, XTAL(1'843'200) / 2) MCFG_DEVICE_PROGRAM_MAP(mem_map) - MCFG_DEVICE_ADD("brg", MC14411, XTAL(1'843'200)) - MCFG_MC14411_F7_CB(WRITELINE("io0", ss50_interface_port_device, f600_1200_w)) // 1200b - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io1", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io2", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io3", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io4", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io5", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io6", ss50_interface_port_device, f600_1200_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io7", ss50_interface_port_device, f600_1200_w)) - MCFG_MC14411_F8_CB(WRITELINE("io0", ss50_interface_port_device, f600_4800_w)) // 600b - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io1", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io2", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io3", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io4", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io5", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io6", ss50_interface_port_device, f600_4800_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io7", ss50_interface_port_device, f600_4800_w)) - MCFG_MC14411_F9_CB(WRITELINE("io0", ss50_interface_port_device, f300_w)) // 300b - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io1", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io2", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io3", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io4", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io5", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io6", ss50_interface_port_device, f300_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io7", ss50_interface_port_device, f300_w)) - MCFG_MC14411_F11_CB(WRITELINE("io0", ss50_interface_port_device, f150_9600_w)) // 150b - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io1", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io2", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io3", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io4", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io5", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io6", ss50_interface_port_device, f150_9600_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io7", ss50_interface_port_device, f150_9600_w)) - MCFG_MC14411_F13_CB(WRITELINE("io0", ss50_interface_port_device, f110_w)) // 110b - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io1", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io2", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io3", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io4", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io5", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io6", ss50_interface_port_device, f110_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("io7", ss50_interface_port_device, f110_w)) + MC14411(config, m_brg, XTAL(1'843'200)); + m_brg->out_f7_cb().set("io0", FUNC(ss50_interface_port_device::f600_1200_w)); // 1200b + m_brg->out_f7_cb().append("io1", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io2", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io3", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io4", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io5", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io6", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f7_cb().append("io7", FUNC(ss50_interface_port_device::f600_1200_w)); + m_brg->out_f8_cb().set("io0", FUNC(ss50_interface_port_device::f600_4800_w)); // 600b + m_brg->out_f8_cb().append("io1", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io2", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io3", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io4", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io5", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io6", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f8_cb().append("io7", FUNC(ss50_interface_port_device::f600_4800_w)); + m_brg->out_f9_cb().set("io0", FUNC(ss50_interface_port_device::f300_w)); // 300b + m_brg->out_f9_cb().append("io1", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io2", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io3", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io4", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io5", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io6", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f9_cb().append("io7", FUNC(ss50_interface_port_device::f300_w)); + m_brg->out_f11_cb().set("io0", FUNC(ss50_interface_port_device::f150_9600_w)); // 150b + m_brg->out_f11_cb().append("io1", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io2", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io3", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io4", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io5", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io6", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f11_cb().append("io7", FUNC(ss50_interface_port_device::f150_9600_w)); + m_brg->out_f13_cb().set("io0", FUNC(ss50_interface_port_device::f110_w)); // 110b + m_brg->out_f13_cb().append("io1", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io2", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io3", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io4", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io5", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io6", FUNC(ss50_interface_port_device::f110_w)); + m_brg->out_f13_cb().append("io7", FUNC(ss50_interface_port_device::f110_w)); MCFG_SS50_INTERFACE_PORT_ADD("io0", default_2rs_devices, nullptr) MCFG_SS50_INTERFACE_IRQ_CALLBACK(WRITELINE("mainirq", input_merger_device, in_w<0>)) diff --git a/src/mame/drivers/swtpc09.cpp b/src/mame/drivers/swtpc09.cpp index 00435181997..48248cd5f0e 100644 --- a/src/mame/drivers/swtpc09.cpp +++ b/src/mame/drivers/swtpc09.cpp @@ -191,14 +191,14 @@ MACHINE_CONFIG_START(swtpc09_state::swtpc09_base) MCFG_RS232_RXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia", ACIA6850, 0) - MCFG_ACIA6850_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_ACIA6850_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - MCFG_ACIA6850_IRQ_HANDLER(WRITELINE(*this, swtpc09_state, acia_interrupt)) - - MCFG_DEVICE_ADD("brg", MC14411, 1.8432_MHz_XTAL) - MCFG_MC14411_F1_CB(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + ACIA6850(config, m_acia, 0); + m_acia->txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + m_acia->rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + m_acia->irq_handler().set(FUNC(swtpc09_state::acia_interrupt)); + + MC14411(config, m_brg, 1.8432_MHz_XTAL); + m_brg->out_f1_cb().set(m_acia, FUNC(acia6850_device::write_txc)); + m_brg->out_f1_cb().append(m_acia, FUNC(acia6850_device::write_rxc)); MCFG_DEVICE_ADD("fdc", FD1793, 1_MHz_XTAL) MCFG_FLOPPY_DRIVE_ADD("fdc:0", swtpc09_floppies, "dd", swtpc09_state::floppy_formats) diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp index ac0c29d20cd..2b2bba65452 100644 --- a/src/mame/drivers/sys9002.cpp +++ b/src/mame/drivers/sys9002.cpp @@ -145,11 +145,11 @@ MACHINE_CONFIG_START(sys9002_state::sys9002) MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_UPDATE_ROW_CB(sys9002_state, crtc_update_row) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 614400) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 614400)); + uart_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart1", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/systec.cpp b/src/mame/drivers/systec.cpp index 45e4ccca455..1c5122376f4 100644 --- a/src/mame/drivers/systec.cpp +++ b/src/mame/drivers/systec.cpp @@ -90,9 +90,9 @@ MACHINE_CONFIG_START(systec_state::systec) MCFG_DEVICE_PROGRAM_MAP(systec_mem) MCFG_DEVICE_IO_MAP(systec_io) - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxca_w)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("sio", FUNC(z80sio_device::txca_w)); + uart_clock.signal_handler().append("sio", FUNC(z80sio_device::rxca_w)); /* Devices */ MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(4'000'000)) diff --git a/src/mame/drivers/taito_b.cpp b/src/mame/drivers/taito_b.cpp index 54e5cfe0af4..d6a56729cac 100644 --- a/src/mame/drivers/taito_b.cpp +++ b/src/mame/drivers/taito_b.cpp @@ -239,7 +239,7 @@ WRITE16_MEMBER(taitob_state::gain_control_w) } } -INPUT_CHANGED_MEMBER(taitob_state::realpunc_sensor) +INPUT_CHANGED_MEMBER(taitob_c_state::realpunc_sensor) { m_maincpu->set_input_line(4, HOLD_LINE); } @@ -319,7 +319,7 @@ WRITE16_MEMBER(taitob_state::spacedxo_tc0220ioc_w) } } -WRITE16_MEMBER(taitob_state::realpunc_output_w) +WRITE16_MEMBER(taitob_c_state::realpunc_output_w) { /* 15 = Camera Enable? @@ -561,19 +561,19 @@ void taitob_state::sbm_map(address_map &map) map(0x900000, 0x97ffff).m(m_tc0180vcu, FUNC(tc0180vcu_device::tc0180vcu_memrw)); } -void taitob_state::realpunc_map(address_map &map) +void taitob_c_state::realpunc_map(address_map &map) { map(0x000000, 0x0fffff).rom(); map(0x100000, 0x10ffff).ram(); map(0x110000, 0x12ffff).ram(); map(0x130000, 0x13ffff).ram(); // Check me map(0x180000, 0x18000f).rw(m_tc0510nio, FUNC(tc0510nio_device::halfword_wordswap_r), FUNC(tc0510nio_device::halfword_wordswap_w)); - map(0x184000, 0x184001).w(FUNC(taitob_state::realpunc_video_ctrl_w)); + map(0x184000, 0x184001).w(FUNC(taitob_c_state::realpunc_video_ctrl_w)); map(0x188000, 0x188001).nopr(); map(0x188000, 0x188000).w("tc0140syt", FUNC(tc0140syt_device::master_port_w)); map(0x188002, 0x188003).nopr(); map(0x188002, 0x188002).w("tc0140syt", FUNC(tc0140syt_device::master_comm_w)); - map(0x18c000, 0x18c001).w(FUNC(taitob_state::realpunc_output_w)); + map(0x18c000, 0x18c001).w(FUNC(taitob_c_state::realpunc_output_w)); map(0x200000, 0x27ffff).m(m_tc0180vcu, FUNC(tc0180vcu_device::tc0180vcu_memrw)); map(0x280000, 0x281fff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); map(0x300000, 0x300001).rw("hd63484", FUNC(hd63484_device::status16_r), FUNC(hd63484_device::address16_w)); @@ -583,7 +583,7 @@ void taitob_state::realpunc_map(address_map &map) map(0x320002, 0x320002).w("tc0140syt", FUNC(tc0140syt_device::master_comm_w)); } -void taitob_state::realpunc_hd63484_map(address_map &map) +void taitob_c_state::realpunc_hd63484_map(address_map &map) { map(0x00000, 0x7ffff).ram(); } @@ -1701,9 +1701,9 @@ static INPUT_PORTS_START( realpunc ) PORT_BIT( 0x02, IP_ACTIVE_LOW,IPT_UNKNOWN ) PORT_BIT( 0x04, IP_ACTIVE_LOW,IPT_UNKNOWN ) PORT_BIT( 0x08, IP_ACTIVE_LOW,IPT_UNKNOWN ) - PORT_BIT( 0x10, IP_ACTIVE_LOW,IPT_BUTTON2 ) PORT_NAME("Pad Photosensor 1 (N)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_state,realpunc_sensor, 0) - PORT_BIT( 0x20, IP_ACTIVE_LOW,IPT_BUTTON3 ) PORT_NAME("Pad Photosensor 2 (U)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_state,realpunc_sensor, 0) - PORT_BIT( 0x40, IP_ACTIVE_LOW,IPT_BUTTON4 ) PORT_NAME("Pad Photosensor 3 (D)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_state,realpunc_sensor, 0) + PORT_BIT( 0x10, IP_ACTIVE_LOW,IPT_BUTTON2 ) PORT_NAME("Pad Photosensor 1 (N)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_c_state,realpunc_sensor, 0) + PORT_BIT( 0x20, IP_ACTIVE_LOW,IPT_BUTTON3 ) PORT_NAME("Pad Photosensor 2 (U)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_c_state,realpunc_sensor, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW,IPT_BUTTON4 ) PORT_NAME("Pad Photosensor 3 (D)") PORT_CHANGED_MEMBER(DEVICE_SELF, taitob_c_state,realpunc_sensor, 0) PORT_BIT( 0x80, IP_ACTIVE_LOW,IPT_UNKNOWN ) INPUT_PORTS_END @@ -1757,13 +1757,13 @@ MACHINE_CONFIG_START(taitob_state::rastsag2) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1815,13 +1815,13 @@ MACHINE_CONFIG_START(taitob_state::masterw) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + tc0040ioc_device &tc0040ioc(TC0040IOC(config, "tc0040ioc", 0)); + tc0040ioc.read_0_callback().set_ioport("DSWA"); + tc0040ioc.read_1_callback().set_ioport("DSWB"); + tc0040ioc.read_2_callback().set_ioport("IN0"); + tc0040ioc.read_3_callback().set_ioport("IN1"); + tc0040ioc.write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + tc0040ioc.read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1850,13 +1850,13 @@ MACHINE_CONFIG_START(taitob_state::masterw) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2203, 24_MHz_XTAL / 8) /* 3 MHz */ - MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_AY8910_PORT_A_WRITE_CB(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.25) - MCFG_SOUND_ROUTE(3, "mono", 0.80) + ym2203_device &ymsnd(YM2203(config, m_ym, 24_MHz_XTAL / 8)); /* 3 MHz */ + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_a_write_callback().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.25); + ymsnd.add_route(1, "mono", 0.25); + ymsnd.add_route(2, "mono", 0.25); + ymsnd.add_route(3, "mono", 0.80); MCFG_DEVICE_ADD("ciu", PC060HA, 0) MCFG_PC060HA_MASTER_CPU("maincpu") @@ -1894,13 +1894,13 @@ MACHINE_CONFIG_START(taitob_state::ashura) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1952,13 +1952,13 @@ MACHINE_CONFIG_START(taitob_state::crimec) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2011,13 +2011,13 @@ MACHINE_CONFIG_START(taitob_state::hitice) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2047,13 +2047,13 @@ MACHINE_CONFIG_START(taitob_state::hitice) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2203, 24_MHz_XTAL / 8) /* 3 MHz */ - MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_AY8910_PORT_A_WRITE_CB(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.25) - MCFG_SOUND_ROUTE(3, "mono", 0.80) + ym2203_device &ymsnd(YM2203(config, m_ym, 24_MHz_XTAL / 8)); /* 3 MHz */ + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_a_write_callback().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.25); + ymsnd.add_route(1, "mono", 0.25); + ymsnd.add_route(2, "mono", 0.25); + ymsnd.add_route(3, "mono", 0.80); MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) // clock frequency & pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -2075,13 +2075,13 @@ MACHINE_CONFIG_START(taitob_state::rambo3p) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2134,13 +2134,13 @@ MACHINE_CONFIG_START(taitob_state::rambo3) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2195,13 +2195,13 @@ MACHINE_CONFIG_START(taitob_state::pbobble) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_0_CB(IOPORT("SERVICE")) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COIN")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("START")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("P1_P2_A")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("P1_P2_B")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_0_callback().set_ioport("SERVICE"); + m_tc0640fio->read_1_callback().set_ioport("COIN"); + m_tc0640fio->read_2_callback().set_ioport("START"); + m_tc0640fio->read_3_callback().set_ioport("P1_P2_A"); + m_tc0640fio->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0640fio->read_7_callback().set_ioport("P1_P2_B"); MCFG_DEVICE_ADD("mb87078", MB87078, 0) MCFG_MB87078_GAIN_CHANGED_CB(WRITE8(*this, taitob_state, mb87078_gain_changed)) @@ -2259,13 +2259,13 @@ MACHINE_CONFIG_START(taitob_state::spacedx) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_0_CB(IOPORT("SERVICE")) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COIN")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("START")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("P1_P2_A")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("P1_P2_B")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_0_callback().set_ioport("SERVICE"); + m_tc0640fio->read_1_callback().set_ioport("COIN"); + m_tc0640fio->read_2_callback().set_ioport("START"); + m_tc0640fio->read_3_callback().set_ioport("P1_P2_A"); + m_tc0640fio->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0640fio->read_7_callback().set_ioport("P1_P2_B"); MCFG_DEVICE_ADD("mb87078", MB87078, 0) MCFG_MB87078_GAIN_CHANGED_CB(WRITE8(*this, taitob_state, mb87078_gain_changed)) @@ -2320,13 +2320,13 @@ MACHINE_CONFIG_START(taitob_state::spacedxo) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2381,13 +2381,13 @@ MACHINE_CONFIG_START(taitob_state::qzshowby) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_0_CB(IOPORT("SERVICE")) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COIN")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("START")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("P1_P2_A")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("P1_P2_B")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_0_callback().set_ioport("SERVICE"); + m_tc0640fio->read_1_callback().set_ioport("COIN"); + m_tc0640fio->read_2_callback().set_ioport("START"); + m_tc0640fio->read_3_callback().set_ioport("P1_P2_A"); + m_tc0640fio->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0640fio->read_7_callback().set_ioport("P1_P2_B"); MCFG_DEVICE_ADD("mb87078", MB87078, 0) MCFG_MB87078_GAIN_CHANGED_CB(WRITE8(*this, taitob_state, mb87078_gain_changed)) @@ -2442,13 +2442,13 @@ MACHINE_CONFIG_START(taitob_state::viofight) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2477,13 +2477,13 @@ MACHINE_CONFIG_START(taitob_state::viofight) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2203, 24_MHz_XTAL / 8) /* 3 MHz */ - MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_AY8910_PORT_A_WRITE_CB(MEMBANK("audiobank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "mono", 0.25) - MCFG_SOUND_ROUTE(1, "mono", 0.25) - MCFG_SOUND_ROUTE(2, "mono", 0.25) - MCFG_SOUND_ROUTE(3, "mono", 0.80) + ym2203_device &ymsnd(YM2203(config, m_ym, 24_MHz_XTAL / 8)); /* 3 MHz */ + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_a_write_callback().set_membank(m_audiobank).mask(0x03); + ymsnd.add_route(0, "mono", 0.25); + ymsnd.add_route(1, "mono", 0.25); + ymsnd.add_route(2, "mono", 0.25); + ymsnd.add_route(3, "mono", 0.80); MCFG_DEVICE_ADD("oki", OKIM6295, 4.224_MHz_XTAL / 4, okim6295_device::PIN7_HIGH) // 1.056MHz clock frequency, but pin 7 not verified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) @@ -2505,13 +2505,13 @@ MACHINE_CONFIG_START(taitob_state::silentd) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2563,13 +2563,13 @@ MACHINE_CONFIG_START(taitob_state::selfeena) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2630,13 +2630,13 @@ MACHINE_CONFIG_START(taitob_state::ryujin) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2695,13 +2695,13 @@ MACHINE_CONFIG_START(taitob_state::sbm) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("JOY")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("START")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("PHOTOSENSOR")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("JOY"); + m_tc0510nio->read_3_callback().set_ioport("START"); + m_tc0510nio->write_4_callback().set(FUNC(taitob_state::player_12_coin_ctrl_w)); + m_tc0510nio->read_7_callback().set_ioport("PHOTOSENSOR"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2752,13 +2752,13 @@ MACHINE_CONFIG_START(taitob_c_state::realpunc) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitob_state, player_12_coin_ctrl_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(taitob_c_state::player_12_coin_ctrl_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -2766,13 +2766,13 @@ MACHINE_CONFIG_START(taitob_c_state::realpunc) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_SIZE(64*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1) - MCFG_SCREEN_UPDATE_DRIVER(taitob_state, screen_update_realpunc) + MCFG_SCREEN_UPDATE_DRIVER(taitob_c_state, screen_update_realpunc) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("tc0180vcu", tc0180vcu_device, screen_vblank)) MCFG_PALETTE_ADD("palette", 4096) MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx) - MCFG_VIDEO_START_OVERRIDE(taitob_state,realpunc) + MCFG_VIDEO_START_OVERRIDE(taitob_c_state,realpunc) MCFG_HD63484_ADD("hd63484", 0, realpunc_hd63484_map) MCFG_HD63484_AUTO_CONFIGURE_SCREEN(false) diff --git a/src/mame/drivers/taito_f2.cpp b/src/mame/drivers/taito_f2.cpp index b6a4ad4b39f..12e1953e681 100644 --- a/src/mame/drivers/taito_f2.cpp +++ b/src/mame/drivers/taito_f2.cpp @@ -2899,13 +2899,13 @@ MACHINE_CONFIG_START(taitof2_state::taito_f2_tc0220ioc ) /* basic machine hardware */ MCFG_DEVICE_REMOVE("watchdog") - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitof2_state, coin_nibble_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitof2_state::coin_nibble_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); MACHINE_CONFIG_END MACHINE_CONFIG_START(taitof2_state::taito_f2_tc0510nio ) @@ -2913,13 +2913,13 @@ MACHINE_CONFIG_START(taitof2_state::taito_f2_tc0510nio ) /* basic machine hardware */ MCFG_DEVICE_REMOVE("watchdog") - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitof2_state, coin_nibble_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(taitof2_state::coin_nibble_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); MCFG_PALETTE_MODIFY("palette") MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB) MACHINE_CONFIG_END @@ -3746,13 +3746,13 @@ MACHINE_CONFIG_START(taitof2_state::cameltrya) MCFG_MACHINE_START_OVERRIDE(taitof2_state,common) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitof2_state, coin_nibble_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitof2_state::coin_nibble_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3815,13 +3815,13 @@ MACHINE_CONFIG_START(taitof2_state::driveout) MCFG_MACHINE_START_OVERRIDE(taitof2_state,common) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitof2_state, coin_nibble_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(taitof2_state::coin_nibble_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/taito_h.cpp b/src/mame/drivers/taito_h.cpp index 9902e60a6a8..d85e7cd93fa 100644 --- a/src/mame/drivers/taito_h.cpp +++ b/src/mame/drivers/taito_h.cpp @@ -657,13 +657,13 @@ MACHINE_CONFIG_START(taitoh_state::syvalion) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitoh_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(taitoh_state::coin_control_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -713,13 +713,13 @@ MACHINE_CONFIG_START(taitoh_state::recordbr) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitoh_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(taitoh_state::coin_control_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -778,13 +778,13 @@ MACHINE_CONFIG_START(taitoh_state::dleague) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoh_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + tc0220ioc_device &tc0220ioc(TC0220IOC(config, "tc0220ioc", 0)); + tc0220ioc.read_0_callback().set_ioport("DSWA"); + tc0220ioc.read_1_callback().set_ioport("DSWB"); + tc0220ioc.read_2_callback().set_ioport("IN0"); + tc0220ioc.read_3_callback().set_ioport("IN1"); + tc0220ioc.write_4_callback().set(FUNC(taitoh_state::coin_control_w)); + tc0220ioc.read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp index e691f4259e6..d19be238324 100644 --- a/src/mame/drivers/taito_l.cpp +++ b/src/mame/drivers/taito_l.cpp @@ -1501,13 +1501,13 @@ MACHINE_CONFIG_START(fhawk_state::fhawk) MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitol_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + tc0220ioc_device &tc0220ioc(TC0220IOC(config, "tc0220ioc", 0)); + tc0220ioc.read_0_callback().set_ioport("DSWA"); + tc0220ioc.read_1_callback().set_ioport("DSWB"); + tc0220ioc.read_2_callback().set_ioport("IN0"); + tc0220ioc.read_3_callback().set_ioport("IN1"); + tc0220ioc.write_4_callback().set(FUNC(taitol_state::coin_control_w)); + tc0220ioc.read_7_callback().set_ioport("IN2"); MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) @@ -1574,15 +1574,15 @@ MACHINE_CONFIG_START(taitol_2cpu_state::raimais) MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitol_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + tc0040ioc_device &tc0040ioc(TC0040IOC(config, "tc0040ioc", 0)); + tc0040ioc.read_0_callback().set_ioport("DSWA"); + tc0040ioc.read_1_callback().set_ioport("DSWB"); + tc0040ioc.read_2_callback().set_ioport("IN0"); + tc0040ioc.read_3_callback().set_ioport("IN1"); + tc0040ioc.write_4_callback().set(FUNC(taitol_state::coin_control_w)); + tc0040ioc.read_7_callback().set_ioport("IN2"); - MCFG_DEVICE_ADD("dpram", MB8421, 0) + MB8421(config, "dpram", 0); MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) @@ -1618,15 +1618,15 @@ MACHINE_CONFIG_START(taitol_2cpu_state::kurikint) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("dpram", MB8421, 0) + tc0040ioc_device &tc0040ioc(TC0040IOC(config, "tc0040ioc", 0)); + tc0040ioc.read_0_callback().set_ioport("DSWA"); + tc0040ioc.read_1_callback().set_ioport("DSWB"); + tc0040ioc.read_2_callback().set_ioport("IN0"); + tc0040ioc.read_3_callback().set_ioport("IN1"); + tc0040ioc.write_4_callback().set(FUNC(taitol_state::coin_control_w)); + tc0040ioc.read_7_callback().set_ioport("IN2"); - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitol_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + MB8421(config, "dpram", 0); MCFG_MACHINE_START_OVERRIDE(taitol_state, taito_l) MCFG_MACHINE_RESET_OVERRIDE(taitol_state, taito_l) @@ -1765,13 +1765,13 @@ MACHINE_CONFIG_START(taitol_2cpu_state::evilston) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitol_state, coin_control_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_0_callback().set_ioport("DSWA"); + tc0510nio.read_1_callback().set_ioport("DSWB"); + tc0510nio.read_2_callback().set_ioport("IN0"); + tc0510nio.read_3_callback().set_ioport("IN1"); + tc0510nio.write_4_callback().set(FUNC(taitol_state::coin_control_w)); + tc0510nio.read_7_callback().set_ioport("IN2"); MCFG_DEVICE_ADD("dpram", MB8421, 0) MCFG_MB8421_INTL_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI)) diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp index 4a8a38be9bc..65cd34cbbd4 100644 --- a/src/mame/drivers/taito_z.cpp +++ b/src/mame/drivers/taito_z.cpp @@ -3196,13 +3196,13 @@ MACHINE_CONFIG_START(taitoz_state::contcirc) MCFG_MACHINE_START_OVERRIDE(taitoz_state,taitoz) MCFG_MACHINE_RESET_OVERRIDE(taitoz_state,taitoz) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3270,13 +3270,13 @@ MACHINE_CONFIG_START(taitoz_state::chasehq) MCFG_MACHINE_START_OVERRIDE(taitoz_state,chasehq) MCFG_MACHINE_RESET_OVERRIDE(taitoz_state,taitoz) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3346,13 +3346,13 @@ MACHINE_CONFIG_START(taitoz_state::enforce) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3426,13 +3426,13 @@ MACHINE_CONFIG_START(taitoz_state::bshark) MCFG_ADC0808_IN2_CB(IOPORT("STICKY")) MCFG_ADC0808_IN3_CB(IOPORT("Y_ADJUST")) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3507,13 +3507,13 @@ MACHINE_CONFIG_START(taitoz_state::sci) MCFG_QUANTUM_TIME(attotime::from_hz(3000)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3588,13 +3588,13 @@ MACHINE_CONFIG_START(taitoz_state::nightstr) MCFG_ADC0808_IN2_CB(IOPORT("X_ADJUST")) MCFG_ADC0808_IN3_CB(IOPORT("Y_ADJUST")) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3664,13 +3664,13 @@ MACHINE_CONFIG_START(taitoz_state::aquajack) MCFG_QUANTUM_TIME(attotime::from_hz(30000)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3745,14 +3745,14 @@ MACHINE_CONFIG_START(taitoz_state::spacegun) MCFG_ADC0808_IN2_CB(IOPORT("STICKX2")) MCFG_ADC0808_IN3_CB(IOPORT("STICKY2")) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_TC0510NIO_WRITE_3_CB(WRITE8(*this, taitoz_state, spacegun_eeprom_w)) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + m_tc0510nio->write_3_callback().set(FUNC(taitoz_state::spacegun_eeprom_w)); + m_tc0510nio->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3816,13 +3816,13 @@ MACHINE_CONFIG_START(taitoz_state::dblaxle) // make quantum time to be a multiple of the xtal (fixes road layer stuck on continue) MCFG_QUANTUM_TIME(attotime::from_hz(XTAL(32'000'000)/1024)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -3890,13 +3890,13 @@ MACHINE_CONFIG_START(taitoz_state::racingb) MCFG_QUANTUM_TIME(attotime::from_hz(600)) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, taitoz_state, coin_control_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(taitoz_state::coin_control_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/taitoair.cpp b/src/mame/drivers/taitoair.cpp index 00de3b4e413..59c6cdc69f3 100644 --- a/src/mame/drivers/taitoair.cpp +++ b/src/mame/drivers/taitoair.cpp @@ -720,13 +720,13 @@ MACHINE_CONFIG_START(taitoair_state::airsys) MCFG_QUANTUM_PERFECT_CPU("maincpu") - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, taitoair_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(taitoair_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); MCFG_TAITOIO_YOKE_ADD("yokectrl") diff --git a/src/mame/drivers/taitojc.cpp b/src/mame/drivers/taitojc.cpp index 1a3efcd6376..73f29e6c121 100644 --- a/src/mame/drivers/taitojc.cpp +++ b/src/mame/drivers/taitojc.cpp @@ -1097,13 +1097,13 @@ MACHINE_CONFIG_START(taitojc_state::taitojc) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) - MCFG_TC0640FIO_READ_0_CB(IOPORT("SERVICE")) - MCFG_TC0640FIO_READ_1_CB(IOPORT("COINS")) - MCFG_TC0640FIO_READ_2_CB(IOPORT("START")) - MCFG_TC0640FIO_READ_3_CB(IOPORT("UNUSED")) - MCFG_TC0640FIO_WRITE_4_CB(WRITE8(*this, taitojc_state, coin_control_w)) - MCFG_TC0640FIO_READ_7_CB(IOPORT("BUTTONS")) + TC0640FIO(config, m_tc0640fio, 0); + m_tc0640fio->read_0_callback().set_ioport("SERVICE"); + m_tc0640fio->read_1_callback().set_ioport("COINS"); + m_tc0640fio->read_2_callback().set_ioport("START"); + m_tc0640fio->read_3_callback().set_ioport("UNUSED"); + m_tc0640fio->write_4_callback().set(FUNC(taitojc_state::coin_control_w)); + m_tc0640fio->read_7_callback().set_ioport("BUTTONS"); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty) diff --git a/src/mame/drivers/taotaido.cpp b/src/mame/drivers/taotaido.cpp index 769b5771489..e86e1b4215d 100644 --- a/src/mame/drivers/taotaido.cpp +++ b/src/mame/drivers/taotaido.cpp @@ -358,19 +358,19 @@ MACHINE_CONFIG_START(taotaido_state::taotaido) MCFG_DEVICE_IO_MAP(sound_port_map) /* IRQs are triggered by the YM2610 */ - MCFG_DEVICE_ADD("io1", VS9209, 0) - MCFG_VS9209_IN_PORTA_CB(IOPORT("P1")) - MCFG_VS9209_IN_PORTB_CB(IOPORT("P2")) - MCFG_VS9209_IN_PORTC_CB(IOPORT("SYSTEM")) - MCFG_VS9209_IN_PORTD_CB(IOPORT("DSW1")) - MCFG_VS9209_IN_PORTE_CB(IOPORT("DSW2")) - MCFG_VS9209_IN_PORTF_CB(IOPORT("DSW3")) - MCFG_VS9209_OUT_PORTG_CB(WRITE8(*this, taotaido_state, unknown_output_w)) - MCFG_VS9209_IN_PORTH_CB(IOPORT("JP")) - - MCFG_DEVICE_ADD("io2", VS9209, 0) - MCFG_VS9209_IN_PORTA_CB(IOPORT("P3")) // used only by taotaida - MCFG_VS9209_IN_PORTB_CB(IOPORT("P4")) // used only by taotaida + vs9209_device &io1(VS9209(config, "io1", 0)); + io1.porta_input_cb().set_ioport("P1"); + io1.portb_input_cb().set_ioport("P2"); + io1.portc_input_cb().set_ioport("SYSTEM"); + io1.portd_input_cb().set_ioport("DSW1"); + io1.porte_input_cb().set_ioport("DSW2"); + io1.portf_input_cb().set_ioport("DSW3"); + io1.portg_output_cb().set(FUNC(taotaido_state::unknown_output_w)); + io1.porth_input_cb().set_ioport("JP"); + + vs9209_device &io2(VS9209(config, "io2", 0)); + io2.porta_input_cb().set_ioport("P3"); // used only by taotaida + io2.portb_input_cb().set_ioport("P4"); // used only by taotaida MCFG_DEVICE_ADD("watchdog", MB3773, 0) diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp index 7984dc7b909..873605d3b76 100644 --- a/src/mame/drivers/tatsumi.cpp +++ b/src/mame/drivers/tatsumi.cpp @@ -889,11 +889,11 @@ MACHINE_CONFIG_START(apache3_state::apache3) MCFG_DEVICE_ADD("adc", M58990, 1000000) // unknown clock MCFG_ADC0808_IN0_CB(IOPORT("STICK_X")) MCFG_ADC0808_IN1_CB(IOPORT("STICK_Y")) - MCFG_ADC0808_IN2_CB(GND) // VSP1 + MCFG_ADC0808_IN2_CB(CONSTANT(0)) // VSP1 MCFG_ADC0808_IN4_CB(READ8(*this, apache3_state, apache3_vr1_r)) MCFG_ADC0808_IN5_CB(IOPORT("THROTTLE")) - MCFG_ADC0808_IN6_CB(GND) // RPSNC - MCFG_ADC0808_IN7_CB(GND) // LPSNC + MCFG_ADC0808_IN6_CB(CONSTANT(0)) // RPSNC + MCFG_ADC0808_IN7_CB(CONSTANT(0)) // LPSNC MCFG_DEVICE_ADD("ppi", I8255, 0) diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp index 0d88627cb32..0d87cd96cb0 100644 --- a/src/mame/drivers/tavernie.cpp +++ b/src/mame/drivers/tavernie.cpp @@ -331,9 +331,9 @@ MACHINE_CONFIG_START(tavernie_state::cpu09) MCFG_RS232_RXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 153600)); + acia_clock.signal_handler().set("acia", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia", FUNC(acia6850_device::write_rxc)); MACHINE_CONFIG_END MACHINE_CONFIG_START(tavernie_state::ivg09) diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp index 07e54756b9a..0864c2bff4a 100644 --- a/src/mame/drivers/thedealr.cpp +++ b/src/mame/drivers/thedealr.cpp @@ -558,15 +558,15 @@ MACHINE_CONFIG_START(thedealr_state::thedealr) MCFG_SETA001_SPRITE_GFXDECODE("gfxdecode") // video hardware - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - MCFG_SCREEN_SIZE(512, 256) - MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0+30, 256-1) - MCFG_SCREEN_UPDATE_DRIVER(thedealr_state, screen_update) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, thedealr_state, screen_vblank)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("subcpu", INPUT_LINE_NMI)) - MCFG_SCREEN_PALETTE("palette") + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(0)); + screen.set_size(512, 256); + screen.set_visarea(0, 384-1, 0+30, 256-1); + screen.set_screen_update(FUNC(thedealr_state::screen_update)); + screen.screen_vblank().set(FUNC(thedealr_state::screen_vblank)); + screen.screen_vblank().append_inputline(m_subcpu, INPUT_LINE_NMI); + screen.set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_thedealr) MCFG_PALETTE_ADD("palette", 512) diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp index f76dcea0f8e..24a0c65f504 100644 --- a/src/mame/drivers/tim100.cpp +++ b/src/mame/drivers/tim100.cpp @@ -187,33 +187,33 @@ MACHINE_CONFIG_START(tim100_state::tim100) MCFG_PALETTE_ADD("palette", 3) - MCFG_DEVICE_ADD("uart_u17", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "keyboard") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart_u17", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart_u17", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart_u17", i8251_device, write_cts)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("keyboard", tim100) - - MCFG_DEVICE_ADD("uart_u18", I8251, 0) - MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) - MCFG_I8251_DTR_HANDLER(WRITELINE("rs232a", rs232_port_device, write_dtr)) - MCFG_I8251_RTS_HANDLER(WRITELINE("rs232a", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232a", RS232_PORT, default_rs232_devices, "terminal") //"keyboard") - MCFG_RS232_RXD_HANDLER(WRITELINE("uart_u18", i8251_device, write_rxd)) - MCFG_RS232_DSR_HANDLER(WRITELINE("uart_u18", i8251_device, write_dsr)) - MCFG_RS232_CTS_HANDLER(WRITELINE("uart_u18", i8251_device, write_cts)) - MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", tim100) - - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart_u17", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart_u17", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart_u18", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart_u18", i8251_device, write_rxc)) + i8251_device &uart_u17(I8251(config, "uart_u17", 0)); + uart_u17.txd_handler().set("rs232", FUNC(rs232_port_device::write_txd)); + uart_u17.dtr_handler().set("rs232", FUNC(rs232_port_device::write_dtr)); + uart_u17.rts_handler().set("rs232", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "keyboard")); + rs232.rxd_handler().set("uart_u17", FUNC(i8251_device::write_rxd)); + rs232.dsr_handler().set("uart_u17", FUNC(i8251_device::write_dsr)); + rs232.cts_handler().set("uart_u17", FUNC(i8251_device::write_cts)); + rs232.set_option_device_input_defaults("keyboard", DEVICE_INPUT_DEFAULTS_NAME(tim100)); + + i8251_device &uart_u18(I8251(config, "uart_u18", 0)); + uart_u18.txd_handler().set("rs232a", FUNC(rs232_port_device::write_txd)); + uart_u18.dtr_handler().set("rs232a", FUNC(rs232_port_device::write_dtr)); + uart_u18.rts_handler().set("rs232a", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232a(RS232_PORT(config, "rs232a", default_rs232_devices, "terminal")); //"keyboard")); + rs232a.rxd_handler().set("uart_u18", FUNC(i8251_device::write_rxd)); + rs232a.dsr_handler().set("uart_u18", FUNC(i8251_device::write_dsr)); + rs232a.cts_handler().set("uart_u18", FUNC(i8251_device::write_cts)); + rs232a.set_option_device_input_defaults("terminal", DEVICE_INPUT_DEFAULTS_NAME(tim100)); + + clock_device &uart_clock(CLOCK(config, "uart_clock", 153'600)); + uart_clock.signal_handler().set("uart_u17", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart_u17", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart_u18", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart_u18", FUNC(i8251_device::write_rxc)); MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/drivers/timelimt.cpp b/src/mame/drivers/timelimt.cpp index ca64a957426..946a92b52c7 100644 --- a/src/mame/drivers/timelimt.cpp +++ b/src/mame/drivers/timelimt.cpp @@ -237,12 +237,12 @@ MACHINE_CONFIG_START(timelimt_state::timelimt) MCFG_QUANTUM_TIME(attotime::from_hz(3000)) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // IC15 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, timelimt_state, nmi_enable_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, timelimt_state, coin_lockout_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(NOOP) // probably flip screen - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(NOOP) // probably flip screen + ls259_device &mainlatch(LS259(config, "mainlatch")); // IC15 + mainlatch.q_out_cb<0>().set(FUNC(timelimt_state::nmi_enable_w)); + mainlatch.q_out_cb<2>().set(FUNC(timelimt_state::coin_lockout_w)); + mainlatch.q_out_cb<3>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); + mainlatch.q_out_cb<6>().set_nop(); // probably flip screen + mainlatch.q_out_cb<7>().set_nop(); // probably flip screen MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/tmc1800.cpp b/src/mame/drivers/tmc1800.cpp index 1733a079ca4..4e3d499b8bf 100644 --- a/src/mame/drivers/tmc1800.cpp +++ b/src/mame/drivers/tmc1800.cpp @@ -719,7 +719,7 @@ MACHINE_CONFIG_START(tmc1800_state::tmc1800) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(1'750'000)) MCFG_DEVICE_PROGRAM_MAP(tmc1800_map) MCFG_DEVICE_IO_MAP(tmc1800_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, tmc1800_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, tmc1800_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, tmc1800_state, ef3_r)) @@ -751,7 +751,7 @@ MACHINE_CONFIG_START(osc1000b_state::osc1000b) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(1'750'000)) MCFG_DEVICE_PROGRAM_MAP(osc1000b_map) MCFG_DEVICE_IO_MAP(osc1000b_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, osc1000b_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, osc1000b_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, osc1000b_state, ef3_r)) @@ -782,7 +782,7 @@ MACHINE_CONFIG_START(tmc2000_state::tmc2000) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(1'750'000)) MCFG_DEVICE_PROGRAM_MAP(tmc2000_map) MCFG_DEVICE_IO_MAP(tmc2000_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, tmc2000_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, tmc2000_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, tmc2000_state, ef3_r)) @@ -808,7 +808,7 @@ MACHINE_CONFIG_START(nano_state::nano) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(1'750'000)) MCFG_DEVICE_PROGRAM_MAP(nano_map) MCFG_DEVICE_IO_MAP(nano_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, nano_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, nano_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, nano_state, ef3_r)) diff --git a/src/mame/drivers/tmc2000e.cpp b/src/mame/drivers/tmc2000e.cpp index dc8d15c18d2..df5a976c9b2 100644 --- a/src/mame/drivers/tmc2000e.cpp +++ b/src/mame/drivers/tmc2000e.cpp @@ -285,7 +285,7 @@ MACHINE_CONFIG_START(tmc2000e_state::tmc2000e) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(1'750'000)) MCFG_DEVICE_PROGRAM_MAP(tmc2000e_map) MCFG_DEVICE_IO_MAP(tmc2000e_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, tmc2000e_state, clear_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, tmc2000e_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, tmc2000e_state, ef3_r)) @@ -298,7 +298,7 @@ MACHINE_CONFIG_START(tmc2000e_state::tmc2000e) // sound hardware SPEAKER(config, "mono").front_center(); - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, tmc2000e_state, rdata_r), READLINE(*this, tmc2000e_state, bdata_r), READLINE(*this, tmc2000e_state, gdata_r)) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, tmc2000e_state, rdata_r), READLINE(*this, tmc2000e_state, bdata_r), READLINE(*this, tmc2000e_state, gdata_r)) MCFG_CDP1864_CHROMINANCE(RES_K(2.2), RES_K(1), RES_K(5.1), RES_K(4.7)) // unverified MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/drivers/tmc600.cpp b/src/mame/drivers/tmc600.cpp index 6021587fe6c..522a0c96fda 100644 --- a/src/mame/drivers/tmc600.cpp +++ b/src/mame/drivers/tmc600.cpp @@ -258,7 +258,7 @@ MACHINE_CONFIG_START(tmc600_state::tmc600) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(3'570'000)) MCFG_DEVICE_PROGRAM_MAP(tmc600_map) MCFG_DEVICE_IO_MAP(tmc600_io_map) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, tmc600_state, ef2_r)) MCFG_COSMAC_EF3_CALLBACK(READLINE(*this, tmc600_state, ef3_r)) MCFG_COSMAC_Q_CALLBACK(WRITELINE(*this, tmc600_state, q_w)) @@ -269,20 +269,20 @@ MACHINE_CONFIG_START(tmc600_state::tmc600) // keyboard output latch MCFG_DEVICE_ADD(CDP1852_KB_TAG, CDP1852, XTAL(3'570'000)/8) // clock is CDP1802 TPB - MCFG_CDP1852_MODE_CALLBACK(VCC) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(1)) // address bus demux for expansion bus MCFG_DEVICE_ADD(CDP1852_BUS_TAG, CDP1852, 0) // clock is expansion bus TPA - MCFG_CDP1852_MODE_CALLBACK(GND) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(0)) // printer output latch MCFG_DEVICE_ADD(CDP1852_TMC700_TAG, CDP1852, XTAL(3'570'000)/8) // clock is CDP1802 TPB - MCFG_CDP1852_MODE_CALLBACK(VCC) + MCFG_CDP1852_MODE_CALLBACK(CONSTANT(1)) MCFG_CDP1852_DO_CALLBACK(WRITE8(*this, tmc600_state, printer_w)) // printer connector - MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(CDP1802_TAG, cosmac_device, ef4_w)) MCFG_DEVCB_XOR(1) + CENTRONICS(config, m_centronics, centronics_devices, "printer"); + m_centronics->busy_handler().set(CDP1802_TAG, FUNC(cosmac_device::ef4_w)).exor(1); // cassette MCFG_CASSETTE_ADD("cassette") diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp index 14f532740b8..f3bcc76e8ba 100644 --- a/src/mame/drivers/toaplan2.cpp +++ b/src/mame/drivers/toaplan2.cpp @@ -3200,85 +3200,84 @@ GFXDECODE_END MACHINE_CONFIG_START(toaplan2_state::tekipaki) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(10'000'000)) /* 10MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(tekipaki_68k_mem) + M68000(config, m_maincpu, 10_MHz_XTAL); // 10MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::tekipaki_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z180, XTAL(10'000'000)) /* HD647180 CPU actually */ - MCFG_DEVICE_PROGRAM_MAP(hd647180_mem_map) - MCFG_DEVICE_IO_MAP(hd647180_io_map) + Z180(config, m_audiocpu, 10_MHz_XTAL); // HD647180 CPU actually + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::hd647180_mem_map); + m_audiocpu->set_addrmap(AS_IO, &toaplan2_state::hd647180_io_map); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + GENERIC_LATCH_8(config, m_soundlatch); - MCFG_DEVICE_ADD("ymsnd", YM3812, XTAL(27'000'000)/8) - MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + ym3812_device &ymsnd(YM3812(config, "ymsnd", 27_MHz_XTAL/8)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::ghox) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(10'000'000)) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(ghox_68k_mem) + M68000(config, m_maincpu, 10_MHz_XTAL); /* verified on pcb */ + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::ghox_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z180, XTAL(10'000'000)) /* HD647180 CPU actually */ - MCFG_DEVICE_PROGRAM_MAP(ghox_hd647180_mem_map) + Z180(config, m_audiocpu, 10_MHz_XTAL); /* HD647180 CPU actually */ + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::ghox_hd647180_mem_map); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,ghox) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on pcb MACHINE_CONFIG_END /* probably dogyuun, vfive and kbash use the same decryption table; @@ -3334,152 +3333,150 @@ a4849 cd MACHINE_CONFIG_START(toaplan2_state::dogyuun) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(25'000'000)/2) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(dogyuun_68k_mem) + M68000(config, m_maincpu, 25_MHz_XTAL/2); /* verified on pcb */ + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::dogyuun_68k_mem); - MCFG_DEVICE_ADD("audiocpu", V25, XTAL(25'000'000)/2) /* NEC V25 type Toaplan marked CPU ??? */ - MCFG_DEVICE_PROGRAM_MAP(v25_mem) - MCFG_V25_CONFIG(nitro_decryption_table) - MCFG_V25_PORT_PT_READ_CB(IOPORT("DSWB")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P0_READ_CB(IOPORT("DSWA")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P1_READ_CB(IOPORT("JMPR")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P2_WRITE_CB(NOOP) // bit 0 is FAULT according to kbash schematic + v25_device &audiocpu(V25(config, m_audiocpu, 25_MHz_XTAL/2)); /* NEC V25 type Toaplan marked CPU ??? */ + audiocpu.set_addrmap(AS_PROGRAM, &toaplan2_state::v25_mem); + audiocpu.set_decryption_table(nitro_decryption_table); + audiocpu.pt_in_cb().set_ioport("DSWB").exor(0xff); + audiocpu.p0_in_cb().set_ioport("DSWA").exor(0xff); + audiocpu.p1_in_cb().set_ioport("JMPR").exor(0xff); + audiocpu.p2_out_cb().set_nop(); // bit 0 is FAULT according to kbash schematic /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_dogyuun) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_dogyuun)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); - MCFG_DEVICE_ADD("gp9001_1", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") + GP9001_VDP(config, m_vdp[1], 27_MHz_XTAL); + m_vdp[1]->set_palette(m_palette); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.5); // verified on pcb - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(25'000'000)/24, okim6295_device::PIN7_HIGH) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 25_MHz_XTAL/24, okim6295_device::PIN7_HIGH); // verified on PCB + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::kbash) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) /* 16MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(kbash_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); /* 16MHz Oscillator */ + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::kbash_68k_mem); /* ROM based v25 */ - MCFG_DEVICE_ADD("audiocpu", V25, XTAL(16'000'000)) /* NEC V25 type Toaplan marked CPU ??? */ - MCFG_DEVICE_PROGRAM_MAP(kbash_v25_mem) - MCFG_V25_CONFIG(nitro_decryption_table) - MCFG_V25_PORT_PT_READ_CB(IOPORT("DSWA")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P0_READ_CB(IOPORT("DSWB")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P1_READ_CB(IOPORT("JMPR")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P2_WRITE_CB(NOOP) // bit 0 is FAULT according to kbash schematic + v25_device &audiocpu(V25(config, m_audiocpu, 16_MHz_XTAL)); /* NEC V25 type Toaplan marked CPU ??? */ + audiocpu.set_addrmap(AS_PROGRAM, &toaplan2_state::kbash_v25_mem); + audiocpu.set_decryption_table(nitro_decryption_table); + audiocpu.pt_in_cb().set_ioport("DSWA").exor(0xff); + audiocpu.p0_in_cb().set_ioport("DSWB").exor(0xff); + audiocpu.p1_in_cb().set_ioport("JMPR").exor(0xff); + audiocpu.p2_out_cb().set_nop(); // bit 0 is FAULT according to kbash schematic /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.5); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/32, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/32, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::kbash2) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) /* 16MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(kbash2_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); /* 16MHz Oscillator */ + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::kbash2_68k_mem); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(16'000'000)/16, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 16_MHz_XTAL/16, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki2", OKIM6295, XTAL(16'000'000)/16, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[1], 16_MHz_XTAL/16, okim6295_device::PIN7_HIGH); + m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::truxton2) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(truxton2_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); /* verified on pcb */ + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::truxton2_68k_mem); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_truxton2) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_2)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_2); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,truxton2) @@ -3488,21 +3485,18 @@ MACHINE_CONFIG_START(toaplan2_state::truxton2) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(0, "lspeaker", 1.0).add_route(1, "rspeaker", 1.0); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(16'000'000)/4, okim6295_device::PIN7_LOW) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "rspeaker", 1.0) + OKIM6295(config, m_oki[0], 16_MHz_XTAL/4, okim6295_device::PIN7_LOW); + m_oki[0]->add_route(ALL_OUTPUTS, "lspeaker", 1.0); + m_oki[0]->add_route(ALL_OUTPUTS, "rspeaker", 1.0); #else // ...but the hardware is mono SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on PCB - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(16'000'000)/4, okim6295_device::PIN7_LOW) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 16_MHz_XTAL/4, okim6295_device::PIN7_LOW); // verified on PCB + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); #endif MACHINE_CONFIG_END @@ -3510,42 +3504,42 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::pipibibs) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(10'000'000)) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(pipibibs_68k_mem) + M68000(config, m_maincpu, 10_MHz_XTAL); // verified on PCB + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::pipibibs_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(pipibibs_sound_z80_mem) + Z80(config, m_audiocpu, 27_MHz_XTAL/8); // verified on PCB + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::pipibibs_sound_z80_mem); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM3812, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + ym3812_device &ymsnd(YM3812(config, "ymsnd", 27_MHz_XTAL/8)); // verified on PCB + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END @@ -3556,39 +3550,39 @@ MACHINE_CONFIG_START(toaplan2_state::pipibibsbl) MCFG_DEVICE_PROGRAM_MAP(pipibibi_bootleg_68k_mem) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(toaplan2_state, pipibibsbl_irq_ack) - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(27'000'000)/8) /* ??? 3.37MHz */ - MCFG_DEVICE_PROGRAM_MAP(pipibibs_sound_z80_mem) + Z80(config, m_audiocpu, 27_MHz_XTAL/8); // ??? 3.37MHz + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::pipibibs_sound_z80_mem); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(ASSERTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4, ASSERT_LINE); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM3812, XTAL(27'000'000)/8) - MCFG_YM3812_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + ym3812_device &ymsnd(YM3812(config, "ymsnd", 27_MHz_XTAL/8)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END /* x = modified to match batsugun 'unencrypted' code - '?' likewise, but not so sure about them */ @@ -3633,43 +3627,42 @@ static const uint8_t ts001turbo_decryption_table[256] = { MACHINE_CONFIG_START(toaplan2_state::fixeight) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(fixeight_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); // verified on PCB + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::fixeight_68k_mem); - MCFG_DEVICE_ADD("audiocpu", V25, XTAL(16'000'000)) /* NEC V25 type Toaplan marked CPU ??? */ - MCFG_DEVICE_PROGRAM_MAP(fixeight_v25_mem) - MCFG_V25_CONFIG(ts001turbo_decryption_table) - MCFG_V25_PORT_P0_READ_CB(IOPORT("EEPROM")) - MCFG_V25_PORT_P0_WRITE_CB(IOPORT("EEPROM")) + v25_device &audiocpu(V25(config, m_audiocpu, 16_MHz_XTAL)); // NEC V25 type Toaplan marked CPU ??? + audiocpu.set_addrmap(AS_PROGRAM, &toaplan2_state::fixeight_v25_mem); + audiocpu.set_decryption_table(ts001turbo_decryption_table); + audiocpu.p0_in_cb().set_ioport("EEPROM"); + audiocpu.p0_out_cb().set_ioport("EEPROM"); - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) + EEPROM_SERIAL_93C46_16BIT(config, m_eeprom); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) /* verified on pcb */ - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); // verified on PCB + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_truxton2) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,truxton2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.5); /* verified on pcb */ - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(16'000'000)/16, okim6295_device::PIN7_HIGH) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 16_MHz_XTAL/16, okim6295_device::PIN7_HIGH); /* verified on pcb */ + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END @@ -3681,398 +3674,391 @@ MACHINE_CONFIG_START(toaplan2_state::fixeightbl) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DRIVER(toaplan2_state, fixeightbl_irq_ack) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_bootleg) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_bootleg)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(ASSERTLINE("maincpu", M68K_IRQ_2)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_2, ASSERT_LINE); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,fixeightbl) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(14'000'000)/16, okim6295_device::PIN7_LOW) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) - MCFG_DEVICE_ADDRESS_MAP(0, fixeightbl_oki) + OKIM6295(config, m_oki[0], 14_MHz_XTAL/16, okim6295_device::PIN7_LOW); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); + m_oki[0]->set_addrmap(0, &toaplan2_state::fixeightbl_oki); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::vfive) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(20'000'000)/2) /* verified on pcb */ - MCFG_DEVICE_PROGRAM_MAP(vfive_68k_mem) + M68000(config, m_maincpu, 20_MHz_XTAL/2); // verified on PCB + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::vfive_68k_mem); - MCFG_DEVICE_ADD("audiocpu", V25, XTAL(20'000'000)/2) /* Verified on pcb, NEC V25 type Toaplan mark scratched out */ - MCFG_DEVICE_PROGRAM_MAP(vfive_v25_mem) - MCFG_V25_CONFIG(nitro_decryption_table) - MCFG_V25_PORT_PT_READ_CB(IOPORT("DSWA")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P0_READ_CB(IOPORT("DSWB")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P1_READ_CB(IOPORT("JMPR")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P2_WRITE_CB(NOOP) // bit 0 is FAULT according to kbash schematic + v25_device &audiocpu(V25(config, m_audiocpu, 20_MHz_XTAL/2)); // Verified on PCB, NEC V25 type Toaplan mark scratched out + audiocpu.set_addrmap(AS_PROGRAM, &toaplan2_state::vfive_v25_mem); + audiocpu.set_decryption_table(nitro_decryption_table); + audiocpu.pt_in_cb().set_ioport("DSWA").exor(0xff); + audiocpu.p0_in_cb().set_ioport("DSWB").exor(0xff); + audiocpu.p1_in_cb().set_ioport("JMPR").exor(0xff); + audiocpu.p2_out_cb().set_nop(); // bit 0 is FAULT according to kbash schematic /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) /* verified on pcb */ - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); // verified on PCB + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) /* verified on pcb */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); // verified on PCB MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::batsugun) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(batsugun_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::batsugun_68k_mem); - MCFG_DEVICE_ADD("audiocpu", V25, XTAL(32'000'000)/2) /* NEC V25 type Toaplan marked CPU ??? */ - MCFG_DEVICE_PROGRAM_MAP(v25_mem) - MCFG_V25_PORT_PT_READ_CB(IOPORT("DSWA")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P0_READ_CB(IOPORT("DSWB")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P1_READ_CB(IOPORT("JMPR")) MCFG_DEVCB_XOR(0xff) - MCFG_V25_PORT_P2_WRITE_CB(NOOP) // bit 0 is FAULT according to kbash schematic + v25_device &audiocpu(V25(config, m_audiocpu, 32_MHz_XTAL/2)); // NEC V25 type Toaplan marked CPU ??? + audiocpu.set_addrmap(AS_PROGRAM, &toaplan2_state::v25_mem); + audiocpu.pt_in_cb().set_ioport("DSWA").exor(0xff); + audiocpu.p0_in_cb().set_ioport("DSWB").exor(0xff); + audiocpu.p1_in_cb().set_ioport("JMPR").exor(0xff); + audiocpu.p2_out_cb().set_nop(); // bit 0 is FAULT according to kbash schematic /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_batsugun) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_batsugun)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); - MCFG_DEVICE_ADD("gp9001_1", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") + GP9001_VDP(config, m_vdp[1], 27_MHz_XTAL); + m_vdp[1]->set_palette(m_palette); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.5); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/8, okim6295_device::PIN7_LOW) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/8, okim6295_device::PIN7_LOW); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::pwrkick) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) - MCFG_DEVICE_PROGRAM_MAP(pwrkick_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::pwrkick_68k_mem); - MCFG_UPD4992_ADD("rtc") + UPD4992(config, m_rtc); MCFG_NVRAM_ADD_0FILL("nvram") - MCFG_TICKET_DISPENSER_ADD("hopper", attotime::from_msec(PWRKICK_HOPPER_PULSE), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH) + TICKET_DISPENSER(config, m_hopper, attotime::from_msec(PWRKICK_HOPPER_PULSE), TICKET_MOTOR_ACTIVE_HIGH, TICKET_STATUS_ACTIVE_HIGH); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - /* empty YM2151 socket*/ - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(27'000'000)/8, okim6295_device::PIN7_HIGH) // not confirmed - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + // empty YM2151 socket + OKIM6295(config, m_oki[0], 27_MHz_XTAL/8, okim6295_device::PIN7_HIGH); // not confirmed + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::othldrby) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) - MCFG_DEVICE_PROGRAM_MAP(othldrby_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::othldrby_68k_mem); - MCFG_UPD4992_ADD("rtc") + UPD4992(config, m_rtc); MCFG_NVRAM_ADD_0FILL("nvram") /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(27'000'000)/8, okim6295_device::PIN7_HIGH) // not confirmed - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 27_MHz_XTAL/8, okim6295_device::PIN7_HIGH); // not confirmed + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::enmadaio) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(20'000'000)/2) - MCFG_DEVICE_PROGRAM_MAP(enmadaio_68k_mem) + M68000(config, m_maincpu, 20_MHz_XTAL/2); + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::enmadaio_68k_mem); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.5); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(16'000'000)/4, okim6295_device::PIN7_LOW) // pin7 not confirmed - MCFG_DEVICE_ADDRESS_MAP(0, enmadaio_oki) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5) + OKIM6295(config, m_oki[0], 16_MHz_XTAL/4, okim6295_device::PIN7_LOW); // pin7 not confirmed + m_oki[0]->set_addrmap(0, &toaplan2_state::enmadaio_oki); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.5); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::snowbro2) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(16'000'000)) - MCFG_DEVICE_PROGRAM_MAP(snowbro2_68k_mem) + M68000(config, m_maincpu, 16_MHz_XTAL); + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::snowbro2_68k_mem); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_toaplan2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_toaplan2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,toaplan2) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(27'000'000)/10, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 27_MHz_XTAL/10, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::mahoudai) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(mahoudai_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::mahoudai_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(32'000'000)/8) /* 4MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(raizing_sound_z80_mem) + Z80(config, m_audiocpu, 32_MHz_XTAL/8); // 4MHz, 32MHz Oscillator + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::raizing_sound_z80_mem); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,bgaregga) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/32, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/32, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::shippumd) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(shippumd_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::shippumd_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(32'000'000)/8) /* 4MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(raizing_sound_z80_mem) + Z80(config, m_audiocpu, 32_MHz_XTAL/8); // 4MHz, 32MHz Oscillator + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::raizing_sound_z80_mem); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,bgaregga) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(27'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 27_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/32, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/32, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::bgaregga) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(bgaregga_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::bgaregga_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(32'000'000)/8) /* 4MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(bgaregga_sound_z80_mem) + Z80(config, m_audiocpu, 32_MHz_XTAL/8); // 4MHz, 32MHz Oscillator + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::bgaregga_sound_z80_mem); MCFG_QUANTUM_TIME(attotime::from_hz(6000)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_4)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_4); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,bgaregga) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE("audiocpu", 0)) - MCFG_GENERIC_LATCH_SEPARATE_ACKNOWLEDGE(true) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); + m_soundlatch->set_separate_acknowledge(true); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(32'000'000)/8) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 32_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/16, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/16, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("nmk112", NMK112, 0) - MCFG_NMK112_ROM0("oki1") + NMK112(config, m_nmk112, 0); + m_nmk112->set_rom0_tag("oki1"); MACHINE_CONFIG_END @@ -4080,49 +4066,48 @@ MACHINE_CONFIG_START(toaplan2_state::bgareggabl) bgaregga(config); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,bgareggabl) - MCFG_SCREEN_MODIFY("screen") - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_bootleg) + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_bootleg)); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::batrider) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator (verified) */ - MCFG_DEVICE_PROGRAM_MAP(batrider_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator (verified) + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::batrider_68k_mem); - MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(32'000'000)/6) /* 5.333MHz , 32MHz Oscillator (verified) */ - MCFG_DEVICE_PROGRAM_MAP(batrider_sound_z80_mem) - MCFG_DEVICE_IO_MAP(batrider_sound_z80_port) + Z80(config, m_audiocpu, 32_MHz_XTAL/6); // 5.333MHz, 32MHz Oscillator (verified) + m_audiocpu->set_addrmap(AS_PROGRAM, &toaplan2_state::batrider_sound_z80_mem); + m_audiocpu->set_addrmap(AS_IO, &toaplan2_state::batrider_sound_z80_port); MCFG_QUANTUM_TIME(attotime::from_hz(600)) MCFG_MACHINE_RESET_OVERRIDE(toaplan2_state,toaplan2) - MCFG_DEVICE_ADD("dma_space", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(batrider_dma_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDR_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000) + ADDRESS_MAP_BANK(config, m_dma_space, 0); + m_dma_space->set_addrmap(0, &toaplan2_state::batrider_dma_mem); + m_dma_space->set_endianness(ENDIANNESS_BIG); + m_dma_space->set_data_width(16); + m_dma_space->set_addr_width(16); + m_dma_space->set_stride(0x8000); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_batrider) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_2)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_2); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,batrider) @@ -4130,31 +4115,30 @@ MACHINE_CONFIG_START(toaplan2_state::batrider) SPEAKER(config, "mono").front_center(); // these two latches are always written together, via a single move.l instruction - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_8_ADD("soundlatch2") - MCFG_GENERIC_LATCH_8_ADD("soundlatch3") - MCFG_GENERIC_LATCH_8_ADD("soundlatch4") + GENERIC_LATCH_8(config, "soundlatch"); + GENERIC_LATCH_8(config, "soundlatch2"); + GENERIC_LATCH_8(config, "soundlatch3"); + GENERIC_LATCH_8(config, "soundlatch4"); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(32'000'000)/8) /* 4MHz , 32MHz Oscillator (verified) */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + YM2151(config, "ymsnd", 32_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 1.0); // 4MHz, 32MHz Oscillator (verified) - MCFG_DEVICE_ADD("oki1", OKIM6295, XTAL(32'000'000)/10, okim6295_device::PIN7_HIGH) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[0], 32_MHz_XTAL/10, okim6295_device::PIN7_HIGH); + m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("oki2", OKIM6295, XTAL(32'000'000)/10, okim6295_device::PIN7_LOW) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + OKIM6295(config, m_oki[1], 32_MHz_XTAL/10, okim6295_device::PIN7_LOW); + m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0); - MCFG_DEVICE_ADD("nmk112", NMK112, 0) - MCFG_NMK112_ROM0("oki1") - MCFG_NMK112_ROM1("oki2") + NMK112(config, m_nmk112, 0); + m_nmk112->set_rom0_tag("oki1"); + m_nmk112->set_rom1_tag("oki2"); MACHINE_CONFIG_END MACHINE_CONFIG_START(toaplan2_state::bbakraid) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", M68000, XTAL(32'000'000)/2) /* 16MHz , 32MHz Oscillator */ - MCFG_DEVICE_PROGRAM_MAP(bbakraid_68k_mem) + M68000(config, m_maincpu, 32_MHz_XTAL/2); // 16MHz, 32MHz Oscillator + m_maincpu->set_addrmap(AS_PROGRAM, &toaplan2_state::bbakraid_68k_mem); MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(32'000'000)/6) /* 5.3333MHz , 32MHz Oscillator */ MCFG_DEVICE_PROGRAM_MAP(bbakraid_sound_z80_mem) @@ -4167,31 +4151,31 @@ MACHINE_CONFIG_START(toaplan2_state::bbakraid) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C66_8BIT) - MCFG_DEVICE_ADD("dma_space", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(batrider_dma_mem) - MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_BIG) - MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_ADDR_WIDTH(16) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x8000) + ADDRESS_MAP_BANK(config, m_dma_space, 0); + m_dma_space->set_addrmap(0, &toaplan2_state::batrider_dma_mem); + m_dma_space->set_endianness(ENDIANNESS_BIG); + m_dma_space->set_data_width(16); + m_dma_space->set_addr_width(16); + m_dma_space->set_stride(0x8000); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(27'000'000)/4,432,0,320,262,0,240) - //MCFG_SCREEN_REFRESH_RATE(60) - //MCFG_SCREEN_SIZE(432, 262) - //MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MCFG_SCREEN_UPDATE_DRIVER(toaplan2_state, screen_update_truxton2) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan2_state, screen_vblank_toaplan2)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(27_MHz_XTAL/4, 432, 0, 320, 262, 0, 240); + //m_screen->set_refresh_hz(60); + //m_screen->set_size(432, 262); + //m_screen->set_visarea(0, 319, 0, 239); + m_screen->set_screen_update(FUNC(toaplan2_state::screen_update_truxton2)); + m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank_toaplan2)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_batrider) MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) - MCFG_DEVICE_ADD("gp9001_0", GP9001_VDP, XTAL(27'000'000)) - MCFG_GFX_PALETTE("palette") - MCFG_GP9001_VINT_CALLBACK(INPUTLINE("maincpu", M68K_IRQ_1)) + GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); + m_vdp[0]->set_palette(m_palette); + m_vdp[0]->vint_out_cb().set_inputline(m_maincpu, M68K_IRQ_1); MCFG_VIDEO_START_OVERRIDE(toaplan2_state,batrider) @@ -4199,14 +4183,13 @@ MACHINE_CONFIG_START(toaplan2_state::bbakraid) SPEAKER(config, "mono").front_center(); // these two latches are always written together, via a single move.l instruction - MCFG_GENERIC_LATCH_8_ADD("soundlatch") - MCFG_GENERIC_LATCH_8_ADD("soundlatch2") - MCFG_GENERIC_LATCH_8_ADD("soundlatch3") - MCFG_GENERIC_LATCH_8_ADD("soundlatch4") + GENERIC_LATCH_8(config, "soundlatch"); + GENERIC_LATCH_8(config, "soundlatch2"); + GENERIC_LATCH_8(config, "soundlatch3"); + GENERIC_LATCH_8(config, "soundlatch4"); - MCFG_DEVICE_ADD("ymz", YMZ280B, XTAL(16'934'400)) + YMZ280B(config, "ymz", 16.9344_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 1.0); // IRQ not used ??? Connected to a test pin (TP082) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/tomcat.cpp b/src/mame/drivers/tomcat.cpp index 84e96470886..75ca544a45e 100644 --- a/src/mame/drivers/tomcat.cpp +++ b/src/mame/drivers/tomcat.cpp @@ -344,15 +344,15 @@ MACHINE_CONFIG_START(tomcat_state::tomcat) MCFG_QUANTUM_TIME(attotime::from_hz(4000)) - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, tomcat_state, mres_w)) - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, tomcat_state, sndres_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, tomcat_state, lnkmode_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, tomcat_state, err_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, tomcat_state, ack_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, tomcat_state, txbuff_w)) + LS259(config, m_mainlatch); + m_mainlatch->q_out_cb<0>().set_output("led1").invert(); + m_mainlatch->q_out_cb<1>().set_output("led2").invert(); + m_mainlatch->q_out_cb<2>().set(FUNC(tomcat_state::mres_w)); + m_mainlatch->q_out_cb<3>().set(FUNC(tomcat_state::sndres_w)); + m_mainlatch->q_out_cb<4>().set(FUNC(tomcat_state::lnkmode_w)); + m_mainlatch->q_out_cb<5>().set(FUNC(tomcat_state::err_w)); + m_mainlatch->q_out_cb<6>().set(FUNC(tomcat_state::ack_w)); + m_mainlatch->q_out_cb<7>().set(FUNC(tomcat_state::txbuff_w)); MCFG_NVRAM_ADD_0FILL("nvram") diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp index cba573bed2b..b467e67453a 100644 --- a/src/mame/drivers/topspeed.cpp +++ b/src/mame/drivers/topspeed.cpp @@ -599,13 +599,13 @@ MACHINE_CONFIG_START(topspeed_state::topspeed) MCFG_PC060HA_MASTER_CPU("maincpu") MCFG_PC060HA_SLAVE_CPU("audiocpu") - MCFG_DEVICE_ADD("tc0040ioc", TC0040IOC, 0) - MCFG_TC0040IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0040IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0040IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0040IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0040IOC_WRITE_4_CB(WRITE8(*this, topspeed_state, coins_w)) - MCFG_TC0040IOC_READ_7_CB(IOPORT("IN2")) + TC0040IOC(config, m_tc0040ioc, 0); + m_tc0040ioc->read_0_callback().set_ioport("DSWA"); + m_tc0040ioc->read_1_callback().set_ioport("DSWB"); + m_tc0040ioc->read_2_callback().set_ioport("IN0"); + m_tc0040ioc->read_3_callback().set_ioport("IN1"); + m_tc0040ioc->write_4_callback().set(FUNC(topspeed_state::coins_w)); + m_tc0040ioc->read_7_callback().set_ioport("IN2"); // video hardware MCFG_SCREEN_ADD("screen", RASTER) @@ -624,11 +624,11 @@ MACHINE_CONFIG_START(topspeed_state::topspeed) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ymsnd", YM2151, XTAL(16'000'000) / 4) - MCFG_YM2151_IRQ_HANDLER(INPUTLINE("audiocpu", 0)) - MCFG_YM2151_PORT_WRITE_HANDLER(MEMBANK("sndbank")) MCFG_DEVCB_MASK(0x03) - MCFG_SOUND_ROUTE(0, "filter1l", 1.0) - MCFG_SOUND_ROUTE(1, "filter1r", 1.0) + ym2151_device &ymsnd(YM2151(config, "ymsnd", 16_MHz_XTAL / 4)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.port_write_handler().set_membank("sndbank").mask(0x03); + ymsnd.add_route(0, "filter1l", 1.0); + ymsnd.add_route(1, "filter1r", 1.0); MCFG_DEVICE_ADD("msm1", MSM5205, XTAL(384'000)) MCFG_MSM5205_VCLK_CB(WRITELINE(*this, topspeed_state, msm5205_1_vck)) // VCK function diff --git a/src/mame/drivers/tranz330.cpp b/src/mame/drivers/tranz330.cpp index 147a626abf0..f81be4882b1 100644 --- a/src/mame/drivers/tranz330.cpp +++ b/src/mame/drivers/tranz330.cpp @@ -148,12 +148,12 @@ void tranz330_state::tranz330(machine_config &config) m_cpu->set_daisy_config(tranz330_daisy_chain); CLOCK(config, "ctc_clock", XTAL(7'159'090)/4) // ? - .set_signal_handler(DEVCB_WRITELINE(*this, tranz330_state, clock_w)); + .signal_handler().set(FUNC(tranz330_state::clock_w)); MSM6242(config, RTC_TAG, XTAL(32'768)); - INPUT_MERGER_ANY_HIGH(config, "irq", 0) - .set_output_handler(DEVCB_INPUTLINE(m_cpu, INPUT_LINE_IRQ0)); + INPUT_MERGER_ANY_HIGH(config, "irq") + .output_handler().set_inputline(m_cpu, INPUT_LINE_IRQ0); Z80PIO(config, m_pio, XTAL(7'159'090)/2); //* m_pio->set_out_int_callback(DEVCB_WRITELINE("irq", input_merger_device, in_w<0>)); //* @@ -173,9 +173,9 @@ void tranz330_state::tranz330(machine_config &config) m_ctc->set_intr_callback(DEVCB_WRITELINE("irq", input_merger_device, in_w<2>)); RS232_PORT(config, m_rs232, default_rs232_devices, nullptr); - m_rs232->set_rxd_handler(DEVCB_WRITELINE(m_dart, z80dart_device, rxb_w)); - m_rs232->set_dcd_handler(DEVCB_WRITELINE(m_dart, z80dart_device, dcdb_w)); - m_rs232->set_cts_handler(DEVCB_WRITELINE(m_dart, z80dart_device, ctsb_w)); + m_rs232->rxd_handler().set(m_dart, FUNC(z80dart_device::rxb_w)); + m_rs232->dcd_handler().set(m_dart, FUNC(z80dart_device::dcdb_w)); + m_rs232->cts_handler().set(m_dart, FUNC(z80dart_device::ctsb_w)); // video MIC10937(config, VFD_TAG).set_port_value(0); diff --git a/src/mame/drivers/triplhnt.cpp b/src/mame/drivers/triplhnt.cpp index a4b23ec9b03..d7ef4d21c8a 100644 --- a/src/mame/drivers/triplhnt.cpp +++ b/src/mame/drivers/triplhnt.cpp @@ -30,31 +30,6 @@ void triplhnt_state::set_collision(int code) } -WRITE_LINE_MEMBER(triplhnt_state::ram_2_w) -{ - if (state) - m_cmos[m_cmos_latch] = m_da_latch; -} - - -WRITE_LINE_MEMBER(triplhnt_state::sprite_zoom_w) -{ - m_sprite_zoom = state; -} - - -WRITE_LINE_MEMBER(triplhnt_state::sprite_bank_w) -{ - m_sprite_bank = state; -} - - -WRITE_LINE_MEMBER(triplhnt_state::lamp1_w) -{ - m_lamp = state ? 1 : 0; -} - - WRITE_LINE_MEMBER(triplhnt_state::coin_lockout_w) { machine().bookkeeping().coin_lockout_w(0, !state); @@ -305,17 +280,17 @@ MACHINE_CONFIG_START(triplhnt_state::triplhnt) MCFG_NVRAM_ADD_0FILL("nvram") // battery-backed 74C89 at J5 - MCFG_DEVICE_ADD("latch", F9334, 0) // J7 - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // unused - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, triplhnt_state, lamp1_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("discrete", discrete_device, write_line)) // Lamp is used to reset noise - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE("discrete", discrete_device, write_line)) // screech - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, triplhnt_state, coin_lockout_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, triplhnt_state, sprite_zoom_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, triplhnt_state, ram_2_w)) // CMOS write - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, triplhnt_state, tape_control_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, triplhnt_state, sprite_bank_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("discrete", discrete_device, write_line)) // bear + F9334(config, m_latch); // J7 + m_latch->q_out_cb<0>().set_nop(); // unused + m_latch->q_out_cb<1>().set([this] (int state) { m_lamp = state ? 1 : 0; }); + m_latch->q_out_cb<1>().append(m_discrete, FUNC(discrete_device::write_line)); // Lamp is used to reset noise + m_latch->q_out_cb<2>().set(m_discrete, FUNC(discrete_device::write_line)); // screech + m_latch->q_out_cb<3>().set(FUNC(triplhnt_state::coin_lockout_w)); + m_latch->q_out_cb<4>().set([this] (int state) { m_sprite_zoom = state; }); + m_latch->q_out_cb<5>().set([this] (int state) { if (state) m_cmos[m_cmos_latch] = m_da_latch; }); // CMOS write + m_latch->q_out_cb<6>().set(FUNC(triplhnt_state::tape_control_w)); + m_latch->q_out_cb<7>().set([this] (int state) { m_sprite_bank = state; }); + m_latch->q_out_cb<7>().append(m_discrete, FUNC(discrete_device::write_line)); // bear MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/trs80dt1.cpp b/src/mame/drivers/trs80dt1.cpp index 4f3f7dff75e..368ed294d21 100644 --- a/src/mame/drivers/trs80dt1.cpp +++ b/src/mame/drivers/trs80dt1.cpp @@ -327,20 +327,20 @@ MACHINE_CONFIG_START(trs80dt1_state::trs80dt1) MCFG_SCREEN_VISIBLE_AREA(0, 40*12-1, 0, 16*16-1) MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trs80dt1 ) - MCFG_DEVICE_ADD("crtc", I8275, 12480000 / 8) - MCFG_I8275_CHARACTER_WIDTH(8) - MCFG_I8275_DRAW_CHARACTER_CALLBACK_OWNER(trs80dt1_state, crtc_update_row) - MCFG_I8275_DRQ_CALLBACK(INPUTLINE("maincpu", MCS51_INT0_LINE)) // BRDY pin goes through inverter to /INT0, so we don't invert - MCFG_I8275_IRQ_CALLBACK(WRITELINE("7474", ttl7474_device, clear_w)) // INT pin - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("7474", ttl7474_device, d_w)) - MCFG_I8275_VRTC_CALLBACK(WRITELINE("7474", ttl7474_device, clock_w)) - MCFG_VIDEO_SET_SCREEN("screen") + I8275(config, m_crtc, 12480000 / 8); + m_crtc->set_character_width(8); + m_crtc->set_display_callback(FUNC(trs80dt1_state::crtc_update_row), this); + m_crtc->drq_wr_callback().set_inputline(m_maincpu, MCS51_INT0_LINE); // BRDY pin goes through inverter to /INT0, so we don't invert + m_crtc->irq_wr_callback().set(m_7474, FUNC(ttl7474_device::clear_w)); // INT pin + m_crtc->irq_wr_callback().append(m_7474, FUNC(ttl7474_device::d_w)); + m_crtc->vrtc_wr_callback().set(m_7474, FUNC(ttl7474_device::clock_w)); + m_crtc->set_screen("screen"); MCFG_PALETTE_ADD("palette", 3) MCFG_X2210_ADD("nvram") - MCFG_DEVICE_ADD("7474", TTL7474, 0) - MCFG_7474_COMP_OUTPUT_CB(INPUTLINE("maincpu", MCS51_INT1_LINE)) MCFG_DEVCB_INVERT // /Q connects directly to /INT1, so we need to invert? + TTL7474(config, m_7474, 0); + m_7474->comp_output_cb().set_inputline(m_maincpu, MCS51_INT1_LINE).invert(); // /Q connects directly to /INT1, so we need to invert? /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp index 27c16cb67f8..79b169ef8c5 100644 --- a/src/mame/drivers/ts803.cpp +++ b/src/mame/drivers/ts803.cpp @@ -442,13 +442,13 @@ MACHINE_CONFIG_START(ts803_state::ts803) MCFG_MC6845_UPDATE_ROW_CB(ts803_state, crtc_update_row) MCFG_MC6845_ADDR_CHANGED_CB(ts803_state, crtc_update_addr) - MCFG_DEVICE_ADD("sti_clock", CLOCK, 16_MHz_XTAL / 13) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("sti", z80sti_device, tc_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sti", z80sti_device, rc_w)) + clock_device &sti_clock(CLOCK(config, "sti_clock", 16_MHz_XTAL / 13)); + sti_clock.signal_handler().set("sti", FUNC(z80sti_device::tc_w)); + sti_clock.signal_handler().append("sti", FUNC(z80sti_device::rc_w)); - MCFG_DEVICE_ADD("dart_clock", CLOCK, (16_MHz_XTAL / 13) / 8) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("dart", z80dart_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("dart", z80dart_device, rxca_w)) + clock_device &dart_clock(CLOCK(config, "dart_clock", 16_MHz_XTAL / 13 / 8)); + dart_clock.signal_handler().set("dart", FUNC(z80dart_device::txca_w)); + dart_clock.signal_handler().append("dart", FUNC(z80dart_device::rxca_w)); MCFG_DEVICE_ADD("sti", Z80STI, 16_MHz_XTAL / 4) MCFG_Z80STI_OUT_TBO_CB(WRITELINE("dart", z80dart_device, rxtxcb_w)) diff --git a/src/mame/drivers/tsamurai.cpp b/src/mame/drivers/tsamurai.cpp index 9e635360c4e..96fedf0651e 100644 --- a/src/mame/drivers/tsamurai.cpp +++ b/src/mame/drivers/tsamurai.cpp @@ -843,15 +843,15 @@ MACHINE_CONFIG_START(tsamurai_state::m660) MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, tsamurai_state, textbank2_w)) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MCFG_SCREEN_SIZE(32*8, 32*8) - MCFG_SCREEN_VISIBLE_AREA(0, 255, 16, 255-16) - MCFG_SCREEN_UPDATE_DRIVER(tsamurai_state, screen_update) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tsamurai_state, vblank_irq)) - MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("audio3", INPUT_LINE_NMI)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_refresh_hz(60); + screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500) /* not accurate */); + screen.set_size(32*8, 32*8); + screen.set_visarea(0, 255, 16, 255-16); + screen.set_screen_update(FUNC(tsamurai_state::screen_update)); + screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(tsamurai_state::vblank_irq)); + screen.screen_vblank().append_inputline(m_audio3, INPUT_LINE_NMI); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tsamurai) MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256) diff --git a/src/mame/drivers/tv912.cpp b/src/mame/drivers/tv912.cpp index 79673153301..0e358b7e039 100644 --- a/src/mame/drivers/tv912.cpp +++ b/src/mame/drivers/tv912.cpp @@ -872,43 +872,44 @@ static INPUT_PORTS_START( tv912c ) PORT_BIT(0xdc, IP_ACTIVE_LOW, IPT_UNUSED) INPUT_PORTS_END -MACHINE_CONFIG_START(tv912_state::tv912) - MCFG_DEVICE_ADD("maincpu", I8035, XTAL(23'814'000) / 4) // nominally +6MHz, actually 5.9535 MHz - MCFG_DEVICE_PROGRAM_MAP(prog_map) - MCFG_DEVICE_IO_MAP(io_map) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, tv912_state, p1_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, tv912_state, p2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, tv912_state, p2_w)) - MCFG_MCS48_PORT_T0_IN_CB(READLINE("rs232", rs232_port_device, cts_r)) - MCFG_MCS48_PORT_T1_IN_CB(READLINE("crtc", tms9927_device, bl_r)) MCFG_DEVCB_INVERT - MCFG_MCS48_PORT_PROG_OUT_CB(WRITELINE("uart", ay51013_device, write_xr)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("bankdev", ADDRESS_MAP_BANK, 0) - MCFG_DEVICE_PROGRAM_MAP(bank_map) - MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(8) - MCFG_ADDRESS_MAP_BANK_ADDR_WIDTH(12) - MCFG_ADDRESS_MAP_BANK_STRIDE(0x100) - - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_RAW_PARAMS(XTAL(23'814'000), 105 * CHAR_WIDTH, 0, 80 * CHAR_WIDTH, 270, 0, 240) - MCFG_SCREEN_UPDATE_DRIVER(tv912_state, screen_update) - - MCFG_DEVICE_ADD("crtc", TMS9927, XTAL(23'814'000) / CHAR_WIDTH) - MCFG_TMS9927_CHAR_WIDTH(CHAR_WIDTH) - MCFG_TMS9927_VSYN_CALLBACK(INPUTLINE("maincpu", MCS48_INPUT_IRQ)) - MCFG_VIDEO_SET_SCREEN("screen") - - MCFG_DEVICE_ADD("uart", AY51013, 0) - MCFG_AY51013_READ_SI_CB(READLINE("rs232", rs232_port_device, rxd_r)) - MCFG_AY51013_WRITE_SO_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_AY51013_AUTO_RDAV(true) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "loopback") +void tv912_state::tv912(machine_config &config) +{ + i8035_device &maincpu(I8035(config, m_maincpu, 23.814_MHz_XTAL / 4)); // nominally +6MHz, actually 5.9535 MHz + maincpu.set_addrmap(AS_PROGRAM, &tv912_state::prog_map); + maincpu.set_addrmap(AS_IO, &tv912_state::io_map); + maincpu.p1_out_cb().set(FUNC(tv912_state::p1_w)); + maincpu.p2_in_cb().set(FUNC(tv912_state::p2_r)); + maincpu.p2_out_cb().set(FUNC(tv912_state::p2_w)); + maincpu.t0_in_cb().set(m_rs232, FUNC(rs232_port_device::cts_r)); + maincpu.t1_in_cb().set(m_crtc, FUNC(tms9927_device::bl_r)).invert(); + maincpu.prog_out_cb().set(m_uart, FUNC(ay51013_device::write_xr)).invert(); + + ADDRESS_MAP_BANK(config, m_bankdev, 0); + m_bankdev->set_addrmap(0, &tv912_state::bank_map); + m_bankdev->set_data_width(8); + m_bankdev->set_addr_width(12); + m_bankdev->set_stride(0x100); + + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_raw(23.814_MHz_XTAL, 105 * CHAR_WIDTH, 0, 80 * CHAR_WIDTH, 270, 0, 240); + screen.set_screen_update(FUNC(tv912_state::screen_update)); + + TMS9927(config, m_crtc, 23.814_MHz_XTAL / CHAR_WIDTH); + m_crtc->set_char_width(CHAR_WIDTH); + m_crtc->vsyn_wr_callback().set_inputline(m_maincpu, MCS48_INPUT_IRQ); + m_crtc->set_screen("screen"); + + AY51013(config, m_uart, 0); + m_uart->read_si_callback().set(m_rs232, FUNC(rs232_port_device::rxd_r)); + m_uart->write_so_callback().set(m_rs232, FUNC(rs232_port_device::write_txd)); + m_uart->set_auto_rdav(true); + + RS232_PORT(config, m_rs232, default_rs232_devices, "loopback"); SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("beep", BEEP, XTAL(23'814'000) / 7 / 11 / 256) // nominally 1200 Hz - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END + BEEP(config, m_beep, 23.814_MHz_XTAL / 7 / 11 / 256); // nominally 1200 Hz + m_beep->add_route(ALL_OUTPUTS, "mono", 0.50); +} /************************************************************************************************************** diff --git a/src/mame/drivers/twincobr.cpp b/src/mame/drivers/twincobr.cpp index e9939ecc67a..d4cb0c1a534 100644 --- a/src/mame/drivers/twincobr.cpp +++ b/src/mame/drivers/twincobr.cpp @@ -694,13 +694,13 @@ MACHINE_CONFIG_START(twincobr_state::twincobr) MCFG_DEVICE_ADD("spriteram16", BUFFERED_SPRITERAM16) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(28'000'000)/4, 446, 0, 320, 286, 0, 240) - MCFG_SCREEN_UPDATE_DRIVER(twincobr_state, screen_update_toaplan0) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram16", buffered_spriteram16_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, twincobr_state, twincobr_vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(28_MHz_XTAL/4, 446, 0, 320, 286, 0, 240); + m_screen->set_screen_update(FUNC(twincobr_state::screen_update_toaplan0)); + m_screen->screen_vblank().set(m_spriteram16, FUNC(buffered_spriteram16_device::vblank_copy_rising)); + m_screen->screen_vblank().append(FUNC(twincobr_state::twincobr_vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_twincobr) MCFG_PALETTE_ADD("palette", 1792) diff --git a/src/mame/drivers/undrfire.cpp b/src/mame/drivers/undrfire.cpp index 20a78331f82..7003fbaf22f 100644 --- a/src/mame/drivers/undrfire.cpp +++ b/src/mame/drivers/undrfire.cpp @@ -573,17 +573,17 @@ MACHINE_CONFIG_START(undrfire_state::undrfire) MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("INPUTS0")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("INPUTS1")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("INPUTS2")) - MCFG_TC0510NIO_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_INPUT(READLINE(*this, undrfire_state, frame_counter_r)) MCFG_DEVCB_BIT(0) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, undrfire_state, coin_word_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("SYSTEM")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_0_callback().set_ioport("INPUTS0"); + tc0510nio.read_1_callback().set_ioport("INPUTS1"); + tc0510nio.read_2_callback().set_ioport("INPUTS2"); + tc0510nio.read_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + tc0510nio.read_3_callback().append(FUNC(undrfire_state::frame_counter_r)).lshift(0); + tc0510nio.write_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(undrfire_state::coin_word_w)); + tc0510nio.read_7_callback().set_ioport("SYSTEM"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -636,17 +636,17 @@ MACHINE_CONFIG_START(undrfire_state::cbombers) MCFG_ADC0808_EOC_FF_CB(INPUTLINE("maincpu", 5)) MCFG_ADC0808_IN0_CB(IOPORT("STEER")) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("INPUTS0")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("INPUTS1")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("INPUTS2")) - MCFG_TC0510NIO_READ_3_CB(READLINE("eeprom", eeprom_serial_93cxx_device, do_read)) MCFG_DEVCB_BIT(7) - MCFG_DEVCB_CHAIN_INPUT(READLINE(*this, undrfire_state, frame_counter_r)) MCFG_DEVCB_BIT(0) - MCFG_TC0510NIO_WRITE_3_CB(WRITELINE("eeprom", eeprom_serial_93cxx_device, clk_write)) MCFG_DEVCB_BIT(5) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, di_write)) MCFG_DEVCB_BIT(6) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("eeprom", eeprom_serial_93cxx_device, cs_write)) MCFG_DEVCB_BIT(4) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, undrfire_state, coin_word_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("SYSTEM")) + tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0)); + tc0510nio.read_0_callback().set_ioport("INPUTS0"); + tc0510nio.read_1_callback().set_ioport("INPUTS1"); + tc0510nio.read_2_callback().set_ioport("INPUTS2"); + tc0510nio.read_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::do_read)).lshift(7); + tc0510nio.read_3_callback().append(FUNC(undrfire_state::frame_counter_r)).lshift(0); + tc0510nio.write_3_callback().set(m_eeprom, FUNC(eeprom_serial_93cxx_device::clk_write)).bit(5); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::di_write)).bit(6); + tc0510nio.write_3_callback().append(m_eeprom, FUNC(eeprom_serial_93cxx_device::cs_write)).bit(4); + tc0510nio.write_4_callback().set(FUNC(undrfire_state::coin_word_w)); + tc0510nio.read_7_callback().set_ioport("SYSTEM"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/unior.cpp b/src/mame/drivers/unior.cpp index 9cec34e40bb..237e7be8a30 100644 --- a/src/mame/drivers/unior.cpp +++ b/src/mame/drivers/unior.cpp @@ -396,19 +396,18 @@ MACHINE_CONFIG_START(unior_state::unior) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) + SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* Devices */ - MCFG_DEVICE_ADD("uart", I8251, 0) - - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(20'000'000) / 12) - MCFG_PIT8253_CLK1(XTAL(20'000'000) / 9) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_PIT8253_CLK2(XTAL(16'000'000) / 9 / 64) // unknown frequency - MCFG_PIT8253_OUT2_HANDLER(WRITELINE("speaker", speaker_sound_device, level_w)) + I8251(config, "uart", 0); + + PIT8253(config, m_pit, 0); + m_pit->set_clk<0>(20_MHz_XTAL / 12); + m_pit->set_clk<1>(20_MHz_XTAL / 9); + m_pit->out_handler<1>().set("uart", FUNC(i8251_device::write_txc)); + m_pit->out_handler<1>().append("uart", FUNC(i8251_device::write_rxc)); + m_pit->set_clk<1>(16_MHz_XTAL / 9 / 64); // unknown frequency + m_pit->out_handler<2>().set("speaker", FUNC(speaker_sound_device::level_w)); MCFG_DEVICE_ADD("ppi0", I8255, 0) // ports a & c connect to an external slot diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp index 9f175aadaca..e90ca7d3dbb 100644 --- a/src/mame/drivers/univac.cpp +++ b/src/mame/drivers/univac.cpp @@ -332,24 +332,24 @@ MACHINE_CONFIG_START(univac_state::uts20) MCFG_NVRAM_ADD_1FILL("nvram") - MCFG_DEVICE_ADD("ctc_clock", CLOCK, 2000000) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg2)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(4'000'000)) - MCFG_Z80CTC_INTR_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80CTC_ZC1_CB(WRITELINE("uart", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", z80sio_device, rxca_w)) - MCFG_Z80CTC_ZC2_CB(WRITELINE("uart", z80sio_device, rxtxcb_w)) - - MCFG_DEVICE_ADD("uart", Z80SIO, XTAL(4'000'000)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("uart", z80sio_device, rxa_w)) // FIXME: hacked in permanent loopback to pass test - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("uart", z80sio_device, rxb_w)) // FIXME: hacked in permanent loopback to pass test - MCFG_Z80SIO_OUT_WRDYB_CB(WRITELINE("uart", z80sio_device, dcdb_w)) // FIXME: hacked in permanent loopback to pass test - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", z80sio_device, ctsb_w)) // FIXME: hacked in permanent loopback to pass test + clock_device &ctc_clock(CLOCK(config, "ctc_clock", 2000000)); + ctc_clock.signal_handler().set(m_ctc, FUNC(z80ctc_device::trg0)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg1)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg2)); + ctc_clock.signal_handler().append(m_ctc, FUNC(z80ctc_device::trg3)); + + Z80CTC(config, m_ctc, 4_MHz_XTAL); + m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_ctc->zc_callback<1>().set(m_uart, FUNC(z80sio_device::txca_w)); + m_ctc->zc_callback<1>().append(m_uart, FUNC(z80sio_device::rxca_w)); + m_ctc->zc_callback<2>().set(m_uart, FUNC(z80sio_device::rxtxcb_w)); + + Z80SIO(config, m_uart, 4_MHz_XTAL); + m_uart->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_uart->out_txda_callback().set(m_uart, FUNC(z80sio_device::rxa_w)); // FIXME: hacked in permanent loopback to pass test + m_uart->out_txdb_callback().set(m_uart, FUNC(z80sio_device::rxb_w)); // FIXME: hacked in permanent loopback to pass test + m_uart->out_wrdyb_callback().set(m_uart, FUNC(z80sio_device::dcdb_w)); // FIXME: hacked in permanent loopback to pass test + m_uart->out_wrdyb_callback().append(m_uart, FUNC(z80sio_device::ctsb_w)); // FIXME: hacked in permanent loopback to pass test /* Sound */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/v100.cpp b/src/mame/drivers/v100.cpp index 5eaa2cc6080..bf4d47a2bec 100644 --- a/src/mame/drivers/v100.cpp +++ b/src/mame/drivers/v100.cpp @@ -368,24 +368,24 @@ MACHINE_CONFIG_START(v100_state::v100) MCFG_SCREEN_RAW_PARAMS(XTAL(47'736'000), 170 * CHAR_WIDTH, 0, 132 * CHAR_WIDTH, 312, 0, 240) MCFG_SCREEN_UPDATE_DRIVER(v100_state, screen_update) - MCFG_DEVICE_ADD("vtac", CRT5037, XTAL(47'736'000) / CHAR_WIDTH) - MCFG_TMS9927_CHAR_WIDTH(CHAR_WIDTH) - MCFG_VIDEO_SET_SCREEN("screen") - MCFG_TMS9927_HSYN_CALLBACK(WRITELINE(*this, v100_state, picu_r_w<7>)) MCFG_DEVCB_INVERT - MCFG_TMS9927_VSYN_CALLBACK(WRITELINE(*this, v100_state, picu_r_w<6>)) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("picu", I8214, XTAL(47'736'000) / 12) - MCFG_I8214_INT_CALLBACK(ASSERTLINE("maincpu", 0)) - - MCFG_DEVICE_ADD("ppi", I8255, 0) - MCFG_I8255_OUT_PORTA_CB(WRITE8(*this, v100_state, ppi_porta_w)) - MCFG_I8255_OUT_PORTB_CB(WRITELINE("earom", er1400_device, c3_w)) MCFG_DEVCB_BIT(6) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("earom", er1400_device, c2_w)) MCFG_DEVCB_BIT(5) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("earom", er1400_device, c1_w)) MCFG_DEVCB_BIT(4) MCFG_DEVCB_INVERT - MCFG_I8255_OUT_PORTC_CB(WRITELINE("earom", er1400_device, data_w)) MCFG_DEVCB_BIT(6) MCFG_DEVCB_INVERT - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("earom", er1400_device, clock_w)) MCFG_DEVCB_BIT(0) MCFG_DEVCB_INVERT - - MCFG_DEVICE_ADD("earom", ER1400, 0) + CRT5037(config, m_vtac, XTAL(47'736'000) / CHAR_WIDTH); + m_vtac->set_char_width(CHAR_WIDTH); + m_vtac->set_screen("screen"); + m_vtac->hsyn_wr_callback().set(FUNC(v100_state::picu_r_w<7>)).invert(); + m_vtac->vsyn_wr_callback().set(FUNC(v100_state::picu_r_w<6>)).invert(); + + I8214(config, m_picu, XTAL(47'736'000) / 12); + m_picu->int_wr_callback().set_inputline(m_maincpu, 0, ASSERT_LINE); + + i8255_device &ppi(I8255(config, "ppi", 0)); + ppi.out_pa_callback().set(FUNC(v100_state::ppi_porta_w)); + ppi.out_pb_callback().set(m_earom, FUNC(er1400_device::c3_w)).bit(6).invert(); + ppi.out_pb_callback().append(m_earom, FUNC(er1400_device::c2_w)).bit(5).invert(); + ppi.out_pb_callback().append(m_earom, FUNC(er1400_device::c1_w)).bit(4).invert(); + ppi.out_pc_callback().set(m_earom, FUNC(er1400_device::data_w)).bit(6).invert(); + ppi.out_pc_callback().append(m_earom, FUNC(er1400_device::clock_w)).bit(0).invert(); + + ER1400(config, m_earom, 0); MACHINE_CONFIG_END diff --git a/src/mame/drivers/v1050.cpp b/src/mame/drivers/v1050.cpp index ac4654ec574..473fc8ff429 100644 --- a/src/mame/drivers/v1050.cpp +++ b/src/mame/drivers/v1050.cpp @@ -1109,13 +1109,13 @@ MACHINE_CONFIG_START(v1050_state::v1050) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":3", v1050_floppies, nullptr, floppy_image_device::default_floppy_formats) // SASI bus - MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("scsi_data_in") - MCFG_SCSI_REQ_HANDLER(WRITELINE("scsi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_BSY_HANDLER(WRITELINE("scsi_ctrl_in", input_buffer_device, write_bit1)) - MCFG_SCSI_MSG_HANDLER(WRITELINE("scsi_ctrl_in", input_buffer_device, write_bit2)) - MCFG_SCSI_CD_HANDLER(WRITELINE("scsi_ctrl_in", input_buffer_device, write_bit3)) - MCFG_SCSI_IO_HANDLER(WRITELINE(*this, v1050_state, write_sasi_io)) MCFG_DEVCB_XOR(1) // bit4 + SCSI_PORT(config, m_sasibus, 0); + m_sasibus->set_data_input_buffer("scsi_data_in"); + m_sasibus->req_handler().set("scsi_ctrl_in", FUNC(input_buffer_device::write_bit0)).exor(1); + m_sasibus->bsy_handler().set("scsi_ctrl_in", FUNC(input_buffer_device::write_bit1)); + m_sasibus->msg_handler().set("scsi_ctrl_in", FUNC(input_buffer_device::write_bit2)); + m_sasibus->cd_handler().set("scsi_ctrl_in", FUNC(input_buffer_device::write_bit3)); + m_sasibus->io_handler().set(FUNC(v1050_state::write_sasi_io)).exor(1); // bit4 MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", S1410, SCSI_ID_0) MCFG_SCSI_OUTPUT_LATCH_ADD("scsi_data_out", SASIBUS_TAG) diff --git a/src/mame/drivers/v550.cpp b/src/mame/drivers/v550.cpp index 40a85747775..8c8fa969dd5 100644 --- a/src/mame/drivers/v550.cpp +++ b/src/mame/drivers/v550.cpp @@ -117,11 +117,11 @@ MACHINE_CONFIG_START(v550_state::v550) MCFG_COM8116_FT_HANDLER(WRITELINE("mpsc", upd7201_new_device, txca_w)) MCFG_COM8116_FR_HANDLER(WRITELINE("mpsc", upd7201_new_device, rxca_w)) - MCFG_DEVICE_ADD("brg2", COM8116, 5068800) // actually SMC COM8116T-020 - MCFG_COM8116_FT_HANDLER(WRITELINE("mpsc", upd7201_new_device, txcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mpsc", upd7201_new_device, rxcb_w)) - MCFG_COM8116_FR_HANDLER(WRITELINE("usart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("usart", i8251_device, write_rxc)) + com8116_device &brg2(COM8116(config, "brg2", 5068800)); // actually SMC COM8116T-020 + brg2.ft_handler().set("mpsc", FUNC(upd7201_new_device::txcb_w)); + brg2.ft_handler().append("mpsc", FUNC(upd7201_new_device::rxcb_w)); + brg2.fr_handler().set("usart", FUNC(i8251_device::write_txc)); + brg2.fr_handler().append("usart", FUNC(i8251_device::write_rxc)); MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_RAW_PARAMS(16'248'600, 918, 0, 720, 295, 0, 272) diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp index 1b90d14fa59..0601684f2e1 100644 --- a/src/mame/drivers/v6809.cpp +++ b/src/mame/drivers/v6809.cpp @@ -331,15 +331,15 @@ MACHINE_CONFIG_START(v6809_state::v6809) MCFG_PTM6840_O2_CB(WRITELINE(*this, v6809_state, speaker_en_w)) MCFG_PTM6840_IRQ_CB(INPUTLINE("maincpu", M6809_IRQ_LINE)) - MCFG_DEVICE_ADD("acia0", ACIA6850, 0) + ACIA6850(config, "acia0", 0); - MCFG_DEVICE_ADD("acia1", ACIA6850, 0) + ACIA6850(config, "acia1", 0); - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia0", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia0", acia6850_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia1", acia6850_device, write_rxc)) + clock_device &acia_clock(CLOCK(config, "acia_clock", 153600)); + acia_clock.signal_handler().set("acia0", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia0", FUNC(acia6850_device::write_rxc)); + acia_clock.signal_handler().append("acia1", FUNC(acia6850_device::write_txc)); + acia_clock.signal_handler().append("acia1", FUNC(acia6850_device::write_rxc)); MCFG_DEVICE_ADD("rtc", MM58274C, 0) // this is all guess diff --git a/src/mame/drivers/vaportra.cpp b/src/mame/drivers/vaportra.cpp index 0edc8e45efb..6b6700ae286 100644 --- a/src/mame/drivers/vaportra.cpp +++ b/src/mame/drivers/vaportra.cpp @@ -273,8 +273,8 @@ MACHINE_CONFIG_START(vaportra_state::vaportra) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, 0)) + GENERIC_LATCH_8(config, m_soundlatch); + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0); MCFG_DEVICE_ADD("ym1", YM2203, XTAL(32'220'000)/8) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.60) diff --git a/src/mame/drivers/vastar.cpp b/src/mame/drivers/vastar.cpp index 79bd42bef2b..e1c30f5a8a0 100644 --- a/src/mame/drivers/vastar.cpp +++ b/src/mame/drivers/vastar.cpp @@ -432,10 +432,10 @@ MACHINE_CONFIG_START(vastar_state::vastar) MCFG_QUANTUM_TIME(attotime::from_hz(600)) /* 10 CPU slices per frame - seems enough to ensure proper synchronization of the CPUs */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, vastar_state, nmi_mask_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, vastar_state, flip_screen_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(INPUTLINE("sub", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT + ls259_device &mainlatch(LS259(config, "mainlatch")); + mainlatch.q_out_cb<0>().set(FUNC(vastar_state::nmi_mask_w)); + mainlatch.q_out_cb<1>().set(FUNC(vastar_state::flip_screen_w)); + mainlatch.q_out_cb<2>().set_inputline(m_subcpu, INPUT_LINE_RESET).invert(); MCFG_WATCHDOG_ADD("watchdog") diff --git a/src/mame/drivers/vector4.cpp b/src/mame/drivers/vector4.cpp index 6a2ccb41ada..ed4b62df819 100644 --- a/src/mame/drivers/vector4.cpp +++ b/src/mame/drivers/vector4.cpp @@ -74,13 +74,13 @@ MACHINE_CONFIG_START(vector4_state::vector4) MCFG_DEVICE_IO_MAP(vector4_io) /* video hardware */ - MCFG_DEVICE_ADD("uart_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("uart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart1", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart2", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart3", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart3", i8251_device, write_rxc)) + clock_device &uart_clock(CLOCK(config, "uart_clock", 153600)); + uart_clock.signal_handler().set("uart1", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart1", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart2", FUNC(i8251_device::write_rxc)); + uart_clock.signal_handler().append("uart3", FUNC(i8251_device::write_txc)); + uart_clock.signal_handler().append("uart3", FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD("uart1", I8251, 0) MCFG_I8251_TXD_HANDLER(WRITELINE("rs232a", rs232_port_device, write_txd)) diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp index c048e2e2e21..9ad6d577c79 100644 --- a/src/mame/drivers/victor9k.cpp +++ b/src/mame/drivers/victor9k.cpp @@ -60,7 +60,6 @@ #define RS232_B_TAG "rs232b" #define SCREEN_TAG "screen" #define KB_TAG "kb" -#define FDC_TAG "fdc" class victor9k_state : public driver_device { @@ -79,7 +78,7 @@ public: m_crtc(*this, HD46505S_TAG), m_ram(*this, RAM_TAG), m_kb(*this, KB_TAG), - m_fdc(*this, FDC_TAG), + m_fdc(*this, "fdc"), m_centronics(*this, "centronics"), m_rs232a(*this, RS232_A_TAG), m_rs232b(*this, RS232_B_TAG), @@ -783,10 +782,10 @@ MACHINE_CONFIG_START(victor9k_state::victor9k) MCFG_VICTOR9K_KBRDY_HANDLER(WRITELINE(*this, victor9k_state, kbrdy_w)) MCFG_VICTOR9K_KBDATA_HANDLER(WRITELINE(*this, victor9k_state, kbdata_w)) - MCFG_DEVICE_ADD(FDC_TAG, VICTOR_9000_FDC, 0) - MCFG_VICTOR_9000_FDC_IRQ_CB(WRITELINE(*this, victor9k_state, fdc_irq_w)) - MCFG_VICTOR_9000_FDC_SYN_CB(WRITELINE(I8259A_TAG, pic8259_device, ir0_w)) MCFG_DEVCB_XOR(1) - MCFG_VICTOR_9000_FDC_LBRDY_CB(INPUTLINE(I8088_TAG, INPUT_LINE_TEST)) MCFG_DEVCB_XOR(1) + VICTOR_9000_FDC(config, m_fdc, 0); + m_fdc->irq_wr_callback().set(FUNC(victor9k_state::fdc_irq_w)); + m_fdc->syn_wr_callback().set(I8259A_TAG, FUNC(pic8259_device::ir0_w)).invert(); + m_fdc->lbrdy_wr_callback().set_inputline(I8088_TAG, INPUT_LINE_TEST).invert(); // internal ram MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mame/drivers/vip.cpp b/src/mame/drivers/vip.cpp index 3a6ffe8385a..6544d79cbf0 100644 --- a/src/mame/drivers/vip.cpp +++ b/src/mame/drivers/vip.cpp @@ -719,7 +719,7 @@ MACHINE_CONFIG_START(vip_state::vip) MCFG_DEVICE_ADD(CDP1802_TAG, CDP1802, XTAL(3'521'280)/2) MCFG_DEVICE_PROGRAM_MAP(vip_mem) MCFG_DEVICE_IO_MAP(vip_io) - MCFG_COSMAC_WAIT_CALLBACK(VCC) + MCFG_COSMAC_WAIT_CALLBACK(CONSTANT(1)) MCFG_COSMAC_CLEAR_CALLBACK(READLINE(*this, vip_state, clear_r)) MCFG_COSMAC_EF1_CALLBACK(READLINE(*this, vip_state, ef1_r)) MCFG_COSMAC_EF2_CALLBACK(READLINE(*this, vip_state, ef2_r)) diff --git a/src/mame/drivers/votrpss.cpp b/src/mame/drivers/votrpss.cpp index b8eb8d2b0ee..fadb8fea0bd 100644 --- a/src/mame/drivers/votrpss.cpp +++ b/src/mame/drivers/votrpss.cpp @@ -277,12 +277,12 @@ MACHINE_CONFIG_START(votrpss_state::votrpss) MCFG_RS232_DSR_HANDLER(WRITELINE("uart", i8251_device, write_dsr)) MCFG_RS232_CTS_HANDLER(WRITELINE("uart", i8251_device, write_cts)) - MCFG_DEVICE_ADD("pit", PIT8253, 0) - MCFG_PIT8253_CLK0(XTAL(8'000'000)) /* Timer 0: baud rate gen for 8251 */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("uart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("uart", i8251_device, write_rxc)) - MCFG_PIT8253_CLK1(XTAL(8'000'000) / 256) /* Timer 1: Pitch */ - MCFG_PIT8253_CLK2(XTAL(8'000'000) / 4096) /* Timer 2: Volume */ + pit8253_device &pit(PIT8253(config, "pit", 0)); + pit.set_clk<0>(8_MHz_XTAL); // Timer 0: baud rate gen for 8251 + pit.out_handler<0>().set("uart", FUNC(i8251_device::write_txc)); + pit.out_handler<0>().append("uart", FUNC(i8251_device::write_rxc)); + pit.set_clk<1>(8_MHz_XTAL / 256); // Timer 1: Pitch + pit.set_clk<2>(8_MHz_XTAL / 4096); // Timer 2: Volume MCFG_DEVICE_ADD("ppi", I8255, 0) MCFG_I8255_IN_PORTA_CB(READ8(*this, votrpss_state, ppi_pa_r)) diff --git a/src/mame/drivers/votrtnt.cpp b/src/mame/drivers/votrtnt.cpp index e44b71bec01..2c3c0e9c7f7 100644 --- a/src/mame/drivers/votrtnt.cpp +++ b/src/mame/drivers/votrtnt.cpp @@ -156,9 +156,9 @@ MACHINE_CONFIG_START(votrtnt_state::votrtnt) MCFG_RS232_RXD_HANDLER(WRITELINE("acia", acia6850_device, write_rxd)) MCFG_RS232_CTS_HANDLER(WRITELINE("acia", acia6850_device, write_cts)) - MCFG_DEVICE_ADD("acia_clock", CLOCK, 153600) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("acia", acia6850_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("acia", acia6850_device, write_rxc)) + CLOCK(config, m_clock, 153600); + m_clock->signal_handler().set("acia", FUNC(acia6850_device::write_txc)); + m_clock->signal_handler().append("acia", FUNC(acia6850_device::write_rxc)); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/vt100.cpp b/src/mame/drivers/vt100.cpp index a037d29b416..994f9e3bf3c 100644 --- a/src/mame/drivers/vt100.cpp +++ b/src/mame/drivers/vt100.cpp @@ -351,11 +351,11 @@ MACHINE_CONFIG_START(vt100_state::vt100) MCFG_RS232_RXD_HANDLER(WRITELINE("pusart", i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(WRITELINE("pusart", i8251_device, write_dsr)) - MCFG_DEVICE_ADD("dbrg", COM5016_013, XTAL(24'883'200) / 9) // COM5016T-013 (or WD1943CD-02), 2.7648Mhz Clock - MCFG_COM8116_FR_HANDLER(WRITELINE("pusart", i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE("pusart", i8251_device, write_txc)) + com8116_device &dbrg(COM5016_013(config, "dbrg", XTAL(24'883'200) / 9)); // COM5016T-013 (or WD1943CD-02), 2.7648Mhz Clock + dbrg.fr_handler().set(m_pusart, FUNC(i8251_device::write_rxc)); + dbrg.ft_handler().set(m_pusart, FUNC(i8251_device::write_txc)); - MCFG_DEVICE_ADD("nvr", ER1400, 0) + ER1400(config, m_nvr, 0); MCFG_DEVICE_ADD("keyboard", VT100_KEYBOARD, 0) MCFG_VT100_KEYBOARD_SIGNAL_OUT_CALLBACK(WRITELINE("kbduart", ay31015_device, write_si)) @@ -403,21 +403,17 @@ MACHINE_CONFIG_START(vt100_state::vt100ac) MCFG_I8251_RXRDY_HANDLER(WRITELINE("stprxint", input_merger_device, in_w<2>)) MCFG_I8251_TXRDY_HANDLER(WRITELINE("stptxint", input_merger_device, in_w<2>)) - MCFG_INPUT_MERGER_ANY_HIGH("stptxint") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("stpcpu", I8085_RST55_LINE)) + INPUT_MERGER_ANY_HIGH(config, "stptxint").output_handler().set_inputline("stpcpu", I8085_RST55_LINE); - MCFG_INPUT_MERGER_ANY_HIGH("stprxint") - MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("stpcpu", I8085_RST65_LINE)) + INPUT_MERGER_ANY_HIGH(config, "stprxint").output_handler().set_inputline("stpcpu", I8085_RST65_LINE); - MCFG_DEVICE_MODIFY("dbrg") - MCFG_COM8116_FR_HANDLER(WRITELINE("pusart", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart0", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart1", i8251_device, write_rxc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart2", i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE("pusart", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart0", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart1", i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("stpusart2", i8251_device, write_txc)) + com8116_device &dbrg(*subdevice("dbrg")); + dbrg.fr_handler().append("stpusart0", FUNC(i8251_device::write_rxc)); + dbrg.fr_handler().append("stpusart1", FUNC(i8251_device::write_rxc)); + dbrg.fr_handler().append("stpusart2", FUNC(i8251_device::write_rxc)); + dbrg.ft_handler().append("stpusart0", FUNC(i8251_device::write_txc)); + dbrg.ft_handler().append("stpusart1", FUNC(i8251_device::write_txc)); + dbrg.ft_handler().append("stpusart2", FUNC(i8251_device::write_txc)); MACHINE_CONFIG_END MACHINE_CONFIG_START(vt100_state::vt180) diff --git a/src/mame/drivers/vta2000.cpp b/src/mame/drivers/vta2000.cpp index 49c8c4ce57d..5329285bbba 100644 --- a/src/mame/drivers/vta2000.cpp +++ b/src/mame/drivers/vta2000.cpp @@ -190,27 +190,27 @@ PALETTE_INIT_MEMBER(vta2000_state, vta2000) MACHINE_CONFIG_START(vta2000_state::vta2000) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8080, XTAL(4'000'000) / 4) + MCFG_DEVICE_ADD(m_maincpu, I8080, XTAL(4'000'000) / 4) MCFG_DEVICE_PROGRAM_MAP(mem_map) MCFG_DEVICE_IO_MAP(io_map) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic", pic8259_device, inta_cb) - MCFG_DEVICE_ADD("mainpit", PIT8253, 0) - MCFG_PIT8253_CLK0(500'000) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, vta2000_state, speaker_w)) + PIT8253(config, m_mainpit, 0); + m_mainpit->set_clk<0>(500'000); + m_mainpit->out_handler<0>().set(FUNC(vta2000_state::speaker_w)); - MCFG_DEVICE_ADD("pic", PIC8259, 0) - MCFG_PIC8259_IN_SP_CB(GND) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) + pic8259_device &pic(PIC8259(config, "pic", 0)); + pic.in_sp_callback().set_constant(0); + pic.out_int_callback().set_inputline(m_maincpu, 0); - MCFG_DEVICE_ADD("usart", I8251, XTAL(4'000'000) / 4) - MCFG_I8251_RXRDY_HANDLER(WRITELINE("pic", pic8259_device, ir4_w)) + i8251_device &usart(I8251(config, "usart", XTAL(4'000'000) / 4)); + usart.rxrdy_handler().set("pic", FUNC(pic8259_device::ir4_w)); - MCFG_DEVICE_ADD("brgpit", PIT8253, 0) - MCFG_PIT8253_CLK0(1228800) // maybe - MCFG_PIT8253_CLK1(1228800) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("usart", i8251_device, write_rxc)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE("usart", i8251_device, write_txc)) // or vice versa? + pit8253_device &brgpit(PIT8253(config, "brgpit", 0)); + brgpit.set_clk<0>(1'228'800); // maybe + brgpit.set_clk<1>(1'228'800); + brgpit.out_handler<0>().set("usart", FUNC(i8251_device::write_rxc)); + brgpit.out_handler<1>().set("usart", FUNC(i8251_device::write_txc)); // or vice versa? /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/vtech1.cpp b/src/mame/drivers/vtech1.cpp index 445b4626ae9..6d9f22189fd 100644 --- a/src/mame/drivers/vtech1.cpp +++ b/src/mame/drivers/vtech1.cpp @@ -446,11 +446,11 @@ MACHINE_CONFIG_START(vtech1_state::laser110) // video hardware MCFG_SCREEN_MC6847_PAL_ADD("screen", "mc6847") - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL(4'433'619)) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(*this, vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_BW(true) - MCFG_MC6847_FIXED_MODE(mc6847_pal_device::MODE_GM1) + MC6847_PAL(config, m_mc6847, XTAL(4'433'619)); + m_mc6847->fsync_wr_callback().set_inputline(m_maincpu, 0).invert(); + m_mc6847->input_callback().set(FUNC(vtech1_state::mc6847_videoram_r)); + m_mc6847->set_black_and_white(true); + m_mc6847->set_get_fixed_mode(mc6847_pal_device::MODE_GM1); // GM2 = GND, GM0 = GND, INTEXT = GND // other lines not connected @@ -476,16 +476,16 @@ MACHINE_CONFIG_START(vtech1_state::laser110) MCFG_SOFTWARE_LIST_ADD("cass_list", "vz_cass") MACHINE_CONFIG_END -MACHINE_CONFIG_START(vtech1_state::laser200) +void vtech1_state::laser200(machine_config &config) +{ laser110(config); - MCFG_DEVICE_REMOVE("mc6847") - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL(4'433'619)) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(*this, vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_FIXED_MODE(mc6847_pal_device::MODE_GM1) + MC6847_PAL(config.replace(), m_mc6847, XTAL(4'433'619)); + m_mc6847->fsync_wr_callback().set_inputline(m_maincpu, 0).invert(); + m_mc6847->input_callback().set(FUNC(vtech1_state::mc6847_videoram_r)); + m_mc6847->set_get_fixed_mode(mc6847_pal_device::MODE_GM1); // GM2 = GND, GM0 = GND, INTEXT = GND // other lines not connected -MACHINE_CONFIG_END +} MACHINE_CONFIG_START(vtech1_state::laser210) laser200(config); @@ -505,11 +505,10 @@ MACHINE_CONFIG_START(vtech1_state::laser310h) MCFG_DEVICE_MODIFY("maincpu") MCFG_DEVICE_IO_MAP(vtech1_shrg_io) - MCFG_DEVICE_REMOVE("mc6847") - MCFG_DEVICE_ADD("mc6847", MC6847_PAL, XTAL(4'433'619)) - MCFG_MC6847_FSYNC_CALLBACK(INPUTLINE("maincpu", 0)) MCFG_DEVCB_INVERT - MCFG_MC6847_INPUT_CALLBACK(READ8(*this, vtech1_state, mc6847_videoram_r)) - MCFG_MC6847_FIXED_MODE(mc6847_pal_device::MODE_GM1) + MC6847_PAL(config.replace(), m_mc6847, XTAL(4'433'619)); + m_mc6847->fsync_wr_callback().set_inputline(m_maincpu, 0).invert(); + m_mc6847->input_callback().set(FUNC(vtech1_state::mc6847_videoram_r)); + m_mc6847->set_get_fixed_mode(mc6847_pal_device::MODE_GM1); // INTEXT = GND // other lines not connected MACHINE_CONFIG_END diff --git a/src/mame/drivers/wardner.cpp b/src/mame/drivers/wardner.cpp index 3df24c22a91..e5d752ad325 100644 --- a/src/mame/drivers/wardner.cpp +++ b/src/mame/drivers/wardner.cpp @@ -427,13 +427,13 @@ MACHINE_CONFIG_START(wardner_state::wardner) MCFG_DEVICE_ADD("spriteram8", BUFFERED_SPRITERAM8) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK) - MCFG_SCREEN_RAW_PARAMS(XTAL(14'000'000)/2, 446, 0, 320, 286, 0, 240) - MCFG_SCREEN_UPDATE_DRIVER(wardner_state, screen_update_toaplan0) - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram8", buffered_spriteram8_device, vblank_copy_rising)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(*this, wardner_state, wardner_vblank_irq)) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK); + m_screen->set_raw(14_MHz_XTAL/2, 446, 0, 320, 286, 0, 240); + m_screen->set_screen_update(FUNC(wardner_state::screen_update_toaplan0)); + m_screen->screen_vblank().set(m_spriteram8, FUNC(buffered_spriteram8_device::vblank_copy_rising)); + m_screen->screen_vblank().append(FUNC(wardner_state::wardner_vblank_irq)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wardner) MCFG_PALETTE_ADD("palette", 1792) diff --git a/src/mame/drivers/warriorb.cpp b/src/mame/drivers/warriorb.cpp index c17913044e3..c1826bc9003 100644 --- a/src/mame/drivers/warriorb.cpp +++ b/src/mame/drivers/warriorb.cpp @@ -445,13 +445,13 @@ MACHINE_CONFIG_START(warriorb_state::darius2d) MCFG_DEVICE_ADD("audiocpu", Z80,16000000/4) /* 4 MHz ? */ MCFG_DEVICE_PROGRAM_MAP(z80_sound_map) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, warriorb_state, coin_control_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(warriorb_state::coin_control_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_warriorb) @@ -529,13 +529,13 @@ MACHINE_CONFIG_START(warriorb_state::warriorb) MCFG_DEVICE_ADD("audiocpu", Z80,16000000/4) /* 4 MHz ? */ MCFG_DEVICE_PROGRAM_MAP(z80_sound_map) - MCFG_DEVICE_ADD("tc0510nio", TC0510NIO, 0) - MCFG_TC0510NIO_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0510NIO_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0510NIO_READ_2_CB(IOPORT("IN0")) - MCFG_TC0510NIO_READ_3_CB(IOPORT("IN1")) - MCFG_TC0510NIO_WRITE_4_CB(WRITE8(*this, warriorb_state, coin_control_w)) - MCFG_TC0510NIO_READ_7_CB(IOPORT("IN2")) + TC0510NIO(config, m_tc0510nio, 0); + m_tc0510nio->read_0_callback().set_ioport("DSWA"); + m_tc0510nio->read_1_callback().set_ioport("DSWB"); + m_tc0510nio->read_2_callback().set_ioport("IN0"); + m_tc0510nio->read_3_callback().set_ioport("IN1"); + m_tc0510nio->write_4_callback().set(FUNC(warriorb_state::coin_control_w)); + m_tc0510nio->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_warriorb) diff --git a/src/mame/drivers/wgp.cpp b/src/mame/drivers/wgp.cpp index 3994fbfd3e2..ed34c8b6136 100644 --- a/src/mame/drivers/wgp.cpp +++ b/src/mame/drivers/wgp.cpp @@ -922,13 +922,13 @@ MACHINE_CONFIG_START(wgp_state::wgp) MCFG_QUANTUM_TIME(attotime::from_hz(30000)) - MCFG_DEVICE_ADD("tc0220ioc", TC0220IOC, 0) - MCFG_TC0220IOC_READ_0_CB(IOPORT("DSWA")) - MCFG_TC0220IOC_READ_1_CB(IOPORT("DSWB")) - MCFG_TC0220IOC_READ_2_CB(IOPORT("IN0")) - MCFG_TC0220IOC_READ_3_CB(IOPORT("IN1")) - MCFG_TC0220IOC_WRITE_4_CB(WRITE8(*this, wgp_state, coins_w)) - MCFG_TC0220IOC_READ_7_CB(IOPORT("IN2")) + TC0220IOC(config, m_tc0220ioc, 0); + m_tc0220ioc->read_0_callback().set_ioport("DSWA"); + m_tc0220ioc->read_1_callback().set_ioport("DSWB"); + m_tc0220ioc->read_2_callback().set_ioport("IN0"); + m_tc0220ioc->read_3_callback().set_ioport("IN1"); + m_tc0220ioc->write_4_callback().set(FUNC(wgp_state::coins_w)); + m_tc0220ioc->read_7_callback().set_ioport("IN2"); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp index b4e18258a95..7a9b7b308a1 100644 --- a/src/mame/drivers/wicat.cpp +++ b/src/mame/drivers/wicat.cpp @@ -827,15 +827,15 @@ MACHINE_CONFIG_START(wicat_state::wicat) MCFG_RS232_DSR_HANDLER(WRITELINE("uart5",mc2661_device,dsr_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("uart5",mc2661_device,cts_w)) - MCFG_DEVICE_ADD("ledlatch", LS259, 0) // U19 on I/O board - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, wicat_state, adir_w)) - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, wicat_state, bdir_w)) - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(OUTPUT("led1")) MCFG_DEVCB_INVERT // 0 = on, 1 = off - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(OUTPUT("led2")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(OUTPUT("led3")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(OUTPUT("led4")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(OUTPUT("led5")) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(OUTPUT("led6")) MCFG_DEVCB_INVERT + ls259_device &ledlatch(LS259(config, "ledlatch")); // U19 on I/O board + ledlatch.q_out_cb<0>().set(FUNC(wicat_state::adir_w)); + ledlatch.q_out_cb<1>().set(FUNC(wicat_state::bdir_w)); + ledlatch.q_out_cb<2>().set_output("led1").invert(); // 0 = on, 1 = off + ledlatch.q_out_cb<3>().set_output("led2").invert(); + ledlatch.q_out_cb<4>().set_output("led3").invert(); + ledlatch.q_out_cb<5>().set_output("led4").invert(); + ledlatch.q_out_cb<6>().set_output("led5").invert(); + ledlatch.q_out_cb<7>().set_output("led6").invert(); /* video hardware */ MCFG_DEVICE_ADD("videocpu", Z8002, 8_MHz_XTAL/2) // AMD AMZ8002DC diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp index 07e043307bb..45098bf8bff 100644 --- a/src/mame/drivers/williams.cpp +++ b/src/mame/drivers/williams.cpp @@ -1584,14 +1584,13 @@ MACHINE_CONFIG_START(williams_state::williams_muxed) /* basic machine hardware */ /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) MCFG_DEVCB_MASK(0x30) - MCFG_DEVCB_CHAIN_INPUT(READ8("mux_0", ls157_device, output_r)) MCFG_DEVCB_MASK(0x0f) - MCFG_DEVCB_CHAIN_INPUT(READ8("mux_1", ls157_device, output_r)) MCFG_DEVCB_RSHIFT(-6) MCFG_DEVCB_MASK(0xc0) - MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) MCFG_DEVCB_MASK(0xfc) - MCFG_DEVCB_CHAIN_INPUT(READ8("mux_1", ls157_device, output_r)) MCFG_DEVCB_RSHIFT(2) MCFG_DEVCB_MASK(0x03) - MCFG_PIA_CB2_HANDLER(WRITELINE("mux_0", ls157_device, select_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mux_1", ls157_device, select_w)) + m_pia[0]->readpa_handler().set_ioport("IN0").mask(0x30); + m_pia[0]->readpa_handler().append("mux_0", FUNC(ls157_device::output_r)).mask(0x0f); + m_pia[0]->readpa_handler().append("mux_1", FUNC(ls157_device::output_r)).lshift(6).mask(0xc0); + m_pia[0]->readpb_handler().set_ioport("IN1").mask(0xfc); + m_pia[0]->readpb_handler().append("mux_1", FUNC(ls157_device::output_r)).rshift(2).mask(0x03); + m_pia[0]->cb2_handler().set("mux_0", FUNC(ls157_device::select_w)); + m_pia[0]->cb2_handler().append("mux_1", FUNC(ls157_device::select_w)); MCFG_DEVICE_ADD("mux_0", LS157, 0) // IC3 on interface board (actually LS257 with OC tied low) MCFG_74157_A_IN_CB(IOPORT("INP2")) @@ -1623,9 +1622,8 @@ MACHINE_CONFIG_START(williams_state::lottofun) /* basic machine hardware */ /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_WRITEPB_HANDLER(WRITELINE("ticket", ticket_dispenser_device, motor_w)) MCFG_DEVCB_BIT(7) - MCFG_PIA_CA2_HANDLER(WRITELINE(*this, williams_state, lottofun_coin_lock_w)) + m_pia[0]->writepa_handler().set("ticket", FUNC(ticket_dispenser_device::motor_w)).bit(7); + m_pia[0]->ca2_handler().set(FUNC(williams_state::lottofun_coin_lock_w)); MCFG_TICKET_DISPENSER_ADD("ticket", attotime::from_msec(70), TICKET_MOTOR_ACTIVE_LOW, TICKET_STATUS_ACTIVE_HIGH) MACHINE_CONFIG_END @@ -1710,11 +1708,10 @@ MACHINE_CONFIG_START(blaster_state::blaster) MCFG_DEVICE_PROGRAM_MAP(sound_map_b) /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPB_HANDLER(READ8("mux_b", ls157_device, output_r)) MCFG_DEVCB_MASK(0x0f) - MCFG_DEVCB_CHAIN_INPUT(IOPORT("IN1")) MCFG_DEVCB_MASK(0xf0) - MCFG_PIA_CB2_HANDLER(WRITELINE("mux_a", ls157_x2_device, select_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("mux_b", ls157_device, select_w)) + m_pia[0]->readpb_handler().set("mux_b", FUNC(ls157_device::output_r)).mask(0x0f); + m_pia[0]->readpb_handler().append_ioport("IN1").mask(0xf0); + m_pia[0]->cb2_handler().set("mux_a", FUNC(ls157_x2_device::select_w)); + m_pia[0]->cb2_handler().append("mux_b", FUNC(ls157_device::select_w)); MCFG_DEVICE_MODIFY("mux_a") // IC7 (for PA0-PA3) + IC5 (for PA4-PA7) MCFG_74157_A_IN_CB(READ8(*this, williams_state, williams_49way_port_0_r)) @@ -1805,23 +1802,23 @@ MACHINE_CONFIG_START(williams2_state::williams2) MCFG_INPUT_MERGER_ANY_HIGH("soundirq") MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("soundcpu", M6808_IRQ_LINE)) - MCFG_DEVICE_ADD("pia_0", PIA6821, 0) + MCFG_DEVICE_ADD(m_pia[0], PIA6821, 0) MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) MCFG_PIA_READPB_HANDLER(IOPORT("IN1")) - MCFG_DEVICE_ADD("pia_1", PIA6821, 0) + MCFG_DEVICE_ADD(m_pia[1], PIA6821, 0) MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) MCFG_PIA_WRITEPB_HANDLER(WRITE8(*this, williams2_state,williams2_snd_cmd_w)) MCFG_PIA_CB2_HANDLER(WRITELINE("pia_2", pia6821_device, ca1_w)) MCFG_PIA_IRQA_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<0>)) MCFG_PIA_IRQB_HANDLER(WRITELINE("mainirq", input_merger_any_high_device, in_w<1>)) - MCFG_DEVICE_ADD("pia_2", PIA6821, 0) - MCFG_PIA_WRITEPA_HANDLER(WRITE8("pia_1", pia6821_device, portb_w)) - MCFG_PIA_WRITEPB_HANDLER(WRITE8("dac", dac_byte_interface, data_w)) - MCFG_PIA_CA2_HANDLER(WRITELINE("pia_1", pia6821_device, cb1_w)) - MCFG_PIA_IRQA_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<0>)) - MCFG_PIA_IRQB_HANDLER(WRITELINE("soundirq", input_merger_any_high_device, in_w<1>)) + PIA6821(config, m_pia[2], 0); + m_pia[2]->writepa_handler().set(m_pia[1], FUNC(pia6821_device::portb_w)); + m_pia[2]->writepb_handler().set("dac", FUNC(dac_byte_interface::data_w)); + m_pia[2]->ca2_handler().set(m_pia[1], FUNC(pia6821_device::cb1_w)); + m_pia[2]->irqa_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<0>)); + m_pia[2]->irqb_handler().set("soundirq", FUNC(input_merger_any_high_device::in_w<1>)); MACHINE_CONFIG_END @@ -1897,10 +1894,9 @@ MACHINE_CONFIG_START(joust2_state::joust2) MCFG_MACHINE_RESET_OVERRIDE(joust2_state,joust2) /* pia */ - MCFG_DEVICE_MODIFY("pia_0") - MCFG_PIA_READPA_HANDLER(IOPORT("IN0")) MCFG_DEVCB_MASK(0xf0) - MCFG_DEVCB_CHAIN_INPUT(READ8("mux", ls157_device, output_r)) MCFG_DEVCB_MASK(0x0f) - MCFG_PIA_CA2_HANDLER(WRITELINE("mux", ls157_device, select_w)) + m_pia[0]->readpa_handler().set_ioport("IN0").mask(0xf0); + m_pia[0]->readpa_handler().append("mux", FUNC(ls157_device::output_r)).mask(0x0f); + m_pia[0]->ca2_handler().set("mux", FUNC(ls157_device::select_w)); MCFG_DEVICE_MODIFY("pia_1") MCFG_PIA_READPA_HANDLER(IOPORT("IN2")) diff --git a/src/mame/drivers/wiping.cpp b/src/mame/drivers/wiping.cpp index 63bfd7ae992..7dcdbdf8554 100644 --- a/src/mame/drivers/wiping.cpp +++ b/src/mame/drivers/wiping.cpp @@ -296,11 +296,11 @@ MACHINE_CONFIG_START(wiping_state::wiping) MCFG_DEVICE_PROGRAM_MAP(sound_map) MCFG_DEVICE_PERIODIC_INT_DRIVER(wiping_state, sound_timer_irq, 120) /* periodic interrupt, don't know about the frequency */ - MCFG_DEVICE_ADD("mainlatch", LS259, 0) // 5A - MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(*this, wiping_state, main_irq_mask_w)) // INT1 - MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(*this, wiping_state, sound_irq_mask_w)) // INT2 - MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(WRITELINE(*this, wiping_state, flipscreen_w)) // INV - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(INPUTLINE("audiocpu", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT // CP2RE + ls259_device &mainlatch(LS259(config, "mainlatch")); // 5A + mainlatch.q_out_cb<0>().set(FUNC(wiping_state::main_irq_mask_w)); // INT1 + mainlatch.q_out_cb<1>().set(FUNC(wiping_state::sound_irq_mask_w)); // INT2 + mainlatch.q_out_cb<2>().set(FUNC(wiping_state::flipscreen_w)); // INV + mainlatch.q_out_cb<3>().set_inputline(m_audiocpu, INPUT_LINE_RESET).invert(); // CP2RE MCFG_WATCHDOG_ADD("watchdog") @@ -321,8 +321,7 @@ MACHINE_CONFIG_START(wiping_state::wiping) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("wiping", WIPING_CUSTOM, 96000) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + WIPING_CUSTOM(config, "wiping", 96000).add_route(ALL_OUTPUTS, "mono", 1.0); MACHINE_CONFIG_END diff --git a/src/mame/drivers/xain.cpp b/src/mame/drivers/xain.cpp index b7daa797d0f..e8223e87616 100644 --- a/src/mame/drivers/xain.cpp +++ b/src/mame/drivers/xain.cpp @@ -484,7 +484,7 @@ MACHINE_CONFIG_START(xain_state::xsleena) MCFG_DEVICE_ADD(m_audiocpu, MC6809, PIXEL_CLOCK) // 68A09 MCFG_DEVICE_PROGRAM_MAP(sound_map) - MCFG_DEVICE_ADD(m_mcu, TAITO68705_MCU, MCU_CLOCK) + TAITO68705_MCU(config, m_mcu, MCU_CLOCK); MCFG_QUANTUM_PERFECT_CPU("maincpu") @@ -501,21 +501,20 @@ MACHINE_CONFIG_START(xain_state::xsleena) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_GENERIC_LATCH_8_ADD(m_soundlatch) - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, M6809_IRQ_LINE)) - - MCFG_DEVICE_ADD("ym1", YM2203, MCU_CLOCK) - MCFG_YM2203_IRQ_HANDLER(INPUTLINE(m_audiocpu, M6809_FIRQ_LINE)) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) - MCFG_SOUND_ROUTE(2, "mono", 0.50) - MCFG_SOUND_ROUTE(3, "mono", 0.40) - - MCFG_DEVICE_ADD("ym2", YM2203, MCU_CLOCK) - MCFG_SOUND_ROUTE(0, "mono", 0.50) - MCFG_SOUND_ROUTE(1, "mono", 0.50) - MCFG_SOUND_ROUTE(2, "mono", 0.50) - MCFG_SOUND_ROUTE(3, "mono", 0.40) + GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set_inputline(m_audiocpu, M6809_IRQ_LINE); + + ym2203_device &ym1(YM2203(config, "ym1", MCU_CLOCK)); + ym1.irq_handler().set_inputline(m_audiocpu, M6809_FIRQ_LINE); + ym1.add_route(0, "mono", 0.50); + ym1.add_route(1, "mono", 0.50); + ym1.add_route(2, "mono", 0.50); + ym1.add_route(3, "mono", 0.40); + + ym2203_device &ym2(YM2203(config, "ym2", MCU_CLOCK)); + ym2.add_route(0, "mono", 0.50); + ym2.add_route(1, "mono", 0.50); + ym2.add_route(2, "mono", 0.50); + ym2.add_route(3, "mono", 0.40); MACHINE_CONFIG_END diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp index 0eac26ca43e..3f9ede99609 100644 --- a/src/mame/drivers/xerox820.cpp +++ b/src/mame/drivers/xerox820.cpp @@ -752,13 +752,13 @@ MACHINE_CONFIG_START(xerox820ii_state::xerox820ii) MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(WRITELINE(Z80PIO_KB_TAG, z80pio_device, strobe_b)) // SASI bus - MCFG_DEVICE_ADD(SASIBUS_TAG, SCSI_PORT, 0) - MCFG_SCSI_DATA_INPUT_BUFFER("sasi_data_in") - MCFG_SCSI_BSY_HANDLER(WRITELINE("sasi_ctrl_in", input_buffer_device, write_bit0)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_MSG_HANDLER(WRITELINE("sasi_ctrl_in", input_buffer_device, write_bit1)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_CD_HANDLER(WRITELINE("sasi_ctrl_in", input_buffer_device, write_bit2)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_REQ_HANDLER(WRITELINE("sasi_ctrl_in", input_buffer_device, write_bit3)) MCFG_DEVCB_XOR(1) - MCFG_SCSI_IO_HANDLER(WRITELINE("sasi_ctrl_in", input_buffer_device, write_bit4)) MCFG_DEVCB_XOR(1) + SCSI_PORT(config, m_sasibus, 0); + m_sasibus->set_data_input_buffer("sasi_data_in"); + m_sasibus->bsy_handler().set("sasi_ctrl_in", FUNC(input_buffer_device::write_bit0)).exor(1); + m_sasibus->msg_handler().set("sasi_ctrl_in", FUNC(input_buffer_device::write_bit1)).exor(1); + m_sasibus->cd_handler().set("sasi_ctrl_in", FUNC(input_buffer_device::write_bit2)).exor(1); + m_sasibus->req_handler().set("sasi_ctrl_in", FUNC(input_buffer_device::write_bit3)).exor(1); + m_sasibus->io_handler().set("sasi_ctrl_in", FUNC(input_buffer_device::write_bit4)).exor(1); MCFG_SCSIDEV_ADD(SASIBUS_TAG ":" SCSI_PORT_DEVICE1, "harddisk", SA1403D, SCSI_ID_0) diff --git a/src/mame/drivers/xor100.cpp b/src/mame/drivers/xor100.cpp index 21b308d4ed4..0a3ab3dea9a 100644 --- a/src/mame/drivers/xor100.cpp +++ b/src/mame/drivers/xor100.cpp @@ -528,11 +528,11 @@ MACHINE_CONFIG_START(xor100_state::xor100) MCFG_RS232_CTS_HANDLER(WRITELINE(I8251_B_TAG, i8251_device, write_cts)) MCFG_SLOT_OPTION_DEVICE_INPUT_DEFAULTS("terminal", terminal) - MCFG_DEVICE_ADD(COM5016_TAG, COM8116, 5.0688_MHz_XTAL) - MCFG_COM8116_FR_HANDLER(WRITELINE(I8251_A_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(I8251_A_TAG, i8251_device, write_rxc)) - MCFG_COM8116_FT_HANDLER(WRITELINE(I8251_B_TAG, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(I8251_B_TAG, i8251_device, write_rxc)) + com8116_device &brg(COM8116(config, COM5016_TAG, 5.0688_MHz_XTAL)); + brg.fr_handler().set(m_uart_a, FUNC(i8251_device::write_txc)); + brg.fr_handler().append(m_uart_a, FUNC(i8251_device::write_rxc)); + brg.ft_handler().set(m_uart_b, FUNC(i8251_device::write_txc)); + brg.ft_handler().append(m_uart_b, FUNC(i8251_device::write_rxc)); MCFG_DEVICE_ADD(I8255A_TAG, I8255A, 0) MCFG_I8255_OUT_PORTA_CB(WRITE8("cent_data_out", output_latch_device, bus_w)) diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp index fd964962330..47eb8955a04 100644 --- a/src/mame/drivers/z100.cpp +++ b/src/mame/drivers/z100.cpp @@ -699,12 +699,12 @@ MACHINE_CONFIG_START(z100_state::z100) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, z100_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir3_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("pia0", PIA6821, 0) MCFG_PIA_WRITEPA_HANDLER(WRITE8(*this, z100_state, video_pia_A_w)) diff --git a/src/mame/drivers/z88.cpp b/src/mame/drivers/z88.cpp index 2a87f979641..366ddde565c 100644 --- a/src/mame/drivers/z88.cpp +++ b/src/mame/drivers/z88.cpp @@ -617,17 +617,16 @@ MACHINE_CONFIG_START(z88_state::z88) MCFG_DEFAULT_LAYOUT(layout_lcd) device = &UPD65031(config, m_blink, XTAL(9'830'400)); - MCFG_UPD65031_KB_CALLBACK(READ8(*this, z88_state, kb_r)) - MCFG_UPD65031_INT_CALLBACK(INPUTLINE(m_maincpu, INPUT_LINE_IRQ0)) - MCFG_UPD65031_NMI_CALLBACK(INPUTLINE(m_maincpu, INPUT_LINE_NMI)) - MCFG_UPD65031_SPKR_CALLBACK(WRITELINE(m_speaker, speaker_sound_device, level_w)) + m_blink->kb_rd_callback().set(FUNC(z88_state::kb_r)); + m_blink->int_wr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); + m_blink->nmi_wr_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); + m_blink->spkr_wr_callback().set("speaker", FUNC(speaker_sound_device::level_w)); MCFG_UPD65031_SCR_UPDATE_CB(z88_state, lcd_update) MCFG_UPD65031_MEM_UPDATE_CB(z88_state, bankswitch_update) /* sound hardware */ - SPEAKER(config, m_mono).front_center(); - SPEAKER_SOUND(config, m_speaker); - m_speaker->add_route(ALL_OUTPUTS, "mono", 0.50); + SPEAKER(config, "mono").front_center(); + SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50); /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mame/drivers/zac2650.cpp b/src/mame/drivers/zac2650.cpp index 8b524777454..dcba11ad8aa 100644 --- a/src/mame/drivers/zac2650.cpp +++ b/src/mame/drivers/zac2650.cpp @@ -233,18 +233,18 @@ GFXDECODE_END MACHINE_CONFIG_START(zac2650_state::tinvader) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", S2650, 3800000/4) - MCFG_DEVICE_PROGRAM_MAP(main_map) - MCFG_S2650_SENSE_INPUT(READLINE("screen", screen_device, vblank)) MCFG_DEVCB_INVERT + s2650_device &maincpu(S2650(config, m_maincpu, 3800000/4)); + maincpu.set_addrmap(AS_PROGRAM, &zac2650_state::main_map); + maincpu.sense_handler().set(m_screen, FUNC(screen_device::vblank)).invert(); /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(55) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(1041)) - MCFG_SCREEN_SIZE(30*24, 32*24) - MCFG_SCREEN_VISIBLE_AREA(0, 719, 0, 767) - MCFG_SCREEN_UPDATE_DRIVER(zac2650_state, screen_update_tinvader) - MCFG_SCREEN_PALETTE("palette") + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_refresh_hz(55); + m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(1041)); + m_screen->set_size(30*24, 32*24); + m_screen->set_visarea(0, 719, 0, 767); + m_screen->set_screen_update(FUNC(zac2650_state::screen_update_tinvader)); + m_screen->set_palette(m_palette); MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tinvader) MCFG_PALETTE_ADD("palette", 4) @@ -253,8 +253,8 @@ MACHINE_CONFIG_START(zac2650_state::tinvader) /* sound hardware */ SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("s2636", S2636, 0) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + S2636(config, m_s2636, 0); + m_s2636->add_route(ALL_OUTPUTS, "mono", 0.25); MACHINE_CONFIG_END WRITE8_MEMBER(zac2650_state::tinvader_sound_w) diff --git a/src/mame/drivers/zn.cpp b/src/mame/drivers/zn.cpp index b9ae2221cdc..bb7e3f395c1 100644 --- a/src/mame/drivers/zn.cpp +++ b/src/mame/drivers/zn.cpp @@ -412,7 +412,7 @@ MACHINE_CONFIG_START(zn_state::zn1_1mb_vram) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + GENERIC_LATCH_8(config, m_soundlatch); MCFG_SPU_ADD( "spu", XTAL(67'737'600)/2 ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) @@ -459,7 +459,7 @@ MACHINE_CONFIG_START(zn_state::zn2) SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_GENERIC_LATCH_8_ADD("soundlatch") + GENERIC_LATCH_8(config, m_soundlatch); MCFG_SPU_ADD( "spu", XTAL(67'737'600)/2 ) MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) @@ -664,8 +664,7 @@ MACHINE_CONFIG_START(zn_state::coh1000c) MCFG_MACHINE_START_OVERRIDE(zn_state, coh1000c) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1000c) - MCFG_DEVICE_MODIFY("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, INPUT_LINE_NMI)) + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("qsound", QSOUND) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) @@ -690,8 +689,7 @@ MACHINE_CONFIG_START(zn_state::coh1002c) MCFG_MACHINE_START_OVERRIDE(zn_state, coh1000c) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1000c) - MCFG_DEVICE_MODIFY("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, INPUT_LINE_NMI)) + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("qsound", QSOUND) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) @@ -852,8 +850,7 @@ MACHINE_CONFIG_START(zn_state::coh3002c) MCFG_MACHINE_START_OVERRIDE(zn_state, coh1000c) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1000c) - MCFG_DEVICE_MODIFY("soundlatch") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, INPUT_LINE_NMI)) + m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI); MCFG_DEVICE_ADD("qsound", QSOUND) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) @@ -1147,12 +1144,12 @@ MACHINE_CONFIG_START(zn_state::coh1000ta) MCFG_MACHINE_START_OVERRIDE(zn_state, coh1000ta) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1000ta) - MCFG_DEVICE_ADD("ymsnd", YM2610B, XTAL(16'000'000)/2) - MCFG_YM2610_IRQ_HANDLER(INPUTLINE(m_audiocpu, 0)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.25) - MCFG_SOUND_ROUTE(0, "rspeaker", 0.25) - MCFG_SOUND_ROUTE(1, "lspeaker", 1.0) - MCFG_SOUND_ROUTE(2, "rspeaker", 1.0) + ym2610b_device &ymsnd(YM2610B(config, "ymsnd", 16_MHz_XTAL/2)); + ymsnd.irq_handler().set_inputline(m_audiocpu, 0); + ymsnd.add_route(0, "lspeaker", 0.25); + ymsnd.add_route(0, "rspeaker", 0.25); + ymsnd.add_route(1, "lspeaker", 1.0); + ymsnd.add_route(2, "rspeaker", 1.0); MCFG_MB3773_ADD("mb3773") @@ -2392,13 +2389,13 @@ MACHINE_CONFIG_START(zn_state::coh1001l) MCFG_MACHINE_START_OVERRIDE(zn_state, coh1001l) MCFG_MACHINE_RESET_OVERRIDE(zn_state, coh1001l) - MCFG_GENERIC_LATCH_16_ADD("soundlatch16") - MCFG_GENERIC_LATCH_DATA_PENDING_CB(INPUTLINE(m_audiocpu, 3)) + GENERIC_LATCH_16(config, m_soundlatch16); + m_soundlatch16->data_pending_callback().set_inputline(m_audiocpu, 3); - MCFG_DEVICE_ADD("ymz", YMZ280B, XTAL(16'934'400)) - MCFG_YMZ280B_IRQ_HANDLER(INPUTLINE(m_audiocpu, 2)) - MCFG_SOUND_ROUTE(0, "lspeaker", 0.35) - MCFG_SOUND_ROUTE(1, "rspeaker", 0.35) + ymz280b_device &ymz(YMZ280B(config, "ymz", XTAL(16'934'400))); + ymz.irq_handler().set_inputline(m_audiocpu, 2); + ymz.add_route(0, "lspeaker", 0.35); + ymz.add_route(1, "rspeaker", 0.35); MACHINE_CONFIG_END /* diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp index bdf958b73cf..5772f2044ea 100644 --- a/src/mame/drivers/zorba.cpp +++ b/src/mame/drivers/zorba.cpp @@ -207,15 +207,15 @@ MACHINE_CONFIG_START(zorba_state::zorba) MCFG_PIA_IRQB_HANDLER(WRITELINE("irq1", input_merger_device, in_w<1>)) // PIT - MCFG_DEVICE_ADD("pit", PIT8254, 0) - MCFG_PIT8253_CLK0(24_MHz_XTAL / 3) - MCFG_PIT8253_CLK1(24_MHz_XTAL / 3) - MCFG_PIT8253_CLK2(24_MHz_XTAL / 3) - MCFG_PIT8253_OUT0_HANDLER(WRITELINE(*this, zorba_state, br1_w)) - MCFG_PIT8253_OUT1_HANDLER(WRITELINE(m_uart1, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_uart1, i8251_device, write_rxc)) - MCFG_PIT8253_OUT2_HANDLER(WRITELINE(m_uart2, i8251_device, write_txc)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_uart2, i8251_device, write_rxc)) + pit8254_device &pit(PIT8254(config, "pit", 0)); + pit.set_clk<0>(24_MHz_XTAL / 3); + pit.set_clk<1>(24_MHz_XTAL / 3); + pit.set_clk<2>(24_MHz_XTAL / 3); + pit.out_handler<0>().set(FUNC(zorba_state::br1_w)); + pit.out_handler<1>().set(m_uart1, FUNC(i8251_device::write_txc)); + pit.out_handler<1>().append(m_uart1, FUNC(i8251_device::write_rxc)); + pit.out_handler<2>().set(m_uart2, FUNC(i8251_device::write_txc)); + pit.out_handler<2>().append(m_uart2, FUNC(i8251_device::write_rxc)); // CRTC MCFG_DEVICE_ADD(m_crtc, I8275, 14.318'181_MHz_XTAL / 7) @@ -247,11 +247,11 @@ MACHINE_CONFIG_START(zorba_state::zorba) // J3 Parallel printer MCFG_CENTRONICS_OUTPUT_LATCH_ADD("parprndata", "parprn") - MCFG_DEVICE_ADD("parprn", CENTRONICS, centronics_devices, "printer") - MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(m_uart1, i8251_device, write_cts)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(m_uart1, i8251_device, write_dsr)) // TODO: shared with serial CTS - MCFG_CENTRONICS_FAULT_HANDLER(WRITELINE(*this, zorba_state, printer_fault_w)) - MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(*this, zorba_state, printer_select_w)) + centronics_device &parprn(CENTRONICS(config, "parprn", centronics_devices, "printer")); + parprn.busy_handler().set(m_uart1, FUNC(i8251_device::write_cts)); + parprn.busy_handler().append(m_uart1, FUNC(i8251_device::write_dsr)); // TODO: shared with serial CTS + parprn.fault_handler().set(FUNC(zorba_state::printer_fault_w)); + parprn.select_handler().set(FUNC(zorba_state::printer_select_w)); // J3 Serial printer MCFG_DEVICE_ADD("serprn", RS232_PORT, default_rs232_devices, nullptr) diff --git a/src/mame/drivers/zsbc3.cpp b/src/mame/drivers/zsbc3.cpp index 46a0301019a..c2be544d29d 100644 --- a/src/mame/drivers/zsbc3.cpp +++ b/src/mame/drivers/zsbc3.cpp @@ -85,32 +85,32 @@ INPUT_PORTS_END MACHINE_CONFIG_START(zsbc3_state::zsbc3) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",Z80, XTAL(16'000'000) / 4) - MCFG_DEVICE_PROGRAM_MAP(zsbc3_mem) - MCFG_DEVICE_IO_MAP(zsbc3_io) - - MCFG_DEVICE_ADD("ctc", Z80CTC, XTAL(16'000'000) / 4) - MCFG_Z80CTC_ZC0_CB(WRITELINE("sio", z80sio_device, txca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio", z80sio_device, rxca_w)) - - MCFG_DEVICE_ADD("clk2mhz", CLOCK, XTAL(16'000'000) / 8) - MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE("ctc", z80ctc_device, trg0)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg1)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg2)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("ctc", z80ctc_device, trg3)) - - MCFG_DEVICE_ADD("sio", Z80SIO, XTAL(16'000'000) / 4) - //MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) // no evidence of a daisy chain because IM2 is not set - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs232", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs232", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs232", rs232_port_device, write_rts)) - - MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "terminal") - MCFG_RS232_RXD_HANDLER(WRITELINE("sio", z80sio_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("sio", z80sio_device, ctsa_w)) - - MCFG_DEVICE_ADD("pio", Z80PIO, XTAL(16'000'000) / 4) - //MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) + Z80(config, m_maincpu, 16_MHz_XTAL / 4); + m_maincpu->set_addrmap(AS_PROGRAM, &zsbc3_state::zsbc3_mem); + m_maincpu->set_addrmap(AS_IO, &zsbc3_state::zsbc3_io); + + z80ctc_device &ctc(Z80CTC(config, "ctc", 16_MHz_XTAL / 4)); + ctc.zc_callback<0>().set("sio", FUNC(z80sio_device::txca_w)); + ctc.zc_callback<0>().append("sio", FUNC(z80sio_device::rxca_w)); + + clock_device &clk2mhz(CLOCK(config, "clk2mhz", 16_MHz_XTAL / 8)); + clk2mhz.signal_handler().set("ctc", FUNC(z80ctc_device::trg0)); + clk2mhz.signal_handler().append("ctc", FUNC(z80ctc_device::trg1)); + clk2mhz.signal_handler().append("ctc", FUNC(z80ctc_device::trg2)); + clk2mhz.signal_handler().append("ctc", FUNC(z80ctc_device::trg3)); + + z80sio_device &sio(Z80SIO(config, "sio", 16_MHz_XTAL / 4)); + //sio.out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); // no evidence of a daisy chain because IM2 is not set + sio.out_txda_callback().set("rs232", FUNC(rs232_port_device::write_txd)); + sio.out_dtra_callback().set("rs232", FUNC(rs232_port_device::write_dtr)); + sio.out_rtsa_callback().set("rs232", FUNC(rs232_port_device::write_rts)); + + rs232_port_device &rs232(RS232_PORT(config, "rs232", default_rs232_devices, "terminal")); + rs232.rxd_handler().set("sio", FUNC(z80sio_device::rxa_w)); + rs232.cts_handler().set("sio", FUNC(z80sio_device::ctsa_w)); + + /*z80pio_device &pio(*/Z80PIO(config, "pio", 16_MHz_XTAL / 4)/*)*/; + //pio.out_int_callback.set_inputline(m_maincpu, INPUT_LINE_IRQ0); MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mame/includes/alesis.h b/src/mame/includes/alesis.h index aefb7ce31af..a9fa9a1f33b 100644 --- a/src/mame/includes/alesis.h +++ b/src/mame/includes/alesis.h @@ -170,7 +170,7 @@ private: required_device m_lcdc; optional_device m_cassette; - required_device m_maincpu; + required_device m_maincpu; required_ioport m_col1; required_ioport m_col2; diff --git a/src/mame/includes/apexc.h b/src/mame/includes/apexc.h index f6e938c7f8b..f012a10da0f 100644 --- a/src/mame/includes/apexc.h +++ b/src/mame/includes/apexc.h @@ -1,6 +1,5 @@ // license:GPL-2.0+ // copyright-holders:Raphael Nabet, Robbbert - #ifndef MAME_INCLUDES_APEXC #define MAME_INCLUDES_APEXC diff --git a/src/mame/includes/apollo.h b/src/mame/includes/apollo.h index 7874dfbf0da..86381bf981e 100644 --- a/src/mame/includes/apollo.h +++ b/src/mame/includes/apollo.h @@ -338,16 +338,16 @@ void apollo_csr_set_status_register(uint16_t mask, uint16_t data); MCFG_DEVICE_ADD(_tag, APOLLO_SIO, _clock) #define MCFG_APOLLO_SIO_IRQ_CALLBACK(_cb) \ - devcb = &downcast(*device).set_irq_cb(DEVCB_##_cb); + downcast(*device).set_irq_cb(DEVCB_##_cb); #define MCFG_APOLLO_SIO_A_TX_CALLBACK(_cb) \ - devcb = &downcast(*device).set_a_tx_cb(DEVCB_##_cb); + downcast(*device).set_a_tx_cb(DEVCB_##_cb); #define MCFG_APOLLO_SIO_B_TX_CALLBACK(_cb) \ - devcb = &downcast(*device).set_b_tx_cb(DEVCB_##_cb); + downcast(*device).set_b_tx_cb(DEVCB_##_cb); #define MCFG_APOLLO_SIO_OUTPORT_CALLBACK(_cb) \ - devcb = &downcast(*device).set_outport_cb(DEVCB_##_cb); + downcast(*device).set_outport_cb(DEVCB_##_cb); class apollo_sio: public duart_base_device { @@ -685,7 +685,7 @@ DECLARE_DEVICE_TYPE(APOLLO_MONO19I, apollo_graphics_19i) //************************************************************************** #define MCFG_APOLLO_STDIO_TX_CALLBACK(_cb) \ - devcb = &downcast(*device).set_tx_cb(DEVCB_##_cb); + downcast(*device).set_tx_cb(DEVCB_##_cb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/includes/asteroid.h b/src/mame/includes/asteroid.h index c8d0f58ef86..42054d2c125 100644 --- a/src/mame/includes/asteroid.h +++ b/src/mame/includes/asteroid.h @@ -14,8 +14,8 @@ class asteroid_state : public driver_device { public: - asteroid_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + asteroid_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_dvg(*this, "dvg"), m_earom(*this, "earom"), @@ -24,7 +24,8 @@ public: m_dsw_sel(*this, "dsw_sel"), m_cocktail(*this, "COCKTAIL"), m_ram1(*this, "ram1"), - m_ram2(*this, "ram2") { } + m_ram2(*this, "ram2") + { } /* devices */ required_device m_maincpu; diff --git a/src/mame/includes/balsente.h b/src/mame/includes/balsente.h index 3c5faab772f..955ea5e7e15 100644 --- a/src/mame/includes/balsente.h +++ b/src/mame/includes/balsente.h @@ -109,7 +109,6 @@ private: DECLARE_READ8_MEMBER(novram_8bit_r); DECLARE_WRITE8_MEMBER(novram_8bit_w); DECLARE_WRITE8_MEMBER(acia_w); - DECLARE_WRITE_LINE_MEMBER(uint_w); DECLARE_WRITE_LINE_MEMBER(uint_propagate_w); DECLARE_READ8_MEMBER(adc_data_r); DECLARE_WRITE8_MEMBER(adc_select_w); diff --git a/src/mame/includes/ccastles.h b/src/mame/includes/ccastles.h index 0bbf47be6c2..a9f04bf671a 100644 --- a/src/mame/includes/ccastles.h +++ b/src/mame/includes/ccastles.h @@ -37,7 +37,6 @@ public: protected: DECLARE_WRITE8_MEMBER(irq_ack_w); - template DECLARE_WRITE_LINE_MEMBER(ccounter_w); DECLARE_READ8_MEMBER(leta_r); DECLARE_WRITE8_MEMBER(nvram_recall_w); DECLARE_WRITE_LINE_MEMBER(nvram_store_w); diff --git a/src/mame/includes/cloud9.h b/src/mame/includes/cloud9.h index aaf24481d1f..8c9dc970317 100644 --- a/src/mame/includes/cloud9.h +++ b/src/mame/includes/cloud9.h @@ -36,8 +36,6 @@ public: protected: DECLARE_WRITE8_MEMBER(irq_ack_w); - DECLARE_WRITE_LINE_MEMBER(coin1_counter_w); - DECLARE_WRITE_LINE_MEMBER(coin2_counter_w); DECLARE_READ8_MEMBER(leta_r); DECLARE_WRITE8_MEMBER(nvram_recall_w); DECLARE_WRITE8_MEMBER(nvram_store_w); diff --git a/src/mame/includes/cvs.h b/src/mame/includes/cvs.h index b19bacfd303..49499306105 100644 --- a/src/mame/includes/cvs.h +++ b/src/mame/includes/cvs.h @@ -85,9 +85,9 @@ public: uint32_t screen_update_cvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(cvs_main_cpu_interrupt); TIMER_CALLBACK_MEMBER(cvs_393hz_timer_cb); - void set_pens( ); - void cvs_scroll_stars( ); - void cvs_init_stars( ); + void set_pens(); + void cvs_scroll_stars(); + void cvs_init_stars(); void cvs_update_stars(bitmap_ind16 &bitmap, const rectangle &cliprect, const pen_t star_pen, bool update_always); void start_393hz_timer(); void cvs(machine_config &config); diff --git a/src/mame/includes/dec8.h b/src/mame/includes/dec8.h index 46bfea1cd24..b659e023ef0 100644 --- a/src/mame/includes/dec8.h +++ b/src/mame/includes/dec8.h @@ -133,7 +133,6 @@ private: DECLARE_WRITE8_MEMBER(csilver_i8751_w); DECLARE_WRITE8_MEMBER(dec8_bank_w); DECLARE_WRITE8_MEMBER(ghostb_bank_w); - DECLARE_WRITE_LINE_MEMBER(ghostb_nmi_w); DECLARE_WRITE8_MEMBER(csilver_control_w); DECLARE_WRITE8_MEMBER(dec8_sound_w); DECLARE_WRITE8_MEMBER(csilver_adpcm_data_w); diff --git a/src/mame/includes/dragon.h b/src/mame/includes/dragon.h index 3e3d62d1853..1c8f38d8830 100644 --- a/src/mame/includes/dragon.h +++ b/src/mame/includes/dragon.h @@ -8,11 +8,11 @@ ***************************************************************************/ -#pragma once - #ifndef MAME_INCLUDES_DRAGON_H #define MAME_INCLUDES_DRAGON_H +#pragma once + #include "includes/coco12.h" #include "imagedev/printer.h" diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index e24108613b3..92fd3c0fdbb 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -317,7 +317,7 @@ public: void mooncrst_map(address_map &map); void ozon1_io_map(address_map &map); void ozon1_map(address_map &map); - void racknrol(address_map &map); + void racknrol_map(address_map &map); void racknrol_io(address_map &map); void rockclim_map(address_map &map); void scramb2_map(address_map &map); diff --git a/src/mame/includes/gng.h b/src/mame/includes/gng.h index 06940c6347a..3905f28b70b 100644 --- a/src/mame/includes/gng.h +++ b/src/mame/includes/gng.h @@ -33,8 +33,6 @@ public: private: DECLARE_WRITE8_MEMBER(gng_bankswitch_w); - DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w); - DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w); DECLARE_WRITE_LINE_MEMBER(ym_reset_w); DECLARE_READ8_MEMBER(diamond_hack_r); DECLARE_WRITE8_MEMBER(gng_fgvideoram_w); diff --git a/src/mame/includes/jpmsys5.h b/src/mame/includes/jpmsys5.h index 0e3cebb0731..c8efe8e8b22 100644 --- a/src/mame/includes/jpmsys5.h +++ b/src/mame/includes/jpmsys5.h @@ -42,7 +42,6 @@ public: DECLARE_WRITE_LINE_MEMBER(pia_irq); DECLARE_WRITE_LINE_MEMBER(u29_ca2_w); DECLARE_WRITE_LINE_MEMBER(u29_cb2_w); - DECLARE_WRITE_LINE_MEMBER(acia_irq); DECLARE_WRITE_LINE_MEMBER(a0_tx_w); DECLARE_WRITE_LINE_MEMBER(a1_tx_w); DECLARE_WRITE_LINE_MEMBER(a2_tx_w); diff --git a/src/mame/includes/kopunch.h b/src/mame/includes/kopunch.h index 1bc3cceafdc..b4581f1764d 100644 --- a/src/mame/includes/kopunch.h +++ b/src/mame/includes/kopunch.h @@ -5,6 +5,10 @@ Sega KO Punch *************************************************************************/ +#ifndef MAME_INCLUDES_KOPUNCH_H +#define MAME_INCLUDES_KOPUNCH_H + +#pragma once #include "emupal.h" @@ -65,3 +69,5 @@ private: uint8_t m_gfxbank; uint8_t m_scrollx; }; + +#endif // MAME_INCLUDES_KOPUNCH_H diff --git a/src/mame/includes/liberatr.h b/src/mame/includes/liberatr.h index 1d717f7cbd1..43139771e2d 100644 --- a/src/mame/includes/liberatr.h +++ b/src/mame/includes/liberatr.h @@ -54,8 +54,6 @@ private: DECLARE_READ8_MEMBER( bitmap_xy_r ); DECLARE_WRITE8_MEMBER( bitmap_xy_w ); - DECLARE_WRITE_LINE_MEMBER(planet_select_w); - uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); // early raster EAROM interface diff --git a/src/mame/includes/pgm2.h b/src/mame/includes/pgm2.h index a3fbbcc6d33..f935cda5b72 100644 --- a/src/mame/includes/pgm2.h +++ b/src/mame/includes/pgm2.h @@ -1,6 +1,5 @@ // license:BSD-3-Clause // copyright-holders:David Haywood - #ifndef MAME_INCLUDES_PGM2_H #define MAME_INCLUDES_PGM2_H diff --git a/src/mame/includes/super6.h b/src/mame/includes/super6.h index 1fecf3ae3aa..d9641bda2a3 100644 --- a/src/mame/includes/super6.h +++ b/src/mame/includes/super6.h @@ -31,19 +31,19 @@ class super6_state : public driver_device { public: super6_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_ctc(*this, Z80CTC_TAG), - m_dart(*this, Z80DART_TAG), - m_dma(*this, Z80DMA_TAG), - m_pio(*this, Z80PIO_TAG), - m_fdc(*this, WD2793_TAG), - m_brg(*this, BR1945_TAG), - m_ram(*this, RAM_TAG), - m_floppy0(*this, WD2793_TAG":0"), - m_floppy1(*this, WD2793_TAG":1"), - m_rom(*this, Z80_TAG), - m_j7(*this, "J7") + : driver_device(mconfig, type, tag) + , m_maincpu(*this, Z80_TAG) + , m_ctc(*this, Z80CTC_TAG) + , m_dart(*this, Z80DART_TAG) + , m_dma(*this, Z80DMA_TAG) + , m_pio(*this, Z80PIO_TAG) + , m_fdc(*this, WD2793_TAG) + , m_brg(*this, BR1945_TAG) + , m_ram(*this, RAM_TAG) + , m_floppy0(*this, WD2793_TAG":0") + , m_floppy1(*this, WD2793_TAG":1") + , m_rom(*this, Z80_TAG) + , m_j7(*this, "J7") { } void super6(machine_config &config); diff --git a/src/mame/includes/taito_b.h b/src/mame/includes/taito_b.h index 33b98ae3875..78e5fd2e3cc 100644 --- a/src/mame/includes/taito_b.h +++ b/src/mame/includes/taito_b.h @@ -56,18 +56,11 @@ public: void init_taito_b(); - DECLARE_INPUT_CHANGED_MEMBER(realpunc_sensor); - - DECLARE_VIDEO_START(realpunc); - uint32_t screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - +protected: DECLARE_WRITE8_MEMBER(player_12_coin_ctrl_w); - void realpunc_map(address_map &map); - void realpunc_hd63484_map(address_map &map); void sound_map(address_map &map); -private: DECLARE_WRITE8_MEMBER(bankswitch_w); template DECLARE_READ16_MEMBER(tracky_hi_r); template DECLARE_READ16_MEMBER(tracky_lo_r); @@ -79,10 +72,8 @@ private: DECLARE_READ16_MEMBER(player_34_coin_ctrl_r); DECLARE_WRITE16_MEMBER(player_34_coin_ctrl_w); DECLARE_WRITE16_MEMBER(spacedxo_tc0220ioc_w); - DECLARE_WRITE16_MEMBER(realpunc_output_w); DECLARE_WRITE16_MEMBER(hitice_pixelram_w); DECLARE_WRITE16_MEMBER(hitice_pixel_scroll_w); - DECLARE_WRITE16_MEMBER(realpunc_video_ctrl_w); DECLARE_WRITE8_MEMBER(mb87078_gain_changed); DECLARE_VIDEO_START(hitice); DECLARE_VIDEO_RESET(hitice); @@ -116,7 +107,6 @@ private: /* video-related */ std::unique_ptr m_pixel_bitmap; - std::unique_ptr m_realpunc_bitmap; uint16_t m_pixel_scroll[3]; @@ -126,8 +116,6 @@ private: uint16_t m_eep_latch; uint16_t m_coin_word; - uint16_t m_realpunc_video_ctrl; - /* devices */ required_device m_maincpu; required_device m_audiocpu; @@ -146,7 +134,7 @@ private: optional_ioport_array<2> m_trackx_io; optional_ioport_array<2> m_tracky_io; - void hitice_clear_pixel_bitmap( ); + void hitice_clear_pixel_bitmap(); }; class taitob_c_state : public taitob_state @@ -155,6 +143,22 @@ public: using taitob_state::taitob_state; static constexpr feature_type unemulated_features() { return feature::CAMERA; } void realpunc(machine_config &config); + + DECLARE_INPUT_CHANGED_MEMBER(realpunc_sensor); + +protected: + DECLARE_WRITE16_MEMBER(realpunc_output_w); + DECLARE_WRITE16_MEMBER(realpunc_video_ctrl_w); + + void realpunc_map(address_map &map); + void realpunc_hd63484_map(address_map &map); + + DECLARE_VIDEO_START(realpunc); + uint32_t screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); + +private: + std::unique_ptr m_realpunc_bitmap; + uint16_t m_realpunc_video_ctrl; }; -#endif // MAME_INCLUDES_TAITO_B_H \ No newline at end of file +#endif // MAME_INCLUDES_TAITO_B_H diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h index 674d538bdf3..b666bd3ee25 100644 --- a/src/mame/includes/triplhnt.h +++ b/src/mame/includes/triplhnt.h @@ -57,10 +57,6 @@ private: TIMER_HIT }; - DECLARE_WRITE_LINE_MEMBER(ram_2_w); - DECLARE_WRITE_LINE_MEMBER(sprite_zoom_w); - DECLARE_WRITE_LINE_MEMBER(sprite_bank_w); - DECLARE_WRITE_LINE_MEMBER(lamp1_w); DECLARE_WRITE_LINE_MEMBER(coin_lockout_w); DECLARE_WRITE_LINE_MEMBER(tape_control_w); diff --git a/src/mame/includes/v1050.h b/src/mame/includes/v1050.h index f8f61f59ff0..87ef69b3119 100644 --- a/src/mame/includes/v1050.h +++ b/src/mame/includes/v1050.h @@ -64,8 +64,8 @@ class v1050_state : public driver_device { public: - v1050_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + v1050_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, Z80_TAG), m_subcpu(*this, M6502_TAG), m_pic(*this, UPB8214_TAG), diff --git a/src/mame/includes/xbox_pci.h b/src/mame/includes/xbox_pci.h index 14800e22fc2..7d4f69dfd62 100644 --- a/src/mame/includes/xbox_pci.h +++ b/src/mame/includes/xbox_pci.h @@ -112,7 +112,7 @@ private: DECLARE_DEVICE_TYPE(MCPX_SMBUS, mcpx_smbus_device) #define MCFG_MCPX_SMBUS_INTERRUPT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); + downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * OHCI USB Controller @@ -151,7 +151,7 @@ private: DECLARE_DEVICE_TYPE(MCPX_OHCI, mcpx_ohci_device) #define MCFG_MCPX_OHCI_INTERRUPT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); + downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * Ethernet @@ -295,7 +295,7 @@ private: DECLARE_DEVICE_TYPE(MCPX_IDE, mcpx_ide_device) #define MCFG_MCPX_IDE_INTERRUPT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); + downcast(*device).set_interrupt_handler(DEVCB_##_devcb); /* * AGP Bridge @@ -352,6 +352,6 @@ DECLARE_DEVICE_TYPE(NV2A_GPU, nv2a_gpu_device) #define MCFG_MCPX_NV2A_GPU_CPU(_cpu_tag) \ downcast(device)->set_cpu_tag(_cpu_tag); #define MCFG_MCPX_NV2A_GPU_INTERRUPT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_interrupt_handler(DEVCB_##_devcb); + downcast(*device).set_interrupt_handler(DEVCB_##_devcb); #endif // MAME_INCLUDES_XBOX_PCI_H diff --git a/src/mame/includes/z88.h b/src/mame/includes/z88.h index ae644f4d746..cfe59c28a84 100644 --- a/src/mame/includes/z88.h +++ b/src/mame/includes/z88.h @@ -48,8 +48,6 @@ public: , m_screen(*this, "screen") , m_palette(*this, "palette") , m_blink(*this, "blink") - , m_mono(*this, "mono") - , m_speaker(*this, "speaker") , m_lines(*this, "LINE%u", 0U) , m_banks(*this, "bank%u", 1U) , m_carts(*this, "slot%u", 0U) @@ -100,8 +98,6 @@ private: required_device m_screen; required_device m_palette; required_device m_blink; - required_device m_mono; - required_device m_speaker; required_ioport_array<8> m_lines; required_memory_bank_array<5> m_banks; optional_device_array m_carts; @@ -117,4 +113,4 @@ private: uint8_t * m_ram_base; }; -#endif /* MAME_INCLUDES_Z88_H */ +#endif // MAME_INCLUDES_Z88_H diff --git a/src/mame/machine/315_5296.h b/src/mame/machine/315_5296.h index 053705970ee..7e51589b110 100644 --- a/src/mame/machine/315_5296.h +++ b/src/mame/machine/315_5296.h @@ -13,55 +13,6 @@ -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -// A to H 8-bit input ports -#define MCFG_315_5296_IN_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_in_pa_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_in_pb_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_in_pc_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTD_CB(_devcb) \ - devcb = &downcast(*device).set_in_pd_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTE_CB(_devcb) \ - devcb = &downcast(*device).set_in_pe_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTF_CB(_devcb) \ - devcb = &downcast(*device).set_in_pf_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTG_CB(_devcb) \ - devcb = &downcast(*device).set_in_pg_callback(DEVCB_##_devcb); -#define MCFG_315_5296_IN_PORTH_CB(_devcb) \ - devcb = &downcast(*device).set_in_ph_callback(DEVCB_##_devcb); - -// A to H 8-bit output ports -#define MCFG_315_5296_OUT_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_out_pa_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_out_pb_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_out_pc_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTD_CB(_devcb) \ - devcb = &downcast(*device).set_out_pd_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTE_CB(_devcb) \ - devcb = &downcast(*device).set_out_pe_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTF_CB(_devcb) \ - devcb = &downcast(*device).set_out_pf_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTG_CB(_devcb) \ - devcb = &downcast(*device).set_out_pg_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_PORTH_CB(_devcb) \ - devcb = &downcast(*device).set_out_ph_callback(DEVCB_##_devcb); - -// CNT output pins -#define MCFG_315_5296_OUT_CNT0_CB(_devcb) \ - devcb = &downcast(*device).set_out_cnt0_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_CNT1_CB(_devcb) \ - devcb = &downcast(*device).set_out_cnt1_callback(DEVCB_##_devcb); -#define MCFG_315_5296_OUT_CNT2_CB(_devcb) \ - devcb = &downcast(*device).set_out_cnt2_callback(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -74,32 +25,32 @@ public: sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration helpers - template devcb_base &set_in_pa_callback(Object &&cb) { return m_in_pa_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pb_callback(Object &&cb) { return m_in_pb_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pc_callback(Object &&cb) { return m_in_pc_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pd_callback(Object &&cb) { return m_in_pd_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pe_callback(Object &&cb) { return m_in_pe_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pf_callback(Object &&cb) { return m_in_pf_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_pg_callback(Object &&cb) { return m_in_pg_cb.set_callback(std::forward(cb)); } - template devcb_base &set_in_ph_callback(Object &&cb) { return m_in_ph_cb.set_callback(std::forward(cb)); } - - template devcb_base &set_out_pa_callback(Object &&cb) { return m_out_pa_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pb_callback(Object &&cb) { return m_out_pb_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pc_callback(Object &&cb) { return m_out_pc_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pd_callback(Object &&cb) { return m_out_pd_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pe_callback(Object &&cb) { return m_out_pe_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pf_callback(Object &&cb) { return m_out_pf_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_pg_callback(Object &&cb) { return m_out_pg_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_ph_callback(Object &&cb) { return m_out_ph_cb.set_callback(std::forward(cb)); } - - template devcb_base &set_out_cnt0_callback(Object &&cb) { return m_out_cnt0_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_cnt1_callback(Object &&cb) { return m_out_cnt1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_out_cnt2_callback(Object &&cb) { return m_out_cnt2_cb.set_callback(std::forward(cb)); } - - DECLARE_READ8_MEMBER( read ); - DECLARE_WRITE8_MEMBER( write ); - - uint8_t debug_peek_output(offs_t offset) { return m_output_latch[offset & 7]; } + auto in_pa_callback() { return m_in_pa_cb.bind(); } + auto in_pb_callback() { return m_in_pb_cb.bind(); } + auto in_pc_callback() { return m_in_pc_cb.bind(); } + auto in_pd_callback() { return m_in_pd_cb.bind(); } + auto in_pe_callback() { return m_in_pe_cb.bind(); } + auto in_pf_callback() { return m_in_pf_cb.bind(); } + auto in_pg_callback() { return m_in_pg_cb.bind(); } + auto in_ph_callback() { return m_in_ph_cb.bind(); } + + auto out_pa_callback() { return m_out_pa_cb.bind(); } + auto out_pb_callback() { return m_out_pb_cb.bind(); } + auto out_pc_callback() { return m_out_pc_cb.bind(); } + auto out_pd_callback() { return m_out_pd_cb.bind(); } + auto out_pe_callback() { return m_out_pe_cb.bind(); } + auto out_pf_callback() { return m_out_pf_cb.bind(); } + auto out_pg_callback() { return m_out_pg_cb.bind(); } + auto out_ph_callback() { return m_out_ph_cb.bind(); } + + auto out_cnt0_callback() { return m_out_cnt0_cb.bind(); } + auto out_cnt1_callback() { return m_out_cnt1_cb.bind(); } + auto out_cnt2_callback() { return m_out_cnt2_cb.bind(); } + + DECLARE_READ8_MEMBER(read); + DECLARE_WRITE8_MEMBER(write); + + uint8_t debug_peek_output(offs_t offset) const { return m_output_latch[offset & 7]; } protected: // device-level overrides @@ -141,5 +92,4 @@ private: // device type definition DECLARE_DEVICE_TYPE(SEGA_315_5296, sega_315_5296_device) - #endif // MAME_MACHINE_315_5296_H diff --git a/src/mame/machine/315_5338a.h b/src/mame/machine/315_5338a.h index c8ece88c109..7c2a7ea04b6 100644 --- a/src/mame/machine/315_5338a.h +++ b/src/mame/machine/315_5338a.h @@ -24,59 +24,6 @@ #pragma once -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_315_5338A_READ_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback(DEVCB_##_devcb); - -#define MCFG_315_5338A_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PA_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<0>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PA_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<0>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PB_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<1>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PB_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<1>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PC_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<2>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PC_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<2>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PD_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<3>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PD_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<3>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PE_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<4>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PE_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<4>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PF_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<5>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PF_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<5>(DEVCB_##_devcb); - -#define MCFG_315_5338A_IN_PG_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<6>(DEVCB_##_devcb); - -#define MCFG_315_5338A_OUT_PG_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<6>(DEVCB_##_devcb); - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -88,17 +35,25 @@ public: sega_315_5338a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - template devcb_base &set_read_callback(Object &&cb) - { return m_read_cb.set_callback(std::forward(cb)); } - - template devcb_base &set_write_callback(Object &&cb) - { return m_write_cb.set_callback(std::forward(cb)); } - - template devcb_base &set_out_callback(Object &&cb) - { return m_out_port_cb[Port].set_callback(std::forward(cb)); } - - template devcb_base &set_in_callback(Object &&cb) - { return m_in_port_cb[Port].set_callback(std::forward(cb)); } + auto read_callback() { return m_read_cb.bind(); } + + auto write_callback() { return m_write_cb.bind(); } + + auto in_pa_callback() { return m_in_port_cb[0].bind(); } + auto in_pb_callback() { return m_in_port_cb[1].bind(); } + auto in_pc_callback() { return m_in_port_cb[2].bind(); } + auto in_pd_callback() { return m_in_port_cb[3].bind(); } + auto in_pe_callback() { return m_in_port_cb[4].bind(); } + auto in_pf_callback() { return m_in_port_cb[5].bind(); } + auto in_pg_callback() { return m_in_port_cb[6].bind(); } + + auto out_pa_callback() { return m_out_port_cb[0].bind(); } + auto out_pb_callback() { return m_out_port_cb[1].bind(); } + auto out_pc_callback() { return m_out_port_cb[2].bind(); } + auto out_pd_callback() { return m_out_port_cb[3].bind(); } + auto out_pe_callback() { return m_out_port_cb[4].bind(); } + auto out_pf_callback() { return m_out_port_cb[5].bind(); } + auto out_pg_callback() { return m_out_port_cb[6].bind(); } DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); diff --git a/src/mame/machine/315_5649.h b/src/mame/machine/315_5649.h index 60037925803..ad3835d0032 100644 --- a/src/mame/machine/315_5649.h +++ b/src/mame/machine/315_5649.h @@ -19,82 +19,82 @@ //************************************************************************** #define MCFG_315_5649_IN_PA_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<0>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<0>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PA_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<0>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<0>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PB_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<1>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<1>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PB_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<1>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<1>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PC_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<2>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<2>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PC_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<2>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<2>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PD_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<3>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<3>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PD_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<3>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<3>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PE_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<4>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<4>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PE_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<4>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<4>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PF_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<5>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<5>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PF_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<5>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<5>(DEVCB_##_devcb); #define MCFG_315_5649_IN_PG_CB(_devcb) \ - devcb = &downcast(*device).set_in_port_callback<6>(DEVCB_##_devcb); + downcast(*device).set_in_port_callback<6>(DEVCB_##_devcb); #define MCFG_315_5649_OUT_PG_CB(_devcb) \ - devcb = &downcast(*device).set_out_port_callback<6>(DEVCB_##_devcb); + downcast(*device).set_out_port_callback<6>(DEVCB_##_devcb); #define MCFG_315_5649_AN0_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<0>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<0>(DEVCB_##_devcb); #define MCFG_315_5649_AN1_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<1>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<1>(DEVCB_##_devcb); #define MCFG_315_5649_AN2_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<2>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<2>(DEVCB_##_devcb); #define MCFG_315_5649_AN3_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<3>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<3>(DEVCB_##_devcb); #define MCFG_315_5649_AN4_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<4>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<4>(DEVCB_##_devcb); #define MCFG_315_5649_AN5_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<5>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<5>(DEVCB_##_devcb); #define MCFG_315_5649_AN6_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<6>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<6>(DEVCB_##_devcb); #define MCFG_315_5649_AN7_CB(_devcb) \ - devcb = &downcast(*device).set_an_port_callback<7>(DEVCB_##_devcb); + downcast(*device).set_an_port_callback<7>(DEVCB_##_devcb); #define MCFG_315_5649_SERIAL_CH1_READ_CB(_devcb) \ - devcb = &downcast(*device).set_serial_rd_callback<0>(DEVCB_##_devcb); + downcast(*device).set_serial_rd_callback<0>(DEVCB_##_devcb); #define MCFG_315_5649_SERIAL_CH1_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_serial_wr_callback<0>(DEVCB_##_devcb); + downcast(*device).set_serial_wr_callback<0>(DEVCB_##_devcb); #define MCFG_315_5649_SERIAL_CH2_READ_CB(_devcb) \ - devcb = &downcast(*device).set_serial_rd_callback<1>(DEVCB_##_devcb); + downcast(*device).set_serial_rd_callback<1>(DEVCB_##_devcb); #define MCFG_315_5649_SERIAL_CH2_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_serial_wr_callback<1>(DEVCB_##_devcb); + downcast(*device).set_serial_wr_callback<1>(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/6883sam.h b/src/mame/machine/6883sam.h index 61e5fd27033..1e5669ef246 100644 --- a/src/mame/machine/6883sam.h +++ b/src/mame/machine/6883sam.h @@ -15,7 +15,7 @@ #define MCFG_SAM6883_RES_CALLBACK(_read) \ - devcb = &downcast(*device).set_res_rd_callback(DEVCB_##_read); + downcast(*device).set_res_rd_callback(DEVCB_##_read); //************************************************************************** diff --git a/src/mame/machine/abc80kb.h b/src/mame/machine/abc80kb.h index b88cf9c8a20..7e26881183d 100644 --- a/src/mame/machine/abc80kb.h +++ b/src/mame/machine/abc80kb.h @@ -25,7 +25,7 @@ //************************************************************************** #define MCFG_ABC80_KEYBOARD_KEYDOWN_CALLBACK(_write) \ - devcb = &downcast(*device).set_keydown_wr_callback(DEVCB_##_write); + downcast(*device).set_keydown_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/acs8600_ics.cpp b/src/mame/machine/acs8600_ics.cpp index 3b63cc119aa..944ea30c1f7 100644 --- a/src/mame/machine/acs8600_ics.cpp +++ b/src/mame/machine/acs8600_ics.cpp @@ -15,9 +15,10 @@ DEFINE_DEVICE_TYPE(ACS8600_ICS, acs8600_ics_device, "acs8600_ics", "Altos ACS860 acs8600_ics_device::acs8600_ics_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, ACS8600_ICS, tag, owner, clock), m_icscpu(*this, "icscpu"), - m_maincpu(*this, finder_base::DUMMY_TAG), m_out_irq1_func(*this), - m_out_irq2_func(*this) + m_out_irq2_func(*this), + m_host_space_device(*this, finder_base::DUMMY_TAG), + m_host_space_index(-1) { } @@ -96,35 +97,37 @@ static const z80_daisy_config ics_daisy_chain[] = }; MACHINE_CONFIG_START(acs8600_ics_device::device_add_mconfig) - MCFG_DEVICE_ADD("icscpu", Z80, XTAL(4'000'000)) + MCFG_DEVICE_ADD(m_icscpu, Z80, 4_MHz_XTAL) MCFG_DEVICE_PROGRAM_MAP(ics_mem) MCFG_DEVICE_IO_MAP(ics_io) MCFG_Z80_DAISY_CHAIN(ics_daisy_chain) - MCFG_DEVICE_ADD("stc1", AM9513, XTAL(1'843'200)) - MCFG_AM9513_OUT1_CALLBACK(WRITELINE("sio1", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio1", z80sio_device, txca_w)) - MCFG_AM9513_OUT2_CALLBACK(WRITELINE("sio1", z80sio_device, rxtxcb_w)) - MCFG_AM9513_OUT3_CALLBACK(WRITELINE("sio2", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio2", z80sio_device, txca_w)) - MCFG_AM9513_OUT4_CALLBACK(WRITELINE("sio2", z80sio_device, rxtxcb_w)) - MCFG_AM9513_OUT5_CALLBACK(WRITELINE("sio3", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio3", z80sio_device, txca_w)) - MCFG_DEVICE_ADD("stc2", AM9513, XTAL(1'843'200)) - MCFG_AM9513_OUT1_CALLBACK(WRITELINE("sio3", z80sio_device, rxtxcb_w)) - MCFG_AM9513_OUT2_CALLBACK(WRITELINE("sio4", z80sio_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("sio4", z80sio_device, txca_w)) - MCFG_AM9513_OUT3_CALLBACK(WRITELINE("sio4", z80sio_device, rxtxcb_w)) - - MCFG_DEVICE_ADD("sio1", Z80SIO, XTAL(8'000'000)/2) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs2321a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs2321a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs2321a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs2321b", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs2321b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs2321b", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("icscpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_CPU("icscpu") + am9513_device &stc1(AM9513(config, "stc1", 1.8432_MHz_XTAL)); + stc1.out1_cb().set("sio1", FUNC(z80sio_device::rxca_w)); + stc1.out1_cb().append("sio1", FUNC(z80sio_device::txca_w)); + stc1.out2_cb().set("sio1", FUNC(z80sio_device::rxtxcb_w)); + stc1.out3_cb().set("sio2", FUNC(z80sio_device::rxca_w)); + stc1.out3_cb().append("sio2", FUNC(z80sio_device::txca_w)); + stc1.out4_cb().set("sio2", FUNC(z80sio_device::rxtxcb_w)); + stc1.out5_cb().set("sio3", FUNC(z80sio_device::rxca_w)); + stc1.out5_cb().append("sio3", FUNC(z80sio_device::txca_w)); + + am9513_device &stc2(AM9513(config, "stc2", 1.8432_MHz_XTAL)); + stc2.out1_cb().set("sio3", FUNC(z80sio_device::rxtxcb_w)); + stc2.out2_cb().set("sio4", FUNC(z80sio_device::rxca_w)); + stc2.out2_cb().append("sio4", FUNC(z80sio_device::txca_w)); + stc2.out3_cb().set("sio4", FUNC(z80sio_device::rxtxcb_w)); + + z80sio_device &sio1(Z80SIO(config, "sio1", 8_MHz_XTAL/2)); + sio1.out_txda_callback().set("rs2321a", FUNC(rs232_port_device::write_txd)); + sio1.out_dtra_callback().set("rs2321a", FUNC(rs232_port_device::write_dtr)); + sio1.out_rtsa_callback().set("rs2321a", FUNC(rs232_port_device::write_rts)); + sio1.out_txdb_callback().set("rs2321b", FUNC(rs232_port_device::write_txd)); + sio1.out_dtrb_callback().set("rs2321b", FUNC(rs232_port_device::write_dtr)); + sio1.out_rtsb_callback().set("rs2321b", FUNC(rs232_port_device::write_rts)); + sio1.out_int_callback().set_inputline(m_icscpu, INPUT_LINE_IRQ0); + sio1.set_cputag(m_icscpu); + MCFG_DEVICE_ADD("rs2321a", RS232_PORT, default_rs232_devices, "terminal") MCFG_RS232_RXD_HANDLER(WRITELINE("sio1", z80sio_device, rxa_w)) MCFG_RS232_DCD_HANDLER(WRITELINE("sio1", z80sio_device, dcda_w)) @@ -136,15 +139,16 @@ MACHINE_CONFIG_START(acs8600_ics_device::device_add_mconfig) MCFG_RS232_DCD_HANDLER(WRITELINE("sio1", z80sio_device, dcdb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio1", z80sio_device, ctsb_w)) - MCFG_DEVICE_ADD("sio2", Z80SIO, XTAL(8'000'000)/2) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs2322a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs2322a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs2322a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs2322b", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs2322b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs2322b", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("icscpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_CPU("icscpu") + z80sio_device &sio2(Z80SIO(config, "sio2", 8_MHz_XTAL/2)); + sio2.out_txda_callback().set("rs2322a", FUNC(rs232_port_device::write_txd)); + sio2.out_dtra_callback().set("rs2322a", FUNC(rs232_port_device::write_dtr)); + sio2.out_rtsa_callback().set("rs2322a", FUNC(rs232_port_device::write_rts)); + sio2.out_txdb_callback().set("rs2322b", FUNC(rs232_port_device::write_txd)); + sio2.out_dtrb_callback().set("rs2322b", FUNC(rs232_port_device::write_dtr)); + sio2.out_rtsb_callback().set("rs2322b", FUNC(rs232_port_device::write_rts)); + sio2.out_int_callback().set_inputline(m_icscpu, INPUT_LINE_IRQ0); + sio2.set_cputag(m_icscpu); + MCFG_DEVICE_ADD("rs2322a", RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE("sio2", z80sio_device, rxa_w)) MCFG_RS232_DCD_HANDLER(WRITELINE("sio2", z80sio_device, dcda_w)) @@ -155,15 +159,16 @@ MACHINE_CONFIG_START(acs8600_ics_device::device_add_mconfig) MCFG_RS232_DCD_HANDLER(WRITELINE("sio2", z80sio_device, dcdb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio2", z80sio_device, ctsb_w)) - MCFG_DEVICE_ADD("sio3", Z80SIO, XTAL(8'000'000)/2) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs2323a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs2323a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs2323a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs2323b", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs2323b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs2323b", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("icscpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_CPU("icscpu") + z80sio_device &sio3(Z80SIO(config, "sio3", 8_MHz_XTAL/2)); + sio3.out_txda_callback().set("rs2323a", FUNC(rs232_port_device::write_txd)); + sio3.out_dtra_callback().set("rs2323a", FUNC(rs232_port_device::write_dtr)); + sio3.out_rtsa_callback().set("rs2323a", FUNC(rs232_port_device::write_rts)); + sio3.out_txdb_callback().set("rs2323b", FUNC(rs232_port_device::write_txd)); + sio3.out_dtrb_callback().set("rs2323b", FUNC(rs232_port_device::write_dtr)); + sio3.out_rtsb_callback().set("rs2323b", FUNC(rs232_port_device::write_rts)); + sio3.out_int_callback().set_inputline(m_icscpu, INPUT_LINE_IRQ0); + sio3.set_cputag(m_icscpu); + MCFG_DEVICE_ADD("rs2323a", RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE("sio3", z80sio_device, rxa_w)) MCFG_RS232_DCD_HANDLER(WRITELINE("sio3", z80sio_device, dcda_w)) @@ -174,15 +179,16 @@ MACHINE_CONFIG_START(acs8600_ics_device::device_add_mconfig) MCFG_RS232_DCD_HANDLER(WRITELINE("sio3", z80sio_device, dcdb_w)) MCFG_RS232_CTS_HANDLER(WRITELINE("sio3", z80sio_device, ctsb_w)) - MCFG_DEVICE_ADD("sio4", Z80SIO, XTAL(8'000'000)/2) - MCFG_Z80SIO_OUT_TXDA_CB(WRITELINE("rs2324a", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRA_CB(WRITELINE("rs2324a", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSA_CB(WRITELINE("rs2324a", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_TXDB_CB(WRITELINE("rs2324b", rs232_port_device, write_txd)) - MCFG_Z80SIO_OUT_DTRB_CB(WRITELINE("rs2324b", rs232_port_device, write_dtr)) - MCFG_Z80SIO_OUT_RTSB_CB(WRITELINE("rs2324b", rs232_port_device, write_rts)) - MCFG_Z80SIO_OUT_INT_CB(INPUTLINE("icscpu", INPUT_LINE_IRQ0)) - MCFG_Z80SIO_CPU("icscpu") + z80sio_device &sio4(Z80SIO(config, "sio4", 8_MHz_XTAL/2)); + sio4.out_txda_callback().set("rs2324a", FUNC(rs232_port_device::write_txd)); + sio4.out_dtra_callback().set("rs2324a", FUNC(rs232_port_device::write_dtr)); + sio4.out_rtsa_callback().set("rs2324a", FUNC(rs232_port_device::write_rts)); + sio4.out_txdb_callback().set("rs2324b", FUNC(rs232_port_device::write_txd)); + sio4.out_dtrb_callback().set("rs2324b", FUNC(rs232_port_device::write_dtr)); + sio4.out_rtsb_callback().set("rs2324b", FUNC(rs232_port_device::write_rts)); + sio4.out_int_callback().set_inputline(m_icscpu, INPUT_LINE_IRQ0); + sio4.set_cputag(m_icscpu); + MCFG_DEVICE_ADD("rs2324a", RS232_PORT, default_rs232_devices, nullptr) MCFG_RS232_RXD_HANDLER(WRITELINE("sio4", z80sio_device, rxa_w)) MCFG_RS232_DCD_HANDLER(WRITELINE("sio4", z80sio_device, dcda_w)) @@ -194,10 +200,14 @@ MACHINE_CONFIG_START(acs8600_ics_device::device_add_mconfig) MCFG_RS232_CTS_HANDLER(WRITELINE("sio4", z80sio_device, ctsb_w)) MACHINE_CONFIG_END -void acs8600_ics_device::device_start() +void acs8600_ics_device::device_resolve_objects() { - m_maincpu_mem = &m_maincpu->space(AS_PROGRAM); + m_maincpu_mem = &m_host_space_device->space(m_host_space_index); m_out_irq1_func.resolve_safe(); m_out_irq2_func.resolve_safe(); } +void acs8600_ics_device::device_start() +{ +} + diff --git a/src/mame/machine/acs8600_ics.h b/src/mame/machine/acs8600_ics.h index ef8f99c56bd..1ca1f623245 100644 --- a/src/mame/machine/acs8600_ics.h +++ b/src/mame/machine/acs8600_ics.h @@ -1,55 +1,48 @@ // license:BSD-3-Clause // copyright-holders:Carl -#ifndef MAME_MACHINE_ACS8600_ICS_H_ -#define MAME_MACHINE_ACS8600_ICS_H_ +#ifndef MAME_MACHINE_ACS8600_ICS_H +#define MAME_MACHINE_ACS8600_ICS_H #pragma once + class acs8600_ics_device : public device_t { public: - template - acs8600_ics_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&maincpu_tag) - : acs8600_ics_device(mconfig, tag, owner, (uint32_t)0) - { - m_maincpu.set_tag(std::forward(maincpu_tag)); - } - acs8600_ics_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - DECLARE_WRITE8_MEMBER(hiaddr_w); - DECLARE_WRITE8_MEMBER(ctrl_w); - DECLARE_READ8_MEMBER(hostram_r); - DECLARE_WRITE8_MEMBER(hostram_w); DECLARE_WRITE_LINE_MEMBER(attn_w); - template devcb_base &set_irq1_callback(Object &&cb) { return m_out_irq1_func.set_callback(std::forward(cb)); } - template devcb_base &set_irq2_callback(Object &&cb) { return m_out_irq2_func.set_callback(std::forward(cb)); } + auto irq1_callback() { return m_out_irq1_func.bind(); } + auto irq2_callback() { return m_out_irq2_func.bind(); } + template void set_host_space(T &&tag, int index) { m_host_space_device.set_tag(std::forward(tag)); m_host_space_index = index; } const tiny_rom_entry *device_rom_region() const override; - void ics_io(address_map &map); - void ics_mem(address_map &map); protected: + virtual void device_resolve_objects() override; virtual void device_start() override; virtual void device_add_mconfig(machine_config &config) override; + DECLARE_WRITE8_MEMBER(hiaddr_w); + DECLARE_WRITE8_MEMBER(ctrl_w); + DECLARE_READ8_MEMBER(hostram_r); + DECLARE_WRITE8_MEMBER(hostram_w); + + void ics_io(address_map &map); + void ics_mem(address_map &map); + private: required_device m_icscpu; - required_device m_maincpu; devcb_write_line m_out_irq1_func; devcb_write_line m_out_irq2_func; + required_device m_host_space_device; + int m_host_space_index; address_space *m_maincpu_mem; u8 m_hiaddr; u8 m_ctrl; }; -#define MCFG_ACS8600_ICS_IRQ1(_irq_line) \ - devcb = &downcast(*device).set_irq1_callback(DEVCB_##_irq_line); - -#define MCFG_ACS8600_ICS_IRQ2(_irq_line) \ - devcb = &downcast(*device).set_irq2_callback(DEVCB_##_irq_line); - DECLARE_DEVICE_TYPE(ACS8600_ICS, acs8600_ics_device) -#endif +#endif // MAME_MACHINE_ACS8600_ICS_H diff --git a/src/mame/machine/apollo.cpp b/src/mame/machine/apollo.cpp index 323e487f108..5fad90fa5d5 100644 --- a/src/mame/machine/apollo.cpp +++ b/src/mame/machine/apollo.cpp @@ -1084,14 +1084,14 @@ MACHINE_CONFIG_START(apollo_state::common) MCFG_I8237_OUT_DACK_2_CB(WRITELINE(*this, apollo_state, pc_dack6_w)) MCFG_I8237_OUT_DACK_3_CB(WRITELINE(*this, apollo_state, pc_dack7_w)) - MCFG_DEVICE_ADD(APOLLO_PIC1_TAG, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, apollo_state, apollo_pic8259_master_set_int_line)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, apollo_state, apollo_pic8259_get_slave_ack)) - - MCFG_DEVICE_ADD(APOLLO_PIC2_TAG, PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, apollo_state, apollo_pic8259_slave_set_int_line)) - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_pic8259_master, 0); + m_pic8259_master->out_int_callback().set(FUNC(apollo_state::apollo_pic8259_master_set_int_line)); + m_pic8259_master->in_sp_callback().set_constant(1); + m_pic8259_master->read_slave_ack_callback().set(FUNC(apollo_state::apollo_pic8259_get_slave_ack)); + + PIC8259(config, m_pic8259_slave, 0); + m_pic8259_slave->out_int_callback().set(FUNC(apollo_state::apollo_pic8259_slave_set_int_line)); + m_pic8259_slave->in_sp_callback().set_constant(0); MCFG_DEVICE_ADD(APOLLO_PTM_TAG, PTM6840, 0) MCFG_PTM6840_EXTERNAL_CLOCKS(250000, 125000, 62500) diff --git a/src/mame/machine/apollo_kbd.h b/src/mame/machine/apollo_kbd.h index aba8281ba3a..97221e62fa9 100644 --- a/src/mame/machine/apollo_kbd.h +++ b/src/mame/machine/apollo_kbd.h @@ -32,10 +32,10 @@ //************************************************************************** #define MCFG_APOLLO_KBD_TX_CALLBACK(_cb) \ - devcb = &downcast(*device).set_tx_cb(DEVCB_##_cb); + downcast(*device).set_tx_cb(DEVCB_##_cb); #define MCFG_APOLLO_KBD_GERMAN_CALLBACK(_cb) \ - devcb = &downcast(*device).set_german_cb(DEVCB_##_cb); + downcast(*device).set_german_cb(DEVCB_##_cb); //************************************************************************** diff --git a/src/mame/machine/apricotkb.h b/src/mame/machine/apricotkb.h index 50c6a9cfb15..530346608fd 100644 --- a/src/mame/machine/apricotkb.h +++ b/src/mame/machine/apricotkb.h @@ -27,7 +27,7 @@ //************************************************************************** #define MCFG_APRICOT_KEYBOARD_TXD_CALLBACK(_write) \ - devcb = &downcast(*device).set_tcd_wr_callback(DEVCB_##_write); + downcast(*device).set_tcd_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/at.cpp b/src/mame/machine/at.cpp index 6057d870502..97ea32b571d 100644 --- a/src/mame/machine/at.cpp +++ b/src/mame/machine/at.cpp @@ -95,39 +95,39 @@ MACHINE_CONFIG_START(at_mb_device::device_add_mconfig) MCFG_I8237_OUT_DACK_2_CB(WRITELINE(*this, at_mb_device, dack6_w)) MCFG_I8237_OUT_DACK_3_CB(WRITELINE(*this, at_mb_device, dack7_w)) - MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE(":maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) - MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, at_mb_device, get_slave_ack)) + pic8259_device &pic8259_master(PIC8259(config, "pic8259_master", 0)); + pic8259_master.out_int_callback().set_inputline(":maincpu", 0); + pic8259_master.in_sp_callback().set_constant(1); + pic8259_master.read_slave_ack_callback().set(FUNC(at_mb_device::get_slave_ack)); - MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir2_w)) - MCFG_PIC8259_IN_SP_CB(GND) + PIC8259(config, m_pic8259_slave, 0); + m_pic8259_slave->out_int_callback().set("pic8259_master", FUNC(pic8259_device::ir2_w)); + m_pic8259_slave->in_sp_callback().set_constant(0); MCFG_DEVICE_ADD("isabus", ISA16, 0) MCFG_ISA16_CPU(":maincpu") - MCFG_ISA_OUT_IRQ2_CB(WRITELINE("pic8259_slave", pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used + MCFG_ISA_OUT_IRQ2_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir2_w)) // in place of irq 2 on at irq 9 is used MCFG_ISA_OUT_IRQ3_CB(WRITELINE("pic8259_master", pic8259_device, ir3_w)) MCFG_ISA_OUT_IRQ4_CB(WRITELINE("pic8259_master", pic8259_device, ir4_w)) MCFG_ISA_OUT_IRQ5_CB(WRITELINE("pic8259_master", pic8259_device, ir5_w)) MCFG_ISA_OUT_IRQ6_CB(WRITELINE("pic8259_master", pic8259_device, ir6_w)) MCFG_ISA_OUT_IRQ7_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) - MCFG_ISA_OUT_IRQ10_CB(WRITELINE("pic8259_slave", pic8259_device, ir3_w)) - MCFG_ISA_OUT_IRQ11_CB(WRITELINE("pic8259_slave", pic8259_device, ir4_w)) - MCFG_ISA_OUT_IRQ12_CB(WRITELINE("pic8259_slave", pic8259_device, ir5_w)) - MCFG_ISA_OUT_IRQ14_CB(WRITELINE("pic8259_slave", pic8259_device, ir6_w)) - MCFG_ISA_OUT_IRQ15_CB(WRITELINE("pic8259_slave", pic8259_device, ir7_w)) - MCFG_ISA_OUT_DRQ0_CB(WRITELINE("dma8237_1", am9517a_device, dreq0_w)) - MCFG_ISA_OUT_DRQ1_CB(WRITELINE("dma8237_1", am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ2_CB(WRITELINE("dma8237_1", am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ3_CB(WRITELINE("dma8237_1", am9517a_device, dreq3_w)) - MCFG_ISA_OUT_DRQ5_CB(WRITELINE("dma8237_2", am9517a_device, dreq1_w)) - MCFG_ISA_OUT_DRQ6_CB(WRITELINE("dma8237_2", am9517a_device, dreq2_w)) - MCFG_ISA_OUT_DRQ7_CB(WRITELINE("dma8237_2", am9517a_device, dreq3_w)) - - MCFG_DEVICE_ADD("rtc", MC146818, 32.768_kHz_XTAL) - MCFG_MC146818_IRQ_HANDLER(WRITELINE("pic8259_slave", pic8259_device, ir0_w)) - MCFG_MC146818_CENTURY_INDEX(0x32) + MCFG_ISA_OUT_IRQ10_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir3_w)) + MCFG_ISA_OUT_IRQ11_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir4_w)) + MCFG_ISA_OUT_IRQ12_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir5_w)) + MCFG_ISA_OUT_IRQ14_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir6_w)) + MCFG_ISA_OUT_IRQ15_CB(WRITELINE(m_pic8259_slave, pic8259_device, ir7_w)) + MCFG_ISA_OUT_DRQ0_CB(WRITELINE(m_dma8237_1, am9517a_device, dreq0_w)) + MCFG_ISA_OUT_DRQ1_CB(WRITELINE(m_dma8237_1, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ2_CB(WRITELINE(m_dma8237_1, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ3_CB(WRITELINE(m_dma8237_1, am9517a_device, dreq3_w)) + MCFG_ISA_OUT_DRQ5_CB(WRITELINE(m_dma8237_2, am9517a_device, dreq1_w)) + MCFG_ISA_OUT_DRQ6_CB(WRITELINE(m_dma8237_2, am9517a_device, dreq2_w)) + MCFG_ISA_OUT_DRQ7_CB(WRITELINE(m_dma8237_2, am9517a_device, dreq3_w)) + + MC146818(config, m_mc146818, 32.768_kHz_XTAL); + m_mc146818->irq_callback().set(m_pic8259_slave, FUNC(pic8259_device::ir0_w)); + m_mc146818->set_century_index(0x32); /* sound hardware */ SPEAKER(config, "mono").front_center(); diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index 56edee0ec77..f7a17481c2a 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -35,7 +35,7 @@ #define MCFG_ATARI_SOUND_COMM_ADD(_tag, _soundcpu, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_SOUND_COMM, 0) \ downcast(*device).set_sound_cpu(_soundcpu); \ - devcb = &downcast(*device).set_main_int_cb(DEVCB_##_intcb); + downcast(*device).set_main_int_cb(DEVCB_##_intcb); diff --git a/src/mame/machine/balsente.cpp b/src/mame/machine/balsente.cpp index 465b2c5a27e..6a59c4231c3 100644 --- a/src/mame/machine/balsente.cpp +++ b/src/mame/machine/balsente.cpp @@ -333,11 +333,6 @@ WRITE8_MEMBER(balsente_state::acia_w) m_acia->write(space, offset, (BIT(offset, 0) && data == 0xe0) ? 0 : data); } -WRITE_LINE_MEMBER(balsente_state::uint_w) -{ - m_uint = bool(state); -} - WRITE_LINE_MEMBER(balsente_state::uint_propagate_w) { if (state && BIT(m_counter_control, 5)) diff --git a/src/mame/machine/c117.h b/src/mame/machine/c117.h index bbe8d3ca5c1..9432aa845c2 100644 --- a/src/mame/machine/c117.h +++ b/src/mame/machine/c117.h @@ -17,7 +17,7 @@ downcast(*device).set_cpu_tags(_maincpu, _subcpu); #define MCFG_CUS117_SUBRES_CB(_devcb) \ - devcb = &downcast(*device).set_subres_cb(DEVCB_##_devcb); + downcast(*device).set_subres_cb(DEVCB_##_devcb); //*************************************************************************** diff --git a/src/mame/machine/cammu.h b/src/mame/machine/cammu.h index efd08061d4f..e852beb4c37 100644 --- a/src/mame/machine/cammu.h +++ b/src/mame/machine/cammu.h @@ -12,7 +12,7 @@ downcast(*device).set_cammu_id(_id); #define MCFG_CAMMU_EXCEPTION_CB(_exceptioncb) \ - devcb = &downcast(*device).set_exception_callback(DEVCB_##_exceptioncb); + downcast(*device).set_exception_callback(DEVCB_##_exceptioncb); #define MCFG_CAMMU_LINK(_tag) \ downcast(*device).add_linked(_tag); diff --git a/src/mame/machine/cat702.h b/src/mame/machine/cat702.h index 4c66568b817..4d25407e4a6 100644 --- a/src/mame/machine/cat702.h +++ b/src/mame/machine/cat702.h @@ -11,7 +11,7 @@ DECLARE_DEVICE_TYPE(CAT702, cat702_device) #define MCFG_CAT702_DATAOUT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dataout_handler(DEVCB_##_devcb); + downcast(*device).set_dataout_handler(DEVCB_##_devcb); class cat702_device : public device_t { diff --git a/src/mame/machine/cit101_kbd.h b/src/mame/machine/cit101_kbd.h index 9404d0ea4a6..4ffc070e269 100644 --- a/src/mame/machine/cit101_kbd.h +++ b/src/mame/machine/cit101_kbd.h @@ -21,7 +21,7 @@ //************************************************************************** #define MCFG_CIT101_HLE_KEYBOARD_TXD_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_txd_callback(DEVCB_##_devcb); + downcast(*device).set_txd_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/compiskb.h b/src/mame/machine/compiskb.h index 3d13cb2fcbb..a6e9093973f 100644 --- a/src/mame/machine/compiskb.h +++ b/src/mame/machine/compiskb.h @@ -20,7 +20,7 @@ //************************************************************************** #define MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_tx_handler(DEVCB_##_devcb); + downcast(*device).set_out_tx_handler(DEVCB_##_devcb); diff --git a/src/mame/machine/cuda.h b/src/mame/machine/cuda.h index f7984087b33..99f786908b2 100644 --- a/src/mame/machine/cuda.h +++ b/src/mame/machine/cuda.h @@ -38,16 +38,16 @@ MCFG_DEVICE_REMOVE(CUDA_TAG) #define MCFG_CUDA_RESET_CALLBACK(_cb) \ - devcb = &downcast(*device).set_reset_cb(DEVCB_##_cb); + downcast(*device).set_reset_cb(DEVCB_##_cb); #define MCFG_CUDA_LINECHANGE_CALLBACK(_cb) \ - devcb = &downcast(*device).set_linechange_cb(DEVCB_##_cb); + downcast(*device).set_linechange_cb(DEVCB_##_cb); #define MCFG_CUDA_VIA_CLOCK_CALLBACK(_cb) \ - devcb = &downcast(*device).set_via_clock_cb(DEVCB_##_cb); + downcast(*device).set_via_clock_cb(DEVCB_##_cb); #define MCFG_CUDA_VIA_DATA_CALLBACK(_cb) \ - devcb = &downcast(*device).set_via_data_cb(DEVCB_##_cb); + downcast(*device).set_via_data_cb(DEVCB_##_cb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/machine/dec_lk201.h b/src/mame/machine/dec_lk201.h index 06c0d29beef..9d1bc423722 100644 --- a/src/mame/machine/dec_lk201.h +++ b/src/mame/machine/dec_lk201.h @@ -38,7 +38,7 @@ //************************************************************************** #define MCFG_LK201_TX_HANDLER(_cb) \ - devcb = &downcast(*device).set_tx_handler(DEVCB_##_cb); + downcast(*device).set_tx_handler(DEVCB_##_cb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/machine/deco104.h b/src/mame/machine/deco104.h index e9bde950888..aa2957437b9 100644 --- a/src/mame/machine/deco104.h +++ b/src/mame/machine/deco104.h @@ -22,8 +22,4 @@ protected: DECLARE_DEVICE_TYPE(DECO104PROT, deco104_device) - -#define MCFG_DECO104_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, DECO104PROT, 0) - #endif // MAME_MACHINE_DECO104_H diff --git a/src/mame/machine/deco146.h b/src/mame/machine/deco146.h index fd9bc753154..2ac17aed197 100644 --- a/src/mame/machine/deco146.h +++ b/src/mame/machine/deco146.h @@ -9,16 +9,16 @@ #define MCFG_DECO146_IN_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_port_a_cb(DEVCB_##_devcb); + downcast(*device).set_port_a_cb(DEVCB_##_devcb); #define MCFG_DECO146_IN_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_port_b_cb(DEVCB_##_devcb); + downcast(*device).set_port_b_cb(DEVCB_##_devcb); #define MCFG_DECO146_IN_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_port_c_cb(DEVCB_##_devcb); + downcast(*device).set_port_c_cb(DEVCB_##_devcb); #define MCFG_DECO146_SOUNDLATCH_IRQ_CB(_devcb) \ - devcb = &downcast(*device).set_soundlatch_irq_callback(DEVCB_##_devcb); + downcast(*device).set_soundlatch_irq_callback(DEVCB_##_devcb); // there are some standard ways the chip gets hooked up, so have them here ready to use #define MCFG_DECO146_SET_INTERFACE_SCRAMBLE( a9,a8,a7,a6,a5,a4,a3,a2,a1,a0 ) \ @@ -85,6 +85,9 @@ public: template devcb_base &set_port_a_cb(Object &&object) { return m_port_a_r.set_callback(std::forward(object)); } template devcb_base &set_port_b_cb(Object &&object) { return m_port_b_r.set_callback(std::forward(object)); } template devcb_base &set_port_c_cb(Object &&object) { return m_port_c_r.set_callback(std::forward(object)); } + auto port_a_cb() { return m_port_a_r.bind(); } + auto port_b_cb() { return m_port_b_r.bind(); } + auto port_c_cb() { return m_port_c_r.bind(); } void set_interface_scramble(uint8_t a9, uint8_t a8, uint8_t a7, uint8_t a6, uint8_t a5, uint8_t a4, uint8_t a3,uint8_t a2,uint8_t a1,uint8_t a0) { m_external_addrswap[9] = a9; @@ -103,6 +106,7 @@ public: void set_use_magic_read_address_xor(bool use_xor) { m_magic_read_address_xor_enabled = use_xor; } template devcb_base &set_soundlatch_irq_callback(Object &&cb) { return m_soundlatch_irq_cb.set_callback(std::forward(cb)); } + auto soundlatch_irq_cb() { return m_soundlatch_irq_cb.bind(); } DECLARE_READ8_MEMBER( soundlatch_r ); diff --git a/src/mame/machine/deco_irq.h b/src/mame/machine/deco_irq.h index bc559c9cbf0..78a44d21741 100644 --- a/src/mame/machine/deco_irq.h +++ b/src/mame/machine/deco_irq.h @@ -23,22 +23,22 @@ downcast(*device).set_screen_tag(_screen_tag); #define MCFG_DECO_IRQ_LIGHTGUN1_CB(_devcb) \ - devcb = &downcast(*device).set_lightgun1_callback(DEVCB_##_devcb); + downcast(*device).set_lightgun1_callback(DEVCB_##_devcb); #define MCFG_DECO_IRQ_LIGHTGUN2_CB(_devcb) \ - devcb = &downcast(*device).set_lightgun2_callback(DEVCB_##_devcb); + downcast(*device).set_lightgun2_callback(DEVCB_##_devcb); #define MCFG_DECO_IRQ_LIGHTGUN_IRQ_CB(_devcb) \ - devcb = &downcast(*device).set_lightgun_irq_callback(DEVCB_##_devcb); + downcast(*device).set_lightgun_irq_callback(DEVCB_##_devcb); #define MCFG_DECO_IRQ_RASTER1_IRQ_CB(_devcb) \ - devcb = &downcast(*device).set_raster1_irq_callback(DEVCB_##_devcb); + downcast(*device).set_raster1_irq_callback(DEVCB_##_devcb); #define MCFG_DECO_IRQ_RASTER2_IRQ_CB(_devcb) \ - devcb = &downcast(*device).set_raster2_irq_callback(DEVCB_##_devcb); + downcast(*device).set_raster2_irq_callback(DEVCB_##_devcb); #define MCFG_DECO_IRQ_VBLANK_IRQ_CB(_devcb) \ - devcb = &downcast(*device).set_vblank_irq_callback(DEVCB_##_devcb); + downcast(*device).set_vblank_irq_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/egret.h b/src/mame/machine/egret.h index a6bb3bc6fc8..c94cf56be0f 100644 --- a/src/mame/machine/egret.h +++ b/src/mame/machine/egret.h @@ -36,16 +36,16 @@ MCFG_DEVICE_REMOVE(EGRET_TAG) #define MCFG_EGRET_RESET_CALLBACK(_cb) \ - devcb = &downcast(*device).set_reset_cb(DEVCB_##_cb); + downcast(*device).set_reset_cb(DEVCB_##_cb); #define MCFG_EGRET_LINECHANGE_CALLBACK(_cb) \ - devcb = &downcast(*device).set_linechange_cb(DEVCB_##_cb); + downcast(*device).set_linechange_cb(DEVCB_##_cb); #define MCFG_EGRET_VIA_CLOCK_CALLBACK(_cb) \ - devcb = &downcast(*device).set_via_clock_cb(DEVCB_##_cb); + downcast(*device).set_via_clock_cb(DEVCB_##_cb); #define MCFG_EGRET_VIA_DATA_CALLBACK(_cb) \ - devcb = &downcast(*device).set_via_data_cb(DEVCB_##_cb); + downcast(*device).set_via_data_cb(DEVCB_##_cb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/machine/esqpanel.h b/src/mame/machine/esqpanel.h index 730a46b2bc8..05221f2745c 100644 --- a/src/mame/machine/esqpanel.h +++ b/src/mame/machine/esqpanel.h @@ -53,10 +53,10 @@ MCFG_DEVICE_REMOVE(_tag) #define MCFG_ESQPANEL_TX_CALLBACK(_write) \ - devcb = &downcast(*device).set_tx_wr_callback(DEVCB_##_write); + downcast(*device).set_tx_wr_callback(DEVCB_##_write); #define MCFG_ESQPANEL_ANALOG_CALLBACK(_write) \ - devcb = &downcast(*device).set_analog_wr_callback(DEVCB_##_write); + downcast(*device).set_analog_wr_callback(DEVCB_##_write); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/machine/fm_scsi.h b/src/mame/machine/fm_scsi.h index 2fcd1950fbd..c93b2d0ae4c 100644 --- a/src/mame/machine/fm_scsi.h +++ b/src/mame/machine/fm_scsi.h @@ -16,9 +16,9 @@ MCFG_DEVICE_ADD(_tag, FMSCSI, 0) #define MCFG_FMSCSI_IRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irq_handler(DEVCB_##_devcb); + downcast(*device).set_irq_handler(DEVCB_##_devcb); #define MCFG_FMSCSI_DRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_drq_handler(DEVCB_##_devcb); + downcast(*device).set_drq_handler(DEVCB_##_devcb); class fmscsi_device : public legacy_scsi_host_adapter { diff --git a/src/mame/machine/gaelco3d.h b/src/mame/machine/gaelco3d.h index 4a30d708322..21a37195445 100644 --- a/src/mame/machine/gaelco3d.h +++ b/src/mame/machine/gaelco3d.h @@ -16,7 +16,7 @@ ***************************************************************************/ #define MCFG_GAELCO_SERIAL_IRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irq_handler(DEVCB_##_devcb); + downcast(*device).set_irq_handler(DEVCB_##_devcb); diff --git a/src/mame/machine/hp9845_printer.h b/src/mame/machine/hp9845_printer.h index 0c8aea9e594..c7752b24c03 100644 --- a/src/mame/machine/hp9845_printer.h +++ b/src/mame/machine/hp9845_printer.h @@ -16,13 +16,13 @@ #include "imagedev/bitbngr.h" #define MCFG_9845PRT_IRL_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irl_handler(DEVCB_##_devcb); + downcast(*device).set_irl_handler(DEVCB_##_devcb); #define MCFG_9845PRT_FLG_HANDLER(_devcb) \ - devcb = &downcast(*device).set_flg_handler(DEVCB_##_devcb); + downcast(*device).set_flg_handler(DEVCB_##_devcb); #define MCFG_9845PRT_STS_HANDLER(_devcb) \ - devcb = &downcast(*device).set_sts_handler(DEVCB_##_devcb); + downcast(*device).set_sts_handler(DEVCB_##_devcb); class hp9845_printer_device : public device_t { diff --git a/src/mame/machine/ibm6580_fdc.h b/src/mame/machine/ibm6580_fdc.h index 30bbb2c9b6f..92a85fb9a7d 100644 --- a/src/mame/machine/ibm6580_fdc.h +++ b/src/mame/machine/ibm6580_fdc.h @@ -10,13 +10,13 @@ #define MCFG_DW_FDC_OUT_DATA_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_data_handler(DEVCB_##_devcb); + downcast(*device).set_out_data_handler(DEVCB_##_devcb); #define MCFG_DW_FDC_OUT_CLOCK_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_clock_handler(DEVCB_##_devcb); + downcast(*device).set_out_clock_handler(DEVCB_##_devcb); #define MCFG_DW_FDC_OUT_STROBE_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_strobe_handler(DEVCB_##_devcb); + downcast(*device).set_out_strobe_handler(DEVCB_##_devcb); class dw_fdc_device : public device_t diff --git a/src/mame/machine/ibm6580_kbd.h b/src/mame/machine/ibm6580_kbd.h index f39ce79857b..4796503ba58 100644 --- a/src/mame/machine/ibm6580_kbd.h +++ b/src/mame/machine/ibm6580_kbd.h @@ -6,23 +6,14 @@ #pragma once -#define MCFG_DW_KEYBOARD_OUT_DATA_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_data_handler(DEVCB_##_devcb); - -#define MCFG_DW_KEYBOARD_OUT_CLOCK_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_clock_handler(DEVCB_##_devcb); - -#define MCFG_DW_KEYBOARD_OUT_STROBE_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_strobe_handler(DEVCB_##_devcb); - class dw_keyboard_device : public device_t { public: dw_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_out_data_handler(Object &&cb) { return m_out_data.set_callback(std::forward(cb)); } - template devcb_base &set_out_clock_handler(Object &&cb) { return m_out_clock.set_callback(std::forward(cb)); } - template devcb_base &set_out_strobe_handler(Object &&cb) { return m_out_strobe.set_callback(std::forward(cb)); } + auto out_data_handler() { return m_out_data.bind(); } + auto out_clock_handler() { return m_out_clock.bind(); } + auto out_strobe_handler() { return m_out_strobe.bind(); } DECLARE_WRITE_LINE_MEMBER(reset_w); DECLARE_WRITE_LINE_MEMBER(ack_w); diff --git a/src/mame/machine/interpro_ioga.h b/src/mame/machine/interpro_ioga.h index cb7b8529788..dee30060b17 100644 --- a/src/mame/machine/interpro_ioga.h +++ b/src/mame/machine/interpro_ioga.h @@ -7,27 +7,27 @@ #pragma once #define MCFG_INTERPRO_IOGA_NMI_CB(_out_nmi) \ - devcb = &downcast(*device).set_out_nmi_callback(DEVCB_##_out_nmi); + downcast(*device).set_out_nmi_callback(DEVCB_##_out_nmi); #define MCFG_INTERPRO_IOGA_IRQ_CB(_out_irq) \ - devcb = &downcast(*device).set_out_irq_callback(DEVCB_##_out_irq); + downcast(*device).set_out_irq_callback(DEVCB_##_out_irq); #define MCFG_INTERPRO_IOGA_IVEC_CB(_out_ivec) \ - devcb = &downcast(*device).set_out_irq_vector_callback(DEVCB_##_out_ivec); + downcast(*device).set_out_irq_vector_callback(DEVCB_##_out_ivec); #define MCFG_INTERPRO_IOGA_DMA_CB(_channel, _dma_r, _dma_w) \ - devcb = &downcast(*device).set_dma_r_callback(_channel, DEVCB_##_dma_r); \ - devcb = &downcast(*device).set_dma_w_callback(_channel, DEVCB_##_dma_w); + downcast(*device).set_dma_r_callback(_channel, DEVCB_##_dma_r); \ + downcast(*device).set_dma_w_callback(_channel, DEVCB_##_dma_w); #define MCFG_INTERPRO_IOGA_SERIAL_DMA_CB(_channel, _dma_r, _dma_w) \ - devcb = &downcast(*device).set_serial_dma_r_callback(_channel, DEVCB_##_dma_r); \ - devcb = &downcast(*device).set_serial_dma_w_callback(_channel, DEVCB_##_dma_w); + downcast(*device).set_serial_dma_r_callback(_channel, DEVCB_##_dma_r); \ + downcast(*device).set_serial_dma_w_callback(_channel, DEVCB_##_dma_w); #define MCFG_INTERPRO_IOGA_FDCTC_CB(_tc) \ - devcb = &downcast(*device).set_fdc_tc_callback(DEVCB_##_tc); + downcast(*device).set_fdc_tc_callback(DEVCB_##_tc); #define MCFG_INTERPRO_IOGA_ETH_CA_CB(_ca) \ - devcb = &downcast(*device).set_eth_ca_callback(DEVCB_##_ca); + downcast(*device).set_eth_ca_callback(DEVCB_##_ca); #define MCFG_INTERPRO_IOGA_MEMORY(_tag, _spacenum) \ downcast(*device).set_memory(_tag, _spacenum); @@ -85,6 +85,15 @@ public: template devcb_base &set_serial_dma_w_callback(int channel, Object &&cb) { return m_serial_dma_channel[channel].device_w.set_callback(std::forward(cb)); } template devcb_base &set_fdc_tc_callback(Object &&cb) { return m_fdc_tc_func.set_callback(std::forward(cb)); } template devcb_base &set_eth_ca_callback(Object &&cb) { return m_eth_ca_func.set_callback(std::forward(cb)); } + auto out_nmi_callback() { return m_out_nmi_func.bind(); } + auto out_irq_callback() { return m_out_irq_func.bind(); } + auto out_irq_vector_callback() { return m_out_irq_vector_func.bind(); } + template auto dma_r_callback() { return m_dma_channel[Chan].device_r.bind(); } + template auto dma_w_callback() { return m_dma_channel[Chan].device_w.bind(); } + template auto serial_dma_r_callback() { return m_serial_dma_channel[Chan].device_r.bind(); } + template auto serial_dma_w_callback() { return m_serial_dma_channel[Chan].device_w.bind(); } + auto fdc_tc_callback() { return m_fdc_tc_func.bind(); } + auto eth_ca_callback() { return m_eth_ca_func.bind(); } void set_memory(const char *const tag, const int spacenum) { diff --git a/src/mame/machine/interpro_sga.h b/src/mame/machine/interpro_sga.h index d9753bb5533..c845722eb0e 100644 --- a/src/mame/machine/interpro_sga.h +++ b/src/mame/machine/interpro_sga.h @@ -7,7 +7,7 @@ #pragma once #define MCFG_INTERPRO_SGA_BERR_CB(_out_berr) \ - devcb = &downcast(*device).set_out_berr_callback(DEVCB_##_out_berr); + downcast(*device).set_out_berr_callback(DEVCB_##_out_berr); class interpro_sga_device : public device_t { diff --git a/src/mame/machine/ioptimer.h b/src/mame/machine/ioptimer.h index e3a45ca2a0b..a109474d5ce 100644 --- a/src/mame/machine/ioptimer.h +++ b/src/mame/machine/ioptimer.h @@ -16,7 +16,7 @@ #define MCFG_IOP_TIMER_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_int_cb(DEVCB_##_write); + downcast(*device).set_int_cb(DEVCB_##_write); class iop_timer_device : public device_t { diff --git a/src/mame/machine/isbc_208.h b/src/mame/machine/isbc_208.h index f05cd797907..792b9c72306 100644 --- a/src/mame/machine/isbc_208.h +++ b/src/mame/machine/isbc_208.h @@ -51,7 +51,7 @@ private: }; #define MCFG_ISBC_208_IRQ(_irq_line) \ - devcb = &downcast(*device).set_irq_callback(DEVCB_##_irq_line); + downcast(*device).set_irq_callback(DEVCB_##_irq_line); DECLARE_DEVICE_TYPE(ISBC_208, isbc_208_device) diff --git a/src/mame/machine/isbc_215g.h b/src/mame/machine/isbc_215g.h index 565d742f1de..76336b85dab 100644 --- a/src/mame/machine/isbc_215g.h +++ b/src/mame/machine/isbc_215g.h @@ -85,7 +85,7 @@ private: }; #define MCFG_ISBC_215_IRQ(_irq_line) \ - devcb = &downcast(*device).set_irq_callback(DEVCB_##_irq_line); + downcast(*device).set_irq_callback(DEVCB_##_irq_line); DECLARE_DEVICE_TYPE(ISBC_215G, isbc_215g_device) diff --git a/src/mame/machine/k573cass.h b/src/mame/machine/k573cass.h index c317ef2aaf2..4a623f35bfc 100644 --- a/src/mame/machine/k573cass.h +++ b/src/mame/machine/k573cass.h @@ -17,7 +17,7 @@ #include "machine/zs01.h" #define MCFG_KONAMI573_CASSETTE_DSR_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dsr_handler(DEVCB_##_devcb); + downcast(*device).set_dsr_handler(DEVCB_##_devcb); DECLARE_DEVICE_TYPE(KONAMI573_CASSETTE_SLOT, konami573_cassette_slot_device) @@ -143,28 +143,28 @@ DECLARE_DEVICE_TYPE(KONAMI573_CASSETTE_Y, konami573_cassette_y_device) #define MCFG_KONAMI573_CASSETTE_Y_D0_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d0_handler(DEVCB_##_devcb); + downcast(*device).set_d0_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D1_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d1_handler(DEVCB_##_devcb); + downcast(*device).set_d1_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D2_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d2_handler(DEVCB_##_devcb); + downcast(*device).set_d2_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D3_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d3_handler(DEVCB_##_devcb); + downcast(*device).set_d3_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D4_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d4_handler(DEVCB_##_devcb); + downcast(*device).set_d4_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D5_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d5_handler(DEVCB_##_devcb); + downcast(*device).set_d5_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D6_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d6_handler(DEVCB_##_devcb); + downcast(*device).set_d6_handler(DEVCB_##_devcb); #define MCFG_KONAMI573_CASSETTE_Y_D7_HANDLER(_devcb) \ - devcb = &downcast(*device).set_d7_handler(DEVCB_##_devcb); + downcast(*device).set_d7_handler(DEVCB_##_devcb); class konami573_cassette_y_device: public device_t, public konami573_cassette_interface diff --git a/src/mame/machine/kay_kbd.h b/src/mame/machine/kay_kbd.h index 689fdb1e32e..4274f7f3199 100644 --- a/src/mame/machine/kay_kbd.h +++ b/src/mame/machine/kay_kbd.h @@ -8,10 +8,6 @@ #include "sound/spkrdev.h" -#define MCFG_KAYPRO10KBD_RXD_CB(cb) \ - devcb = &downcast(*device).set_rxd_cb(DEVCB_##cb); - - class kaypro_10_keyboard_device : public device_t { public: @@ -19,9 +15,9 @@ public: machine_config const &mconfig, char const *tag, device_t *owner, - std::uint32_t clock); + std::uint32_t clock = 0); - template devcb_base &set_rxd_cb(Object &&cb) { return m_rxd_cb.set_callback(std::forward(cb)); } + auto rxd_cb() { return m_rxd_cb.bind(); } DECLARE_WRITE_LINE_MEMBER(txd_w) { m_txd = state ? 1U : 0U; } diff --git a/src/mame/machine/kc_keyb.h b/src/mame/machine/kc_keyb.h index 08d23773372..1ccef297e9f 100644 --- a/src/mame/machine/kc_keyb.h +++ b/src/mame/machine/kc_keyb.h @@ -12,7 +12,7 @@ #pragma once #define MCFG_KC_KEYBOARD_OUT_CALLBACK(_write) \ - devcb = &downcast(*device).set_out_wr_callback(DEVCB_##_write); + downcast(*device).set_out_wr_callback(DEVCB_##_write); /*************************************************************************** TYPE DEFINITIONS diff --git a/src/mame/machine/km035.h b/src/mame/machine/km035.h index 2f932fdd586..ad8dc58d21b 100644 --- a/src/mame/machine/km035.h +++ b/src/mame/machine/km035.h @@ -18,10 +18,10 @@ //************************************************************************** #define MCFG_KM035_TX_HANDLER(_cb) \ - devcb = &downcast(*device).set_tx_handler(DEVCB_##_cb); + downcast(*device).set_tx_handler(DEVCB_##_cb); #define MCFG_KM035_RTS_HANDLER(_cb) \ - devcb = &downcast(*device).set_rts_handler(DEVCB_##_cb); + downcast(*device).set_rts_handler(DEVCB_##_cb); //************************************************************************** diff --git a/src/mame/machine/m24_kbd.h b/src/mame/machine/m24_kbd.h index cf3c7df39f4..5aa4fe3ccae 100644 --- a/src/mame/machine/m24_kbd.h +++ b/src/mame/machine/m24_kbd.h @@ -8,7 +8,7 @@ #include "cpu/mcs48/mcs48.h" #define MCFG_M24_KEYBOARD_OUT_DATA_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_data_handler(DEVCB_##_devcb); + downcast(*device).set_out_data_handler(DEVCB_##_devcb); class m24_keyboard_device : public device_t { diff --git a/src/mame/machine/m24_z8000.h b/src/mame/machine/m24_z8000.h index 970f5aa273c..df226b87926 100644 --- a/src/mame/machine/m24_z8000.h +++ b/src/mame/machine/m24_z8000.h @@ -11,7 +11,7 @@ #include "machine/pic8259.h" #define MCFG_M24_Z8000_HALT(_devcb) \ - devcb = &downcast(*device).set_halt_callback(DEVCB_##_devcb); + downcast(*device).set_halt_callback(DEVCB_##_devcb); class m24_z8000_device : public device_t { diff --git a/src/mame/machine/mackbd.cpp b/src/mame/machine/mackbd.cpp index c5af275772d..741226a7e84 100644 --- a/src/mame/machine/mackbd.cpp +++ b/src/mame/machine/mackbd.cpp @@ -160,16 +160,17 @@ INPUT_PORTS_END // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START(mackbd_device::device_add_mconfig) - MCFG_DEVICE_ADD(MACKBD_CPU_TAG, I8021, 3000000) // "the approximate clock rate of the MPU is 3 MHz" - MCFG_MCS48_PORT_BUS_IN_CB(READ8(*this, mackbd_device, p0_r)) - MCFG_MCS48_PORT_BUS_OUT_CB(WRITE8(*this, mackbd_device, p0_w)) - MCFG_MCS48_PORT_P1_IN_CB(READ8(*this, mackbd_device, p1_r)) - MCFG_MCS48_PORT_P1_OUT_CB(WRITE8(*this, mackbd_device, p1_w)) - MCFG_MCS48_PORT_P2_IN_CB(READ8(*this, mackbd_device, p2_r)) - MCFG_MCS48_PORT_P2_OUT_CB(WRITE8(*this, mackbd_device, p2_w)) - MCFG_MCS48_PORT_T1_IN_CB(IOPORT("MODS")) MCFG_DEVCB_RSHIFT(1) // option -MACHINE_CONFIG_END +void mackbd_device::device_add_mconfig(machine_config &config) +{ + mcs48_cpu_device &cpu(I8021(config, m_maincpu, 3000000)); // "the approximate clock rate of the MPU is 3 MHz" + cpu.bus_in_cb().set(FUNC(mackbd_device::p0_r)); + cpu.bus_out_cb().set(FUNC(mackbd_device::p0_w)); + cpu.p1_in_cb().set(FUNC(mackbd_device::p1_r)); + cpu.p1_out_cb().set(FUNC(mackbd_device::p1_w)); + cpu.p2_in_cb().set(FUNC(mackbd_device::p2_r)); + cpu.p2_out_cb().set(FUNC(mackbd_device::p2_w)); + cpu.t1_in_cb().set_ioport("MODS").bit(1); // option +} const tiny_rom_entry *mackbd_device::device_rom_region() const { @@ -189,8 +190,8 @@ ioport_constructor mackbd_device::device_input_ports() const // mackbd_device - constructor //------------------------------------------------- -mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, MACKBD, tag, owner, clock), +mackbd_device::mackbd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, MACKBD, tag, owner, clock), m_maincpu(*this, MACKBD_CPU_TAG), m_clkout_handler(*this), m_dataout_handler(*this) diff --git a/src/mame/machine/mackbd.h b/src/mame/machine/mackbd.h index 0a1178d51be..4fba653cfc4 100644 --- a/src/mame/machine/mackbd.h +++ b/src/mame/machine/mackbd.h @@ -24,7 +24,7 @@ devcb = downcast(*device).set_clkout_handler(DEVCB_##_devcb); #define MCFG_MACKBD_DATAOUT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dataout_handler(DEVCB_##_devcb); + downcast(*device).set_dataout_handler(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/machine/microdrv.h b/src/mame/machine/microdrv.h index ced4d175223..7fa62714adb 100644 --- a/src/mame/machine/microdrv.h +++ b/src/mame/machine/microdrv.h @@ -28,7 +28,7 @@ MCFG_DEVICE_ADD(_tag, MICRODRIVE, 0) #define MCFG_MICRODRIVE_COMMS_OUT_CALLBACK(_write) \ - devcb = &downcast(*device).set_comms_out_wr_callback(DEVCB_##_write); + downcast(*device).set_comms_out_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/micropolis.h b/src/mame/machine/micropolis.h index 7474e77cbaf..5f2dd3f7b08 100644 --- a/src/mame/machine/micropolis.h +++ b/src/mame/machine/micropolis.h @@ -28,13 +28,13 @@ MCFG_MICROPOLIS_DRIVE_TAGS(FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3) #define MCFG_MICROPOLIS_DDEN_CALLBACK(_read) \ - devcb = &downcast(*device).set_dden_rd_callback(DEVCB_##_read); + downcast(*device).set_dden_rd_callback(DEVCB_##_read); #define MCFG_MICROPOLIS_INTRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_intrq_wr_callback(DEVCB_##_write); + downcast(*device).set_intrq_wr_callback(DEVCB_##_write); #define MCFG_MICROPOLIS_DRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_drq_wr_callback(DEVCB_##_write); + downcast(*device).set_drq_wr_callback(DEVCB_##_write); /*************************************************************************** MACROS diff --git a/src/mame/machine/midikbd.h b/src/mame/machine/midikbd.h index 993003cbd80..d3c77dec6ab 100644 --- a/src/mame/machine/midikbd.h +++ b/src/mame/machine/midikbd.h @@ -10,7 +10,7 @@ #define MCFG_MIDI_KBD_ADD(_tag, _devcb, _clock) \ MCFG_DEVICE_ADD(_tag, MIDI_KBD, _clock) \ - devcb = &downcast(*device).set_tx_callback(DEVCB_##_devcb); + downcast(*device).set_tx_callback(DEVCB_##_devcb); class midi_keyboard_device : public device_t, public device_serial_interface { diff --git a/src/mame/machine/midwayic.h b/src/mame/machine/midwayic.h index 0b7e3e6e820..8d764d34999 100644 --- a/src/mame/machine/midwayic.h +++ b/src/mame/machine/midwayic.h @@ -239,16 +239,16 @@ DECLARE_DEVICE_TYPE(MIDWAY_IOASIC, midway_ioasic_device) downcast(*device).set_shuffle_default(_shuffle); #define MCFG_MIDWAY_IOASIC_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_irqhandler_callback(DEVCB_##_write); + downcast(*device).set_irqhandler_callback(DEVCB_##_write); #define MCFG_MIDWAY_IOASIC_AUTO_ACK(_ack) \ downcast(*device).set_auto_ack(_ack); #define MCFG_MIDWAY_IOASIC_OUT_TX_CB(_devcb) \ - devcb = &downcast(*device).set_serial_tx_callback(DEVCB_##_devcb); + downcast(*device).set_serial_tx_callback(DEVCB_##_devcb); #define MCFG_MIDWAY_IOASIC_AUX_OUT_CB(_devcb) \ - devcb = &downcast(*device).set_aux_output_callback(DEVCB_##_devcb); + downcast(*device).set_aux_output_callback(DEVCB_##_devcb); enum diff --git a/src/mame/machine/mm1kb.h b/src/mame/machine/mm1kb.h index 9cf08ecd942..d9204ae3f69 100644 --- a/src/mame/machine/mm1kb.h +++ b/src/mame/machine/mm1kb.h @@ -20,7 +20,7 @@ //************************************************************************** #define MCFG_MM1_KEYBOARD_KBST_CALLBACK(_write) \ - devcb = &downcast(*device).set_kbst_wr_callback(DEVCB_##_write); + downcast(*device).set_kbst_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/model1io.cpp b/src/mame/machine/model1io.cpp index dadc2e026dd..8fef843c855 100644 --- a/src/mame/machine/model1io.cpp +++ b/src/mame/machine/model1io.cpp @@ -128,30 +128,31 @@ const tiny_rom_entry *model1io_device::device_rom_region() const // device_add_mconfig - add device configuration //------------------------------------------------- -MACHINE_CONFIG_START( model1io_device::device_add_mconfig ) - MCFG_DEVICE_ADD("iocpu", Z80, 32_MHz_XTAL/8) - MCFG_DEVICE_PROGRAM_MAP(mem_map) - - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) // 93C45 - - MCFG_DEVICE_ADD("io", SEGA_315_5338A, 32_MHz_XTAL) - MCFG_315_5338A_READ_CB(READ8(*this, model1io_device, io_r)) - MCFG_315_5338A_WRITE_CB(WRITE8(*this, model1io_device, io_w)) - MCFG_315_5338A_OUT_PA_CB(WRITE8(*this, model1io_device, io_pa_w)) - MCFG_315_5338A_IN_PB_CB(READ8(*this, model1io_device, io_pb_r)) - MCFG_315_5338A_IN_PC_CB(READ8(*this, model1io_device, io_pc_r)) - MCFG_315_5338A_IN_PD_CB(READ8(*this, model1io_device, io_pd_r)) - MCFG_315_5338A_IN_PE_CB(READ8(*this, model1io_device, io_pe_r)) - MCFG_315_5338A_OUT_PE_CB(WRITE8(*this, model1io_device, io_pe_w)) - MCFG_315_5338A_OUT_PF_CB(WRITE8(*this, model1io_device, io_pf_w)) - MCFG_315_5338A_IN_PG_CB(READ8(*this, model1io_device, io_pg_r)) - - MCFG_DEVICE_ADD("adc", MSM6253, 0) - MCFG_MSM6253_IN0_ANALOG_READ(model1io_device, analog0_r) - MCFG_MSM6253_IN1_ANALOG_READ(model1io_device, analog1_r) - MCFG_MSM6253_IN2_ANALOG_READ(model1io_device, analog2_r) - MCFG_MSM6253_IN3_ANALOG_READ(model1io_device, analog3_r) -MACHINE_CONFIG_END +void model1io_device::device_add_mconfig(machine_config &config) +{ + z80_device &iocpu(Z80(config, "iocpu", 32_MHz_XTAL/8)); + iocpu.set_addrmap(AS_PROGRAM, &model1io_device::mem_map); + + EEPROM_SERIAL_93C46_16BIT(config, m_eeprom); // 93C45 + + sega_315_5338a_device &io(SEGA_315_5338A(config, "io", 32_MHz_XTAL)); + io.read_callback().set(FUNC(model1io_device::io_r)); + io.write_callback().set(FUNC(model1io_device::io_w)); + io.out_pa_callback().set(FUNC(model1io_device::io_pa_w)); + io.in_pb_callback().set(FUNC(model1io_device::io_pb_r)); + io.in_pc_callback().set(FUNC(model1io_device::io_pc_r)); + io.in_pd_callback().set(FUNC(model1io_device::io_pd_r)); + io.in_pe_callback().set(FUNC(model1io_device::io_pe_r)); + io.out_pe_callback().set(FUNC(model1io_device::io_pe_w)); + io.out_pf_callback().set(FUNC(model1io_device::io_pf_w)); + io.in_pg_callback().set(FUNC(model1io_device::io_pg_r)); + + msm6253_device &adc(MSM6253(config, "adc", 0)); + adc.set_input_cb<0>(FUNC(model1io_device::analog0_r), this); + adc.set_input_cb<1>(FUNC(model1io_device::analog1_r), this); + adc.set_input_cb<2>(FUNC(model1io_device::analog2_r), this); + adc.set_input_cb<3>(FUNC(model1io_device::analog3_r), this); +} //************************************************************************** diff --git a/src/mame/machine/model1io.h b/src/mame/machine/model1io.h index 78434ff5adb..7c78ab2cf18 100644 --- a/src/mame/machine/model1io.h +++ b/src/mame/machine/model1io.h @@ -23,52 +23,52 @@ //************************************************************************** #define MCFG_MODEL1IO_READ_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback(DEVCB_##_devcb); + downcast(*device).set_read_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback(DEVCB_##_devcb); + downcast(*device).set_write_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO_IN0_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback(DEVCB_##_devcb, 0); + downcast(*device).set_in_callback(DEVCB_##_devcb, 0); #define MCFG_MODEL1IO_IN1_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback(DEVCB_##_devcb, 1); + downcast(*device).set_in_callback(DEVCB_##_devcb, 1); #define MCFG_MODEL1IO_IN2_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback(DEVCB_##_devcb, 2); + downcast(*device).set_in_callback(DEVCB_##_devcb, 2); #define MCFG_MODEL1IO_DRIVE_READ_CB(_devcb) \ - devcb = &downcast(*device).set_drive_read_callback(DEVCB_##_devcb); + downcast(*device).set_drive_read_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO_DRIVE_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_drive_write_callback(DEVCB_##_devcb); + downcast(*device).set_drive_write_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO_AN0_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 0); + downcast(*device).set_an_callback(DEVCB_##_devcb, 0); #define MCFG_MODEL1IO_AN1_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 1); + downcast(*device).set_an_callback(DEVCB_##_devcb, 1); #define MCFG_MODEL1IO_AN2_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 2); + downcast(*device).set_an_callback(DEVCB_##_devcb, 2); #define MCFG_MODEL1IO_AN3_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 3); + downcast(*device).set_an_callback(DEVCB_##_devcb, 3); #define MCFG_MODEL1IO_AN4_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 4); + downcast(*device).set_an_callback(DEVCB_##_devcb, 4); #define MCFG_MODEL1IO_AN5_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 5); + downcast(*device).set_an_callback(DEVCB_##_devcb, 5); #define MCFG_MODEL1IO_AN6_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 6); + downcast(*device).set_an_callback(DEVCB_##_devcb, 6); #define MCFG_MODEL1IO_AN7_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback(DEVCB_##_devcb, 7); + downcast(*device).set_an_callback(DEVCB_##_devcb, 7); #define MCFG_MODEL1IO_OUTPUT_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback(DEVCB_##_devcb); + downcast(*device).set_output_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/model1io2.cpp b/src/mame/machine/model1io2.cpp index 4a793bf63bb..4d142f5c5a8 100644 --- a/src/mame/machine/model1io2.cpp +++ b/src/mame/machine/model1io2.cpp @@ -135,57 +135,57 @@ const tiny_rom_entry *model1io2_device::device_rom_region() const //------------------------------------------------- MACHINE_CONFIG_START( model1io2_device::device_add_mconfig ) - MCFG_DEVICE_ADD("iocpu", TMPZ84C015, 19.6608_MHz_XTAL / 2) // TMPZ84C015AF-12 - MCFG_DEVICE_PROGRAM_MAP(mem_map) + tmpz84c015_device &iocpu(TMPZ84C015(config, "iocpu", 19.6608_MHz_XTAL / 2)); // TMPZ84C015AF-12 + iocpu.set_addrmap(AS_PROGRAM, &model1io2_device::mem_map); // SIO channel a baud rate adjusted by dsw1 1+2: 38400, 19200, 9600, 4800 - MCFG_TMPZ84C015_ZC2_CB(WRITELINE("iocpu", tmpz84c015_device, rxca_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("iocpu", tmpz84c015_device, txca_w)) - MCFG_TMPZ84C015_ZC3_CB(WRITELINE("iocpu", tmpz84c015_device, rxcb_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("iocpu", tmpz84c015_device, txcb_w)) - - MCFG_TMPZ84C015_OUT_TXDA_CB(WRITELINE("cn7", rs232_port_device, write_txd)) - MCFG_TMPZ84C015_OUT_RTSA_CB(WRITELINE("cn7", rs232_port_device, write_rts)) - MCFG_TMPZ84C015_OUT_DTRA_CB(WRITELINE("cn7", rs232_port_device, write_dtr)) - - MCFG_TMPZ84C015_OUT_TXDB_CB(WRITELINE("cn8", rs232_port_device, write_txd)) - MCFG_TMPZ84C015_OUT_RTSB_CB(WRITELINE("cn8", rs232_port_device, write_rts)) - MCFG_TMPZ84C015_OUT_DTRB_CB(WRITELINE("cn8", rs232_port_device, write_dtr)) - - MCFG_TMPZ84C015_IN_PA_CB(IOPORT("dsw2")) - MCFG_TMPZ84C015_IN_PB_CB(IOPORT("dsw3")) - - MCFG_DEVICE_ADD("cn7", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("iocpu", tmpz84c015_device, rxa_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("iocpu", tmpz84c015_device, ctsa_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("iocpu", tmpz84c015_device, dcda_w)) - - MCFG_DEVICE_ADD("cn8", RS232_PORT, default_rs232_devices, nullptr) - MCFG_RS232_RXD_HANDLER(WRITELINE("iocpu", tmpz84c015_device, rxb_w)) - MCFG_RS232_CTS_HANDLER(WRITELINE("iocpu", tmpz84c015_device, ctsb_w)) - MCFG_RS232_DCD_HANDLER(WRITELINE("iocpu", tmpz84c015_device, dcdb_w)) - - MCFG_DEVICE_ADD("io", SEGA_315_5338A, 32_MHz_XTAL) - MCFG_315_5338A_READ_CB(READ8(*this, model1io2_device, io_r)) - MCFG_315_5338A_WRITE_CB(WRITE8(*this, model1io2_device, io_w)) - MCFG_315_5338A_IN_PA_CB(READ8(*this, model1io2_device, io_pa_r)) - MCFG_315_5338A_IN_PB_CB(READ8(*this, model1io2_device, io_pb_r)) - MCFG_315_5338A_IN_PC_CB(READ8(*this, model1io2_device, io_pc_r)) - MCFG_315_5338A_OUT_PD_CB(WRITE8(*this, model1io2_device, io_pd_w)) - MCFG_315_5338A_IN_PE_CB(READ8(*this, model1io2_device, io_pe_r)) - MCFG_315_5338A_OUT_PE_CB(WRITE8(*this, model1io2_device, io_pe_w)) - MCFG_315_5338A_OUT_PF_CB(WRITE8(*this, model1io2_device, io_pf_w)) - MCFG_315_5338A_OUT_PG_CB(WRITE8(*this, model1io2_device, io_pg_w)) - - MCFG_DEVICE_ADD("eeprom", EEPROM_SERIAL_93C46_16BIT) // 93C45 - - MCFG_DEVICE_ADD("watchdog", MB3773, 0) - - MCFG_DEVICE_ADD("adc", MSM6253, 32_MHz_XTAL / 16 / 4) - MCFG_MSM6253_IN0_ANALOG_READ(model1io2_device, analog0_r) - MCFG_MSM6253_IN1_ANALOG_READ(model1io2_device, analog1_r) - MCFG_MSM6253_IN2_ANALOG_READ(model1io2_device, analog2_r) - MCFG_MSM6253_IN3_ANALOG_READ(model1io2_device, analog3_r) + iocpu.zc_callback<2>().set("iocpu", FUNC(tmpz84c015_device::rxca_w)); + iocpu.zc_callback<2>().append("iocpu", FUNC(tmpz84c015_device::txca_w)); + iocpu.zc_callback<3>().set("iocpu", FUNC(tmpz84c015_device::rxcb_w)); + iocpu.zc_callback<3>().append("iocpu", FUNC(tmpz84c015_device::txcb_w)); + + iocpu.out_txda_callback().set("cn7", FUNC(rs232_port_device::write_txd)); + iocpu.out_rtsa_callback().set("cn7", FUNC(rs232_port_device::write_rts)); + iocpu.out_dtra_callback().set("cn7", FUNC(rs232_port_device::write_dtr)); + + iocpu.out_txdb_callback().set("cn8", FUNC(rs232_port_device::write_txd)); + iocpu.out_rtsb_callback().set("cn8", FUNC(rs232_port_device::write_rts)); + iocpu.out_dtrb_callback().set("cn8", FUNC(rs232_port_device::write_dtr)); + + iocpu.in_pa_callback().set_ioport("dsw2"); + iocpu.in_pb_callback().set_ioport("dsw3"); + + rs232_port_device &cn7(RS232_PORT(config, "cn7", default_rs232_devices, nullptr)); + cn7.rxd_handler().set("iocpu", FUNC(tmpz84c015_device::rxa_w)); + cn7.cts_handler().set("iocpu", FUNC(tmpz84c015_device::ctsa_w)); + cn7.dcd_handler().set("iocpu", FUNC(tmpz84c015_device::dcda_w)); + + rs232_port_device &cn8(RS232_PORT(config, "cn8", default_rs232_devices, nullptr)); + cn8.rxd_handler().set("iocpu", FUNC(tmpz84c015_device::rxb_w)); + cn8.cts_handler().set("iocpu", FUNC(tmpz84c015_device::ctsb_w)); + cn8.dcd_handler().set("iocpu", FUNC(tmpz84c015_device::dcdb_w)); + + sega_315_5338a_device &io(SEGA_315_5338A(config, "io", 32_MHz_XTAL)); + io.read_callback().set(FUNC(model1io2_device::io_r)); + io.write_callback().set(FUNC(model1io2_device::io_w)); + io.in_pa_callback().set(FUNC(model1io2_device::io_pa_r)); + io.in_pb_callback().set(FUNC(model1io2_device::io_pb_r)); + io.in_pc_callback().set(FUNC(model1io2_device::io_pc_r)); + io.out_pd_callback().set(FUNC(model1io2_device::io_pd_w)); + io.in_pe_callback().set(FUNC(model1io2_device::io_pe_r)); + io.out_pe_callback().set(FUNC(model1io2_device::io_pe_w)); + io.out_pf_callback().set(FUNC(model1io2_device::io_pf_w)); + io.out_pg_callback().set(FUNC(model1io2_device::io_pg_w)); + + EEPROM_SERIAL_93C46_16BIT(config, m_eeprom); // 93C45 + + MB3773(config, m_watchdog, 0); + + msm6253_device &adc(MSM6253(config, "adc", 32_MHz_XTAL / 16 / 4)); + adc.set_input_cb<0>(FUNC(model1io2_device::analog0_r), this); + adc.set_input_cb<1>(FUNC(model1io2_device::analog1_r), this); + adc.set_input_cb<2>(FUNC(model1io2_device::analog2_r), this); + adc.set_input_cb<3>(FUNC(model1io2_device::analog3_r), this); // diagnostic lcd display MCFG_SCREEN_ADD("screen", LCD) diff --git a/src/mame/machine/model1io2.h b/src/mame/machine/model1io2.h index f9e26a1ca3d..90e43430ff9 100644 --- a/src/mame/machine/model1io2.h +++ b/src/mame/machine/model1io2.h @@ -22,52 +22,52 @@ //************************************************************************** #define MCFG_MODEL1IO2_READ_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback(DEVCB_##_devcb); + downcast(*device).set_read_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO2_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback(DEVCB_##_devcb); + downcast(*device).set_write_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO2_IN0_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<0>(DEVCB_##_devcb); + downcast(*device).set_in_callback<0>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_IN1_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<1>(DEVCB_##_devcb); + downcast(*device).set_in_callback<1>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_IN2_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<2>(DEVCB_##_devcb); + downcast(*device).set_in_callback<2>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_DRIVE_READ_CB(_devcb) \ - devcb = &downcast(*device).set_drive_read_callback(DEVCB_##_devcb); + downcast(*device).set_drive_read_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO2_DRIVE_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_drive_write_callback(DEVCB_##_devcb); + downcast(*device).set_drive_write_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN0_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<0>(DEVCB_##_devcb); + downcast(*device).set_an_callback<0>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN1_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<1>(DEVCB_##_devcb); + downcast(*device).set_an_callback<1>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN2_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<2>(DEVCB_##_devcb); + downcast(*device).set_an_callback<2>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN3_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<3>(DEVCB_##_devcb); + downcast(*device).set_an_callback<3>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN4_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<4>(DEVCB_##_devcb); + downcast(*device).set_an_callback<4>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN5_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<5>(DEVCB_##_devcb); + downcast(*device).set_an_callback<5>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN6_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<6>(DEVCB_##_devcb); + downcast(*device).set_an_callback<6>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_AN7_CB(_devcb) \ - devcb = &downcast(*device).set_an_callback<7>(DEVCB_##_devcb); + downcast(*device).set_an_callback<7>(DEVCB_##_devcb); #define MCFG_MODEL1IO2_OUTPUT_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback(DEVCB_##_devcb); + downcast(*device).set_output_callback(DEVCB_##_devcb); #define MCFG_MODEL1IO2_LIGHTGUN_P1Y_TAG(_tag) \ downcast(*device).set_lightgun_tag<0>(_tag); diff --git a/src/mame/machine/ms7004.h b/src/mame/machine/ms7004.h index 608ba702723..4c6979a486e 100644 --- a/src/mame/machine/ms7004.h +++ b/src/mame/machine/ms7004.h @@ -17,10 +17,10 @@ //************************************************************************** #define MCFG_MS7004_TX_HANDLER(_cb) \ - devcb = &downcast(*device).set_tx_handler(DEVCB_##_cb); + downcast(*device).set_tx_handler(DEVCB_##_cb); #define MCFG_MS7004_RTS_HANDLER(_cb) \ - devcb = &downcast(*device).set_rts_handler(DEVCB_##_cb); + downcast(*device).set_rts_handler(DEVCB_##_cb); //************************************************************************** diff --git a/src/mame/machine/msx_matsushita.h b/src/mame/machine/msx_matsushita.h index 8e155e2b399..0cf24e8bcdb 100644 --- a/src/mame/machine/msx_matsushita.h +++ b/src/mame/machine/msx_matsushita.h @@ -14,7 +14,7 @@ DECLARE_DEVICE_TYPE(MSX_MATSUSHITA, msx_matsushita_device) MCFG_DEVICE_ADD(_tag, MSX_MATSUSHITA, 0) #define MCFG_MSX_MATSUSHITA_TURBO_CB(_devcb) \ - devcb = &downcast(*device).set_turbo_callback(DEVCB_##_devcb); + downcast(*device).set_turbo_callback(DEVCB_##_devcb); class msx_matsushita_device : public device_t, diff --git a/src/mame/machine/namco06.h b/src/mame/machine/namco06.h index a6a411be3ce..bce93495248 100644 --- a/src/mame/machine/namco06.h +++ b/src/mame/machine/namco06.h @@ -23,42 +23,42 @@ struct namco_06xx_config downcast(*device).set_maincpu(_tag); #define MCFG_NAMCO_06XX_READ_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback<0>(DEVCB_##_devcb); + downcast(*device).set_read_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback<1>(DEVCB_##_devcb); + downcast(*device).set_read_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback<2>(DEVCB_##_devcb); + downcast(*device).set_read_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback<3>(DEVCB_##_devcb); + downcast(*device).set_read_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_REQUEST_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_request_callback<0>(DEVCB_##_devcb); + downcast(*device).set_read_request_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_REQUEST_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_request_callback<1>(DEVCB_##_devcb); + downcast(*device).set_read_request_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_REQUEST_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_request_callback<2>(DEVCB_##_devcb); + downcast(*device).set_read_request_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_READ_REQUEST_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_request_callback<3>(DEVCB_##_devcb); + downcast(*device).set_read_request_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_WRITE_0_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback<0>(DEVCB_##_devcb); + downcast(*device).set_write_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_WRITE_1_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback<1>(DEVCB_##_devcb); + downcast(*device).set_write_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_WRITE_2_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback<2>(DEVCB_##_devcb); + downcast(*device).set_write_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_06XX_WRITE_3_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback<3>(DEVCB_##_devcb); + downcast(*device).set_write_callback<3>(DEVCB_##_devcb); /* device get info callback */ diff --git a/src/mame/machine/namco51.h b/src/mame/machine/namco51.h index 3f94482c9ce..0ee64727137 100644 --- a/src/mame/machine/namco51.h +++ b/src/mame/machine/namco51.h @@ -15,22 +15,22 @@ downcast(*device).set_screen_tag(screen_tag); #define MCFG_NAMCO_51XX_INPUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<0>(DEVCB_##_devcb); + downcast(*device).set_input_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_51XX_INPUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<1>(DEVCB_##_devcb); + downcast(*device).set_input_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_51XX_INPUT_2_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<2>(DEVCB_##_devcb); + downcast(*device).set_input_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_51XX_INPUT_3_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<3>(DEVCB_##_devcb); + downcast(*device).set_input_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO_51XX_OUTPUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback<0>(DEVCB_##_devcb); + downcast(*device).set_output_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_51XX_OUTPUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback<1>(DEVCB_##_devcb); + downcast(*device).set_output_callback<1>(DEVCB_##_devcb); class namco_51xx_device : public device_t { @@ -40,6 +40,8 @@ public: template void set_screen_tag(T &&tag) { m_screen.set_tag(std::forward(tag)); } template devcb_base &set_input_callback(Object &&cb) { return m_in[N].set_callback(std::forward(cb)); } template devcb_base &set_output_callback(Object &&cb) { return m_out[N].set_callback(std::forward(cb)); } + template auto input_callback() { return m_in[N].bind(); } + template auto output_callback() { return m_out[N].bind(); } DECLARE_WRITE8_MEMBER( write ); DECLARE_READ8_MEMBER( read ); diff --git a/src/mame/machine/namco53.h b/src/mame/machine/namco53.h index 7b8852bc738..ec2be4d9330 100644 --- a/src/mame/machine/namco53.h +++ b/src/mame/machine/namco53.h @@ -11,22 +11,22 @@ MCFG_DEVICE_ADD(_tag, NAMCO_53XX, _clock) #define MCFG_NAMCO_53XX_K_CB(_devcb) \ - devcb = &downcast(*device).set_k_port_callback(DEVCB_##_devcb); + downcast(*device).set_k_port_callback(DEVCB_##_devcb); #define MCFG_NAMCO_53XX_INPUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<0>(DEVCB_##_devcb); + downcast(*device).set_input_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_53XX_INPUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<1>(DEVCB_##_devcb); + downcast(*device).set_input_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_53XX_INPUT_2_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<2>(DEVCB_##_devcb); + downcast(*device).set_input_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_53XX_INPUT_3_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<3>(DEVCB_##_devcb); + downcast(*device).set_input_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO_53XX_P_CB(_devcb) \ - devcb = &downcast(*device).set_p_port_callback(DEVCB_##_devcb); + downcast(*device).set_p_port_callback(DEVCB_##_devcb); class namco_53xx_device : public device_t @@ -35,9 +35,12 @@ public: namco_53xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); template devcb_base &set_input_callback(Object &&cb) { return m_in[N].set_callback(std::forward(cb)); } + template auto input_callback() { return m_in[N].bind(); } template devcb_base &set_k_port_callback(Object &&cb) { return m_k.set_callback(std::forward(cb)); } template devcb_base &set_p_port_callback(Object &&cb) { return m_p.set_callback(std::forward(cb)); } + auto k_port_callback() { return m_k.bind(); } + auto p_port_callback() { return m_p.bind(); } DECLARE_READ8_MEMBER( K_r ); DECLARE_READ8_MEMBER( R0_r ); diff --git a/src/mame/machine/namco62.h b/src/mame/machine/namco62.h index c4bffda3ab9..5a2778ec572 100644 --- a/src/mame/machine/namco62.h +++ b/src/mame/machine/namco62.h @@ -9,22 +9,22 @@ MCFG_DEVICE_ADD(_tag, NAMCO_62XX, _clock) #define MCFG_NAMCO_62XX_INPUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<0>(DEVCB_##_devcb); + downcast(*device).set_input_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_62XX_INPUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<1>(DEVCB_##_devcb); + downcast(*device).set_input_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO_62XX_INPUT_2_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<2>(DEVCB_##_devcb); + downcast(*device).set_input_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO_62XX_INPUT_3_CB(_devcb) \ - devcb = &downcast(*device).set_input_callback<3>(DEVCB_##_devcb); + downcast(*device).set_input_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO_62XX_OUTPUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback<0>(DEVCB_##_devcb); + downcast(*device).set_output_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO_62XX_OUTPUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_output_callback<1>(DEVCB_##_devcb); + downcast(*device).set_output_callback<1>(DEVCB_##_devcb); class namco_62xx_device : public device_t diff --git a/src/mame/machine/namco_c148.h b/src/mame/machine/namco_c148.h index c2e2cab4e50..f63d958a0af 100644 --- a/src/mame/machine/namco_c148.h +++ b/src/mame/machine/namco_c148.h @@ -25,10 +25,10 @@ downcast(*device).link_c148_device(_tag); #define MCFG_NAMCO_C148_EXT1_CB(_cb) \ - devcb = &downcast(*device).set_out_ext1_callback(DEVCB_##_cb); + downcast(*device).set_out_ext1_callback(DEVCB_##_cb); #define MCFG_NAMCO_C148_EXT2_CB(_cb) \ - devcb = &downcast(*device).set_out_ext2_callback(DEVCB_##_cb); + downcast(*device).set_out_ext2_callback(DEVCB_##_cb); //************************************************************************** diff --git a/src/mame/machine/namcoio.h b/src/mame/machine/namcoio.h index a0fd950369e..b788fd452a6 100644 --- a/src/mame/machine/namcoio.h +++ b/src/mame/machine/namcoio.h @@ -13,7 +13,8 @@ class namcoio_device : public device_t public: template devcb_base &set_in_callback(Object &&cb) { return m_in_cb[N].set_callback(std::forward(cb)); } template devcb_base &set_out_callback(Object &&cb) { return m_out_cb[N].set_callback(std::forward(cb)); } - + template auto in_callback() { return m_in_cb[N].bind(); } + template auto out_callback() { return m_out_cb[N].bind(); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -89,59 +90,59 @@ DECLARE_DEVICE_TYPE(NAMCO_59XX, namco59xx_device) ***************************************************************************/ #define MCFG_NAMCO56XX_IN_0_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<0>(DEVCB_##_devcb); + downcast(*device).set_in_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO56XX_IN_1_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<1>(DEVCB_##_devcb); + downcast(*device).set_in_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO56XX_IN_2_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<2>(DEVCB_##_devcb); + downcast(*device).set_in_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO56XX_IN_3_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<3>(DEVCB_##_devcb); + downcast(*device).set_in_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO56XX_OUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<0>(DEVCB_##_devcb); + downcast(*device).set_out_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO56XX_OUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<1>(DEVCB_##_devcb); + downcast(*device).set_out_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_IN_0_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<0>(DEVCB_##_devcb); + downcast(*device).set_in_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_IN_1_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<1>(DEVCB_##_devcb); + downcast(*device).set_in_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_IN_2_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<2>(DEVCB_##_devcb); + downcast(*device).set_in_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_IN_3_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<3>(DEVCB_##_devcb); + downcast(*device).set_in_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_OUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<0>(DEVCB_##_devcb); + downcast(*device).set_out_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO58XX_OUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<1>(DEVCB_##_devcb); + downcast(*device).set_out_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_IN_0_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<0>(DEVCB_##_devcb); + downcast(*device).set_in_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_IN_1_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<1>(DEVCB_##_devcb); + downcast(*device).set_in_callback<1>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_IN_2_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<2>(DEVCB_##_devcb); + downcast(*device).set_in_callback<2>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_IN_3_CB(_devcb) \ - devcb = &downcast(*device).set_in_callback<3>(DEVCB_##_devcb); + downcast(*device).set_in_callback<3>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_OUT_0_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<0>(DEVCB_##_devcb); + downcast(*device).set_out_callback<0>(DEVCB_##_devcb); #define MCFG_NAMCO59XX_OUT_1_CB(_devcb) \ - devcb = &downcast(*device).set_out_callback<1>(DEVCB_##_devcb); + downcast(*device).set_out_callback<1>(DEVCB_##_devcb); #endif // MAME_MACHINE_NAMCOIO_H diff --git a/src/mame/machine/nb1412m2.h b/src/mame/machine/nb1412m2.h index a570a7a4021..ae57cf2a1bb 100644 --- a/src/mame/machine/nb1412m2.h +++ b/src/mame/machine/nb1412m2.h @@ -21,7 +21,7 @@ Nichibutsu 1412M2 device emulation MCFG_DEVICE_ADD((tag), NB1412M2, (freq)) #define MCFG_NB1412M2_DAC_CB(_devcb) \ - devcb = &downcast(*device).set_dac_callback(DEVCB_##_devcb); + downcast(*device).set_dac_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/nextkbd.h b/src/mame/machine/nextkbd.h index 7e04b5e1ba6..7ec98122c56 100644 --- a/src/mame/machine/nextkbd.h +++ b/src/mame/machine/nextkbd.h @@ -7,13 +7,13 @@ #define MCFG_NEXTKBD_INT_CHANGE_CALLBACK(_write) \ - devcb = &downcast(*device).set_int_change_wr_callback(DEVCB_##_write); + downcast(*device).set_int_change_wr_callback(DEVCB_##_write); #define MCFG_NEXTKBD_INT_POWER_CALLBACK(_write) \ - devcb = &downcast(*device).set_int_power_wr_callback(DEVCB_##_write); + downcast(*device).set_int_power_wr_callback(DEVCB_##_write); #define MCFG_NEXTKBD_INT_NMI_CALLBACK(_write) \ - devcb = &downcast(*device).set_int_nmi_wr_callback(DEVCB_##_write); + downcast(*device).set_int_nmi_wr_callback(DEVCB_##_write); class nextkbd_device : public device_t { public: diff --git a/src/mame/machine/nextmo.h b/src/mame/machine/nextmo.h index 90d778f2877..af88f690f9d 100644 --- a/src/mame/machine/nextmo.h +++ b/src/mame/machine/nextmo.h @@ -6,10 +6,10 @@ #pragma once #define MCFG_NEXTMO_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_irq_wr_callback(DEVCB_##_write); + downcast(*device).set_irq_wr_callback(DEVCB_##_write); #define MCFG_NEXTMO_DRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_drq_wr_callback(DEVCB_##_write); + downcast(*device).set_drq_wr_callback(DEVCB_##_write); class nextmo_device : public device_t { diff --git a/src/mame/machine/pc1512kb.h b/src/mame/machine/pc1512kb.h index fe5f7c5b30a..f4830b9221d 100644 --- a/src/mame/machine/pc1512kb.h +++ b/src/mame/machine/pc1512kb.h @@ -30,10 +30,10 @@ //************************************************************************** #define MCFG_PC1512_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &downcast(*device).set_clock_wr_callback(DEVCB_##_write); + downcast(*device).set_clock_wr_callback(DEVCB_##_write); #define MCFG_PC1512_KEYBOARD_DATA_CALLBACK(_write) \ - devcb = &downcast(*device).set_data_wr_callback(DEVCB_##_write); + downcast(*device).set_data_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/pc9801_kbd.h b/src/mame/machine/pc9801_kbd.h index 140a8c326e5..7275bf99666 100644 --- a/src/mame/machine/pc9801_kbd.h +++ b/src/mame/machine/pc9801_kbd.h @@ -17,7 +17,7 @@ //************************************************************************** #define MCFG_PC9801_KBD_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_irq_wr_callback(DEVCB_##_write); + downcast(*device).set_irq_wr_callback(DEVCB_##_write); //************************************************************************** diff --git a/src/mame/machine/pcd_kbd.h b/src/mame/machine/pcd_kbd.h index b8f95c2853a..2fce6e8e31e 100644 --- a/src/mame/machine/pcd_kbd.h +++ b/src/mame/machine/pcd_kbd.h @@ -6,7 +6,7 @@ #pragma once #define MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_tx_handler(DEVCB_##_devcb); + downcast(*device).set_out_tx_handler(DEVCB_##_devcb); class pcd_keyboard_device : public device_t { diff --git a/src/mame/machine/pcshare.cpp b/src/mame/machine/pcshare.cpp index 0ab2e7f20bc..67caa8e7415 100644 --- a/src/mame/machine/pcshare.cpp +++ b/src/mame/machine/pcshare.cpp @@ -190,12 +190,12 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(pcat_base_state::pcat_common) MCFG_DEVICE_ADD("pic8259_1", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, pcat_base_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_2", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_1", pic8259_device, ir2_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("dma8237_1", AM9517A, 14.318181_MHz_XTAL / 3) MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, pcat_base_state, pc_dma_hrq_changed)) diff --git a/src/mame/machine/ps2timer.h b/src/mame/machine/ps2timer.h index 879526f1d92..902bf93af0a 100644 --- a/src/mame/machine/ps2timer.h +++ b/src/mame/machine/ps2timer.h @@ -14,7 +14,6 @@ #pragma once -#include "emu.h" class ps2_timer_device : public device_t { @@ -115,4 +114,4 @@ protected: DECLARE_DEVICE_TYPE(SONYPS2_TIMER, ps2_timer_device) -#endif // MAME_MACHINE_PS2TIMER_H \ No newline at end of file +#endif // MAME_MACHINE_PS2TIMER_H diff --git a/src/mame/machine/psxcd.h b/src/mame/machine/psxcd.h index dd9b19dfbe4..2a32e094ff9 100644 --- a/src/mame/machine/psxcd.h +++ b/src/mame/machine/psxcd.h @@ -13,7 +13,7 @@ //************************************************************************** #define MCFG_PSXCD_IRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irq_handler(DEVCB_##_devcb); + downcast(*device).set_irq_handler(DEVCB_##_devcb); class psxcd_device : public cdrom_image_device { diff --git a/src/mame/machine/qimi.h b/src/mame/machine/qimi.h index baef9984218..0ebfad9a8a5 100644 --- a/src/mame/machine/qimi.h +++ b/src/mame/machine/qimi.h @@ -19,7 +19,7 @@ //************************************************************************** #define MCFG_QIMI_EXTINT_CALLBACK(_write) \ - devcb = &downcast(*device).set_exting_wr_callback(DEVCB_##_write); + downcast(*device).set_exting_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/rad_eu3a05gpio.h b/src/mame/machine/rad_eu3a05gpio.h index 435e09be56f..329ac588940 100644 --- a/src/mame/machine/rad_eu3a05gpio.h +++ b/src/mame/machine/rad_eu3a05gpio.h @@ -5,13 +5,13 @@ #define MAME_AUDIO_RAD_EU3A05GPIO_H #define MCFG_RADICA6502_GPIO_READ_PORT0_CB(_devcb) \ - devcb = &downcast(*device).set_gpio_read_0_callback(DEVCB_##_devcb); + downcast(*device).set_gpio_read_0_callback(DEVCB_##_devcb); #define MCFG_RADICA6502_GPIO_READ_PORT1_CB(_devcb) \ - devcb = &downcast(*device).set_gpio_read_1_callback(DEVCB_##_devcb); + downcast(*device).set_gpio_read_1_callback(DEVCB_##_devcb); #define MCFG_RADICA6502_GPIO_READ_PORT2_CB(_devcb) \ - devcb = &downcast(*device).set_gpio_read_2_callback(DEVCB_##_devcb); + downcast(*device).set_gpio_read_2_callback(DEVCB_##_devcb); class radica6502_gpio_device : public device_t diff --git a/src/mame/machine/segaic16.h b/src/mame/machine/segaic16.h index 4cd2c64cbd7..48b6c0c3b59 100644 --- a/src/mame/machine/segaic16.h +++ b/src/mame/machine/segaic16.h @@ -27,9 +27,9 @@ #define MCFG_SEGA_315_5195_MAPPER_HANDLER(_class, _mapper) \ downcast(*device).set_mapper(sega_315_5195_mapper_device::mapper_delegate(&_class::_mapper, #_class "::" #_mapper, nullptr, (_class *)nullptr)); #define MCFG_SEGA_315_5195_PBF_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_pbf_callback(DEVCB_##_devcb); + downcast(*device).set_pbf_callback(DEVCB_##_devcb); #define MCFG_SEGA_315_5195_MCU_INT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_mcu_int_callback(DEVCB_##_devcb); + downcast(*device).set_mcu_int_callback(DEVCB_##_devcb); #define MCFG_SEGA_315_5248_MULTIPLIER_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, SEGA_315_5248_MULTIPLIER, 0) @@ -37,13 +37,6 @@ #define MCFG_SEGA_315_5249_DIVIDER_ADD(_tag) \ MCFG_DEVICE_ADD(_tag, SEGA_315_5249_DIVIDER, 0) -#define MCFG_SEGA_315_5250_COMPARE_TIMER_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, SEGA_315_5250_COMPARE_TIMER, 0) -#define MCFG_SEGA_315_5250_68KINT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_68kint_callback(DEVCB_##_devcb); -#define MCFG_SEGA_315_5250_ZINT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_zint_callback(DEVCB_##_devcb); - //************************************************************************** // TYPE DEFINITIONS @@ -252,8 +245,8 @@ public: sega_315_5250_compare_timer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration helpers - template devcb_base &set_68kint_callback(Object &&object) { return m_68kint_callback.set_callback(std::forward(object)); } - template devcb_base &set_zint_callback(Object &&object) { return m_zint_callback.set_callback(std::forward(object)); } + auto m68kint_callback() { return m_68kint_callback.bind(); } + auto zint_callback() { return m_zint_callback.bind(); } // public interface DECLARE_WRITE_LINE_MEMBER(exck_w); diff --git a/src/mame/machine/seibucop/seibucop.h b/src/mame/machine/seibucop/seibucop.h index 7bd5809d9bf..2ab5e2ab6b6 100644 --- a/src/mame/machine/seibucop/seibucop.h +++ b/src/mame/machine/seibucop/seibucop.h @@ -17,10 +17,10 @@ #define LOG_Move0905 0 #define MCFG_RAIDEN2COP_VIDEORAM_OUT_CB(_devcb) \ - devcb = &downcast(*device).set_videoramout_cb(DEVCB_##_devcb); + downcast(*device).set_videoramout_cb(DEVCB_##_devcb); #define MCFG_RAIDEN2COP_PALETTERAM_OUT_CB(_devcb) \ - devcb = &downcast(*device).set_paletteramout_cb(DEVCB_##_devcb); + downcast(*device).set_paletteramout_cb(DEVCB_##_devcb); #define MCFG_RAIDEN2COP_HOST_CPU(_tag) \ downcast(*device).set_host_cpu_tag(_tag); diff --git a/src/mame/machine/tait8741.h b/src/mame/machine/tait8741.h index 5da76a49d7a..ceb9b39e823 100644 --- a/src/mame/machine/tait8741.h +++ b/src/mame/machine/tait8741.h @@ -18,10 +18,10 @@ MCFG_DEVICE_ADD(_tag, TAITO8741_4PACK, 0) #define MCFG_TAITO8741_PORT_HANDLERS(_devcb0, _devcb1, _devcb2, _devcb3) \ - devcb = &downcast(*device).set_port_handler_0_callback(DEVCB_##_devcb0); \ - devcb = &downcast(*device).set_port_handler_1_callback(DEVCB_##_devcb1); \ - devcb = &downcast(*device).set_port_handler_2_callback(DEVCB_##_devcb2); \ - devcb = &downcast(*device).set_port_handler_3_callback(DEVCB_##_devcb3); + downcast(*device).set_port_handler_0_callback(DEVCB_##_devcb0); \ + downcast(*device).set_port_handler_1_callback(DEVCB_##_devcb1); \ + downcast(*device).set_port_handler_2_callback(DEVCB_##_devcb2); \ + downcast(*device).set_port_handler_3_callback(DEVCB_##_devcb3); #define MCFG_TAITO8741_MODES(_mode0, _mode1, _mode2, _mode3) \ downcast(*device).set_mode(0, _mode0); \ diff --git a/src/mame/machine/taito68705interface.h b/src/mame/machine/taito68705interface.h index ce87836187e..80871f77799 100644 --- a/src/mame/machine/taito68705interface.h +++ b/src/mame/machine/taito68705interface.h @@ -63,7 +63,7 @@ private: #define MCFG_TAITO_M68705_AUX_STROBE_CB(cb) \ - devcb = &downcast(*device).set_aux_strobe_cb(DEVCB_##cb); + downcast(*device).set_aux_strobe_cb(DEVCB_##cb); class taito68705_mcu_device : public taito68705_mcu_device_base { @@ -98,10 +98,10 @@ protected: #define MCFG_ARKANOID_MCU_SEMAPHORE_CB(cb) \ - devcb = &downcast(*device).set_semaphore_cb(DEVCB_##cb); + downcast(*device).set_semaphore_cb(DEVCB_##cb); #define MCFG_ARKANOID_MCU_PORTB_R_CB(cb) \ - devcb = &downcast(*device).set_portb_r_cb(DEVCB_##cb); + downcast(*device).set_portb_r_cb(DEVCB_##cb); class arkanoid_mcu_device_base : public taito68705_mcu_device_base { diff --git a/src/mame/machine/taitocchip.h b/src/mame/machine/taitocchip.h index 526b54137c4..f551a7192b0 100644 --- a/src/mame/machine/taitocchip.h +++ b/src/mame/machine/taitocchip.h @@ -15,25 +15,25 @@ DECLARE_DEVICE_TYPE(TAITO_CCHIP, taito_cchip_device) MCFG_DEVICE_ADD(_tag, TAITO_CCHIP, _clock) #define MCFG_CCHIP_IN_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_in_pa_callback(DEVCB_##_devcb); + downcast(*device).set_in_pa_callback(DEVCB_##_devcb); #define MCFG_CCHIP_IN_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_in_pb_callback(DEVCB_##_devcb); + downcast(*device).set_in_pb_callback(DEVCB_##_devcb); #define MCFG_CCHIP_IN_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_in_pc_callback(DEVCB_##_devcb); + downcast(*device).set_in_pc_callback(DEVCB_##_devcb); #define MCFG_CCHIP_IN_PORTAD_CB(_devcb) \ - devcb = &downcast(*device).set_in_ad_callback(DEVCB_##_devcb); + downcast(*device).set_in_ad_callback(DEVCB_##_devcb); #define MCFG_CCHIP_OUT_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_out_pa_callback(DEVCB_##_devcb); + downcast(*device).set_out_pa_callback(DEVCB_##_devcb); #define MCFG_CCHIP_OUT_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_out_pb_callback(DEVCB_##_devcb); + downcast(*device).set_out_pb_callback(DEVCB_##_devcb); #define MCFG_CCHIP_OUT_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_out_pc_callback(DEVCB_##_devcb); + downcast(*device).set_out_pc_callback(DEVCB_##_devcb); class taito_cchip_device : public device_t diff --git a/src/mame/machine/taitoio.h b/src/mame/machine/taitoio.h index 63b843b8f28..06bd5868d2d 100644 --- a/src/mame/machine/taitoio.h +++ b/src/mame/machine/taitoio.h @@ -21,12 +21,12 @@ class tc0040ioc_device : public device_t public: tc0040ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_read_0_callback(Object &&cb) { return m_read_0_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_1_callback(Object &&cb) { return m_read_1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_2_callback(Object &&cb) { return m_read_2_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_3_callback(Object &&cb) { return m_read_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_4_callback(Object &&cb) { return m_write_4_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_7_callback(Object &&cb) { return m_read_7_cb.set_callback(std::forward(cb)); } + auto read_0_callback() { return m_read_0_cb.bind(); } + auto read_1_callback() { return m_read_1_cb.bind(); } + auto read_2_callback() { return m_read_2_cb.bind(); } + auto read_3_callback() { return m_read_3_cb.bind(); } + auto write_4_callback() { return m_write_4_cb.bind(); } + auto read_7_callback() { return m_read_7_cb.bind(); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -64,13 +64,13 @@ class tc0220ioc_device : public device_t public: tc0220ioc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_read_0_callback(Object &&cb) { return m_read_0_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_1_callback(Object &&cb) { return m_read_1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_2_callback(Object &&cb) { return m_read_2_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_3_callback(Object &&cb) { return m_read_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_3_callback(Object &&cb) { return m_write_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_4_callback(Object &&cb) { return m_write_4_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_7_callback(Object &&cb) { return m_read_7_cb.set_callback(std::forward(cb)); } + auto read_0_callback() { return m_read_0_cb.bind(); } + auto read_1_callback() { return m_read_1_cb.bind(); } + auto read_2_callback() { return m_read_2_cb.bind(); } + auto read_3_callback() { return m_read_3_cb.bind(); } + auto write_3_callback() { return m_write_3_cb.bind(); } + auto write_4_callback() { return m_write_4_cb.bind(); } + auto read_7_callback() { return m_read_7_cb.bind(); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -103,13 +103,13 @@ class tc0510nio_device : public device_t public: tc0510nio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_read_0_callback(Object &&cb) { return m_read_0_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_1_callback(Object &&cb) { return m_read_1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_2_callback(Object &&cb) { return m_read_2_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_3_callback(Object &&cb) { return m_read_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_3_callback(Object &&cb) { return m_write_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_4_callback(Object &&cb) { return m_write_4_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_7_callback(Object &&cb) { return m_read_7_cb.set_callback(std::forward(cb)); } + auto read_0_callback() { return m_read_0_cb.bind(); } + auto read_1_callback() { return m_read_1_cb.bind(); } + auto read_2_callback() { return m_read_2_cb.bind(); } + auto read_3_callback() { return m_read_3_cb.bind(); } + auto write_3_callback() { return m_write_3_cb.bind(); } + auto write_4_callback() { return m_write_4_cb.bind(); } + auto read_7_callback() { return m_read_7_cb.bind(); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -146,13 +146,12 @@ class tc0640fio_device : public device_t public: tc0640fio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_read_0_callback(Object &&cb) { return m_read_0_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_1_callback(Object &&cb) { return m_read_1_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_2_callback(Object &&cb) { return m_read_2_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_3_callback(Object &&cb) { return m_read_3_cb.set_callback(std::forward(cb)); } - template devcb_base &set_write_4_callback(Object &&cb) { return m_write_4_cb.set_callback(std::forward(cb)); } - template devcb_base &set_read_7_callback(Object &&cb) { return m_read_7_cb.set_callback(std::forward(cb)); } - + auto read_0_callback() { return m_read_0_cb.bind(); } + auto read_1_callback() { return m_read_1_cb.bind(); } + auto read_2_callback() { return m_read_2_cb.bind(); } + auto read_3_callback() { return m_read_3_cb.bind(); } + auto write_4_callback() { return m_write_4_cb.bind(); } + auto read_7_callback() { return m_read_7_cb.bind(); } DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); @@ -183,91 +182,4 @@ protected: DECLARE_DEVICE_TYPE(TC0640FIO, tc0640fio_device) - -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_TC0040IOC_READ_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_0_callback(DEVCB_##_devcb); - -#define MCFG_TC0040IOC_READ_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_1_callback(DEVCB_##_devcb); - -#define MCFG_TC0040IOC_READ_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_2_callback(DEVCB_##_devcb); - -#define MCFG_TC0040IOC_READ_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0040IOC_WRITE_4_CB(_devcb) \ - devcb = &downcast(*device).set_write_4_callback(DEVCB_##_devcb); - -#define MCFG_TC0040IOC_READ_7_CB(_devcb) \ - devcb = &downcast(*device).set_read_7_callback(DEVCB_##_devcb); - - -#define MCFG_TC0220IOC_READ_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_0_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_READ_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_1_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_READ_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_2_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_READ_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_WRITE_3_CB(_devcb) \ - devcb = &downcast(*device).set_write_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_WRITE_4_CB(_devcb) \ - devcb = &downcast(*device).set_write_4_callback(DEVCB_##_devcb); - -#define MCFG_TC0220IOC_READ_7_CB(_devcb) \ - devcb = &downcast(*device).set_read_7_callback(DEVCB_##_devcb); - - -#define MCFG_TC0510NIO_READ_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_0_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_READ_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_1_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_READ_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_2_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_READ_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_WRITE_3_CB(_devcb) \ - devcb = &downcast(*device).set_write_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_WRITE_4_CB(_devcb) \ - devcb = &downcast(*device).set_write_4_callback(DEVCB_##_devcb); - -#define MCFG_TC0510NIO_READ_7_CB(_devcb) \ - devcb = &downcast(*device).set_read_7_callback(DEVCB_##_devcb); - - -#define MCFG_TC0640FIO_READ_0_CB(_devcb) \ - devcb = &downcast(*device).set_read_0_callback(DEVCB_##_devcb); - -#define MCFG_TC0640FIO_READ_1_CB(_devcb) \ - devcb = &downcast(*device).set_read_1_callback(DEVCB_##_devcb); - -#define MCFG_TC0640FIO_READ_2_CB(_devcb) \ - devcb = &downcast(*device).set_read_2_callback(DEVCB_##_devcb); - -#define MCFG_TC0640FIO_READ_3_CB(_devcb) \ - devcb = &downcast(*device).set_read_3_callback(DEVCB_##_devcb); - -#define MCFG_TC0640FIO_WRITE_4_CB(_devcb) \ - devcb = &downcast(*device).set_write_4_callback(DEVCB_##_devcb); - -#define MCFG_TC0640FIO_READ_7_CB(_devcb) \ - devcb = &downcast(*device).set_read_7_callback(DEVCB_##_devcb); - - #endif // MAME_MACHINE_TAITOIO_H diff --git a/src/mame/machine/taitosjsec.h b/src/mame/machine/taitosjsec.h index 48ccfe57a1b..d46e5ec705f 100644 --- a/src/mame/machine/taitosjsec.h +++ b/src/mame/machine/taitosjsec.h @@ -13,13 +13,13 @@ DECLARE_DEVICE_TYPE(TAITO_SJ_SECURITY_MCU, taito_sj_security_mcu_device) #define MCFG_TAITO_SJ_SECURITY_MCU_INT_MODE(mode) \ downcast(*device).set_int_mode(taito_sj_security_mcu_device::int_mode::mode); #define MCFG_TAITO_SJ_SECURITY_MCU_68READ_CB(cb) \ - devcb = &downcast(*device).set_68read_cb(DEVCB_##cb); + downcast(*device).set_68read_cb(DEVCB_##cb); #define MCFG_TAITO_SJ_SECURITY_MCU_68WRITE_CB(cb) \ - devcb = &downcast(*device).set_68write_cb(DEVCB_##cb); + downcast(*device).set_68write_cb(DEVCB_##cb); #define MCFG_TAITO_SJ_SECURITY_MCU_68INTRQ_CB(cb) \ - devcb = &downcast(*device).set_68intrq_cb(DEVCB_##cb); + downcast(*device).set_68intrq_cb(DEVCB_##cb); #define MCFG_TAITO_SJ_SECURITY_MCU_BUSRQ_CB(cb) \ - devcb = &downcast(*device).set_busrq_cb(DEVCB_##cb); + downcast(*device).set_busrq_cb(DEVCB_##cb); class taito_sj_security_mcu_device : public device_t { diff --git a/src/mame/machine/tandy2kb.h b/src/mame/machine/tandy2kb.h index 39ecdace66f..1af6a5d3b52 100644 --- a/src/mame/machine/tandy2kb.h +++ b/src/mame/machine/tandy2kb.h @@ -28,10 +28,10 @@ //************************************************************************** #define MCFG_TANDY2000_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &downcast(*device).set_clock_wr_callback(DEVCB_##_write); + downcast(*device).set_clock_wr_callback(DEVCB_##_write); #define MCFG_TANDY2000_KEYBOARD_DATA_CALLBACK(_write) \ - devcb = &downcast(*device).set_data_wr_callback(DEVCB_##_write); + downcast(*device).set_data_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/trs80m2kb.h b/src/mame/machine/trs80m2kb.h index 9637f240601..b3f0d987855 100644 --- a/src/mame/machine/trs80m2kb.h +++ b/src/mame/machine/trs80m2kb.h @@ -29,7 +29,7 @@ //************************************************************************** #define MCFG_TRS80M2_KEYBOARD_CLOCK_CALLBACK(_write) \ - devcb = &downcast(*device).set_clock_wr_callback(DEVCB_##_write); + downcast(*device).set_clock_wr_callback(DEVCB_##_write); diff --git a/src/mame/machine/upd65031.h b/src/mame/machine/upd65031.h index 17e6ec64913..490772f4777 100644 --- a/src/mame/machine/upd65031.h +++ b/src/mame/machine/upd65031.h @@ -18,16 +18,16 @@ //************************************************************************** #define MCFG_UPD65031_KB_CALLBACK(_read) \ - devcb = &downcast(*device).set_kb_rd_callback(DEVCB_##_read); + downcast(*device).set_kb_rd_callback(DEVCB_##_read); #define MCFG_UPD65031_INT_CALLBACK(_write) \ - devcb = &downcast(*device).set_int_wr_callback(DEVCB_##_write); + downcast(*device).set_int_wr_callback(DEVCB_##_write); #define MCFG_UPD65031_NMI_CALLBACK(_write) \ - devcb = &downcast(*device).set_nmi_wr_callback(DEVCB_##_write); + downcast(*device).set_nmi_wr_callback(DEVCB_##_write); #define MCFG_UPD65031_SPKR_CALLBACK(_write) \ - devcb = &downcast(*device).set_spkr_wr_callback(DEVCB_##_write); + downcast(*device).set_spkr_wr_callback(DEVCB_##_write); #define MCFG_UPD65031_SCR_UPDATE_CB(_class, _method) \ downcast(*device).set_screen_update_callback(upd65031_screen_update_delegate(&_class::_method, #_class "::" #_method, this)); @@ -59,6 +59,10 @@ public: template devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward(cb)); } template devcb_base &set_nmi_wr_callback(Object &&cb) { return m_write_nmi.set_callback(std::forward(cb)); } template devcb_base &set_spkr_wr_callback(Object &&cb) { return m_write_spkr.set_callback(std::forward(cb)); } + auto kb_rd_callback() { return m_read_kb.bind(); } + auto int_wr_callback() { return m_write_int.bind(); } + auto nmi_wr_callback() { return m_write_nmi.bind(); } + auto spkr_wr_callback() { return m_write_spkr.bind(); } template void set_screen_update_callback(Object &&cb) { m_screen_update_cb = std::forward(cb); } template void set_memory_update_callback(Object &&cb) { m_out_mem_cb = std::forward(cb); } diff --git a/src/mame/machine/v1050kb.h b/src/mame/machine/v1050kb.h index 96172ba33ff..a36280bb425 100644 --- a/src/mame/machine/v1050kb.h +++ b/src/mame/machine/v1050kb.h @@ -21,7 +21,7 @@ //************************************************************************** #define MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(_devcb) \ - devcb = &downcast(*device).set_out_tx_handler(DEVCB_##_devcb); + downcast(*device).set_out_tx_handler(DEVCB_##_devcb); diff --git a/src/mame/machine/victor9k_fdc.h b/src/mame/machine/victor9k_fdc.h index 649598af50c..a7c39c6e7b5 100644 --- a/src/mame/machine/victor9k_fdc.h +++ b/src/mame/machine/victor9k_fdc.h @@ -19,21 +19,6 @@ -//************************************************************************** -// INTERFACE CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VICTOR_9000_FDC_IRQ_CB(_write) \ - devcb = &downcast(*device).set_irq_wr_callback(DEVCB_##_write); - -#define MCFG_VICTOR_9000_FDC_SYN_CB(_write) \ - devcb = &downcast(*device).set_syn_wr_callback(DEVCB_##_write); - -#define MCFG_VICTOR_9000_FDC_LBRDY_CB(_write) \ - devcb = &downcast(*device).set_lbrdy_wr_callback(DEVCB_##_write); - - - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -46,9 +31,9 @@ public: // construction/destruction victor_9000_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_irq_wr_callback(Object &&cb) { return m_irq_cb.set_callback(std::forward(cb)); } - template devcb_base &set_syn_wr_callback(Object &&cb) { return m_syn_cb.set_callback(std::forward(cb)); } - template devcb_base &set_lbrdy_wr_callback(Object &&cb) { return m_lbrdy_cb.set_callback(std::forward(cb)); } + auto irq_wr_callback() { return m_irq_cb.bind(); } + auto syn_wr_callback() { return m_syn_cb.bind(); } + auto lbrdy_wr_callback() { return m_lbrdy_cb.bind(); } DECLARE_READ8_MEMBER( cs5_r ) { return m_via4->read(space, offset); } DECLARE_WRITE8_MEMBER( cs5_w ) { m_via4->write(space, offset, data); } diff --git a/src/mame/machine/victor9k_kb.h b/src/mame/machine/victor9k_kb.h index e1e042ac7e3..683100506c9 100644 --- a/src/mame/machine/victor9k_kb.h +++ b/src/mame/machine/victor9k_kb.h @@ -21,10 +21,10 @@ //************************************************************************** #define MCFG_VICTOR9K_KBRDY_HANDLER(_devcb) \ - devcb = &downcast(*device).set_kbrdy_cb(DEVCB_##_devcb); + downcast(*device).set_kbrdy_cb(DEVCB_##_devcb); #define MCFG_VICTOR9K_KBDATA_HANDLER(_devcb) \ - devcb = &downcast(*device).set_kbdata_cb(DEVCB_##_devcb); + downcast(*device).set_kbdata_cb(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/vs9209.h b/src/mame/machine/vs9209.h index 161799419cc..6acebb5022c 100644 --- a/src/mame/machine/vs9209.h +++ b/src/mame/machine/vs9209.h @@ -11,46 +11,6 @@ #pragma once -//************************************************************************** -// CONFIGURATION MACROS -//************************************************************************** - -#define MCFG_VS9209_IN_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(0, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(1, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(2, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTD_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(3, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTE_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(4, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTF_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(5, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTG_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(6, DEVCB_##_devcb); -#define MCFG_VS9209_IN_PORTH_CB(_devcb) \ - devcb = &downcast(*device).set_input_cb(7, DEVCB_##_devcb); - -#ifdef VS9209_PROBABLY_NONEXISTENT_OUTPUTS -#define MCFG_VS9209_OUT_PORTA_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(0, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTB_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(1, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTC_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(2, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTD_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(3, DEVCB_##_devcb); -#endif -#define MCFG_VS9209_OUT_PORTE_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(4, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTF_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(5, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTG_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(6, DEVCB_##_devcb); -#define MCFG_VS9209_OUT_PORTH_CB(_devcb) \ - devcb = &downcast(*device).set_output_cb(7, DEVCB_##_devcb); - //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -64,16 +24,24 @@ public: vs9209_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock); // configuration - template devcb_base &set_input_cb(int p, Object &&obj) - { - assert(p >= 0 && p < 8); - return m_input_cb[p].set_callback(std::forward(obj)); - } - template devcb_base &set_output_cb(int p, Object &&obj) - { - assert(p >= 0 && p < 8); - return m_output_cb[p].set_callback(std::forward(obj)); - } + auto porta_input_cb() { return m_input_cb[0].bind(); } + auto portb_input_cb() { return m_input_cb[1].bind(); } + auto portc_input_cb() { return m_input_cb[2].bind(); } + auto portd_input_cb() { return m_input_cb[3].bind(); } + auto porte_input_cb() { return m_input_cb[4].bind(); } + auto portf_input_cb() { return m_input_cb[5].bind(); } + auto portg_input_cb() { return m_input_cb[6].bind(); } + auto porth_input_cb() { return m_input_cb[7].bind(); } +#ifdef VS9209_PROBABLY_NONEXISTENT_OUTPUTS + auto porta_output_cb() { return m_output_cb[0].bind(); } + auto portb_output_cb() { return m_output_cb[1].bind(); } + auto portc_output_cb() { return m_output_cb[2].bind(); } + auto portd_output_cb() { return m_output_cb[3].bind(); } +#endif // VS9209_PROBABLY_NONEXISTENT_OUTPUTS + auto porte_output_cb() { return m_output_cb[4].bind(); } + auto portf_output_cb() { return m_output_cb[5].bind(); } + auto portg_output_cb() { return m_output_cb[6].bind(); } + auto porth_output_cb() { return m_output_cb[7].bind(); } // memory handlers DECLARE_READ8_MEMBER(read); diff --git a/src/mame/machine/vt100_kbd.h b/src/mame/machine/vt100_kbd.h index 9b1499fd918..0c2a6c24d76 100644 --- a/src/mame/machine/vt100_kbd.h +++ b/src/mame/machine/vt100_kbd.h @@ -22,7 +22,7 @@ //************************************************************************** #define MCFG_VT100_KEYBOARD_SIGNAL_OUT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_signal_out_callback(DEVCB_##_devcb); + downcast(*device).set_signal_out_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/wangpckb.h b/src/mame/machine/wangpckb.h index c5b3d59a92f..320f0f57d01 100644 --- a/src/mame/machine/wangpckb.h +++ b/src/mame/machine/wangpckb.h @@ -34,7 +34,7 @@ MCFG_DEVICE_ADD(WANGPC_KEYBOARD_TAG, WANGPC_KEYBOARD, 0) #define MCFG_WANGPCKB_TXD_HANDLER(_devcb) \ - devcb = &downcast(*device).set_txd_handler(DEVCB_##_devcb); + downcast(*device).set_txd_handler(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/machine/x820kb.h b/src/mame/machine/x820kb.h index 1a17b8d3123..e3000fe415a 100644 --- a/src/mame/machine/x820kb.h +++ b/src/mame/machine/x820kb.h @@ -20,7 +20,7 @@ //************************************************************************** #define MCFG_XEROX_820_KEYBOARD_KBSTB_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_kbstb_wr_callback(DEVCB_##_devcb); + downcast(*device).set_kbstb_wr_callback(DEVCB_##_devcb); diff --git a/src/mame/machine/xbox.cpp b/src/mame/machine/xbox.cpp index a85a0c2bfb6..2e2bc7bdaa2 100644 --- a/src/mame/machine/xbox.cpp +++ b/src/mame/machine/xbox.cpp @@ -893,12 +893,12 @@ MACHINE_CONFIG_START(xbox_base_state::xbox_base) MCFG_DEVICE_ADD("pic8259_1", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, xbox_base_state, xbox_pic8259_1_set_int_line)) - MCFG_PIC8259_IN_SP_CB(VCC) + MCFG_PIC8259_IN_SP_CB(CONSTANT(1)) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, xbox_base_state, get_slave_ack)) MCFG_DEVICE_ADD("pic8259_2", PIC8259, 0) MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_1", pic8259_device, ir2_w)) - MCFG_PIC8259_IN_SP_CB(GND) + MCFG_PIC8259_IN_SP_CB(CONSTANT(0)) MCFG_DEVICE_ADD("pit8254", PIT8254, 0) MCFG_PIT8253_CLK0(1125000) /* heartbeat IRQ */ diff --git a/src/mame/machine/znmcu.h b/src/mame/machine/znmcu.h index 8603bac7eb8..5b8e3a88d94 100644 --- a/src/mame/machine/znmcu.h +++ b/src/mame/machine/znmcu.h @@ -9,19 +9,19 @@ DECLARE_DEVICE_TYPE(ZNMCU, znmcu_device) #define MCFG_ZNMCU_DATAOUT_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dataout_handler(DEVCB_##_devcb); + downcast(*device).set_dataout_handler(DEVCB_##_devcb); #define MCFG_ZNMCU_DSR_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dsr_handler(DEVCB_##_devcb); + downcast(*device).set_dsr_handler(DEVCB_##_devcb); #define MCFG_ZNMCU_DSW_HANDLER(_devcb) \ - devcb = &downcast(*device).set_dsw_handler(DEVCB_##_devcb); + downcast(*device).set_dsw_handler(DEVCB_##_devcb); #define MCFG_ZNMCU_ANALOG1_HANDLER(_devcb) \ - devcb = &downcast(*device).set_analog1_handler(DEVCB_##_devcb); + downcast(*device).set_analog1_handler(DEVCB_##_devcb); #define MCFG_ZNMCU_ANALOG2_HANDLER(_devcb) \ - devcb = &downcast(*device).set_analog2_handler(DEVCB_##_devcb); + downcast(*device).set_analog2_handler(DEVCB_##_devcb); class znmcu_device : public device_t { diff --git a/src/mame/machine/zx8302.h b/src/mame/machine/zx8302.h index f49bfddd72e..150a697c624 100644 --- a/src/mame/machine/zx8302.h +++ b/src/mame/machine/zx8302.h @@ -45,46 +45,46 @@ downcast(*device).set_rtc_clock(_clk); #define MCFG_ZX8302_OUT_IPL1L_CB(_devcb) \ - devcb = &downcast(*device).set_out_ipl1l_callback(DEVCB_##_devcb); + downcast(*device).set_out_ipl1l_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_BAUDX4_CB(_devcb) \ - devcb = &downcast(*device).set_out_baudx4_callback(DEVCB_##_devcb); + downcast(*device).set_out_baudx4_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_COMDATA_CB(_devcb) \ - devcb = &downcast(*device).set_out_comdata_callback(DEVCB_##_devcb); + downcast(*device).set_out_comdata_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_TXD1_CB(_devcb) \ - devcb = &downcast(*device).set_out_txd1_callback(DEVCB_##_devcb); + downcast(*device).set_out_txd1_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_TXD2_CB(_devcb) \ - devcb = &downcast(*device).set_out_txd2_callback(DEVCB_##_devcb); + downcast(*device).set_out_txd2_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_NETOUT_CB(_devcb) \ - devcb = &downcast(*device).set_out_netout_callback(DEVCB_##_devcb); + downcast(*device).set_out_netout_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_MDSELCK_CB(_devcb) \ - devcb = &downcast(*device).set_out_mdselck_callback(DEVCB_##_devcb); + downcast(*device).set_out_mdselck_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_MDSELD_CB(_devcb) \ - devcb = &downcast(*device).set_out_mdseld_callback(DEVCB_##_devcb); + downcast(*device).set_out_mdseld_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_MDRDW_CB(_devcb) \ - devcb = &downcast(*device).set_out_mdrdw_callback(DEVCB_##_devcb); + downcast(*device).set_out_mdrdw_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_ERASE_CB(_devcb) \ - devcb = &downcast(*device).set_out_erase_callback(DEVCB_##_devcb); + downcast(*device).set_out_erase_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_RAW1_CB(_devcb) \ - devcb = &downcast(*device).set_out_raw1_callback(DEVCB_##_devcb); + downcast(*device).set_out_raw1_callback(DEVCB_##_devcb); #define MCFG_ZX8302_IN_RAW1_CB(_devcb) \ - devcb = &downcast(*device).set_in_raw1_callback(DEVCB_##_devcb); + downcast(*device).set_in_raw1_callback(DEVCB_##_devcb); #define MCFG_ZX8302_OUT_RAW2_CB(_devcb) \ - devcb = &downcast(*device).set_out_raw2_callback(DEVCB_##_devcb); + downcast(*device).set_out_raw2_callback(DEVCB_##_devcb); #define MCFG_ZX8302_IN_RAW2_CB(_devcb) \ - devcb = &downcast(*device).set_in_raw2_callback(DEVCB_##_devcb); + downcast(*device).set_in_raw2_callback(DEVCB_##_devcb); ///************************************************************************* diff --git a/src/mame/video/733_asr.h b/src/mame/video/733_asr.h index 82edf41dd5a..6d5527762bf 100644 --- a/src/mame/video/733_asr.h +++ b/src/mame/video/733_asr.h @@ -87,9 +87,9 @@ private: DECLARE_DEVICE_TYPE(ASR733, asr733_device) #define MCFG_ASR733_KEYINT_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_keyint_callback(DEVCB_##_intcallb); + downcast(*device).set_keyint_callback(DEVCB_##_intcallb); #define MCFG_ASR733_LINEINT_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_lineint_callback(DEVCB_##_intcallb); + downcast(*device).set_lineint_callback(DEVCB_##_intcallb); #endif // MAME_VIDEO_733_ASR diff --git a/src/mame/video/911_vdt.h b/src/mame/video/911_vdt.h index b47786ef87b..b92c0a9d748 100644 --- a/src/mame/video/911_vdt.h +++ b/src/mame/video/911_vdt.h @@ -115,9 +115,9 @@ private: DECLARE_DEVICE_TYPE(VDT911, vdt911_device) #define MCFG_VDT911_KEYINT_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_keyint_callback(DEVCB_##_intcallb); + downcast(*device).set_keyint_callback(DEVCB_##_intcallb); #define MCFG_VDT911_LINEINT_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_lineint_callback(DEVCB_##_intcallb); + downcast(*device).set_lineint_callback(DEVCB_##_intcallb); #endif // MAME_VIDEO_911_VDT_H diff --git a/src/mame/video/abc800.cpp b/src/mame/video/abc800.cpp index 53f0530ead4..ec9c2c63999 100644 --- a/src/mame/video/abc800.cpp +++ b/src/mame/video/abc800.cpp @@ -278,11 +278,12 @@ uint32_t abc800m_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma //------------------------------------------------- MACHINE_CONFIG_START(abc800m_state::abc800m_video) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) - MCFG_MC6845_UPDATE_ROW_CB(abc800m_state, abc800m_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(Z80DART_TAG, z80dart_device, rib_w)) MCFG_DEVCB_XOR(1) + mc6845_device &mc6845(MC6845(config, MC6845_TAG, ABC800_CCLK)); + mc6845.set_screen(SCREEN_TAG); + mc6845.set_show_border_area(true); + mc6845.set_char_width(ABC800_CHAR_WIDTH); + mc6845.set_update_row_callback(FUNC(abc800m_state::abc800m_update_row), this); + mc6845.out_vsync_callback().set(m_dart, FUNC(z80dart_device::rib_w)).invert(); MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t(0xff, 0xff, 0x00)) MCFG_SCREEN_UPDATE_DRIVER(abc800m_state, screen_update) diff --git a/src/mame/video/abc802.cpp b/src/mame/video/abc802.cpp index 893e76f5e0f..fb1eb1da22f 100644 --- a/src/mame/video/abc802.cpp +++ b/src/mame/video/abc802.cpp @@ -179,12 +179,13 @@ WRITE_LINE_MEMBER( abc802_state::vs_w ) //------------------------------------------------- MACHINE_CONFIG_START(abc802_state::abc802_video) - MCFG_MC6845_ADD(MC6845_TAG, MC6845, SCREEN_TAG, ABC800_CCLK) - MCFG_MC6845_SHOW_BORDER_AREA(true) - MCFG_MC6845_CHAR_WIDTH(ABC800_CHAR_WIDTH) - MCFG_MC6845_UPDATE_ROW_CB(abc802_state, abc802_update_row) - MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(*this, abc802_state, vs_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE(Z80DART_TAG, z80dart_device, rib_w)) MCFG_DEVCB_XOR(1) + mc6845_device &mc6845(MC6845(config, MC6845_TAG, ABC800_CCLK)); + mc6845.set_screen(SCREEN_TAG); + mc6845.set_show_border_area(true); + mc6845.set_char_width(ABC800_CHAR_WIDTH); + mc6845.set_update_row_callback(FUNC(abc802_state::abc802_update_row), this); + mc6845.out_vsync_callback().set(FUNC(abc802_state::vs_w)); + mc6845.out_vsync_callback().append(m_dart, FUNC(z80dart_device::rib_w)).invert(); MCFG_SCREEN_ADD_MONOCHROME(SCREEN_TAG, RASTER, rgb_t::amber()) MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update) diff --git a/src/mame/video/atarivad.h b/src/mame/video/atarivad.h index a7461bff3c9..acc8486d4c4 100644 --- a/src/mame/video/atarivad.h +++ b/src/mame/video/atarivad.h @@ -21,7 +21,7 @@ #define MCFG_ATARI_VAD_ADD(_tag, _screen, _intcb) \ MCFG_DEVICE_ADD(_tag, ATARI_VAD, 0) \ MCFG_VIDEO_SET_SCREEN(_screen) \ - devcb = &downcast(*device).set_scanline_int_cb(DEVCB_##_intcb); + downcast(*device).set_scanline_int_cb(DEVCB_##_intcb); #define MCFG_ATARI_VAD_PLAYFIELD(_class, _gfxtag, _getinfo) \ { std::string fulltag(device->tag()); fulltag.append(":playfield"); device_t *device; \ diff --git a/src/mame/video/bfm_dm01.h b/src/mame/video/bfm_dm01.h index bac2de6ce74..93205a92a7a 100644 --- a/src/mame/video/bfm_dm01.h +++ b/src/mame/video/bfm_dm01.h @@ -14,7 +14,7 @@ #include "screen.h" #define MCFG_BFM_DM01_BUSY_CB(_devcb) \ - devcb = &downcast(*device).set_busy_callback(DEVCB_##_devcb); + downcast(*device).set_busy_callback(DEVCB_##_devcb); class bfm_dm01_device : public device_t { diff --git a/src/mame/video/cidelsa.cpp b/src/mame/video/cidelsa.cpp index e8cbfab93a1..d649d64ddad 100644 --- a/src/mame/video/cidelsa.cpp +++ b/src/mame/video/cidelsa.cpp @@ -159,7 +159,7 @@ MACHINE_CONFIG_START(cidelsa_state::destryer_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(cidelsa_state, cidelsa_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(cidelsa_state, cidelsa_charram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(cidelsa_state, cidelsa_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, cidelsa_state, prd_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -173,7 +173,7 @@ MACHINE_CONFIG_START(cidelsa_state::altair_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(cidelsa_state, cidelsa_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(cidelsa_state, cidelsa_charram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(cidelsa_state, cidelsa_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, cidelsa_state, prd_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -187,7 +187,7 @@ MACHINE_CONFIG_START(draco_state::draco_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(draco_state, draco_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(draco_state, draco_charram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(draco_state, draco_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1)) MCFG_DEVICE_ADD(AY8910_TAG, AY8910, DRACO_SND_CHR1) MCFG_AY8910_OUTPUT_TYPE(AY8910_SINGLE_OUTPUT) diff --git a/src/mame/video/comx35.cpp b/src/mame/video/comx35.cpp index 2754d80d2d5..7c31d10be56 100644 --- a/src/mame/video/comx35.cpp +++ b/src/mame/video/comx35.cpp @@ -100,7 +100,7 @@ MACHINE_CONFIG_START(comx35_state::comx35_pal_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, comx35_state, prd_w)) MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) @@ -119,7 +119,7 @@ MACHINE_CONFIG_START(comx35_state::comx35_ntsc_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(comx35_state, comx35_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(comx35_state, comx35_charram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(comx35_state, comx35_charram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(GND) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(0)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, comx35_state, prd_w)) MCFG_CDP1869_SET_SCREEN(SCREEN_TAG) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/video/decodmd1.cpp b/src/mame/video/decodmd1.cpp index 90a5abf593e..e23e47644a7 100644 --- a/src/mame/video/decodmd1.cpp +++ b/src/mame/video/decodmd1.cpp @@ -217,13 +217,13 @@ MACHINE_CONFIG_START(decodmd_type1_device::device_add_mconfig) MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("8K") - MCFG_DEVICE_ADD("bitlatch", HC259, 0) // U4 - MCFG_ADDRESSABLE_LATCH_PARALLEL_OUT_CB(MEMBANK("dmdbank1")) MCFG_DEVCB_MASK(0x07) MCFG_DEVCB_INVERT - MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(WRITELINE(*this, decodmd_type1_device, blank_w)) - MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(WRITELINE(*this, decodmd_type1_device, status_w)) - MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(*this, decodmd_type1_device, rowdata_w)) - MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(*this, decodmd_type1_device, rowclock_w)) - MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(*this, decodmd_type1_device, test_w)) + HC259(config, m_bitlatch); // U4 + m_bitlatch->parallel_out_cb().set_membank(m_rombank1).mask(0x07).invert(); + m_bitlatch->q_out_cb<3>().set(FUNC(decodmd_type1_device::blank_w)); + m_bitlatch->q_out_cb<4>().set(FUNC(decodmd_type1_device::status_w)); + m_bitlatch->q_out_cb<5>().set(FUNC(decodmd_type1_device::rowdata_w)); + m_bitlatch->q_out_cb<6>().set(FUNC(decodmd_type1_device::rowclock_w)); + m_bitlatch->q_out_cb<7>().set(FUNC(decodmd_type1_device::test_w)); MACHINE_CONFIG_END diff --git a/src/mame/video/dynax_blitter_rev2.h b/src/mame/video/dynax_blitter_rev2.h index 29704351251..a28f2fb8f8a 100644 --- a/src/mame/video/dynax_blitter_rev2.h +++ b/src/mame/video/dynax_blitter_rev2.h @@ -16,24 +16,24 @@ //************************************************************************** #define MCFG_DYNAX_BLITTER_REV2_VRAM_OUT_CB(_devcb) \ - devcb = &downcast(*device).set_vram_out_cb(DEVCB_##_devcb); + downcast(*device).set_vram_out_cb(DEVCB_##_devcb); #define MCFG_DYNAX_BLITTER_REV2_SCROLLX_CB(_devcb) \ - devcb = &downcast(*device).set_scrollx_cb(DEVCB_##_devcb); + downcast(*device).set_scrollx_cb(DEVCB_##_devcb); #define MCFG_DYNAX_BLITTER_REV2_SCROLLY_CB(_devcb) \ - devcb = &downcast(*device).set_scrolly_cb(DEVCB_##_devcb); + downcast(*device).set_scrolly_cb(DEVCB_##_devcb); #define MCFG_DYNAX_BLITTER_REV2_READY_CB(_devcb) \ - devcb = &downcast(*device).set_ready_cb(DEVCB_##_devcb); + downcast(*device).set_ready_cb(DEVCB_##_devcb); #define MCFG_CDRACULA_BLITTER_VRAM_OUT_CB(_devcb) \ - devcb = &downcast(*device).set_vram_out_cb(DEVCB_##_devcb); + downcast(*device).set_vram_out_cb(DEVCB_##_devcb); #define MCFG_CDRACULA_BLITTER_SCROLLX_CB(_devcb) \ - devcb = &downcast(*device).set_scrollx_cb(DEVCB_##_devcb); + downcast(*device).set_scrollx_cb(DEVCB_##_devcb); #define MCFG_CDRACULA_BLITTER_SCROLLY_CB(_devcb) \ - devcb = &downcast(*device).set_scrolly_cb(DEVCB_##_devcb); + downcast(*device).set_scrolly_cb(DEVCB_##_devcb); #define MCFG_CDRACULA_BLITTER_READY_CB(_devcb) \ - devcb = &downcast(*device).set_ready_cb(DEVCB_##_devcb); + downcast(*device).set_ready_cb(DEVCB_##_devcb); #define MCFG_CDRACULA_BLITTER_DEST_CB(_devcb) \ - devcb = &downcast(*device).set_blit_dest_cb(DEVCB_##_devcb); + downcast(*device).set_blit_dest_cb(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS @@ -52,6 +52,10 @@ public: template devcb_base &set_scrollx_cb(Object &&cb) { return m_scrollx_cb.set_callback(std::forward(cb)); } template devcb_base &set_scrolly_cb(Object &&cb) { return m_scrolly_cb.set_callback(std::forward(cb)); } template devcb_base &set_ready_cb(Object &&cb) { return m_ready_cb.set_callback(std::forward(cb)); } + auto vram_out_cb() { return m_vram_out_cb.bind(); } + auto scrollx_cb() { return m_scrollx_cb.bind(); } + auto scrolly_cb() { return m_scrolly_cb.bind(); } + auto ready_cb() { return m_ready_cb.bind(); } // write handlers DECLARE_WRITE8_MEMBER(pen_w); diff --git a/src/mame/video/exidy440.cpp b/src/mame/video/exidy440.cpp index df28b2b340d..3aba8684ea7 100644 --- a/src/mame/video/exidy440.cpp +++ b/src/mame/video/exidy440.cpp @@ -463,13 +463,13 @@ uint32_t topsecex_state::screen_update_topsecex(screen_device &screen, bitmap_in MACHINE_CONFIG_START(exidy440_state::exidy440_video) MCFG_PALETTE_ADD("palette", 256) - MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) - MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) - MCFG_SCREEN_UPDATE_DRIVER(exidy440_state, screen_update_exidy440) - MCFG_SCREEN_PALETTE("palette") - MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, exidy440_state, vblank_interrupt_w)) - MCFG_DEVCB_CHAIN_OUTPUT(WRITELINE("440audio", exidy440_sound_device, sound_interrupt_w)) + screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER)); + screen.set_video_attributes(VIDEO_ALWAYS_UPDATE); + screen.set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART); + screen.set_screen_update(FUNC(exidy440_state::screen_update_exidy440)); + screen.set_palette(m_palette); + screen.screen_vblank().set(FUNC(exidy440_state::vblank_interrupt_w)); + screen.screen_vblank().append(m_custom, FUNC(exidy440_sound_device::sound_interrupt_w)); MACHINE_CONFIG_END diff --git a/src/mame/video/gime.h b/src/mame/video/gime.h index a8f208ff58c..3ecf1aa3e7e 100644 --- a/src/mame/video/gime.h +++ b/src/mame/video/gime.h @@ -28,13 +28,13 @@ #define MCFG_GIME_FSYNC_CALLBACK MCFG_MC6847_FSYNC_CALLBACK #define MCFG_GIME_IRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_irq_wr_callback(DEVCB_##_write); + downcast(*device).set_irq_wr_callback(DEVCB_##_write); #define MCFG_GIME_FIRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_firq_wr_callback(DEVCB_##_write); + downcast(*device).set_firq_wr_callback(DEVCB_##_write); #define MCFG_GIME_FLOATING_BUS_CALLBACK(_read) \ - devcb = &downcast(*device).set_floating_bus_rd_callback(DEVCB_##_read); + downcast(*device).set_floating_bus_rd_callback(DEVCB_##_read); //************************************************************************** diff --git a/src/mame/video/gp9001.h b/src/mame/video/gp9001.h index 876ea9ba886..9e3a25a2a64 100644 --- a/src/mame/video/gp9001.h +++ b/src/mame/video/gp9001.h @@ -6,9 +6,6 @@ #pragma once -#define MCFG_GP9001_VINT_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_vint_out_cb(DEVCB_##_devcb); - class gp9001vdp_device : public device_t, public device_gfx_interface, public device_video_interface, @@ -22,14 +19,14 @@ class gp9001vdp_device : public device_t, public: gp9001vdp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_vint_out_cb(Object &&obj) { return m_vint_out_cb.set_callback(std::forward(obj)); } + auto vint_out_cb() { return m_vint_out_cb.bind(); } - void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const uint8_t* primap ); - void gp9001_draw_custom_tilemap( bitmap_ind16 &bitmap, int layer, const uint8_t* priremap, const uint8_t* pri_enable ); - void gp9001_render_vdp( bitmap_ind16 &bitmap, const rectangle &cliprect); - void gp9001_screen_eof(void); - void create_tilemaps(void); - void init_scroll_regs(void); + void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, const uint8_t* primap); + void gp9001_draw_custom_tilemap(bitmap_ind16 &bitmap, int layer, const uint8_t* priremap, const uint8_t* pri_enable); + void gp9001_render_vdp(bitmap_ind16 &bitmap, const rectangle &cliprect); + void gp9001_screen_eof(); + void create_tilemaps(); + void init_scroll_regs(); bitmap_ind8 *custom_priority_bitmap; diff --git a/src/mame/video/gtia.h b/src/mame/video/gtia.h index e00ac8aa73b..2d01f47bfbf 100644 --- a/src/mame/video/gtia.h +++ b/src/mame/video/gtia.h @@ -17,10 +17,10 @@ #define MCFG_GTIA_READ_CB(_devcb) \ - devcb = &downcast(*device).set_read_callback(DEVCB_##_devcb); + downcast(*device).set_read_callback(DEVCB_##_devcb); #define MCFG_GTIA_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_write_callback(DEVCB_##_devcb); + downcast(*device).set_write_callback(DEVCB_##_devcb); #define MCFG_GTIA_REGION(region) \ downcast(*device).set_region(region); diff --git a/src/mame/video/k051960.h b/src/mame/video/k051960.h index a5807d3efea..a5c523fcab7 100644 --- a/src/mame/video/k051960.h +++ b/src/mame/video/k051960.h @@ -28,13 +28,13 @@ typedef device_delegate(*device).set_screen_tag(_tag); #define MCFG_K051960_IRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irq_handler(DEVCB_##_devcb); + downcast(*device).set_irq_handler(DEVCB_##_devcb); #define MCFG_K051960_NMI_HANDLER(_devcb) \ - devcb = &downcast(*device).set_nmi_handler(DEVCB_##_devcb); + downcast(*device).set_nmi_handler(DEVCB_##_devcb); #define MCFG_K051960_VREG_CONTRAST_HANDLER(_devcb) \ - devcb = &downcast(*device).set_vreg_contrast_handler(DEVCB_##_devcb); + downcast(*device).set_vreg_contrast_handler(DEVCB_##_devcb); class k051960_device : public device_t, public device_gfx_interface diff --git a/src/mame/video/k052109.h b/src/mame/video/k052109.h index 294ee133366..69ee5108dc2 100644 --- a/src/mame/video/k052109.h +++ b/src/mame/video/k052109.h @@ -20,7 +20,7 @@ typedef device_delegate(*device).set_screen_tag(_tag); #define MCFG_K052109_IRQ_HANDLER(_devcb) \ - devcb = &downcast(*device).set_irq_handler(DEVCB_##_devcb); + downcast(*device).set_irq_handler(DEVCB_##_devcb); class k052109_device : public device_t, public device_gfx_interface diff --git a/src/mame/video/k053250_ps.h b/src/mame/video/k053250_ps.h index ebc16089ce7..f755a34a1c1 100644 --- a/src/mame/video/k053250_ps.h +++ b/src/mame/video/k053250_ps.h @@ -17,7 +17,7 @@ downcast(*device).set_offsets(offx, offy); #define MCFG_K053250PS_DMAIRQ_CB(_cb) \ - devcb = &downcast(*device).set_dmairq_cb(DEVCB_##_cb); + downcast(*device).set_dmairq_cb(DEVCB_##_cb); class k053250ps_device : public device_t, public device_gfx_interface, diff --git a/src/mame/video/k057714.h b/src/mame/video/k057714.h index 08524f1fde3..2b902fc62b6 100644 --- a/src/mame/video/k057714.h +++ b/src/mame/video/k057714.h @@ -64,7 +64,7 @@ private: DECLARE_DEVICE_TYPE(K057714, k057714_device) #define MCFG_K057714_IRQ_CALLBACK(_devcb) \ - devcb = &downcast(*device).set_irq_callback(DEVCB_##_devcb); + downcast(*device).set_irq_callback(DEVCB_##_devcb); #endif // MAME_MACHINE_K057714_H diff --git a/src/mame/video/k1ge.h b/src/mame/video/k1ge.h index 250ad493173..1fcac610cf2 100644 --- a/src/mame/video/k1ge.h +++ b/src/mame/video/k1ge.h @@ -17,14 +17,14 @@ #define MCFG_K1GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ MCFG_DEVICE_ADD( _tag, K1GE, _clock ) \ MCFG_VIDEO_SET_SCREEN( _screen ) \ - devcb = &downcast(*device).set_vblank_callback(DEVCB_##_vblank ); \ - devcb = &downcast(*device).set_hblank_callback(DEVCB_##_hblank ); + downcast(*device).set_vblank_callback(DEVCB_##_vblank ); \ + downcast(*device).set_hblank_callback(DEVCB_##_hblank ); #define MCFG_K2GE_ADD(_tag, _clock, _screen, _vblank, _hblank ) \ MCFG_DEVICE_ADD( _tag, K2GE, _clock ) \ MCFG_VIDEO_SET_SCREEN( _screen ) \ - devcb = &downcast(*device).set_vblank_callback(DEVCB_##_vblank ); \ - devcb = &downcast(*device).set_hblank_callback(DEVCB_##_hblank ); + downcast(*device).set_vblank_callback(DEVCB_##_vblank ); \ + downcast(*device).set_hblank_callback(DEVCB_##_hblank ); class k1ge_device : public device_t, public device_video_interface diff --git a/src/mame/video/liberatr.cpp b/src/mame/video/liberatr.cpp index c97b1cd66ad..f4d59688d0d 100644 --- a/src/mame/video/liberatr.cpp +++ b/src/mame/video/liberatr.cpp @@ -54,12 +54,6 @@ WRITE8_MEMBER( liberatr_state::bitmap_w ) } -WRITE_LINE_MEMBER(liberatr_state::planet_select_w) -{ - m_planet_select = state; -} - - /******************************************************************************************** liberatr_init_planet() diff --git a/src/mame/video/nick.h b/src/mame/video/nick.h index a57258309c7..3f2cc6452f2 100644 --- a/src/mame/video/nick.h +++ b/src/mame/video/nick.h @@ -33,7 +33,7 @@ #define MCFG_NICK_VIRQ_CALLBACK(_write) \ - devcb = &downcast(*device).set_virq_wr_callback(DEVCB_##_write); + downcast(*device).set_virq_wr_callback(DEVCB_##_write); /* there are 64us per line, although in reality diff --git a/src/mame/video/pcd.h b/src/mame/video/pcd.h index 0a92588d310..8d874d5cbf8 100644 --- a/src/mame/video/pcd.h +++ b/src/mame/video/pcd.h @@ -15,7 +15,7 @@ #define MCFG_PCX_VIDEO_TXD_HANDLER(_devcb) \ - devcb = &downcast(*device).set_txd_handler(DEVCB_##_devcb); + downcast(*device).set_txd_handler(DEVCB_##_devcb); class pcdx_video_device : public device_t, public device_gfx_interface { diff --git a/src/mame/video/pecom.cpp b/src/mame/video/pecom.cpp index 5365b9fd3bc..1cd4c67287f 100644 --- a/src/mame/video/pecom.cpp +++ b/src/mame/video/pecom.cpp @@ -101,7 +101,7 @@ MACHINE_CONFIG_START(pecom_state::pecom_video) MCFG_CDP1869_CHAR_PCB_READ_OWNER(pecom_state, pecom_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(pecom_state, pecom_char_ram_r) MCFG_CDP1869_CHAR_RAM_WRITE_OWNER(pecom_state, pecom_char_ram_w) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, pecom_state, pecom_prd_w)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25); diff --git a/src/mame/video/runaway.cpp b/src/mame/video/runaway.cpp index 234355c3450..01fdecad60a 100644 --- a/src/mame/video/runaway.cpp +++ b/src/mame/video/runaway.cpp @@ -44,10 +44,9 @@ WRITE_LINE_MEMBER(runaway_state::tile_bank_w) { if (state != m_tile_bank) { + m_tile_bank = state; m_bg_tilemap->mark_all_dirty(); } - - m_tile_bank = state; } diff --git a/src/mame/video/segaic24.h b/src/mame/video/segaic24.h index 04d0fae7250..dfc17df0099 100644 --- a/src/mame/video/segaic24.h +++ b/src/mame/video/segaic24.h @@ -11,10 +11,10 @@ #pragma once #define MCFG_S24TILE_XHOUT_CALLBACK(_write) \ - devcb = &downcast(*device).set_xhout_write_callback(DEVCB_##_write); + downcast(*device).set_xhout_write_callback(DEVCB_##_write); #define MCFG_S24TILE_XVOUT_CALLBACK(_write) \ - devcb = &downcast(*device).set_xvout_write_callback(DEVCB_##_write); + downcast(*device).set_xvout_write_callback(DEVCB_##_write); class segas24_tile_device : public device_t, public device_gfx_interface diff --git a/src/mame/video/seibu_crtc.h b/src/mame/video/seibu_crtc.h index 30818aa5a6f..e6e58be1e10 100644 --- a/src/mame/video/seibu_crtc.h +++ b/src/mame/video/seibu_crtc.h @@ -17,19 +17,19 @@ //************************************************************************** #define MCFG_SEIBU_CRTC_DECRYPT_KEY_CB(_devcb) \ - devcb = &downcast(*device).set_decrypt_key_callback(DEVCB_##_devcb); + downcast(*device).set_decrypt_key_callback(DEVCB_##_devcb); #define MCFG_SEIBU_CRTC_LAYER_EN_CB(_devcb) \ - devcb = &downcast(*device).set_layer_en_callback(DEVCB_##_devcb); + downcast(*device).set_layer_en_callback(DEVCB_##_devcb); #define MCFG_SEIBU_CRTC_LAYER_SCROLL_CB(_devcb) \ - devcb = &downcast(*device).set_layer_scroll_callback(DEVCB_##_devcb); + downcast(*device).set_layer_scroll_callback(DEVCB_##_devcb); #define MCFG_SEIBU_CRTC_LAYER_SCROLL_BASE_CB(_devcb) \ - devcb = &downcast(*device).set_layer_scroll_base_callback(DEVCB_##_devcb); + downcast(*device).set_layer_scroll_base_callback(DEVCB_##_devcb); #define MCFG_SEIBU_CRTC_REG_1A_CB(_devcb) \ - devcb = &downcast(*device).set_reg_1a_callback(DEVCB_##_devcb); + downcast(*device).set_reg_1a_callback(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/video/taito_b.cpp b/src/mame/video/taito_b.cpp index 2383430f83f..a5ad113d0be 100644 --- a/src/mame/video/taito_b.cpp +++ b/src/mame/video/taito_b.cpp @@ -32,7 +32,7 @@ void taitob_state::hitice_clear_pixel_bitmap( ) hitice_pixelram_w(space, i, 0, 0xffff); } -WRITE16_MEMBER(taitob_state::realpunc_video_ctrl_w) +WRITE16_MEMBER(taitob_c_state::realpunc_video_ctrl_w) { COMBINE_DATA(&m_realpunc_video_ctrl); } @@ -62,7 +62,7 @@ VIDEO_RESET_MEMBER(taitob_state,hitice) } -VIDEO_START_MEMBER(taitob_state,realpunc) +VIDEO_START_MEMBER(taitob_c_state,realpunc) { m_realpunc_bitmap = std::make_unique(m_screen->width(), m_screen->height()); @@ -107,7 +107,7 @@ uint32_t taitob_state::screen_update_taitob(screen_device &screen, bitmap_ind16 -uint32_t taitob_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) +uint32_t taitob_c_state::screen_update_realpunc(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { const pen_t *palette = m_palette->pens(); uint8_t const video_control = m_tc0180vcu->get_videoctrl(); diff --git a/src/mame/video/tc0180vcu.h b/src/mame/video/tc0180vcu.h index 3d3f4e8ece8..f8c31c75dea 100644 --- a/src/mame/video/tc0180vcu.h +++ b/src/mame/video/tc0180vcu.h @@ -6,9 +6,9 @@ #pragma once #define MCFG_TC0180VCU_INTH_CALLBACK(_write) \ - devcb = &downcast(*device).set_inth_callback(DEVCB_##_write); + downcast(*device).set_inth_callback(DEVCB_##_write); #define MCFG_TC0180VCU_INTL_CALLBACK(_write) \ - devcb = &downcast(*device).set_intl_callback(DEVCB_##_write); + downcast(*device).set_intl_callback(DEVCB_##_write); class tc0180vcu_device : public device_t, public device_gfx_interface, public device_video_interface { diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h index 027f9d2b68d..57c9ade29aa 100644 --- a/src/mame/video/tia.h +++ b/src/mame/video/tia.h @@ -36,13 +36,13 @@ struct player_gfx { //************************************************************************** #define MCFG_TIA_READ_INPUT_PORT_CB(_devcb) \ - devcb = &downcast(*device).set_read_input_port_callback(DEVCB_##_devcb); + downcast(*device).set_read_input_port_callback(DEVCB_##_devcb); #define MCFG_TIA_DATABUS_CONTENTS_CB(_devcb) \ - devcb = &downcast(*device).set_databus_contents_callback(DEVCB_##_devcb); + downcast(*device).set_databus_contents_callback(DEVCB_##_devcb); #define MCFG_TIA_VSYNC_CB(_devcb) \ - devcb = &downcast(*device).set_vsync_callback(DEVCB_##_devcb); + downcast(*device).set_vsync_callback(DEVCB_##_devcb); //************************************************************************** // TYPE DEFINITIONS diff --git a/src/mame/video/tmc1800.cpp b/src/mame/video/tmc1800.cpp index 29414734828..631bf1595ab 100644 --- a/src/mame/video/tmc1800.cpp +++ b/src/mame/video/tmc1800.cpp @@ -57,7 +57,7 @@ MACHINE_CONFIG_START(tmc2000_state::tmc2000_video) MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) SPEAKER(config, "mono").front_center(); - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, tmc2000_state, rdata_r), READLINE(*this, tmc2000_state, bdata_r), READLINE(*this, tmc2000_state, gdata_r)) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, READLINE(*this, tmc2000_state, rdata_r), READLINE(*this, tmc2000_state, bdata_r), READLINE(*this, tmc2000_state, gdata_r)) MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_K(2.05), RES_K(2.26), RES_K(3.92)) // RL64, RL63, RL61, RL65 (also RH62 (2K pot) in series, but ignored here) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END @@ -67,7 +67,7 @@ MACHINE_CONFIG_START(nano_state::nano_video) MCFG_SCREEN_UPDATE_DEVICE(CDP1864_TAG, cdp1864_device, screen_update) SPEAKER(config, "mono").front_center(); - MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), GND, INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, VCC, VCC, VCC) + MCFG_CDP1864_ADD(CDP1864_TAG, SCREEN_TAG, XTAL(1'750'000), CONSTANT(0), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_INT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_DMAOUT), INPUTLINE(CDP1802_TAG, COSMAC_INPUT_LINE_EF1), NOOP, CONSTANT(1), CONSTANT(1), CONSTANT(1)) MCFG_CDP1864_CHROMINANCE(RES_K(1.21), RES_INF, RES_INF, 0) // R18 (unconfirmed) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) MACHINE_CONFIG_END diff --git a/src/mame/video/tmc600.cpp b/src/mame/video/tmc600.cpp index 00cf771de67..bfa59a47995 100644 --- a/src/mame/video/tmc600.cpp +++ b/src/mame/video/tmc600.cpp @@ -128,7 +128,7 @@ MACHINE_CONFIG_START(tmc600_state::tmc600_video) MCFG_CDP1869_COLOR_CLOCK(cdp1869_device::COLOR_CLK_PAL) MCFG_CDP1869_CHAR_PCB_READ_OWNER(tmc600_state, tmc600_pcb_r) MCFG_CDP1869_CHAR_RAM_READ_OWNER(tmc600_state, tmc600_char_ram_r) - MCFG_CDP1869_PAL_NTSC_CALLBACK(VCC) + MCFG_CDP1869_PAL_NTSC_CALLBACK(CONSTANT(1)) MCFG_CDP1869_PRD_CALLBACK(WRITELINE(*this, tmc600_state, prd_w)) MCFG_VIDEO_SET_SCREEN(SCREEN_TAG) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) diff --git a/src/mame/video/uv201.h b/src/mame/video/uv201.h index 39311855a2c..26d11435a92 100644 --- a/src/mame/video/uv201.h +++ b/src/mame/video/uv201.h @@ -65,13 +65,13 @@ //************************************************************************** #define MCFG_UV201_EXT_INT_CALLBACK(_write) \ - devcb = &downcast(*device).set_ext_int_wr_callback(DEVCB_##_write); + downcast(*device).set_ext_int_wr_callback(DEVCB_##_write); #define MCFG_UV201_HBLANK_CALLBACK(_write) \ - devcb = &downcast(*device).set_hblank_wr_callback(DEVCB_##_write); + downcast(*device).set_hblank_wr_callback(DEVCB_##_write); #define MCFG_UV201_DB_CALLBACK(_read) \ - devcb = &downcast(*device).set_db_rd_callback(DEVCB_##_read); + downcast(*device).set_db_rd_callback(DEVCB_##_read); diff --git a/src/mame/video/vsystem_gga.h b/src/mame/video/vsystem_gga.h index a15d02a963a..02e633c2b38 100644 --- a/src/mame/video/vsystem_gga.h +++ b/src/mame/video/vsystem_gga.h @@ -51,7 +51,7 @@ //************************************************************************** #define MCFG_VSYSTEM_GGA_REGISTER_WRITE_CB(_devcb) \ - devcb = &downcast(*device).set_write_cb(DEVCB_##_devcb); + downcast(*device).set_write_cb(DEVCB_##_devcb); //************************************************************************** diff --git a/src/mame/video/vtvideo.h b/src/mame/video/vtvideo.h index 9017657cffd..fa91cc64398 100644 --- a/src/mame/video/vtvideo.h +++ b/src/mame/video/vtvideo.h @@ -117,15 +117,15 @@ DECLARE_DEVICE_TYPE(RAINBOW_VIDEO, rainbow_video_device) downcast(*device).set_chargen_tag(_tag); #define MCFG_VT_VIDEO_RAM_CALLBACK(_read) \ - devcb = &downcast(*device).set_ram_rd_callback(DEVCB_##_read); + downcast(*device).set_ram_rd_callback(DEVCB_##_read); #define MCFG_VT_VIDEO_VERT_FREQ_INTR_CALLBACK(_write) \ - devcb = &downcast(*device).set_vert_freq_intr_wr_callback(DEVCB_##_write); + downcast(*device).set_vert_freq_intr_wr_callback(DEVCB_##_write); #define MCFG_VT_VIDEO_LBA3_LBA4_CALLBACK(_write) \ - devcb = &downcast(*device).set_lba3_lba4_wr_callback(DEVCB_##_write); + downcast(*device).set_lba3_lba4_wr_callback(DEVCB_##_write); #define MCFG_VT_VIDEO_LBA7_CALLBACK(_write) \ - devcb = &downcast(*device).set_lba7_wr_callback(DEVCB_##_write); + downcast(*device).set_lba7_wr_callback(DEVCB_##_write); #endif // MAME_VIDEO_VTVIDEO_H diff --git a/src/mame/video/wpc_dmd.h b/src/mame/video/wpc_dmd.h index 312974f4fdd..a6d6f6bfa3f 100644 --- a/src/mame/video/wpc_dmd.h +++ b/src/mame/video/wpc_dmd.h @@ -11,7 +11,7 @@ #include "machine/timer.h" #define MCFG_WPC_DMD_SCANLINE_CALLBACK(_scanline_cb) \ - devcb = &downcast(*device).set_scanline_cb(DEVCB_##_scanline_cb); + downcast(*device).set_scanline_cb(DEVCB_##_scanline_cb); class wpc_dmd_device : public device_t { diff --git a/src/mame/video/ygv608.h b/src/mame/video/ygv608.h index c2c9e82ed3a..ae054a0ac6b 100644 --- a/src/mame/video/ygv608.h +++ b/src/mame/video/ygv608.h @@ -315,10 +315,10 @@ DECLARE_DEVICE_TYPE(YGV608, ygv608_device) //************************************************************************** #define MCFG_YGV608_VBLANK_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_vblank_callback(DEVCB_##_intcallb); + downcast(*device).set_vblank_callback(DEVCB_##_intcallb); #define MCFG_YGV608_RASTER_HANDLER( _intcallb ) \ - devcb = &downcast(*device).set_raster_callback(DEVCB_##_intcallb); + downcast(*device).set_raster_callback(DEVCB_##_intcallb); #endif diff --git a/src/mame/video/zx8301.h b/src/mame/video/zx8301.h index 4c92403a519..1d3b64f22d8 100644 --- a/src/mame/video/zx8301.h +++ b/src/mame/video/zx8301.h @@ -42,7 +42,7 @@ ///************************************************************************* #define MCFG_ZX8301_VSYNC_CALLBACK(_write) \ - devcb = &downcast(*device).set_vsync_wr_callback(DEVCB_##_write); + downcast(*device).set_vsync_wr_callback(DEVCB_##_write); -- cgit v1.2.3