summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
committer Vas Crabb <vas@vastheman.com>2018-12-29 05:53:50 +1100
commitf1f0591f43f381123e8d9ec20c52eb7c0c332c79 (patch)
tree97c8dd30a6ea292c3189f372b8103a2e303c0b2d /src/mame
parent65bfb2654f0c73235f114e9145c766245bed9790 (diff)
Start cleaning up palette configuration:
* Basically, initialisers go in the constructor arguments, and things for setting format go in set_format. * Initialisation patterns can be specified with an enum discriminator or with a FUNC and optionally a tag. * Formats can be specified with an enum discriminator or a size and function pointer. * You must always supply the number of entries when setting the format. * When initislising with a paletter initialisation member, you can specify the entries and indirecte entries together. * The palette_device now has a standard constructor, so use .set_entries if you are specifying entry count with no format/initialisation. * Also killed an overload on delegates that wasn't being useful.
Diffstat (limited to 'src/mame')
-rw-r--r--src/mame/drivers/1942.cpp10
-rw-r--r--src/mame/drivers/1943.cpp8
-rw-r--r--src/mame/drivers/1945kiii.cpp6
-rw-r--r--src/mame/drivers/2mindril.cpp5
-rw-r--r--src/mame/drivers/3x3puzzl.cpp21
-rw-r--r--src/mame/drivers/40love.cpp4
-rw-r--r--src/mame/drivers/4enraya.cpp4
-rw-r--r--src/mame/drivers/4roses.cpp8
-rw-r--r--src/mame/drivers/5clown.cpp67
-rw-r--r--src/mame/drivers/8080bw.cpp54
-rw-r--r--src/mame/drivers/88games.cpp4
-rw-r--r--src/mame/drivers/a5105.cpp76
-rw-r--r--src/mame/drivers/a51xx.cpp3
-rw-r--r--src/mame/drivers/a7150.cpp2
-rw-r--r--src/mame/drivers/a7800.cpp20
-rw-r--r--src/mame/drivers/aa310.cpp2
-rw-r--r--src/mame/drivers/ac1.cpp4
-rw-r--r--src/mame/drivers/accomm.cpp9
-rw-r--r--src/mame/drivers/ace.cpp4
-rw-r--r--src/mame/drivers/acefruit.cpp23
-rw-r--r--src/mame/drivers/acommand.cpp11
-rw-r--r--src/mame/drivers/actfancr.cpp6
-rw-r--r--src/mame/drivers/adp.cpp54
-rw-r--r--src/mame/drivers/advision.cpp2
-rw-r--r--src/mame/drivers/aeroboto.cpp2
-rw-r--r--src/mame/drivers/aerofgt.cpp96
-rw-r--r--src/mame/drivers/airbustr.cpp7
-rw-r--r--src/mame/drivers/airraid.cpp5
-rw-r--r--src/mame/drivers/ajax.cpp3
-rw-r--r--src/mame/drivers/albazc.cpp24
-rw-r--r--src/mame/drivers/albazg.cpp5
-rw-r--r--src/mame/drivers/aleck64.cpp2
-rw-r--r--src/mame/drivers/alesis.cpp5
-rw-r--r--src/mame/drivers/alg.cpp5
-rw-r--r--src/mame/drivers/aliens.cpp4
-rw-r--r--src/mame/drivers/alpha68k.cpp48
-rw-r--r--src/mame/drivers/alphasma.cpp7
-rw-r--r--src/mame/drivers/alphatpx.cpp4
-rw-r--r--src/mame/drivers/alphatro.cpp19
-rw-r--r--src/mame/drivers/alto2.cpp2
-rw-r--r--src/mame/drivers/amaticmg.cpp97
-rw-r--r--src/mame/drivers/ambush.cpp155
-rw-r--r--src/mame/drivers/amiga.cpp3
-rw-r--r--src/mame/drivers/ampoker2.cpp11
-rw-r--r--src/mame/drivers/amspdwy.cpp7
-rw-r--r--src/mame/drivers/amstrad.cpp33
-rw-r--r--src/mame/drivers/amusco.cpp25
-rw-r--r--src/mame/drivers/amust.cpp2
-rw-r--r--src/mame/drivers/angelkds.cpp7
-rw-r--r--src/mame/drivers/anzterm.cpp2
-rw-r--r--src/mame/drivers/apc.cpp6
-rw-r--r--src/mame/drivers/apexc.cpp2
-rw-r--r--src/mame/drivers/apogee.cpp14
-rw-r--r--src/mame/drivers/apple1.cpp3
-rw-r--r--src/mame/drivers/apple2.cpp14
-rw-r--r--src/mame/drivers/apple2e.cpp17
-rw-r--r--src/mame/drivers/apple2gs.cpp7
-rw-r--r--src/mame/drivers/apple3.cpp4
-rw-r--r--src/mame/drivers/applix.cpp93
-rw-r--r--src/mame/drivers/appoooh.cpp16
-rw-r--r--src/mame/drivers/apricot.cpp3
-rw-r--r--src/mame/drivers/aquarium.cpp7
-rw-r--r--src/mame/drivers/aquarius.cpp11
-rw-r--r--src/mame/drivers/arabian.cpp2
-rw-r--r--src/mame/drivers/arcadecl.cpp6
-rw-r--r--src/mame/drivers/arcadia.cpp9
-rw-r--r--src/mame/drivers/aristmk4.cpp17
-rw-r--r--src/mame/drivers/aristmk5.cpp2
-rw-r--r--src/mame/drivers/aristmk6.cpp2
-rw-r--r--src/mame/drivers/arkanoid.cpp12
-rw-r--r--src/mame/drivers/armedf.cpp64
-rw-r--r--src/mame/drivers/arsystems.cpp3
-rw-r--r--src/mame/drivers/ashnojoe.cpp6
-rw-r--r--src/mame/drivers/asterix.cpp4
-rw-r--r--src/mame/drivers/astinvad.cpp8
-rw-r--r--src/mame/drivers/astrcorp.cpp36
-rw-r--r--src/mame/drivers/astrocde.cpp4
-rw-r--r--src/mame/drivers/astrohome.cpp2
-rw-r--r--src/mame/drivers/at.cpp2
-rw-r--r--src/mame/drivers/atari400.cpp22
-rw-r--r--src/mame/drivers/atarifb.cpp44
-rw-r--r--src/mame/drivers/atarig1.cpp3
-rw-r--r--src/mame/drivers/atarig42.cpp3
-rw-r--r--src/mame/drivers/atarigx2.cpp3
-rw-r--r--src/mame/drivers/atarist.cpp8
-rw-r--r--src/mame/drivers/atarisy1.cpp5
-rw-r--r--src/mame/drivers/atarisy2.cpp2
-rw-r--r--src/mame/drivers/atarisy4.cpp2
-rw-r--r--src/mame/drivers/atetris.cpp2
-rw-r--r--src/mame/drivers/att4425.cpp2
-rw-r--r--src/mame/drivers/attache.cpp4
-rw-r--r--src/mame/drivers/atvtrack.cpp2
-rw-r--r--src/mame/drivers/aussiebyte.cpp2
-rw-r--r--src/mame/drivers/avigo.cpp10
-rw-r--r--src/mame/drivers/avt.cpp73
-rw-r--r--src/mame/drivers/ax20.cpp11
-rw-r--r--src/mame/drivers/b2m.cpp5
-rw-r--r--src/mame/drivers/backfire.cpp8
-rw-r--r--src/mame/drivers/badlands.cpp6
-rw-r--r--src/mame/drivers/badlandsbl.cpp6
-rw-r--r--src/mame/drivers/bagman.cpp10
-rw-r--r--src/mame/drivers/balsente.cpp5
-rw-r--r--src/mame/drivers/banctec.cpp2
-rw-r--r--src/mame/drivers/bankp.cpp8
-rw-r--r--src/mame/drivers/baraduke.cpp3
-rw-r--r--src/mame/drivers/bartop52.cpp2
-rw-r--r--src/mame/drivers/batman.cpp3
-rw-r--r--src/mame/drivers/battlnts.cpp5
-rw-r--r--src/mame/drivers/bbc.cpp6
-rw-r--r--src/mame/drivers/bbusters.cpp10
-rw-r--r--src/mame/drivers/bcs3.cpp4
-rw-r--r--src/mame/drivers/beathead.cpp8
-rw-r--r--src/mame/drivers/beehive.cpp4
-rw-r--r--src/mame/drivers/beezer.cpp3
-rw-r--r--src/mame/drivers/bestleag.cpp14
-rw-r--r--src/mame/drivers/bigbord2.cpp5
-rw-r--r--src/mame/drivers/bigevglf.cpp2
-rw-r--r--src/mame/drivers/bigstrkb.cpp8
-rw-r--r--src/mame/drivers/binbug.cpp2
-rw-r--r--src/mame/drivers/bingoman.cpp30
-rw-r--r--src/mame/drivers/bingor.cpp63
-rw-r--r--src/mame/drivers/bionicc.cpp5
-rw-r--r--src/mame/drivers/bishi.cpp3
-rw-r--r--src/mame/drivers/bitgraph.cpp4
-rw-r--r--src/mame/drivers/bk.cpp2
-rw-r--r--src/mame/drivers/bking.cpp13
-rw-r--r--src/mame/drivers/blackt96.cpp11
-rw-r--r--src/mame/drivers/bladestl.cpp7
-rw-r--r--src/mame/drivers/blitz68k.cpp2
-rw-r--r--src/mame/drivers/blktiger.cpp7
-rw-r--r--src/mame/drivers/blmbycar.cpp5
-rw-r--r--src/mame/drivers/blockade.cpp6
-rw-r--r--src/mame/drivers/blockhl.cpp11
-rw-r--r--src/mame/drivers/blocktax.cpp7
-rw-r--r--src/mame/drivers/bloodbro.cpp9
-rw-r--r--src/mame/drivers/blstroid.cpp5
-rw-r--r--src/mame/drivers/blueprnt.cpp7
-rw-r--r--src/mame/drivers/bmcbowl.cpp6
-rw-r--r--src/mame/drivers/bmcpokr.cpp2
-rw-r--r--src/mame/drivers/bmjr.cpp2
-rw-r--r--src/mame/drivers/bml3.cpp2
-rw-r--r--src/mame/drivers/bnstars.cpp43
-rw-r--r--src/mame/drivers/bogeyman.cpp8
-rw-r--r--src/mame/drivers/bombjack.cpp5
-rw-r--r--src/mame/drivers/bottom9.cpp3
-rw-r--r--src/mame/drivers/boxer.cpp11
-rw-r--r--src/mame/drivers/brkthru.cpp14
-rw-r--r--src/mame/drivers/bsktball.cpp30
-rw-r--r--src/mame/drivers/btime.cpp19
-rw-r--r--src/mame/drivers/bublbobl.cpp34
-rw-r--r--src/mame/drivers/buggychl.cpp12
-rw-r--r--src/mame/drivers/busicom.cpp5
-rw-r--r--src/mame/drivers/buster.cpp11
-rw-r--r--src/mame/drivers/bw12.cpp2
-rw-r--r--src/mame/drivers/bw2.cpp5
-rw-r--r--src/mame/drivers/c10.cpp2
-rw-r--r--src/mame/drivers/c65.cpp11
-rw-r--r--src/mame/drivers/c900.cpp2
-rw-r--r--src/mame/drivers/cabal.cpp14
-rw-r--r--src/mame/drivers/cabaret.cpp7
-rw-r--r--src/mame/drivers/calomega.cpp7
-rw-r--r--src/mame/drivers/calorie.cpp14
-rw-r--r--src/mame/drivers/camplynx.cpp13
-rw-r--r--src/mame/drivers/candela.cpp2
-rw-r--r--src/mame/drivers/canyon.cpp18
-rw-r--r--src/mame/drivers/cardline.cpp67
-rw-r--r--src/mame/drivers/carjmbre.cpp23
-rw-r--r--src/mame/drivers/carpolo.cpp8
-rw-r--r--src/mame/drivers/carrera.cpp66
-rw-r--r--src/mame/drivers/caswin.cpp20
-rw-r--r--src/mame/drivers/cave.cpp38
-rw-r--r--src/mame/drivers/cb2001.cpp52
-rw-r--r--src/mame/drivers/cball.cpp19
-rw-r--r--src/mame/drivers/cbasebal.cpp5
-rw-r--r--src/mame/drivers/cbm2.cpp2
-rw-r--r--src/mame/drivers/cbuster.cpp3
-rw-r--r--src/mame/drivers/cc40.cpp24
-rw-r--r--src/mame/drivers/ccastles.cpp2
-rw-r--r--src/mame/drivers/cchance.cpp20
-rw-r--r--src/mame/drivers/cclimber.cpp24
-rw-r--r--src/mame/drivers/cd2650.cpp2
-rw-r--r--src/mame/drivers/cdc721.cpp21
-rw-r--r--src/mame/drivers/centiped.cpp6
-rw-r--r--src/mame/drivers/cesclass.cpp11
-rw-r--r--src/mame/drivers/cfx9850.cpp6
-rw-r--r--src/mame/drivers/chaknpop.cpp7
-rw-r--r--src/mame/drivers/champbas.cpp32
-rw-r--r--src/mame/drivers/champbwl.cpp31
-rw-r--r--src/mame/drivers/chanbara.cpp68
-rw-r--r--src/mame/drivers/chance32.cpp20
-rw-r--r--src/mame/drivers/changela.cpp3
-rw-r--r--src/mame/drivers/channelf.cpp20
-rw-r--r--src/mame/drivers/cheekyms.cpp30
-rw-r--r--src/mame/drivers/chinagat.cpp86
-rw-r--r--src/mame/drivers/chinsan.cpp2
-rw-r--r--src/mame/drivers/chqflag.cpp3
-rw-r--r--src/mame/drivers/circus.cpp8
-rw-r--r--src/mame/drivers/circusc.cpp9
-rw-r--r--src/mame/drivers/cischeat.cpp27
-rw-r--r--src/mame/drivers/citycon.cpp7
-rw-r--r--src/mame/drivers/clcd.cpp5
-rw-r--r--src/mame/drivers/cloak.cpp2
-rw-r--r--src/mame/drivers/cloud9.cpp2
-rw-r--r--src/mame/drivers/clshroad.cpp15
-rw-r--r--src/mame/drivers/cmi.cpp4
-rw-r--r--src/mame/drivers/cmmb.cpp9
-rw-r--r--src/mame/drivers/cninja.cpp28
-rw-r--r--src/mame/drivers/cntsteer.cpp34
-rw-r--r--src/mame/drivers/cocoloco.cpp50
-rw-r--r--src/mame/drivers/combatsc.cpp31
-rw-r--r--src/mame/drivers/commando.cpp10
-rw-r--r--src/mame/drivers/compgolf.cpp7
-rw-r--r--src/mame/drivers/compucolor.cpp2
-rw-r--r--src/mame/drivers/comquest.cpp2
-rw-r--r--src/mame/drivers/concept.cpp6
-rw-r--r--src/mame/drivers/contra.cpp13
-rw-r--r--src/mame/drivers/controlid.cpp15
-rw-r--r--src/mame/drivers/coolridr.cpp6
-rw-r--r--src/mame/drivers/cop01.cpp17
-rw-r--r--src/mame/drivers/copsnrob.cpp16
-rw-r--r--src/mame/drivers/corona.cpp82
-rw-r--r--src/mame/drivers/cosmic.cpp19
-rw-r--r--src/mame/drivers/cps3.cpp2
-rw-r--r--src/mame/drivers/craft.cpp2
-rw-r--r--src/mame/drivers/crbaloon.cpp6
-rw-r--r--src/mame/drivers/crgolf.cpp10
-rw-r--r--src/mame/drivers/crimfght.cpp3
-rw-r--r--src/mame/drivers/crospang.cpp3
-rw-r--r--src/mame/drivers/crshrace.cpp5
-rw-r--r--src/mame/drivers/crystal.cpp2
-rw-r--r--src/mame/drivers/cv1k.cpp2
-rw-r--r--src/mame/drivers/cvs.cpp4
-rw-r--r--src/mame/drivers/cxhumax.cpp2
-rw-r--r--src/mame/drivers/cyberbal.cpp9
-rw-r--r--src/mame/drivers/cybertnk.cpp25
-rw-r--r--src/mame/drivers/cybstorm.cpp3
-rw-r--r--src/mame/drivers/cyclemb.cpp49
-rw-r--r--src/mame/drivers/cz101.cpp7
-rw-r--r--src/mame/drivers/d6800.cpp2
-rw-r--r--src/mame/drivers/d9final.cpp10
-rw-r--r--src/mame/drivers/dacholer.cpp58
-rw-r--r--src/mame/drivers/dai.cpp7
-rw-r--r--src/mame/drivers/dai3wksi.cpp9
-rw-r--r--src/mame/drivers/dambustr.cpp12
-rw-r--r--src/mame/drivers/darius.cpp11
-rw-r--r--src/mame/drivers/darkmist.cpp11
-rw-r--r--src/mame/drivers/dassault.cpp3
-rw-r--r--src/mame/drivers/dblcrown.cpp25
-rw-r--r--src/mame/drivers/dblewing.cpp3
-rw-r--r--src/mame/drivers/dbz.cpp6
-rw-r--r--src/mame/drivers/dcheese.cpp6
-rw-r--r--src/mame/drivers/dcon.cpp14
-rw-r--r--src/mame/drivers/dct11em.cpp2
-rw-r--r--src/mame/drivers/dday.cpp11
-rw-r--r--src/mame/drivers/ddayjlc.cpp51
-rw-r--r--src/mame/drivers/ddealer.cpp14
-rw-r--r--src/mame/drivers/ddenlovr.cpp14
-rw-r--r--src/mame/drivers/ddragon.cpp21
-rw-r--r--src/mame/drivers/ddragon3.cpp21
-rw-r--r--src/mame/drivers/ddribble.cpp7
-rw-r--r--src/mame/drivers/deadang.cpp7
-rw-r--r--src/mame/drivers/dec0.cpp26
-rw-r--r--src/mame/drivers/deco156.cpp8
-rw-r--r--src/mame/drivers/deco32.cpp11
-rw-r--r--src/mame/drivers/deco_ld.cpp36
-rw-r--r--src/mame/drivers/deco_mlc.cpp12
-rw-r--r--src/mame/drivers/decocass.cpp16
-rw-r--r--src/mame/drivers/deshoros.cpp10
-rw-r--r--src/mame/drivers/destroyr.cpp17
-rw-r--r--src/mame/drivers/dgn_beta.cpp51
-rw-r--r--src/mame/drivers/dgpix.cpp10
-rw-r--r--src/mame/drivers/dietgo.cpp3
-rw-r--r--src/mame/drivers/dim68k.cpp2
-rw-r--r--src/mame/drivers/divebomb.cpp8
-rw-r--r--src/mame/drivers/diverboy.cpp12
-rw-r--r--src/mame/drivers/djmain.cpp5
-rw-r--r--src/mame/drivers/dkong.cpp36
-rw-r--r--src/mame/drivers/dlair.cpp27
-rw-r--r--src/mame/drivers/dlair2.cpp7
-rw-r--r--src/mame/drivers/dmndrby.cpp84
-rw-r--r--src/mame/drivers/dms5000.cpp2
-rw-r--r--src/mame/drivers/dmv.cpp2
-rw-r--r--src/mame/drivers/docastle.cpp26
-rw-r--r--src/mame/drivers/dogfgt.cpp9
-rw-r--r--src/mame/drivers/dominob.cpp27
-rw-r--r--src/mame/drivers/dooyong.cpp56
-rw-r--r--src/mame/drivers/dorachan.cpp2
-rw-r--r--src/mame/drivers/dotrikun.cpp6
-rw-r--r--src/mame/drivers/dragon.cpp2
-rw-r--r--src/mame/drivers/dragrace.cpp28
-rw-r--r--src/mame/drivers/dreambal.cpp3
-rw-r--r--src/mame/drivers/dreamwld.cpp16
-rw-r--r--src/mame/drivers/drgnmst.cpp7
-rw-r--r--src/mame/drivers/dribling.cpp3
-rw-r--r--src/mame/drivers/drmicro.cpp8
-rw-r--r--src/mame/drivers/drtomy.cpp17
-rw-r--r--src/mame/drivers/drw80pkr.cpp43
-rw-r--r--src/mame/drivers/duet16.cpp2
-rw-r--r--src/mame/drivers/dvk_kcgd.cpp15
-rw-r--r--src/mame/drivers/dvk_ksm.cpp4
-rw-r--r--src/mame/drivers/dwarfd.cpp21
-rw-r--r--src/mame/drivers/dynadice.cpp9
-rw-r--r--src/mame/drivers/dynax.cpp45
-rw-r--r--src/mame/drivers/dynduke.cpp5
-rw-r--r--src/mame/drivers/e100.cpp2
-rw-r--r--src/mame/drivers/ec65.cpp4
-rw-r--r--src/mame/drivers/efdt.cpp25
-rw-r--r--src/mame/drivers/egghunt.cpp12
-rw-r--r--src/mame/drivers/electron.cpp10
-rw-r--r--src/mame/drivers/elwro800.cpp5
-rw-r--r--src/mame/drivers/emate.cpp3
-rw-r--r--src/mame/drivers/enigma2.cpp9
-rw-r--r--src/mame/drivers/eolith.cpp2
-rw-r--r--src/mame/drivers/eolith16.cpp36
-rw-r--r--src/mame/drivers/epos.cpp6
-rw-r--r--src/mame/drivers/equites.cpp8
-rw-r--r--src/mame/drivers/ertictac.cpp2
-rw-r--r--src/mame/drivers/esd16.cpp5
-rw-r--r--src/mame/drivers/esh.cpp83
-rw-r--r--src/mame/drivers/espial.cpp7
-rw-r--r--src/mame/drivers/esprit.cpp8
-rw-r--r--src/mame/drivers/ettrivia.cpp49
-rw-r--r--src/mame/drivers/eurocom2.cpp4
-rw-r--r--src/mame/drivers/excali64.cpp25
-rw-r--r--src/mame/drivers/exedexes.cpp4
-rw-r--r--src/mame/drivers/exelv.cpp4
-rw-r--r--src/mame/drivers/exerion.cpp8
-rw-r--r--src/mame/drivers/expro02.cpp58
-rw-r--r--src/mame/drivers/exprraid.cpp4
-rw-r--r--src/mame/drivers/exterm.cpp4
-rw-r--r--src/mame/drivers/extrema.cpp5
-rw-r--r--src/mame/drivers/exzisus.cpp4
-rw-r--r--src/mame/drivers/f-32.cpp11
-rw-r--r--src/mame/drivers/f1gp.cpp14
-rw-r--r--src/mame/drivers/fantland.cpp28
-rw-r--r--src/mame/drivers/fastfred.cpp11
-rw-r--r--src/mame/drivers/fastinvaders.cpp2
-rw-r--r--src/mame/drivers/fastlane.cpp5
-rw-r--r--src/mame/drivers/fb01.cpp18
-rw-r--r--src/mame/drivers/fc100.cpp2
-rw-r--r--src/mame/drivers/fcombat.cpp9
-rw-r--r--src/mame/drivers/feversoc.cpp15
-rw-r--r--src/mame/drivers/fgoal.cpp46
-rw-r--r--src/mame/drivers/finalizr.cpp8
-rw-r--r--src/mame/drivers/firebeat.cpp8
-rw-r--r--src/mame/drivers/firetrap.cpp14
-rw-r--r--src/mame/drivers/firetrk.cpp17
-rw-r--r--src/mame/drivers/fitfight.cpp13
-rw-r--r--src/mame/drivers/fk1.cpp6
-rw-r--r--src/mame/drivers/flipjack.cpp29
-rw-r--r--src/mame/drivers/flkatck.cpp4
-rw-r--r--src/mame/drivers/flower.cpp8
-rw-r--r--src/mame/drivers/flstory.cpp3
-rw-r--r--src/mame/drivers/flyball.cpp17
-rw-r--r--src/mame/drivers/fm7.cpp36
-rw-r--r--src/mame/drivers/fmtowns.cpp6
-rw-r--r--src/mame/drivers/foodf.cpp2
-rw-r--r--src/mame/drivers/fortecar.cpp56
-rw-r--r--src/mame/drivers/fp200.cpp10
-rw-r--r--src/mame/drivers/freekick.cpp8
-rw-r--r--src/mame/drivers/fresh.cpp27
-rw-r--r--src/mame/drivers/fromanc2.cpp32
-rw-r--r--src/mame/drivers/funkybee.cpp7
-rw-r--r--src/mame/drivers/funkyjet.cpp3
-rw-r--r--src/mame/drivers/funtech.cpp12
-rw-r--r--src/mame/drivers/funworld.cpp111
-rw-r--r--src/mame/drivers/funybubl.cpp7
-rw-r--r--src/mame/drivers/fuukifg2.cpp10
-rw-r--r--src/mame/drivers/fuukifg3.cpp5
-rw-r--r--src/mame/drivers/gaelco.cpp28
-rw-r--r--src/mame/drivers/gaelco2.cpp18
-rw-r--r--src/mame/drivers/gaelco3d.cpp10
-rw-r--r--src/mame/drivers/gaiden.cpp22
-rw-r--r--src/mame/drivers/gal3.cpp22
-rw-r--r--src/mame/drivers/galaga.cpp18
-rw-r--r--src/mame/drivers/galastrm.cpp2
-rw-r--r--src/mame/drivers/galaxi.cpp13
-rw-r--r--src/mame/drivers/galaxia.cpp4
-rw-r--r--src/mame/drivers/galaxian.cpp34
-rw-r--r--src/mame/drivers/galaxold.cpp60
-rw-r--r--src/mame/drivers/galaxy.cpp5
-rw-r--r--src/mame/drivers/galeb.cpp4
-rw-r--r--src/mame/drivers/galgame.cpp9
-rw-r--r--src/mame/drivers/galgames.cpp9
-rw-r--r--src/mame/drivers/galivan.cpp16
-rw-r--r--src/mame/drivers/galpani2.cpp14
-rw-r--r--src/mame/drivers/galpani3.cpp7
-rw-r--r--src/mame/drivers/galpanic.cpp9
-rw-r--r--src/mame/drivers/galspnbl.cpp8
-rw-r--r--src/mame/drivers/gamecom.cpp15
-rw-r--r--src/mame/drivers/gameking.cpp32
-rw-r--r--src/mame/drivers/gamepock.cpp2
-rw-r--r--src/mame/drivers/gaplus.cpp4
-rw-r--r--src/mame/drivers/gauntlet.cpp5
-rw-r--r--src/mame/drivers/gb.cpp83
-rw-r--r--src/mame/drivers/gberet.cpp16
-rw-r--r--src/mame/drivers/gcpinbal.cpp9
-rw-r--r--src/mame/drivers/gei.cpp5
-rw-r--r--src/mame/drivers/geniusiq.cpp54
-rw-r--r--src/mame/drivers/ghosteo.cpp2
-rw-r--r--src/mame/drivers/giclassic.cpp20
-rw-r--r--src/mame/drivers/gijoe.cpp4
-rw-r--r--src/mame/drivers/ginganin.cpp7
-rw-r--r--src/mame/drivers/glass.cpp7
-rw-r--r--src/mame/drivers/gluck2.cpp9
-rw-r--r--src/mame/drivers/gmaster.cpp19
-rw-r--r--src/mame/drivers/gng.cpp5
-rw-r--r--src/mame/drivers/go2000.cpp14
-rw-r--r--src/mame/drivers/goal92.cpp7
-rw-r--r--src/mame/drivers/goindol.cpp4
-rw-r--r--src/mame/drivers/goldngam.cpp2
-rw-r--r--src/mame/drivers/goldnpkr.cpp170
-rw-r--r--src/mame/drivers/goldstar.cpp209
-rw-r--r--src/mame/drivers/gomoku.cpp5
-rw-r--r--src/mame/drivers/good.cpp14
-rw-r--r--src/mame/drivers/goodejan.cpp14
-rw-r--r--src/mame/drivers/gotcha.cpp5
-rw-r--r--src/mame/drivers/gottlieb.cpp2
-rw-r--r--src/mame/drivers/gotya.cpp4
-rw-r--r--src/mame/drivers/goupil.cpp6
-rw-r--r--src/mame/drivers/gradius3.cpp4
-rw-r--r--src/mame/drivers/grchamp.cpp8
-rw-r--r--src/mame/drivers/grfd2301.cpp4
-rw-r--r--src/mame/drivers/gridcomp.cpp4
-rw-r--r--src/mame/drivers/gridlee.cpp3
-rw-r--r--src/mame/drivers/groundfx.cpp7
-rw-r--r--src/mame/drivers/gstream.cpp10
-rw-r--r--src/mame/drivers/gstriker.cpp7
-rw-r--r--src/mame/drivers/gsword.cpp18
-rw-r--r--src/mame/drivers/gticlub.cpp4
-rw-r--r--src/mame/drivers/gts3a.cpp3
-rw-r--r--src/mame/drivers/guab.cpp2
-rw-r--r--src/mame/drivers/gumbo.cpp5
-rw-r--r--src/mame/drivers/gunbustr.cpp11
-rw-r--r--src/mame/drivers/gunpey.cpp4
-rw-r--r--src/mame/drivers/gunsmoke.cpp8
-rw-r--r--src/mame/drivers/gyruss.cpp8
-rw-r--r--src/mame/drivers/h19.cpp2
-rw-r--r--src/mame/drivers/halleys.cpp76
-rw-r--r--src/mame/drivers/hanaawas.cpp6
-rw-r--r--src/mame/drivers/harddriv.cpp2
-rw-r--r--src/mame/drivers/hazeltin.cpp2
-rw-r--r--src/mame/drivers/hcastle.cpp5
-rw-r--r--src/mame/drivers/headonb.cpp9
-rw-r--r--src/mame/drivers/hexion.cpp4
-rw-r--r--src/mame/drivers/hideseek.cpp21
-rw-r--r--src/mame/drivers/higemaru.cpp8
-rw-r--r--src/mame/drivers/highvdeo.cpp15
-rw-r--r--src/mame/drivers/hikaru.cpp2
-rw-r--r--src/mame/drivers/himesiki.cpp8
-rw-r--r--src/mame/drivers/hitme.cpp5
-rw-r--r--src/mame/drivers/hitpoker.cpp2
-rw-r--r--src/mame/drivers/hnayayoi.cpp2
-rw-r--r--src/mame/drivers/hng64.cpp2
-rw-r--r--src/mame/drivers/holeland.cpp8
-rw-r--r--src/mame/drivers/homedata.cpp24
-rw-r--r--src/mame/drivers/homelab.cpp8
-rw-r--r--src/mame/drivers/homerun.cpp2
-rw-r--r--src/mame/drivers/homez80.cpp4
-rw-r--r--src/mame/drivers/hornet.cpp3
-rw-r--r--src/mame/drivers/hotblock.cpp2
-rw-r--r--src/mame/drivers/hp2640.cpp5
-rw-r--r--src/mame/drivers/hp48.cpp2
-rw-r--r--src/mame/drivers/hp64k.cpp6
-rw-r--r--src/mame/drivers/hp80.cpp2
-rw-r--r--src/mame/drivers/hp95lx.cpp18
-rw-r--r--src/mame/drivers/hp9k.cpp12
-rw-r--r--src/mame/drivers/hp_ipc.cpp4
-rw-r--r--src/mame/drivers/hprot1.cpp17
-rw-r--r--src/mame/drivers/huebler.cpp2
-rw-r--r--src/mame/drivers/hunter2.cpp11
-rw-r--r--src/mame/drivers/hvyunit.cpp7
-rw-r--r--src/mame/drivers/hx20.cpp79
-rw-r--r--src/mame/drivers/hyperspt.cpp6
-rw-r--r--src/mame/drivers/i7000.cpp12
-rw-r--r--src/mame/drivers/ibm3153.cpp17
-rw-r--r--src/mame/drivers/ibm6580.cpp13
-rw-r--r--src/mame/drivers/ibmpcjr.cpp4
-rw-r--r--src/mame/drivers/icatel.cpp15
-rw-r--r--src/mame/drivers/ichiban.cpp2
-rw-r--r--src/mame/drivers/igs009.cpp7
-rw-r--r--src/mame/drivers/igs011.cpp3
-rw-r--r--src/mame/drivers/igs017.cpp65
-rw-r--r--src/mame/drivers/igs_fear.cpp3
-rw-r--r--src/mame/drivers/igspoker.cpp7
-rw-r--r--src/mame/drivers/ikki.cpp8
-rw-r--r--src/mame/drivers/imolagp.cpp37
-rw-r--r--src/mame/drivers/indigo.cpp2
-rw-r--r--src/mame/drivers/indy_indigo2.cpp2
-rw-r--r--src/mame/drivers/inteladv.cpp17
-rw-r--r--src/mame/drivers/intv.cpp56
-rw-r--r--src/mame/drivers/inufuku.cpp7
-rw-r--r--src/mame/drivers/ipds.cpp6
-rw-r--r--src/mame/drivers/iq151.cpp2
-rw-r--r--src/mame/drivers/iqblock.cpp6
-rw-r--r--src/mame/drivers/irisha.cpp2
-rw-r--r--src/mame/drivers/irobot.cpp3
-rw-r--r--src/mame/drivers/ironhors.cpp8
-rw-r--r--src/mame/drivers/istellar.cpp4
-rw-r--r--src/mame/drivers/istrebiteli.cpp89
-rw-r--r--src/mame/drivers/itech32.cpp12
-rw-r--r--src/mame/drivers/itgambl2.cpp58
-rw-r--r--src/mame/drivers/itgambl3.cpp48
-rw-r--r--src/mame/drivers/itgamble.cpp2
-rw-r--r--src/mame/drivers/itt3030.cpp24
-rw-r--r--src/mame/drivers/jack.cpp14
-rw-r--r--src/mame/drivers/jackal.cpp10
-rw-r--r--src/mame/drivers/jackie.cpp2
-rw-r--r--src/mame/drivers/jackpool.cpp20
-rw-r--r--src/mame/drivers/jailbrek.cpp8
-rw-r--r--src/mame/drivers/jalmah.cpp11
-rw-r--r--src/mame/drivers/jangou.cpp61
-rw-r--r--src/mame/drivers/jantotsu.cpp42
-rw-r--r--src/mame/drivers/jchan.cpp11
-rw-r--r--src/mame/drivers/jclub2.cpp17
-rw-r--r--src/mame/drivers/jokrwild.cpp45
-rw-r--r--src/mame/drivers/jollyjgr.cpp85
-rw-r--r--src/mame/drivers/jongkyo.cpp27
-rw-r--r--src/mame/drivers/jonos.cpp4
-rw-r--r--src/mame/drivers/joystand.cpp19
-rw-r--r--src/mame/drivers/jr100.cpp9
-rw-r--r--src/mame/drivers/jr200.cpp11
-rw-r--r--src/mame/drivers/jrpacman.cpp4
-rw-r--r--src/mame/drivers/jtc.cpp28
-rw-r--r--src/mame/drivers/jungleyo.cpp9
-rw-r--r--src/mame/drivers/junofrst.cpp2
-rw-r--r--src/mame/drivers/jupace.cpp2
-rw-r--r--src/mame/drivers/jupiter.cpp2
-rw-r--r--src/mame/drivers/k8915.cpp2
-rw-r--r--src/mame/drivers/kaneko16.cpp39
-rw-r--r--src/mame/drivers/kangaroo.cpp2
-rw-r--r--src/mame/drivers/kaypro.cpp14
-rw-r--r--src/mame/drivers/kc.cpp6
-rw-r--r--src/mame/drivers/kchamp.cpp16
-rw-r--r--src/mame/drivers/kdt6.cpp2
-rw-r--r--src/mame/drivers/kickgoal.cpp14
-rw-r--r--src/mame/drivers/kingdrby.cpp93
-rw-r--r--src/mame/drivers/kingobox.cpp16
-rw-r--r--src/mame/drivers/kinst.cpp2
-rw-r--r--src/mame/drivers/klax.cpp4
-rw-r--r--src/mame/drivers/kncljoe.cpp8
-rw-r--r--src/mame/drivers/koikoi.cpp63
-rw-r--r--src/mame/drivers/konamigx.cpp7
-rw-r--r--src/mame/drivers/konamim2.cpp4
-rw-r--r--src/mame/drivers/konblands.cpp40
-rw-r--r--src/mame/drivers/konendev.cpp2
-rw-r--r--src/mame/drivers/konmedal.cpp26
-rw-r--r--src/mame/drivers/konmedal68k.cpp8
-rw-r--r--src/mame/drivers/kontest.cpp46
-rw-r--r--src/mame/drivers/kopunch.cpp5
-rw-r--r--src/mame/drivers/kramermc.cpp4
-rw-r--r--src/mame/drivers/kron.cpp6
-rw-r--r--src/mame/drivers/ksayakyu.cpp7
-rw-r--r--src/mame/drivers/kyugo.cpp4
-rw-r--r--src/mame/drivers/labyrunr.cpp8
-rw-r--r--src/mame/drivers/ladybug.cpp47
-rw-r--r--src/mame/drivers/ladyfrog.cpp3
-rw-r--r--src/mame/drivers/laser3k.cpp79
-rw-r--r--src/mame/drivers/laserbas.cpp24
-rw-r--r--src/mame/drivers/laserbat.cpp4
-rw-r--r--src/mame/drivers/lasso.cpp24
-rw-r--r--src/mame/drivers/lastduel.cpp14
-rw-r--r--src/mame/drivers/lazercmd.cpp29
-rw-r--r--src/mame/drivers/lbeach.cpp24
-rw-r--r--src/mame/drivers/lcmate2.cpp43
-rw-r--r--src/mame/drivers/ldplayer.cpp13
-rw-r--r--src/mame/drivers/legionna.cpp47
-rw-r--r--src/mame/drivers/lemmings.cpp3
-rw-r--r--src/mame/drivers/lethal.cpp3
-rw-r--r--src/mame/drivers/lethalj.cpp2
-rw-r--r--src/mame/drivers/lgp.cpp85
-rw-r--r--src/mame/drivers/liberate.cpp12
-rw-r--r--src/mame/drivers/limenko.cpp10
-rw-r--r--src/mame/drivers/lisa.cpp3
-rw-r--r--src/mame/drivers/lkage.cpp29
-rw-r--r--src/mame/drivers/llc.cpp4
-rw-r--r--src/mame/drivers/lockon.cpp7
-rw-r--r--src/mame/drivers/lola8a.cpp2
-rw-r--r--src/mame/drivers/looping.cpp58
-rw-r--r--src/mame/drivers/lordgun.cpp4
-rw-r--r--src/mame/drivers/lsasquad.cpp8
-rw-r--r--src/mame/drivers/ltcasino.cpp17
-rw-r--r--src/mame/drivers/lucky74.cpp6
-rw-r--r--src/mame/drivers/lvcards.cpp8
-rw-r--r--src/mame/drivers/lviv.cpp3
-rw-r--r--src/mame/drivers/lwings.cpp10
-rw-r--r--src/mame/drivers/m10.cpp24
-rw-r--r--src/mame/drivers/m107.cpp2
-rw-r--r--src/mame/drivers/m14.cpp19
-rw-r--r--src/mame/drivers/m20.cpp6
-rw-r--r--src/mame/drivers/m3.cpp2
-rw-r--r--src/mame/drivers/m52.cpp14
-rw-r--r--src/mame/drivers/m57.cpp8
-rw-r--r--src/mame/drivers/m58.cpp8
-rw-r--r--src/mame/drivers/m62.cpp29
-rw-r--r--src/mame/drivers/m63.cpp102
-rw-r--r--src/mame/drivers/m72.cpp2
-rw-r--r--src/mame/drivers/m79152pc.cpp2
-rw-r--r--src/mame/drivers/m90.cpp2
-rw-r--r--src/mame/drivers/m92.cpp2
-rw-r--r--src/mame/drivers/mac.cpp21
-rw-r--r--src/mame/drivers/mac128.cpp10
-rw-r--r--src/mame/drivers/macpci.cpp3
-rw-r--r--src/mame/drivers/macrossp.cpp3
-rw-r--r--src/mame/drivers/madmotor.cpp3
-rw-r--r--src/mame/drivers/magic10.cpp14
-rw-r--r--src/mame/drivers/magicfly.cpp56
-rw-r--r--src/mame/drivers/magmax.cpp6
-rw-r--r--src/mame/drivers/magnum.cpp2
-rw-r--r--src/mame/drivers/mainevt.cpp8
-rw-r--r--src/mame/drivers/mainsnk.cpp14
-rw-r--r--src/mame/drivers/majorpkr.cpp12
-rw-r--r--src/mame/drivers/malzak.cpp12
-rw-r--r--src/mame/drivers/mappy.cpp12
-rw-r--r--src/mame/drivers/marineb.cpp7
-rw-r--r--src/mame/drivers/marinedt.cpp78
-rw-r--r--src/mame/drivers/mario.cpp12
-rw-r--r--src/mame/drivers/markham.cpp8
-rw-r--r--src/mame/drivers/mastboy.cpp2
-rw-r--r--src/mame/drivers/mastboyo.cpp11
-rw-r--r--src/mame/drivers/matmania.cpp15
-rw-r--r--src/mame/drivers/maxaflex.cpp2
-rw-r--r--src/mame/drivers/mazerbla.cpp16
-rw-r--r--src/mame/drivers/mbc200.cpp2
-rw-r--r--src/mame/drivers/mbc55x.cpp9
-rw-r--r--src/mame/drivers/mbee.cpp13
-rw-r--r--src/mame/drivers/mc8020.cpp2
-rw-r--r--src/mame/drivers/mc8030.cpp2
-rw-r--r--src/mame/drivers/mcatadv.cpp7
-rw-r--r--src/mame/drivers/mcr.cpp8
-rw-r--r--src/mame/drivers/mcr3.cpp8
-rw-r--r--src/mame/drivers/mcr68.cpp5
-rw-r--r--src/mame/drivers/meadows.cpp6
-rw-r--r--src/mame/drivers/megasys1.cpp31
-rw-r--r--src/mame/drivers/megazone.cpp8
-rw-r--r--src/mame/drivers/meijinsn.cpp23
-rw-r--r--src/mame/drivers/meritum.cpp6
-rw-r--r--src/mame/drivers/mermaid.cpp11
-rw-r--r--src/mame/drivers/mes.cpp2
-rw-r--r--src/mame/drivers/metalmx.cpp16
-rw-r--r--src/mame/drivers/metlclsh.cpp7
-rw-r--r--src/mame/drivers/metlfrzr.cpp12
-rw-r--r--src/mame/drivers/mexico86.cpp4
-rw-r--r--src/mame/drivers/meyc8088.cpp15
-rw-r--r--src/mame/drivers/mgames.cpp30
-rw-r--r--src/mame/drivers/mgolf.cpp11
-rw-r--r--src/mame/drivers/micral.cpp2
-rw-r--r--src/mame/drivers/micro3d.cpp5
-rw-r--r--src/mame/drivers/micronic.cpp14
-rw-r--r--src/mame/drivers/microtan.cpp2
-rw-r--r--src/mame/drivers/microvsn.cpp82
-rw-r--r--src/mame/drivers/midas.cpp26
-rw-r--r--src/mame/drivers/midtunit.cpp2
-rw-r--r--src/mame/drivers/midwunit.cpp2
-rw-r--r--src/mame/drivers/midxunit.cpp2
-rw-r--r--src/mame/drivers/midyunit.cpp12
-rw-r--r--src/mame/drivers/midzeus.cpp2
-rw-r--r--src/mame/drivers/mikie.cpp8
-rw-r--r--src/mame/drivers/mikro80.cpp2
-rw-r--r--src/mame/drivers/mikromik.cpp14
-rw-r--r--src/mame/drivers/mikrosha.cpp13
-rw-r--r--src/mame/drivers/mil4000.cpp13
-rw-r--r--src/mame/drivers/miniboy7.cpp69
-rw-r--r--src/mame/drivers/minitel_2_rpic.cpp2
-rw-r--r--src/mame/drivers/minivideo.cpp7
-rw-r--r--src/mame/drivers/mirage.cpp8
-rw-r--r--src/mame/drivers/mirax.cpp108
-rw-r--r--src/mame/drivers/missb2.cpp35
-rw-r--r--src/mame/drivers/missile.cpp2
-rw-r--r--src/mame/drivers/mitchell.cpp25
-rw-r--r--src/mame/drivers/mjkjidai.cpp2
-rw-r--r--src/mame/drivers/mjsister.cpp11
-rw-r--r--src/mame/drivers/mk85.cpp2
-rw-r--r--src/mame/drivers/mk90.cpp7
-rw-r--r--src/mame/drivers/mlanding.cpp5
-rw-r--r--src/mame/drivers/mmagic.cpp9
-rw-r--r--src/mame/drivers/model1.cpp3
-rw-r--r--src/mame/drivers/model2.cpp2
-rw-r--r--src/mame/drivers/model3.cpp3
-rw-r--r--src/mame/drivers/modellot.cpp2
-rw-r--r--src/mame/drivers/mogura.cpp37
-rw-r--r--src/mame/drivers/mole.cpp6
-rw-r--r--src/mame/drivers/molecular.cpp30
-rw-r--r--src/mame/drivers/momoko.cpp9
-rw-r--r--src/mame/drivers/monzagp.cpp50
-rw-r--r--src/mame/drivers/moo.cpp20
-rw-r--r--src/mame/drivers/mosaic.cpp6
-rw-r--r--src/mame/drivers/mouser.cpp8
-rw-r--r--src/mame/drivers/mpc3000.cpp7
-rw-r--r--src/mame/drivers/mpu12wbk.cpp25
-rw-r--r--src/mame/drivers/mpu4dealem.cpp57
-rw-r--r--src/mame/drivers/mpu4vid.cpp2
-rw-r--r--src/mame/drivers/mquake.cpp7
-rw-r--r--src/mame/drivers/mrdo.cpp16
-rw-r--r--src/mame/drivers/mrflea.cpp6
-rw-r--r--src/mame/drivers/mrgame.cpp42
-rw-r--r--src/mame/drivers/mrjong.cpp16
-rw-r--r--src/mame/drivers/ms0515.cpp12
-rw-r--r--src/mame/drivers/ms6102.cpp2
-rw-r--r--src/mame/drivers/msisaac.cpp3
-rw-r--r--src/mame/drivers/mstation.cpp13
-rw-r--r--src/mame/drivers/mugsmash.cpp6
-rw-r--r--src/mame/drivers/multi8.cpp2
-rw-r--r--src/mame/drivers/multigam.cpp17
-rw-r--r--src/mame/drivers/munchmo.cpp5
-rw-r--r--src/mame/drivers/mupid2.cpp3
-rw-r--r--src/mame/drivers/murogem.cpp35
-rw-r--r--src/mame/drivers/murogmbl.cpp111
-rw-r--r--src/mame/drivers/mustache.cpp4
-rw-r--r--src/mame/drivers/mwarr.cpp5
-rw-r--r--src/mame/drivers/mx2178.cpp2
-rw-r--r--src/mame/drivers/mycom.cpp2
-rw-r--r--src/mame/drivers/mystwarr.cpp7
-rw-r--r--src/mame/drivers/mz2000.cpp11
-rw-r--r--src/mame/drivers/mz2500.cpp63
-rw-r--r--src/mame/drivers/mz3500.cpp29
-rw-r--r--src/mame/drivers/mz700.cpp4
-rw-r--r--src/mame/drivers/mz80.cpp2
-rw-r--r--src/mame/drivers/n64.cpp2
-rw-r--r--src/mame/drivers/n8080.cpp6
-rw-r--r--src/mame/drivers/nakajies.cpp27
-rw-r--r--src/mame/drivers/namcona1.cpp2
-rw-r--r--src/mame/drivers/namconb1.cpp4
-rw-r--r--src/mame/drivers/namcops2.cpp2
-rw-r--r--src/mame/drivers/namcos21.cpp6
-rw-r--r--src/mame/drivers/namcos21_c67.cpp7
-rw-r--r--src/mame/drivers/namcos21_de.cpp10
-rw-r--r--src/mame/drivers/namcos23.cpp6
-rw-r--r--src/mame/drivers/namcos86.cpp3
-rw-r--r--src/mame/drivers/nanos.cpp2
-rw-r--r--src/mame/drivers/naomi.cpp2
-rw-r--r--src/mame/drivers/nascom1.cpp2
-rw-r--r--src/mame/drivers/naughtyb.cpp2
-rw-r--r--src/mame/drivers/nbmj8688.cpp18
-rw-r--r--src/mame/drivers/nbmj9195.cpp2
-rw-r--r--src/mame/drivers/nc.cpp9
-rw-r--r--src/mame/drivers/nemesis.cpp25
-rw-r--r--src/mame/drivers/neogeo.cpp2
-rw-r--r--src/mame/drivers/neoprint.cpp28
-rw-r--r--src/mame/drivers/news.cpp6
-rw-r--r--src/mame/drivers/nibble.cpp29
-rw-r--r--src/mame/drivers/nightgal.cpp42
-rw-r--r--src/mame/drivers/ninjakd2.cpp7
-rw-r--r--src/mame/drivers/nitedrvr.cpp4
-rw-r--r--src/mame/drivers/nmg5.cpp13
-rw-r--r--src/mame/drivers/nmk16.cpp125
-rw-r--r--src/mame/drivers/nokia_3310.cpp2
-rw-r--r--src/mame/drivers/norautp.cpp6
-rw-r--r--src/mame/drivers/notetaker.cpp2
-rw-r--r--src/mame/drivers/nova2001.cpp30
-rw-r--r--src/mame/drivers/novag6502.cpp17
-rw-r--r--src/mame/drivers/novag68k.cpp7
-rw-r--r--src/mame/drivers/nsmpoker.cpp27
-rw-r--r--src/mame/drivers/nwk-tr.cpp2
-rw-r--r--src/mame/drivers/nycaptor.cpp24
-rw-r--r--src/mame/drivers/nyny.cpp9
-rw-r--r--src/mame/drivers/odyssey2.cpp127
-rw-r--r--src/mame/drivers/offtwall.cpp3
-rw-r--r--src/mame/drivers/ohmygod.cpp5
-rw-r--r--src/mame/drivers/ojankohs.cpp23
-rw-r--r--src/mame/drivers/okean240.cpp2
-rw-r--r--src/mame/drivers/olibochu.cpp54
-rw-r--r--src/mame/drivers/olytext.cpp2
-rw-r--r--src/mame/drivers/ondra.cpp2
-rw-r--r--src/mame/drivers/oneshot.cpp7
-rw-r--r--src/mame/drivers/onetwo.cpp9
-rw-r--r--src/mame/drivers/opwolf.cpp10
-rw-r--r--src/mame/drivers/orao.cpp2
-rw-r--r--src/mame/drivers/orbit.cpp2
-rw-r--r--src/mame/drivers/oric.cpp3
-rw-r--r--src/mame/drivers/orion.cpp10
-rw-r--r--src/mame/drivers/osbexec.cpp4
-rw-r--r--src/mame/drivers/osborne1.cpp2
-rw-r--r--src/mame/drivers/othello.cpp17
-rw-r--r--src/mame/drivers/overdriv.cpp4
-rw-r--r--src/mame/drivers/p112.cpp7
-rw-r--r--src/mame/drivers/p2000t.cpp20
-rw-r--r--src/mame/drivers/pacland.cpp4
-rw-r--r--src/mame/drivers/pacman.cpp6
-rw-r--r--src/mame/drivers/palm.cpp27
-rw-r--r--src/mame/drivers/pandoras.cpp9
-rw-r--r--src/mame/drivers/panicr.cpp63
-rw-r--r--src/mame/drivers/paradise.cpp6
-rw-r--r--src/mame/drivers/parodius.cpp4
-rw-r--r--src/mame/drivers/partner.cpp5
-rw-r--r--src/mame/drivers/pasha2.cpp4
-rw-r--r--src/mame/drivers/pasopia7.cpp23
-rw-r--r--src/mame/drivers/pass.cpp5
-rw-r--r--src/mame/drivers/pastelg.cpp6
-rw-r--r--src/mame/drivers/patapata.cpp5
-rw-r--r--src/mame/drivers/pb1000.cpp23
-rw-r--r--src/mame/drivers/pbaction.cpp9
-rw-r--r--src/mame/drivers/pc100.cpp12
-rw-r--r--src/mame/drivers/pc1500.cpp10
-rw-r--r--src/mame/drivers/pc2000.cpp11
-rw-r--r--src/mame/drivers/pc4.cpp10
-rw-r--r--src/mame/drivers/pc6001.cpp12
-rw-r--r--src/mame/drivers/pc8801.cpp13
-rw-r--r--src/mame/drivers/pc9801.cpp17
-rw-r--r--src/mame/drivers/pce220.cpp45
-rw-r--r--src/mame/drivers/pcktgal.cpp11
-rw-r--r--src/mame/drivers/pcm.cpp2
-rw-r--r--src/mame/drivers/pcw.cpp3
-rw-r--r--src/mame/drivers/pcw16.cpp6
-rw-r--r--src/mame/drivers/pda600.cpp2
-rw-r--r--src/mame/drivers/pdp1.cpp80
-rw-r--r--src/mame/drivers/pegasus.cpp2
-rw-r--r--src/mame/drivers/pengo.cpp4
-rw-r--r--src/mame/drivers/peoplepc.cpp2
-rw-r--r--src/mame/drivers/peplus.cpp63
-rw-r--r--src/mame/drivers/pet.cpp3
-rw-r--r--src/mame/drivers/pgm.cpp3
-rw-r--r--src/mame/drivers/pgm2.cpp6
-rw-r--r--src/mame/drivers/phoenix.cpp8
-rw-r--r--src/mame/drivers/photon.cpp124
-rw-r--r--src/mame/drivers/photon2.cpp31
-rw-r--r--src/mame/drivers/phunsy.cpp14
-rw-r--r--src/mame/drivers/piggypas.cpp2
-rw-r--r--src/mame/drivers/pingpong.cpp8
-rw-r--r--src/mame/drivers/pipedrm.cpp18
-rw-r--r--src/mame/drivers/pipeline.cpp33
-rw-r--r--src/mame/drivers/pirates.cpp9
-rw-r--r--src/mame/drivers/piratesh.cpp5
-rw-r--r--src/mame/drivers/pitagjr.cpp11
-rw-r--r--src/mame/drivers/pitnrun.cpp5
-rw-r--r--src/mame/drivers/pk8000.cpp3
-rw-r--r--src/mame/drivers/pk8020.cpp7
-rw-r--r--src/mame/drivers/pkscram.cpp46
-rw-r--r--src/mame/drivers/pktgaldx.cpp12
-rw-r--r--src/mame/drivers/plan80.cpp2
-rw-r--r--src/mame/drivers/playch10.cpp2
-rw-r--r--src/mame/drivers/playmark.cpp49
-rw-r--r--src/mame/drivers/plygonet.cpp3
-rw-r--r--src/mame/drivers/pmd85.cpp5
-rw-r--r--src/mame/drivers/pockchal.cpp13
-rw-r--r--src/mame/drivers/pocketc.cpp4
-rw-r--r--src/mame/drivers/pockstat.cpp6
-rw-r--r--src/mame/drivers/pofo.cpp9
-rw-r--r--src/mame/drivers/poisk1.cpp49
-rw-r--r--src/mame/drivers/pokechmp.cpp5
-rw-r--r--src/mame/drivers/pokemini.cpp98
-rw-r--r--src/mame/drivers/poker72.cpp53
-rw-r--r--src/mame/drivers/polepos.cpp8
-rw-r--r--src/mame/drivers/policetr.cpp2
-rw-r--r--src/mame/drivers/poly88.cpp2
-rw-r--r--src/mame/drivers/polyplay.cpp13
-rw-r--r--src/mame/drivers/poolshrk.cpp17
-rw-r--r--src/mame/drivers/pooyan.cpp9
-rw-r--r--src/mame/drivers/popeye.cpp2
-rw-r--r--src/mame/drivers/popobear.cpp9
-rw-r--r--src/mame/drivers/popper.cpp19
-rw-r--r--src/mame/drivers/portrait.cpp12
-rw-r--r--src/mame/drivers/powerbal.cpp14
-rw-r--r--src/mame/drivers/powerins.cpp7
-rw-r--r--src/mame/drivers/pp01.cpp3
-rw-r--r--src/mame/drivers/ppmast93.cpp9
-rw-r--r--src/mame/drivers/prehisle.cpp4
-rw-r--r--src/mame/drivers/prestige.cpp41
-rw-r--r--src/mame/drivers/primo.cpp2
-rw-r--r--src/mame/drivers/progolf.cpp55
-rw-r--r--src/mame/drivers/proteus3.cpp2
-rw-r--r--src/mame/drivers/ps2sony.cpp2
-rw-r--r--src/mame/drivers/psikyo.cpp8
-rw-r--r--src/mame/drivers/psikyo4.cpp4
-rw-r--r--src/mame/drivers/psikyosh.cpp2
-rw-r--r--src/mame/drivers/psion.cpp10
-rw-r--r--src/mame/drivers/ptcsol.cpp2
-rw-r--r--src/mame/drivers/pturn.cpp4
-rw-r--r--src/mame/drivers/pv1000.cpp21
-rw-r--r--src/mame/drivers/pv9234.cpp3
-rw-r--r--src/mame/drivers/px4.cpp27
-rw-r--r--src/mame/drivers/px8.cpp5
-rw-r--r--src/mame/drivers/pyl601.cpp9
-rw-r--r--src/mame/drivers/pyson.cpp2
-rw-r--r--src/mame/drivers/pzletime.cpp34
-rw-r--r--src/mame/drivers/qdrmfgp.cpp6
-rw-r--r--src/mame/drivers/quasar.cpp4
-rw-r--r--src/mame/drivers/quickpick5.cpp7
-rw-r--r--src/mame/drivers/quizo.cpp59
-rw-r--r--src/mame/drivers/quizpani.cpp5
-rw-r--r--src/mame/drivers/quizpun2.cpp25
-rw-r--r--src/mame/drivers/quizshow.cpp14
-rw-r--r--src/mame/drivers/qvt102.cpp2
-rw-r--r--src/mame/drivers/qx10.cpp9
-rw-r--r--src/mame/drivers/r2dtank.cpp9
-rw-r--r--src/mame/drivers/r2dx_v33.cpp14
-rw-r--r--src/mame/drivers/rabbit.cpp13
-rw-r--r--src/mame/drivers/radio86.cpp5
-rw-r--r--src/mame/drivers/raiden.cpp5
-rw-r--r--src/mame/drivers/raiden2.cpp10
-rw-r--r--src/mame/drivers/rallyx.cpp8
-rw-r--r--src/mame/drivers/rampart.cpp4
-rw-r--r--src/mame/drivers/rastan.cpp5
-rw-r--r--src/mame/drivers/rastersp.cpp8
-rw-r--r--src/mame/drivers/rbisland.cpp15
-rw-r--r--src/mame/drivers/rbmk.cpp9
-rw-r--r--src/mame/drivers/rc702.cpp15
-rw-r--r--src/mame/drivers/rd100.cpp2
-rw-r--r--src/mame/drivers/rd110.cpp16
-rw-r--r--src/mame/drivers/realbrk.cpp5
-rw-r--r--src/mame/drivers/redclash.cpp16
-rw-r--r--src/mame/drivers/relief.cpp3
-rw-r--r--src/mame/drivers/renegade.cpp5
-rw-r--r--src/mame/drivers/replicator.cpp14
-rw-r--r--src/mame/drivers/retofinv.cpp13
-rw-r--r--src/mame/drivers/rex6000.cpp44
-rw-r--r--src/mame/drivers/risc2500.cpp2
-rw-r--r--src/mame/drivers/rm380z.cpp2
-rw-r--r--src/mame/drivers/rmhaihai.cpp6
-rw-r--r--src/mame/drivers/rmnimbus.cpp2
-rw-r--r--src/mame/drivers/rmt32.cpp13
-rw-r--r--src/mame/drivers/rockrage.cpp10
-rw-r--r--src/mame/drivers/rocnrope.cpp11
-rw-r--r--src/mame/drivers/rollerg.cpp4
-rw-r--r--src/mame/drivers/rollrace.cpp7
-rw-r--r--src/mame/drivers/ron.cpp40
-rw-r--r--src/mame/drivers/roul.cpp51
-rw-r--r--src/mame/drivers/route16.cpp4
-rw-r--r--src/mame/drivers/royalmah.cpp75
-rw-r--r--src/mame/drivers/rpunch.cpp14
-rw-r--r--src/mame/drivers/rt1715.cpp15
-rw-r--r--src/mame/drivers/runaway.cpp2
-rw-r--r--src/mame/drivers/rungun.cpp11
-rw-r--r--src/mame/drivers/rz1.cpp12
-rw-r--r--src/mame/drivers/safarir.cpp19
-rw-r--r--src/mame/drivers/samcoupe.cpp18
-rw-r--r--src/mame/drivers/sandscrp.cpp10
-rw-r--r--src/mame/drivers/sanremmg.cpp8
-rw-r--r--src/mame/drivers/sanremo.cpp62
-rw-r--r--src/mame/drivers/sapi1.cpp8
-rw-r--r--src/mame/drivers/saturn.cpp2
-rw-r--r--src/mame/drivers/sauro.cpp4
-rw-r--r--src/mame/drivers/sbasketb.cpp6
-rw-r--r--src/mame/drivers/sbc6510.cpp2
-rw-r--r--src/mame/drivers/sbowling.cpp79
-rw-r--r--src/mame/drivers/sbrkout.cpp15
-rw-r--r--src/mame/drivers/sbugger.cpp3
-rw-r--r--src/mame/drivers/scobra.cpp39
-rw-r--r--src/mame/drivers/scotrsht.cpp8
-rw-r--r--src/mame/drivers/scramble.cpp63
-rw-r--r--src/mame/drivers/scregg.cpp19
-rw-r--r--src/mame/drivers/scv.cpp131
-rw-r--r--src/mame/drivers/scyclone.cpp2
-rw-r--r--src/mame/drivers/sderby.cpp42
-rw-r--r--src/mame/drivers/sderby2.cpp18
-rw-r--r--src/mame/drivers/seabattl.cpp15
-rw-r--r--src/mame/drivers/sealy.cpp15
-rw-r--r--src/mame/drivers/segac2.cpp2
-rw-r--r--src/mame/drivers/segag80r.cpp8
-rw-r--r--src/mame/drivers/segahang.cpp2
-rw-r--r--src/mame/drivers/segajw.cpp2
-rw-r--r--src/mame/drivers/segam1.cpp2
-rw-r--r--src/mame/drivers/segaorun.cpp2
-rw-r--r--src/mame/drivers/segapm.cpp3
-rw-r--r--src/mame/drivers/segas16a.cpp2
-rw-r--r--src/mame/drivers/segas16b.cpp2
-rw-r--r--src/mame/drivers/segas18.cpp2
-rw-r--r--src/mame/drivers/segas24.cpp2
-rw-r--r--src/mame/drivers/segas32.cpp4
-rw-r--r--src/mame/drivers/segaxbd.cpp2
-rw-r--r--src/mame/drivers/segaybd.cpp2
-rw-r--r--src/mame/drivers/seibucats.cpp2
-rw-r--r--src/mame/drivers/seibuspi.cpp6
-rw-r--r--src/mame/drivers/seicross.cpp5
-rw-r--r--src/mame/drivers/seicupbl.cpp7
-rw-r--r--src/mame/drivers/sengokmj.cpp14
-rw-r--r--src/mame/drivers/senjyo.cpp9
-rw-r--r--src/mame/drivers/seta.cpp117
-rw-r--r--src/mame/drivers/seta2.cpp21
-rw-r--r--src/mame/drivers/sf.cpp5
-rw-r--r--src/mame/drivers/shadfrce.cpp7
-rw-r--r--src/mame/drivers/shangha3.cpp12
-rw-r--r--src/mame/drivers/shanghai.cpp60
-rw-r--r--src/mame/drivers/shangkid.cpp10
-rw-r--r--src/mame/drivers/shaolins.cpp8
-rw-r--r--src/mame/drivers/shootout.cpp14
-rw-r--r--src/mame/drivers/shougi.cpp15
-rw-r--r--src/mame/drivers/shuuz.cpp3
-rw-r--r--src/mame/drivers/sidearms.cpp15
-rw-r--r--src/mame/drivers/sidepckt.cpp7
-rw-r--r--src/mame/drivers/sigmab98.cpp33
-rw-r--r--src/mame/drivers/silkroad.cpp8
-rw-r--r--src/mame/drivers/silvmil.cpp20
-rw-r--r--src/mame/drivers/simpl156.cpp10
-rw-r--r--src/mame/drivers/simpsons.cpp5
-rw-r--r--src/mame/drivers/skimaxx.cpp2
-rw-r--r--src/mame/drivers/skullxbo.cpp3
-rw-r--r--src/mame/drivers/skyarmy.cpp90
-rw-r--r--src/mame/drivers/skydiver.cpp32
-rw-r--r--src/mame/drivers/skyfox.cpp23
-rw-r--r--src/mame/drivers/skykid.cpp4
-rw-r--r--src/mame/drivers/skyraid.cpp34
-rw-r--r--src/mame/drivers/slapfght.cpp6
-rw-r--r--src/mame/drivers/slapshot.cpp14
-rw-r--r--src/mame/drivers/sm1800.cpp9
-rw-r--r--src/mame/drivers/sm7238.cpp7
-rw-r--r--src/mame/drivers/smc777.cpp40
-rw-r--r--src/mame/drivers/smsmcorp.cpp2
-rw-r--r--src/mame/drivers/snk.cpp22
-rw-r--r--src/mame/drivers/snk6502.cpp17
-rw-r--r--src/mame/drivers/snookr10.cpp9
-rw-r--r--src/mame/drivers/snowbros.cpp10
-rw-r--r--src/mame/drivers/socrates.cpp162
-rw-r--r--src/mame/drivers/solomon.cpp9
-rw-r--r--src/mame/drivers/sonson.cpp8
-rw-r--r--src/mame/drivers/sorcerer.cpp2
-rw-r--r--src/mame/drivers/spaceg.cpp46
-rw-r--r--src/mame/drivers/spartanxtec.cpp25
-rw-r--r--src/mame/drivers/spbactn.cpp10
-rw-r--r--src/mame/drivers/spc1500.cpp11
-rw-r--r--src/mame/drivers/spcforce.cpp23
-rw-r--r--src/mame/drivers/spdodgeb.cpp7
-rw-r--r--src/mame/drivers/special.cpp20
-rw-r--r--src/mame/drivers/spectrum.cpp7
-rw-r--r--src/mame/drivers/speedatk.cpp8
-rw-r--r--src/mame/drivers/speedbal.cpp8
-rw-r--r--src/mame/drivers/speedspn.cpp7
-rw-r--r--src/mame/drivers/spiders.cpp2
-rw-r--r--src/mame/drivers/spinb.cpp29
-rw-r--r--src/mame/drivers/splash.cpp21
-rw-r--r--src/mame/drivers/splus.cpp2
-rw-r--r--src/mame/drivers/spoker.cpp6
-rw-r--r--src/mame/drivers/spool99.cpp17
-rw-r--r--src/mame/drivers/sprcros2.cpp98
-rw-r--r--src/mame/drivers/sprint2.cpp8
-rw-r--r--src/mame/drivers/sprint4.cpp8
-rw-r--r--src/mame/drivers/sprint8.cpp8
-rw-r--r--src/mame/drivers/spy.cpp3
-rw-r--r--src/mame/drivers/srmp2.cpp19
-rw-r--r--src/mame/drivers/srmp5.cpp7
-rw-r--r--src/mame/drivers/srmp6.cpp10
-rw-r--r--src/mame/drivers/srumbler.cpp5
-rw-r--r--src/mame/drivers/ssem.cpp6
-rw-r--r--src/mame/drivers/sshangha.cpp2
-rw-r--r--src/mame/drivers/sshot.cpp9
-rw-r--r--src/mame/drivers/sslam.cpp6
-rw-r--r--src/mame/drivers/ssozumo.cpp8
-rw-r--r--src/mame/drivers/sspeedr.cpp21
-rw-r--r--src/mame/drivers/ssrj.cpp8
-rw-r--r--src/mame/drivers/sstrangr.cpp9
-rw-r--r--src/mame/drivers/ssv.cpp2
-rw-r--r--src/mame/drivers/ssystem3.cpp3
-rw-r--r--src/mame/drivers/stadhero.cpp3
-rw-r--r--src/mame/drivers/starcrus.cpp3
-rw-r--r--src/mame/drivers/starshp1.cpp8
-rw-r--r--src/mame/drivers/statriv2.cpp17
-rw-r--r--src/mame/drivers/stfight.cpp2
-rw-r--r--src/mame/drivers/stlforce.cpp5
-rw-r--r--src/mame/drivers/stuntair.cpp50
-rw-r--r--src/mame/drivers/stv.cpp2
-rw-r--r--src/mame/drivers/sub.cpp8
-rw-r--r--src/mame/drivers/subhuntr.cpp15
-rw-r--r--src/mame/drivers/subs.cpp19
-rw-r--r--src/mame/drivers/subsino.cpp116
-rw-r--r--src/mame/drivers/summit.cpp28
-rw-r--r--src/mame/drivers/suna8.cpp43
-rw-r--r--src/mame/drivers/supbtime.cpp3
-rw-r--r--src/mame/drivers/supdrapo.cpp67
-rw-r--r--src/mame/drivers/super80.cpp8
-rw-r--r--src/mame/drivers/superchs.cpp7
-rw-r--r--src/mame/drivers/supercrd.cpp79
-rw-r--r--src/mame/drivers/superdq.cpp70
-rw-r--r--src/mame/drivers/superqix.cpp8
-rw-r--r--src/mame/drivers/superwng.cpp57
-rw-r--r--src/mame/drivers/supracan.cpp65
-rw-r--r--src/mame/drivers/suprloco.cpp5
-rw-r--r--src/mame/drivers/suprridr.cpp7
-rw-r--r--src/mame/drivers/suprslam.cpp7
-rw-r--r--src/mame/drivers/surpratk.cpp15
-rw-r--r--src/mame/drivers/svision.cpp83
-rw-r--r--src/mame/drivers/svmu.cpp33
-rw-r--r--src/mame/drivers/swyft.cpp2
-rw-r--r--src/mame/drivers/sys2900.cpp2
-rw-r--r--src/mame/drivers/sys9002.cpp2
-rw-r--r--src/mame/drivers/system1.cpp3
-rw-r--r--src/mame/drivers/system16.cpp27
-rw-r--r--src/mame/drivers/tagteam.cpp8
-rw-r--r--src/mame/drivers/tail2nos.cpp7
-rw-r--r--src/mame/drivers/taito_b.cpp86
-rw-r--r--src/mame/drivers/taito_f2.cpp58
-rw-r--r--src/mame/drivers/taito_f3.cpp8
-rw-r--r--src/mame/drivers/taito_h.cpp21
-rw-r--r--src/mame/drivers/taito_l.cpp7
-rw-r--r--src/mame/drivers/taito_o.cpp7
-rw-r--r--src/mame/drivers/taito_x.cpp28
-rw-r--r--src/mame/drivers/taito_z.cpp55
-rw-r--r--src/mame/drivers/taitoair.cpp4
-rw-r--r--src/mame/drivers/taitojc.cpp2
-rw-r--r--src/mame/drivers/taitopjc.cpp2
-rw-r--r--src/mame/drivers/taitowlf.cpp116
-rw-r--r--src/mame/drivers/tamag1.cpp6
-rw-r--r--src/mame/drivers/tandy2k.cpp2
-rw-r--r--src/mame/drivers/tank8.cpp9
-rw-r--r--src/mame/drivers/tankbatt.cpp4
-rw-r--r--src/mame/drivers/tankbust.cpp93
-rw-r--r--src/mame/drivers/taotaido.cpp5
-rw-r--r--src/mame/drivers/targeth.cpp7
-rw-r--r--src/mame/drivers/tasman.cpp13
-rw-r--r--src/mame/drivers/tatsumi.cpp18
-rw-r--r--src/mame/drivers/tattack.cpp57
-rw-r--r--src/mame/drivers/tavernie.cpp2
-rw-r--r--src/mame/drivers/taxidriv.cpp39
-rw-r--r--src/mame/drivers/tbowl.cpp10
-rw-r--r--src/mame/drivers/tceptor.cpp4
-rw-r--r--src/mame/drivers/tdv2324.cpp2
-rw-r--r--src/mame/drivers/tecmo.cpp8
-rw-r--r--src/mame/drivers/tecmo16.cpp5
-rw-r--r--src/mame/drivers/tecmosys.cpp3
-rw-r--r--src/mame/drivers/tehkanwc.cpp8
-rw-r--r--src/mame/drivers/tek405x.cpp4
-rw-r--r--src/mame/drivers/tek410x.cpp2
-rw-r--r--src/mame/drivers/tek440x.cpp8
-rw-r--r--src/mame/drivers/terak.cpp2
-rw-r--r--src/mame/drivers/terracre.cpp8
-rw-r--r--src/mame/drivers/thayers.cpp2
-rw-r--r--src/mame/drivers/thedealr.cpp13
-rw-r--r--src/mame/drivers/thedeep.cpp2
-rw-r--r--src/mame/drivers/thepit.cpp10
-rw-r--r--src/mame/drivers/thief.cpp2
-rw-r--r--src/mame/drivers/thomson.cpp6
-rw-r--r--src/mame/drivers/thoop2.cpp5
-rw-r--r--src/mame/drivers/thunderj.cpp3
-rw-r--r--src/mame/drivers/thunderx.cpp3
-rw-r--r--src/mame/drivers/ti630.cpp13
-rw-r--r--src/mame/drivers/ti74.cpp21
-rw-r--r--src/mame/drivers/ti85.cpp16
-rw-r--r--src/mame/drivers/ti89.cpp5
-rw-r--r--src/mame/drivers/tiamc1.cpp8
-rw-r--r--src/mame/drivers/tigeroad.cpp4
-rw-r--r--src/mame/drivers/tim011.cpp17
-rw-r--r--src/mame/drivers/tim100.cpp7
-rw-r--r--src/mame/drivers/timelimt.cpp7
-rw-r--r--src/mame/drivers/timeplt.cpp3
-rw-r--r--src/mame/drivers/tk2000.cpp19
-rw-r--r--src/mame/drivers/tk80bs.cpp8
-rw-r--r--src/mame/drivers/tmaster.cpp9
-rw-r--r--src/mame/drivers/tmmjprd.cpp4
-rw-r--r--src/mame/drivers/tmnt.cpp38
-rw-r--r--src/mame/drivers/tmspoker.cpp30
-rw-r--r--src/mame/drivers/tnzs.cpp14
-rw-r--r--src/mame/drivers/toaplan1.cpp63
-rw-r--r--src/mame/drivers/toaplan2.cpp79
-rw-r--r--src/mame/drivers/toki.cpp18
-rw-r--r--src/mame/drivers/topspeed.cpp5
-rw-r--r--src/mame/drivers/toypop.cpp56
-rw-r--r--src/mame/drivers/tp84.cpp16
-rw-r--r--src/mame/drivers/tr175.cpp2
-rw-r--r--src/mame/drivers/trackfld.cpp13
-rw-r--r--src/mame/drivers/travrusa.cpp11
-rw-r--r--src/mame/drivers/triplhnt.cpp14
-rw-r--r--src/mame/drivers/trs80.cpp9
-rw-r--r--src/mame/drivers/trs80dt1.cpp2
-rw-r--r--src/mame/drivers/trs80m2.cpp4
-rw-r--r--src/mame/drivers/trs80m3.cpp4
-rw-r--r--src/mame/drivers/truco.cpp3
-rw-r--r--src/mame/drivers/trucocl.cpp5
-rw-r--r--src/mame/drivers/tryout.cpp7
-rw-r--r--src/mame/drivers/ts803.cpp2
-rw-r--r--src/mame/drivers/tsamurai.cpp10
-rw-r--r--src/mame/drivers/tubep.cpp8
-rw-r--r--src/mame/drivers/tugboat.cpp73
-rw-r--r--src/mame/drivers/tumbleb.cpp47
-rw-r--r--src/mame/drivers/tunhunt.cpp4
-rw-r--r--src/mame/drivers/turbo.cpp15
-rw-r--r--src/mame/drivers/turrett.cpp2
-rw-r--r--src/mame/drivers/tutankhm.cpp6
-rw-r--r--src/mame/drivers/tv990.cpp7
-rw-r--r--src/mame/drivers/tvc.cpp71
-rw-r--r--src/mame/drivers/tvgame.cpp2
-rw-r--r--src/mame/drivers/twin16.cpp8
-rw-r--r--src/mame/drivers/twincobr.cpp7
-rw-r--r--src/mame/drivers/tx0.cpp22
-rw-r--r--src/mame/drivers/tx1.cpp9
-rw-r--r--src/mame/drivers/uknc.cpp2
-rw-r--r--src/mame/drivers/ultraman.cpp6
-rw-r--r--src/mame/drivers/ultratnk.cpp9
-rw-r--r--src/mame/drivers/ultrsprt.cpp10
-rw-r--r--src/mame/drivers/umipoker.cpp15
-rw-r--r--src/mame/drivers/undrfire.cpp14
-rw-r--r--src/mame/drivers/unichamp.cpp39
-rw-r--r--src/mame/drivers/unico.cpp21
-rw-r--r--src/mame/drivers/unior.cpp19
-rw-r--r--src/mame/drivers/unistar.cpp17
-rw-r--r--src/mame/drivers/univac.cpp4
-rw-r--r--src/mame/drivers/unixpc.cpp2
-rw-r--r--src/mame/drivers/unkhorse.cpp6
-rw-r--r--src/mame/drivers/upscope.cpp13
-rw-r--r--src/mame/drivers/usgames.cpp5
-rw-r--r--src/mame/drivers/ut88.cpp4
-rw-r--r--src/mame/drivers/v6809.cpp2
-rw-r--r--src/mame/drivers/vamphalf.cpp24
-rw-r--r--src/mame/drivers/vastar.cpp6
-rw-r--r--src/mame/drivers/vboy.cpp228
-rw-r--r--src/mame/drivers/vc4000.cpp8
-rw-r--r--src/mame/drivers/vector06.cpp2
-rw-r--r--src/mame/drivers/vega.cpp118
-rw-r--r--src/mame/drivers/vegaeo.cpp3
-rw-r--r--src/mame/drivers/vendetta.cpp3
-rw-r--r--src/mame/drivers/vgmplay.cpp2
-rw-r--r--src/mame/drivers/victor9k.cpp7
-rw-r--r--src/mame/drivers/video21.cpp2
-rw-r--r--src/mame/drivers/videopin.cpp17
-rw-r--r--src/mame/drivers/videopkr.cpp122
-rw-r--r--src/mame/drivers/videosaa.cpp7
-rw-r--r--src/mame/drivers/viper.cpp2
-rw-r--r--src/mame/drivers/vixen.cpp2
-rw-r--r--src/mame/drivers/vlc.cpp62
-rw-r--r--src/mame/drivers/volfied.cpp5
-rw-r--r--src/mame/drivers/vpoker.cpp11
-rw-r--r--src/mame/drivers/vt220.cpp9
-rw-r--r--src/mame/drivers/vt240.cpp2
-rw-r--r--src/mame/drivers/vt320.cpp2
-rw-r--r--src/mame/drivers/vt520.cpp11
-rw-r--r--src/mame/drivers/vta2000.cpp12
-rw-r--r--src/mame/drivers/vtech2.cpp85
-rw-r--r--src/mame/drivers/vulgus.cpp8
-rw-r--r--src/mame/drivers/wallc.cpp123
-rw-r--r--src/mame/drivers/wardner.cpp7
-rw-r--r--src/mame/drivers/warpsped.cpp26
-rw-r--r--src/mame/drivers/warpwarp.cpp22
-rw-r--r--src/mame/drivers/wc90.cpp6
-rw-r--r--src/mame/drivers/wc90b.cpp8
-rw-r--r--src/mame/drivers/wecleman.cpp4
-rw-r--r--src/mame/drivers/welltris.cpp5
-rw-r--r--src/mame/drivers/wgp.cpp7
-rw-r--r--src/mame/drivers/wicat.cpp3
-rw-r--r--src/mame/drivers/wildpkr.cpp20
-rw-r--r--src/mame/drivers/williams.cpp7
-rw-r--r--src/mame/drivers/wink.cpp13
-rw-r--r--src/mame/drivers/wiping.cpp8
-rw-r--r--src/mame/drivers/witch.cpp10
-rw-r--r--src/mame/drivers/wiz.cpp7
-rw-r--r--src/mame/drivers/wmg.cpp3
-rw-r--r--src/mame/drivers/wolfpack.cpp8
-rw-r--r--src/mame/drivers/wrally.cpp7
-rw-r--r--src/mame/drivers/wswan.cpp21
-rw-r--r--src/mame/drivers/wwfsstar.cpp7
-rw-r--r--src/mame/drivers/wyvernf0.cpp22
-rw-r--r--src/mame/drivers/x07.cpp7
-rw-r--r--src/mame/drivers/x1.cpp13
-rw-r--r--src/mame/drivers/x1twin.cpp5
-rw-r--r--src/mame/drivers/x68k.cpp4
-rw-r--r--src/mame/drivers/xain.cpp8
-rw-r--r--src/mame/drivers/xavix.cpp2
-rw-r--r--src/mame/drivers/xerox820.cpp4
-rw-r--r--src/mame/drivers/xexex.cpp3
-rw-r--r--src/mame/drivers/xmen.cpp8
-rw-r--r--src/mame/drivers/xorworld.cpp3
-rw-r--r--src/mame/drivers/xxmissio.cpp7
-rw-r--r--src/mame/drivers/xybots.cpp6
-rw-r--r--src/mame/drivers/xyonix.cpp13
-rw-r--r--src/mame/drivers/yiear.cpp5
-rw-r--r--src/mame/drivers/yunsun16.cpp14
-rw-r--r--src/mame/drivers/z1013.cpp2
-rw-r--r--src/mame/drivers/z88.cpp3
-rw-r--r--src/mame/drivers/zac2650.cpp20
-rw-r--r--src/mame/drivers/zaccaria.cpp11
-rw-r--r--src/mame/drivers/zaxxon.cpp9
-rw-r--r--src/mame/drivers/zerozone.cpp2
-rw-r--r--src/mame/drivers/zorba.cpp2
-rw-r--r--src/mame/drivers/zr107.cpp2
-rw-r--r--src/mame/drivers/zrt80.cpp6
-rw-r--r--src/mame/drivers/zwackery.cpp10
-rw-r--r--src/mame/drivers/zx.cpp12
-rw-r--r--src/mame/etc/template_driver.cpp14
-rw-r--r--src/mame/includes/1942.h6
-rw-r--r--src/mame/includes/1943.h2
-rw-r--r--src/mame/includes/20pacgal.h2
-rw-r--r--src/mame/includes/8080bw.h4
-rw-r--r--src/mame/includes/abc80x.h4
-rw-r--r--src/mame/includes/advision.h2
-rw-r--r--src/mame/includes/alesis.h2
-rw-r--r--src/mame/includes/alpha68k.h4
-rw-r--r--src/mame/includes/amiga.h2
-rw-r--r--src/mame/includes/ampoker2.h3
-rw-r--r--src/mame/includes/amstrad.h58
-rw-r--r--src/mame/includes/apexc.h3
-rw-r--r--src/mame/includes/apple3.h2
-rw-r--r--src/mame/includes/appoooh.h4
-rw-r--r--src/mame/includes/aquarius.h2
-rw-r--r--src/mame/includes/arabian.h2
-rw-r--r--src/mame/includes/arcadia.h2
-rw-r--r--src/mame/includes/armedf.h4
-rw-r--r--src/mame/includes/astrocde.h4
-rw-r--r--src/mame/includes/atari400.h2
-rw-r--r--src/mame/includes/atarifb.h2
-rw-r--r--src/mame/includes/atarisy2.h2
-rw-r--r--src/mame/includes/avigo.h76
-rw-r--r--src/mame/includes/b2m.h2
-rw-r--r--src/mame/includes/bagman.h2
-rw-r--r--src/mame/includes/bankp.h2
-rw-r--r--src/mame/includes/baraduke.h2
-rw-r--r--src/mame/includes/bbc.h2
-rw-r--r--src/mame/includes/bionicc.h2
-rw-r--r--src/mame/includes/bking.h2
-rw-r--r--src/mame/includes/bladestl.h2
-rw-r--r--src/mame/includes/blueprnt.h2
-rw-r--r--src/mame/includes/bogeyman.h2
-rw-r--r--src/mame/includes/bosco.h2
-rw-r--r--src/mame/includes/brkthru.h2
-rw-r--r--src/mame/includes/bsktball.h2
-rw-r--r--src/mame/includes/btime.h4
-rw-r--r--src/mame/includes/buggychl.h2
-rw-r--r--src/mame/includes/busicom.h2
-rw-r--r--src/mame/includes/bw2.h2
-rw-r--r--src/mame/includes/calomega.h2
-rw-r--r--src/mame/includes/canyon.h2
-rw-r--r--src/mame/includes/carpolo.h4
-rw-r--r--src/mame/includes/cave.h14
-rw-r--r--src/mame/includes/cclimber.h8
-rw-r--r--src/mame/includes/centiped.h2
-rw-r--r--src/mame/includes/cgc7900.h2
-rw-r--r--src/mame/includes/chaknpop.h2
-rw-r--r--src/mame/includes/champbas.h4
-rw-r--r--src/mame/includes/channelf.h2
-rw-r--r--src/mame/includes/cheekyms.h2
-rw-r--r--src/mame/includes/circusc.h2
-rw-r--r--src/mame/includes/clshroad.h4
-rw-r--r--src/mame/includes/combatsc.h4
-rw-r--r--src/mame/includes/compgolf.h2
-rw-r--r--src/mame/includes/contra.h2
-rw-r--r--src/mame/includes/cop01.h2
-rw-r--r--src/mame/includes/cosmic.h10
-rw-r--r--src/mame/includes/crbaloon.h2
-rw-r--r--src/mame/includes/crgolf.h4
-rw-r--r--src/mame/includes/cvs.h2
-rw-r--r--src/mame/includes/dai.h15
-rw-r--r--src/mame/includes/darkmist.h2
-rw-r--r--src/mame/includes/dcheese.h2
-rw-r--r--src/mame/includes/dday.h2
-rw-r--r--src/mame/includes/ddribble.h2
-rw-r--r--src/mame/includes/dec0.h1
-rw-r--r--src/mame/includes/decocass.h2
-rw-r--r--src/mame/includes/dgn_beta.h2
-rw-r--r--src/mame/includes/digdug.h2
-rw-r--r--src/mame/includes/divebomb.h4
-rw-r--r--src/mame/includes/dkong.h8
-rw-r--r--src/mame/includes/docastle.h2
-rw-r--r--src/mame/includes/dogfgt.h2
-rw-r--r--src/mame/includes/dragrace.h2
-rw-r--r--src/mame/includes/drgnmst.h4
-rw-r--r--src/mame/includes/dribling.h2
-rw-r--r--src/mame/includes/drmicro.h2
-rw-r--r--src/mame/includes/dynax.h4
-rw-r--r--src/mame/includes/efdt.h2
-rw-r--r--src/mame/includes/electron.h5
-rw-r--r--src/mame/includes/epos.h4
-rw-r--r--src/mame/includes/equites.h4
-rw-r--r--src/mame/includes/espial.h2
-rw-r--r--src/mame/includes/exedexes.h2
-rw-r--r--src/mame/includes/exerion.h2
-rw-r--r--src/mame/includes/exterm.h2
-rw-r--r--src/mame/includes/fastfred.h2
-rw-r--r--src/mame/includes/fastlane.h2
-rw-r--r--src/mame/includes/fcombat.h2
-rw-r--r--src/mame/includes/fgoal.h2
-rw-r--r--src/mame/includes/finalizr.h2
-rw-r--r--src/mame/includes/firetrap.h2
-rw-r--r--src/mame/includes/firetrk.h4
-rw-r--r--src/mame/includes/flkatck.h4
-rw-r--r--src/mame/includes/fromance.h4
-rw-r--r--src/mame/includes/funkybee.h2
-rw-r--r--src/mame/includes/funworld.h83
-rw-r--r--src/mame/includes/funybubl.h17
-rw-r--r--src/mame/includes/galaga.h2
-rw-r--r--src/mame/includes/galaxia.h4
-rw-r--r--src/mame/includes/galaxian.h4
-rw-r--r--src/mame/includes/galaxold.h20
-rw-r--r--src/mame/includes/galivan.h2
-rw-r--r--src/mame/includes/galpani2.h2
-rw-r--r--src/mame/includes/galpanic.h2
-rw-r--r--src/mame/includes/galspnbl.h2
-rw-r--r--src/mame/includes/gamecom.h5
-rw-r--r--src/mame/includes/gaplus.h2
-rw-r--r--src/mame/includes/gb.h10
-rw-r--r--src/mame/includes/gberet.h2
-rw-r--r--src/mame/includes/goldstar.h9
-rw-r--r--src/mame/includes/gomoku.h2
-rw-r--r--src/mame/includes/gotya.h2
-rw-r--r--src/mame/includes/grchamp.h2
-rw-r--r--src/mame/includes/gridlee.h2
-rw-r--r--src/mame/includes/gsword.h4
-rw-r--r--src/mame/includes/gunsmoke.h2
-rw-r--r--src/mame/includes/gyruss.h2
-rw-r--r--src/mame/includes/hanaawas.h2
-rw-r--r--src/mame/includes/hcastle.h2
-rw-r--r--src/mame/includes/higemaru.h2
-rw-r--r--src/mame/includes/homedata.h8
-rw-r--r--src/mame/includes/hp48.h2
-rw-r--r--src/mame/includes/hx20.h71
-rw-r--r--src/mame/includes/hyperspt.h2
-rw-r--r--src/mame/includes/ikki.h2
-rw-r--r--src/mame/includes/intv.h2
-rw-r--r--src/mame/includes/irobot.h2
-rw-r--r--src/mame/includes/ironhors.h2
-rw-r--r--src/mame/includes/jack.h2
-rw-r--r--src/mame/includes/jackal.h2
-rw-r--r--src/mame/includes/jailbrek.h2
-rw-r--r--src/mame/includes/kaneko16.h1
-rw-r--r--src/mame/includes/kaypro.h2
-rw-r--r--src/mame/includes/kc.h7
-rw-r--r--src/mame/includes/kchamp.h2
-rw-r--r--src/mame/includes/kickgoal.h4
-rw-r--r--src/mame/includes/kingobox.h6
-rw-r--r--src/mame/includes/kncljoe.h2
-rw-r--r--src/mame/includes/kopunch.h2
-rw-r--r--src/mame/includes/ksayakyu.h2
-rw-r--r--src/mame/includes/kyocera.h4
-rw-r--r--src/mame/includes/labyrunr.h2
-rw-r--r--src/mame/includes/ladybug.h4
-rw-r--r--src/mame/includes/laserbat.h4
-rw-r--r--src/mame/includes/lasso.h4
-rw-r--r--src/mame/includes/lastduel.h2
-rw-r--r--src/mame/includes/lazercmd.h2
-rw-r--r--src/mame/includes/liberate.h2
-rw-r--r--src/mame/includes/lockon.h2
-rw-r--r--src/mame/includes/lucky74.h2
-rw-r--r--src/mame/includes/lvcards.h2
-rw-r--r--src/mame/includes/lviv.h4
-rw-r--r--src/mame/includes/m10.h2
-rw-r--r--src/mame/includes/m52.h25
-rw-r--r--src/mame/includes/m57.h2
-rw-r--r--src/mame/includes/m58.h2
-rw-r--r--src/mame/includes/m62.h10
-rw-r--r--src/mame/includes/mac.h3
-rw-r--r--src/mame/includes/madalien.h2
-rw-r--r--src/mame/includes/magmax.h2
-rw-r--r--src/mame/includes/mainsnk.h2
-rw-r--r--src/mame/includes/malzak.h2
-rw-r--r--src/mame/includes/mappy.h6
-rw-r--r--src/mame/includes/marineb.h2
-rw-r--r--src/mame/includes/mario.h2
-rw-r--r--src/mame/includes/markham.h2
-rw-r--r--src/mame/includes/matmania.h2
-rw-r--r--src/mame/includes/mbc55x.h2
-rw-r--r--src/mame/includes/mbee.h4
-rw-r--r--src/mame/includes/mcr3.h2
-rw-r--r--src/mame/includes/megasys1.h2
-rw-r--r--src/mame/includes/megazone.h2
-rw-r--r--src/mame/includes/mermaid.h5
-rw-r--r--src/mame/includes/micronic.h2
-rw-r--r--src/mame/includes/mikie.h2
-rw-r--r--src/mame/includes/mikromik.h2
-rw-r--r--src/mame/includes/mouser.h2
-rw-r--r--src/mame/includes/mrdo.h2
-rw-r--r--src/mame/includes/mrjong.h2
-rw-r--r--src/mame/includes/munchmo.h2
-rw-r--r--src/mame/includes/mz2500.h2
-rw-r--r--src/mame/includes/n8080.h4
-rw-r--r--src/mame/includes/namcos86.h2
-rw-r--r--src/mame/includes/naughtyb.h2
-rw-r--r--src/mame/includes/nbmj8688.h8
-rw-r--r--src/mame/includes/nc.h2
-rw-r--r--src/mame/includes/norautp.h2
-rw-r--r--src/mame/includes/nova2001.h4
-rw-r--r--src/mame/includes/novagbase.h2
-rw-r--r--src/mame/includes/ojankohs.h2
-rw-r--r--src/mame/includes/orion.h2
-rw-r--r--src/mame/includes/osi.h2
-rw-r--r--src/mame/includes/p2000t.h2
-rw-r--r--src/mame/includes/pacland.h2
-rw-r--r--src/mame/includes/pacman.h2
-rw-r--r--src/mame/includes/pandoras.h2
-rw-r--r--src/mame/includes/pastelg.h2
-rw-r--r--src/mame/includes/pbaction.h7
-rw-r--r--src/mame/includes/pc4.h41
-rw-r--r--src/mame/includes/pc6001.h4
-rw-r--r--src/mame/includes/pc8401a.h2
-rw-r--r--src/mame/includes/pc8801.h2
-rw-r--r--src/mame/includes/pc9801.h2
-rw-r--r--src/mame/includes/pcktgal.h2
-rw-r--r--src/mame/includes/pcw.h2
-rw-r--r--src/mame/includes/pcw16.h8
-rw-r--r--src/mame/includes/pdp1.h2
-rw-r--r--src/mame/includes/phoenix.h6
-rw-r--r--src/mame/includes/pingpong.h2
-rw-r--r--src/mame/includes/pitnrun.h2
-rw-r--r--src/mame/includes/pk8000.h2
-rw-r--r--src/mame/includes/pk8020.h33
-rw-r--r--src/mame/includes/playch10.h2
-rw-r--r--src/mame/includes/pocketc.h6
-rw-r--r--src/mame/includes/polepos.h2
-rw-r--r--src/mame/includes/polyplay.h2
-rw-r--r--src/mame/includes/poolshrk.h2
-rw-r--r--src/mame/includes/pooyan.h2
-rw-r--r--src/mame/includes/popeye.h4
-rw-r--r--src/mame/includes/portrait.h2
-rw-r--r--src/mame/includes/powerins.h5
-rw-r--r--src/mame/includes/pp01.h18
-rw-r--r--src/mame/includes/psion.h2
-rw-r--r--src/mame/includes/px8.h2
-rw-r--r--src/mame/includes/quasar.h5
-rw-r--r--src/mame/includes/radio86.h2
-rw-r--r--src/mame/includes/rallyx.h4
-rw-r--r--src/mame/includes/redclash.h2
-rw-r--r--src/mame/includes/retofinv.h4
-rw-r--r--src/mame/includes/rockrage.h2
-rw-r--r--src/mame/includes/rocnrope.h2
-rw-r--r--src/mame/includes/rollrace.h2
-rw-r--r--src/mame/includes/samcoupe.h2
-rw-r--r--src/mame/includes/sbasketb.h2
-rw-r--r--src/mame/includes/sbugger.h2
-rw-r--r--src/mame/includes/scotrsht.h2
-rw-r--r--src/mame/includes/seicross.h2
-rw-r--r--src/mame/includes/senjyo.h4
-rw-r--r--src/mame/includes/seta.h14
-rw-r--r--src/mame/includes/shangkid.h2
-rw-r--r--src/mame/includes/shaolins.h2
-rw-r--r--src/mame/includes/shootout.h2
-rw-r--r--src/mame/includes/sidepckt.h2
-rw-r--r--src/mame/includes/simpsons.h2
-rw-r--r--src/mame/includes/skydiver.h2
-rw-r--r--src/mame/includes/skyfox.h2
-rw-r--r--src/mame/includes/skykid.h2
-rw-r--r--src/mame/includes/skyraid.h2
-rw-r--r--src/mame/includes/snk.h2
-rw-r--r--src/mame/includes/snk6502.h4
-rw-r--r--src/mame/includes/snookr10.h6
-rw-r--r--src/mame/includes/sonson.h2
-rw-r--r--src/mame/includes/spcforce.h2
-rw-r--r--src/mame/includes/spdodgeb.h2
-rw-r--r--src/mame/includes/special.h18
-rw-r--r--src/mame/includes/spectrum.h2
-rw-r--r--src/mame/includes/speedatk.h2
-rw-r--r--src/mame/includes/sprint2.h2
-rw-r--r--src/mame/includes/sprint4.h2
-rw-r--r--src/mame/includes/sprint8.h2
-rw-r--r--src/mame/includes/srmp2.h4
-rw-r--r--src/mame/includes/ssozumo.h2
-rw-r--r--src/mame/includes/sspeedr.h2
-rw-r--r--src/mame/includes/ssrj.h2
-rw-r--r--src/mame/includes/stactics.h2
-rw-r--r--src/mame/includes/starshp1.h2
-rw-r--r--src/mame/includes/stfight.h21
-rw-r--r--src/mame/includes/sub.h2
-rw-r--r--src/mame/includes/subs.h2
-rw-r--r--src/mame/includes/super80.h2
-rw-r--r--src/mame/includes/superqix.h2
-rw-r--r--src/mame/includes/suprloco.h2
-rw-r--r--src/mame/includes/suprridr.h2
-rw-r--r--src/mame/includes/svision.h43
-rw-r--r--src/mame/includes/tagteam.h2
-rw-r--r--src/mame/includes/tank8.h2
-rw-r--r--src/mame/includes/tankbatt.h2
-rw-r--r--src/mame/includes/tankbust.h2
-rw-r--r--src/mame/includes/taxidriv.h2
-rw-r--r--src/mame/includes/tceptor.h2
-rw-r--r--src/mame/includes/terracre.h2
-rw-r--r--src/mame/includes/thedeep.h2
-rw-r--r--src/mame/includes/thepit.h4
-rw-r--r--src/mame/includes/thomson.h4
-rw-r--r--src/mame/includes/thunderx.h2
-rw-r--r--src/mame/includes/ti85.h4
-rw-r--r--src/mame/includes/ti89.h57
-rw-r--r--src/mame/includes/tiamc1.h2
-rw-r--r--src/mame/includes/timelimt.h2
-rw-r--r--src/mame/includes/timeplt.h2
-rw-r--r--src/mame/includes/tnzs.h2
-rw-r--r--src/mame/includes/tp84.h2
-rw-r--r--src/mame/includes/trackfld.h2
-rw-r--r--src/mame/includes/travrusa.h4
-rw-r--r--src/mame/includes/triplhnt.h2
-rw-r--r--src/mame/includes/trs80.h8
-rw-r--r--src/mame/includes/trs80m3.h8
-rw-r--r--src/mame/includes/truco.h2
-rw-r--r--src/mame/includes/trucocl.h2
-rw-r--r--src/mame/includes/tryout.h2
-rw-r--r--src/mame/includes/tubep.h4
-rw-r--r--src/mame/includes/tunhunt.h2
-rw-r--r--src/mame/includes/turbo.h6
-rw-r--r--src/mame/includes/tx0.h2
-rw-r--r--src/mame/includes/tx1.h4
-rw-r--r--src/mame/includes/ultratnk.h2
-rw-r--r--src/mame/includes/unico.h2
-rw-r--r--src/mame/includes/usgames.h2
-rw-r--r--src/mame/includes/vc4000.h2
-rw-r--r--src/mame/includes/vector06.h1
-rw-r--r--src/mame/includes/vendetta.h2
-rw-r--r--src/mame/includes/vtech2.h10
-rw-r--r--src/mame/includes/vulgus.h2
-rw-r--r--src/mame/includes/warpwarp.h6
-rw-r--r--src/mame/includes/williams.h2
-rw-r--r--src/mame/includes/wiping.h2
-rw-r--r--src/mame/includes/wiz.h2
-rw-r--r--src/mame/includes/wolfpack.h2
-rw-r--r--src/mame/includes/wswan.h4
-rw-r--r--src/mame/includes/x07.h2
-rw-r--r--src/mame/includes/x1.h1
-rw-r--r--src/mame/includes/x68k.h2
-rw-r--r--src/mame/includes/xevious.h2
-rw-r--r--src/mame/includes/xorworld.h2
-rw-r--r--src/mame/includes/xxmissio.h2
-rw-r--r--src/mame/includes/xyonix.h2
-rw-r--r--src/mame/includes/yiear.h2
-rw-r--r--src/mame/includes/z88.h2
-rw-r--r--src/mame/includes/zac2650.h2
-rw-r--r--src/mame/includes/zaccaria.h2
-rw-r--r--src/mame/includes/zaxxon.h2
-rw-r--r--src/mame/includes/zx.h1
-rw-r--r--src/mame/machine/amstrad.cpp229
-rw-r--r--src/mame/machine/imds2ioc.cpp4
-rw-r--r--src/mame/machine/mmboard.cpp5
-rw-r--r--src/mame/machine/mmboard.h4
-rw-r--r--src/mame/machine/model1io2.cpp10
-rw-r--r--src/mame/machine/model1io2.h4
-rw-r--r--src/mame/machine/radio86.cpp6
-rw-r--r--src/mame/machine/st0016.cpp2
-rw-r--r--src/mame/video/1942.cpp68
-rw-r--r--src/mame/video/1943.cpp53
-rw-r--r--src/mame/video/20pacgal.cpp44
-rw-r--r--src/mame/video/733_asr.cpp9
-rw-r--r--src/mame/video/733_asr.h2
-rw-r--r--src/mame/video/8080bw.cpp11
-rw-r--r--src/mame/video/911_vdt.cpp37
-rw-r--r--src/mame/video/911_vdt.h2
-rw-r--r--src/mame/video/abc1600.cpp2
-rw-r--r--src/mame/video/abc80.cpp2
-rw-r--r--src/mame/video/abc800.cpp7
-rw-r--r--src/mame/video/abc802.cpp2
-rw-r--r--src/mame/video/abc806.cpp5
-rw-r--r--src/mame/video/advision.cpp13
-rw-r--r--src/mame/video/agat7.cpp22
-rw-r--r--src/mame/video/agat7.h8
-rw-r--r--src/mame/video/alpha68k.cpp30
-rw-r--r--src/mame/video/amiga.cpp6
-rw-r--r--src/mame/video/ampoker2.cpp57
-rw-r--r--src/mame/video/apexc.cpp6
-rw-r--r--src/mame/video/apollo.cpp2
-rw-r--r--src/mame/video/apple2.cpp15
-rw-r--r--src/mame/video/apple2.h8
-rw-r--r--src/mame/video/apple3.cpp14
-rw-r--r--src/mame/video/appoooh.cpp88
-rw-r--r--src/mame/video/aquarius.cpp14
-rw-r--r--src/mame/video/arabian.cpp66
-rw-r--r--src/mame/video/astrocde.cpp112
-rw-r--r--src/mame/video/atari400.cpp176
-rw-r--r--src/mame/video/atarisy2.cpp16
-rw-r--r--src/mame/video/avigo.cpp7
-rw-r--r--src/mame/video/b2m.cpp18
-rw-r--r--src/mame/video/bagman.cpp53
-rw-r--r--src/mame/video/bankp.cpp51
-rw-r--r--src/mame/video/baraduke.cpp52
-rw-r--r--src/mame/video/bbc.cpp4
-rw-r--r--src/mame/video/bionicc.cpp2
-rw-r--r--src/mame/video/bking.cpp41
-rw-r--r--src/mame/video/bladestl.cpp15
-rw-r--r--src/mame/video/blueprnt.cpp13
-rw-r--r--src/mame/video/bogeyman.cpp42
-rw-r--r--src/mame/video/bosco.cpp74
-rw-r--r--src/mame/video/brkthru.cpp15
-rw-r--r--src/mame/video/btime.cpp42
-rw-r--r--src/mame/video/buggychl.cpp6
-rw-r--r--src/mame/video/busicom.cpp15
-rw-r--r--src/mame/video/calomega.cpp34
-rw-r--r--src/mame/video/carpolo.cpp19
-rw-r--r--src/mame/video/cave.cpp114
-rw-r--r--src/mame/video/cclimber.cpp236
-rw-r--r--src/mame/video/centiped.cpp16
-rw-r--r--src/mame/video/cgc7900.cpp7
-rw-r--r--src/mame/video/chaknpop.cpp35
-rw-r--r--src/mame/video/champbas.cpp28
-rw-r--r--src/mame/video/channelf.cpp22
-rw-r--r--src/mame/video/cheekyms.cpp38
-rw-r--r--src/mame/video/circusc.cpp73
-rw-r--r--src/mame/video/clshroad.cpp38
-rw-r--r--src/mame/video/combatsc.cpp48
-rw-r--r--src/mame/video/compgolf.cpp17
-rw-r--r--src/mame/video/contra.cpp16
-rw-r--r--src/mame/video/cop01.cpp40
-rw-r--r--src/mame/video/cosmic.cpp130
-rw-r--r--src/mame/video/crbaloon.cpp24
-rw-r--r--src/mame/video/crgolf.cpp41
-rw-r--r--src/mame/video/cvs.cpp25
-rw-r--r--src/mame/video/dai.cpp48
-rw-r--r--src/mame/video/darkmist.cpp44
-rw-r--r--src/mame/video/dcheese.cpp4
-rw-r--r--src/mame/video/dday.cpp20
-rw-r--r--src/mame/video/ddribble.cpp15
-rw-r--r--src/mame/video/digdug.cpp53
-rw-r--r--src/mame/video/divebomb.cpp41
-rw-r--r--src/mame/video/dkong.cpp227
-rw-r--r--src/mame/video/docastle.cpp46
-rw-r--r--src/mame/video/dogfgt.cpp43
-rw-r--r--src/mame/video/drgnmst.cpp3
-rw-r--r--src/mame/video/dribling.cpp9
-rw-r--r--src/mame/video/drmicro.cpp42
-rw-r--r--src/mame/video/dynax.cpp70
-rw-r--r--src/mame/video/epos.cpp47
-rw-r--r--src/mame/video/equites.cpp20
-rw-r--r--src/mame/video/espial.cpp41
-rw-r--r--src/mame/video/exedexes.cpp39
-rw-r--r--src/mame/video/exerion.cpp59
-rw-r--r--src/mame/video/exterm.cpp4
-rw-r--r--src/mame/video/fastfred.cpp62
-rw-r--r--src/mame/video/fastlane.cpp14
-rw-r--r--src/mame/video/fcombat.cpp51
-rw-r--r--src/mame/video/finalizr.cpp66
-rw-r--r--src/mame/video/firetrap.cpp19
-rw-r--r--src/mame/video/firetrk.cpp17
-rw-r--r--src/mame/video/funkybee.cpp41
-rw-r--r--src/mame/video/funworld.cpp70
-rw-r--r--src/mame/video/funybubl.cpp2
-rw-r--r--src/mame/video/fuukifg.h9
-rw-r--r--src/mame/video/fuukifg2.cpp12
-rw-r--r--src/mame/video/galaga.cpp73
-rw-r--r--src/mame/video/galaxia.cpp8
-rw-r--r--src/mame/video/galaxian.cpp119
-rw-r--r--src/mame/video/galaxold.cpp343
-rw-r--r--src/mame/video/galivan.cpp55
-rw-r--r--src/mame/video/galpani2.cpp23
-rw-r--r--src/mame/video/galpanic.cpp10
-rw-r--r--src/mame/video/galspnbl.cpp18
-rw-r--r--src/mame/video/gamate.cpp5
-rw-r--r--src/mame/video/gamate.h4
-rw-r--r--src/mame/video/gaplus.cpp31
-rw-r--r--src/mame/video/gberet.cpp54
-rw-r--r--src/mame/video/gic.h4
-rw-r--r--src/mame/video/gomoku.cpp36
-rw-r--r--src/mame/video/gotya.cpp52
-rw-r--r--src/mame/video/grchamp.cpp57
-rw-r--r--src/mame/video/gridlee.cpp16
-rw-r--r--src/mame/video/gsword.cpp62
-rw-r--r--src/mame/video/gunsmoke.cpp33
-rw-r--r--src/mame/video/gyruss.cpp60
-rw-r--r--src/mame/video/hanaawas.cpp43
-rw-r--r--src/mame/video/hcastle.cpp17
-rw-r--r--src/mame/video/higemaru.cpp53
-rw-r--r--src/mame/video/homedata.cpp68
-rw-r--r--src/mame/video/hp48.cpp21
-rw-r--r--src/mame/video/hyperspt.cpp58
-rw-r--r--src/mame/video/ikki.cpp120
-rw-r--r--src/mame/video/irobot.cpp19
-rw-r--r--src/mame/video/ironhors.cpp69
-rw-r--r--src/mame/video/jack.cpp17
-rw-r--r--src/mame/video/jackal.cpp17
-rw-r--r--src/mame/video/jailbrek.cpp23
-rw-r--r--src/mame/video/k1ge.cpp38
-rw-r--r--src/mame/video/k1ge.h4
-rw-r--r--src/mame/video/kaneko16.cpp11
-rw-r--r--src/mame/video/kaypro.cpp6
-rw-r--r--src/mame/video/kc.cpp57
-rw-r--r--src/mame/video/kchamp.cpp14
-rw-r--r--src/mame/video/kingobox.cpp8
-rw-r--r--src/mame/video/kncljoe.cpp68
-rw-r--r--src/mame/video/kopunch.cpp34
-rw-r--r--src/mame/video/ksayakyu.cpp13
-rw-r--r--src/mame/video/kyocera.cpp10
-rw-r--r--src/mame/video/labyrunr.cpp24
-rw-r--r--src/mame/video/ladybug.cpp90
-rw-r--r--src/mame/video/laserbat.cpp8
-rw-r--r--src/mame/video/lasso.cpp69
-rw-r--r--src/mame/video/lastduel.cpp2
-rw-r--r--src/mame/video/leland.cpp8
-rw-r--r--src/mame/video/liberate.cpp24
-rw-r--r--src/mame/video/lockon.cpp11
-rw-r--r--src/mame/video/lucky74.cpp112
-rw-r--r--src/mame/video/lvcards.cpp29
-rw-r--r--src/mame/video/lviv.cpp25
-rw-r--r--src/mame/video/m52.cpp6
-rw-r--r--src/mame/video/m57.cpp88
-rw-r--r--src/mame/video/m58.cpp85
-rw-r--r--src/mame/video/m62.cpp12
-rw-r--r--src/mame/video/mac.cpp8
-rw-r--r--src/mame/video/madalien.cpp21
-rw-r--r--src/mame/video/magmax.cpp28
-rw-r--r--src/mame/video/mainsnk.cpp54
-rw-r--r--src/mame/video/mappy.cpp182
-rw-r--r--src/mame/video/marineb.cpp41
-rw-r--r--src/mame/video/mario.cpp14
-rw-r--r--src/mame/video/markham.cpp21
-rw-r--r--src/mame/video/matmania.cpp16
-rw-r--r--src/mame/video/mbee.cpp54
-rw-r--r--src/mame/video/mcr3.cpp16
-rw-r--r--src/mame/video/megasys1.cpp2
-rw-r--r--src/mame/video/megazone.cpp42
-rw-r--r--src/mame/video/mermaid.cpp49
-rw-r--r--src/mame/video/mikie.cpp70
-rw-r--r--src/mame/video/mikromik.cpp13
-rw-r--r--src/mame/video/mouser.cpp151
-rw-r--r--src/mame/video/mrdo.cpp77
-rw-r--r--src/mame/video/mrjong.cpp30
-rw-r--r--src/mame/video/munchmo.cpp23
-rw-r--r--src/mame/video/n8080.cpp26
-rw-r--r--src/mame/video/namcos86.cpp59
-rw-r--r--src/mame/video/naughtyb.cpp37
-rw-r--r--src/mame/video/nbmj8688.cpp71
-rw-r--r--src/mame/video/nc.cpp4
-rw-r--r--src/mame/video/newbrain.cpp2
-rw-r--r--src/mame/video/nova2001.cpp61
-rw-r--r--src/mame/video/ojankohs.cpp53
-rw-r--r--src/mame/video/orca40c.cpp4
-rw-r--r--src/mame/video/orion.cpp42
-rw-r--r--src/mame/video/osi.cpp51
-rw-r--r--src/mame/video/pacland.cpp10
-rw-r--r--src/mame/video/pacman.cpp56
-rw-r--r--src/mame/video/pandoras.cpp58
-rw-r--r--src/mame/video/pastelg.cpp42
-rw-r--r--src/mame/video/pc6001.cpp78
-rw-r--r--src/mame/video/pc8401a.cpp8
-rw-r--r--src/mame/video/pc_t1t.cpp43
-rw-r--r--src/mame/video/pc_t1t.h19
-rw-r--r--src/mame/video/pcd.cpp7
-rw-r--r--src/mame/video/pcd.h4
-rw-r--r--src/mame/video/pcktgal.cpp40
-rw-r--r--src/mame/video/pcw.cpp10
-rw-r--r--src/mame/video/pcw16.cpp76
-rw-r--r--src/mame/video/phoenix.cpp53
-rw-r--r--src/mame/video/pingpong.cpp50
-rw-r--r--src/mame/video/pitnrun.cpp103
-rw-r--r--src/mame/video/pk8000.cpp40
-rw-r--r--src/mame/video/pk8020.cpp8
-rw-r--r--src/mame/video/playch10.cpp44
-rw-r--r--src/mame/video/pocketc.cpp18
-rw-r--r--src/mame/video/polepos.cpp60
-rw-r--r--src/mame/video/polyplay.cpp35
-rw-r--r--src/mame/video/pooyan.cpp58
-rw-r--r--src/mame/video/popeye.cpp12
-rw-r--r--src/mame/video/portrait.cpp42
-rw-r--r--src/mame/video/pp01.cpp43
-rw-r--r--src/mame/video/prehisle.cpp1
-rw-r--r--src/mame/video/quasar.cpp127
-rw-r--r--src/mame/video/rallyx.cpp165
-rw-r--r--src/mame/video/redclash.cpp89
-rw-r--r--src/mame/video/retofinv.cpp66
-rw-r--r--src/mame/video/rockrage.cpp8
-rw-r--r--src/mame/video/rocnrope.cpp52
-rw-r--r--src/mame/video/rollrace.cpp47
-rw-r--r--src/mame/video/sbasketb.cpp74
-rw-r--r--src/mame/video/sbugger.cpp21
-rw-r--r--src/mame/video/scotrsht.cpp29
-rw-r--r--src/mame/video/seicross.cpp44
-rw-r--r--src/mame/video/senjyo.cpp16
-rw-r--r--src/mame/video/seta.cpp78
-rw-r--r--src/mame/video/shangkid.cpp30
-rw-r--r--src/mame/video/shaolins.cpp69
-rw-r--r--src/mame/video/shootout.cpp42
-rw-r--r--src/mame/video/sidepckt.cpp50
-rw-r--r--src/mame/video/skyfox.cpp12
-rw-r--r--src/mame/video/skykid.cpp25
-rw-r--r--src/mame/video/snk.cpp51
-rw-r--r--src/mame/video/snk6502.cpp98
-rw-r--r--src/mame/video/snookr10.cpp146
-rw-r--r--src/mame/video/sonson.cpp34
-rw-r--r--src/mame/video/spdodgeb.cpp47
-rw-r--r--src/mame/video/special.cpp114
-rw-r--r--src/mame/video/spectrum.cpp40
-rw-r--r--src/mame/video/speedatk.cpp44
-rw-r--r--src/mame/video/sprint2.cpp14
-rw-r--r--src/mame/video/sprint4.cpp14
-rw-r--r--src/mame/video/sprint8.cpp2
-rw-r--r--src/mame/video/srmp2.cpp28
-rw-r--r--src/mame/video/ssozumo.cpp44
-rw-r--r--src/mame/video/ssrj.cpp11
-rw-r--r--src/mame/video/stactics.cpp31
-rw-r--r--src/mame/video/starshp1.cpp24
-rw-r--r--src/mame/video/sub.cpp24
-rw-r--r--src/mame/video/super80.cpp66
-rw-r--r--src/mame/video/superqix.cpp10
-rw-r--r--src/mame/video/suprloco.cpp49
-rw-r--r--src/mame/video/suprridr.cpp47
-rw-r--r--src/mame/video/tagteam.cpp6
-rw-r--r--src/mame/video/taito_l.cpp4
-rw-r--r--src/mame/video/tank8.cpp6
-rw-r--r--src/mame/video/tankbatt.cpp41
-rw-r--r--src/mame/video/tceptor.cpp66
-rw-r--r--src/mame/video/terracre.cpp60
-rw-r--r--src/mame/video/thedeep.cpp9
-rw-r--r--src/mame/video/thepit.cpp56
-rw-r--r--src/mame/video/thomson.cpp34
-rw-r--r--src/mame/video/ti85.cpp29
-rw-r--r--src/mame/video/tia.cpp445
-rw-r--r--src/mame/video/tia.h4
-rw-r--r--src/mame/video/tiamc1.cpp50
-rw-r--r--src/mame/video/timelimt.cpp54
-rw-r--r--src/mame/video/timeplt.cpp57
-rw-r--r--src/mame/video/tnzs.cpp6
-rw-r--r--src/mame/video/tp84.cpp68
-rw-r--r--src/mame/video/trackfld.cpp58
-rw-r--r--src/mame/video/travrusa.cpp174
-rw-r--r--src/mame/video/trs80.cpp22
-rw-r--r--src/mame/video/truco.cpp34
-rw-r--r--src/mame/video/trucocl.cpp9
-rw-r--r--src/mame/video/tryout.cpp42
-rw-r--r--src/mame/video/tubep.cpp263
-rw-r--r--src/mame/video/tunhunt.cpp18
-rw-r--r--src/mame/video/turbo.cpp111
-rw-r--r--src/mame/video/tx1.cpp30
-rw-r--r--src/mame/video/ultratnk.cpp2
-rw-r--r--src/mame/video/unico.cpp10
-rw-r--r--src/mame/video/usgames.cpp30
-rw-r--r--src/mame/video/v1050.cpp2
-rw-r--r--src/mame/video/vector06.cpp6
-rw-r--r--src/mame/video/vtvideo.cpp7
-rw-r--r--src/mame/video/vulgus.cpp30
-rw-r--r--src/mame/video/warpwarp.cpp100
-rw-r--r--src/mame/video/williams.cpp25
-rw-r--r--src/mame/video/wiping.cpp58
-rw-r--r--src/mame/video/wiz.cpp58
-rw-r--r--src/mame/video/wolfpack.cpp19
-rw-r--r--src/mame/video/x68k.cpp12
-rw-r--r--src/mame/video/xevious.cpp84
-rw-r--r--src/mame/video/xorworld.cpp51
-rw-r--r--src/mame/video/xxmissio.cpp39
-rw-r--r--src/mame/video/xyonix.cpp40
-rw-r--r--src/mame/video/yiear.cpp37
-rw-r--r--src/mame/video/z88.cpp2
-rw-r--r--src/mame/video/zaccaria.cpp71
-rw-r--r--src/mame/video/zaxxon.cpp46
1908 files changed, 15856 insertions, 18867 deletions
diff --git a/src/mame/drivers/1942.cpp b/src/mame/drivers/1942.cpp
index c35f9baee7a..a063ee16ef9 100644
--- a/src/mame/drivers/1942.cpp
+++ b/src/mame/drivers/1942.cpp
@@ -578,9 +578,7 @@ MACHINE_CONFIG_START(_1942_state::_1942)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1942)
- MCFG_PALETTE_ADD(m_palette, 64*4+4*32*8+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(_1942_state, 1942)
+ PALETTE(config, m_palette, FUNC(_1942_state::_1942_palette), 64*4+4*32*8+16*16, 256);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
@@ -634,7 +632,7 @@ MACHINE_CONFIG_START(_1942p_state::_1942p)
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", Z80, MAIN_CPU_CLOCK_1942P) /* 4 MHz - verified on PCB */
MCFG_DEVICE_PROGRAM_MAP(_1942p_map)
- MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _1942p_state, irq0_line_hold) // note, powerups won't move down the screen with the original '1942' logic.
+ MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _1942p_state, irq0_line_hold) // note, powerups won't move down the screen with the original '1942' logic.
MCFG_DEVICE_ADD("audiocpu", Z80, SOUND_CPU_CLOCK_1942P) /* 4 MHz - verified on PCB */
MCFG_DEVICE_PROGRAM_MAP(_1942p_sound_map)
@@ -645,9 +643,7 @@ MACHINE_CONFIG_START(_1942p_state::_1942p)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1942p)
- MCFG_PALETTE_ADD(m_palette, 0x500)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x400)
- MCFG_PALETTE_INIT_OWNER(_1942p_state, 1942p)
+ PALETTE(config, m_palette, FUNC(_1942p_state::_1942p_palette), 0x500, 0x400);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
diff --git a/src/mame/drivers/1943.cpp b/src/mame/drivers/1943.cpp
index ac1fdc84a1c..f404a87765e 100644
--- a/src/mame/drivers/1943.cpp
+++ b/src/mame/drivers/1943.cpp
@@ -331,12 +331,10 @@ MACHINE_CONFIG_START(_1943_state::_1943)
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(_1943_state, screen_update_1943)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1943)
- MCFG_PALETTE_ADD("palette", 32*4+16*16+16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(_1943_state, 1943)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_1943)
+ PALETTE(config, m_palette, FUNC(_1943_state::_1943_palette), 32*4+16*16+16*16+16*16, 256);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/1945kiii.cpp b/src/mame/drivers/1945kiii.cpp
index 8c7fe4800d5..be0168b7b0e 100644
--- a/src/mame/drivers/1945kiii.cpp
+++ b/src/mame/drivers/1945kiii.cpp
@@ -380,7 +380,7 @@ void k3_state::flagrall(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &k3_state::flagrall_map);
m_maincpu->set_vblank_int("screen", FUNC(k3_state::irq4_line_hold));
- GFXDECODE(config, m_gfxdecode, "palette", gfx_1945kiii);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1945kiii);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@@ -388,9 +388,9 @@ void k3_state::flagrall(machine_config &config)
m_screen->set_size(64*8, 32*8);
m_screen->set_visarea(0*8, 40*8-1, 0*8, 30*8-1);
m_screen->set_screen_update(FUNC(k3_state::screen_update));
- m_screen->set_palette("palette");
+ m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 0x200).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/2mindril.cpp b/src/mame/drivers/2mindril.cpp
index 639b2c77c80..790b8bd470d 100644
--- a/src/mame/drivers/2mindril.cpp
+++ b/src/mame/drivers/2mindril.cpp
@@ -364,7 +364,7 @@ MACHINE_CONFIG_START(_2mindril_state::drill)
MCFG_DEVICE_PROGRAM_MAP(drill_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", _2mindril_state, drill_vblank_irq)
//MCFG_DEVICE_PERIODIC_INT_DRIVER(_2mindril_state, drill_device_irq, 60)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_2mindril)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_2mindril);
tc0510nio_device &tc0510nio(TC0510NIO(config, "tc0510nio", 0));
tc0510nio.read_0_callback().set_ioport("DSW");
@@ -384,8 +384,7 @@ MACHINE_CONFIG_START(_2mindril_state::drill)
MCFG_SCREEN_UPDATE_DRIVER(_2mindril_state, screen_update_f3)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, _2mindril_state, screen_vblank_f3))
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x2000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/3x3puzzl.cpp b/src/mame/drivers/3x3puzzl.cpp
index 27dafa67738..90cb23b4e5b 100644
--- a/src/mame/drivers/3x3puzzl.cpp
+++ b/src/mame/drivers/3x3puzzl.cpp
@@ -53,14 +53,14 @@ class _3x3puzzle_state : public driver_device
{
public:
_3x3puzzle_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_videoram1(*this, "videoram1"),
- m_videoram2(*this, "videoram2"),
- m_videoram3(*this, "videoram3"),
- m_maincpu(*this, "maincpu"),
- m_oki(*this, "oki"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen")
+ : driver_device(mconfig, type, tag)
+ , m_videoram1(*this, "videoram1")
+ , m_videoram2(*this, "videoram2")
+ , m_videoram3(*this, "videoram3")
+ , m_maincpu(*this, "maincpu")
+ , m_oki(*this, "oki")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_screen(*this, "screen")
{ }
void _3x3puzzle(machine_config &config);
@@ -403,10 +403,9 @@ MACHINE_CONFIG_START(_3x3puzzle_state::_3x3puzzle)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_3x3puzzle)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_3x3puzzle);
- MCFG_PALETTE_ADD("palette", 0x600/2)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 0x600 / 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/40love.cpp b/src/mame/drivers/40love.cpp
index e1fc7b48704..00840d27d24 100644
--- a/src/mame/drivers/40love.cpp
+++ b/src/mame/drivers/40love.cpp
@@ -702,9 +702,7 @@ void fortyl_state::common(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_40love);
- PALETTE(config, m_palette, 1024);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 1024);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/4enraya.cpp b/src/mame/drivers/4enraya.cpp
index 6e1fb0695c4..7a05333266f 100644
--- a/src/mame/drivers/4enraya.cpp
+++ b/src/mame/drivers/4enraya.cpp
@@ -485,11 +485,11 @@ MACHINE_CONFIG_START(_4enraya_state::_4enraya )
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(_4enraya_state, screen_update_4enraya)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_4enraya)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/4roses.cpp b/src/mame/drivers/4roses.cpp
index 30c55c598bf..9ec63144db4 100644
--- a/src/mame/drivers/4roses.cpp
+++ b/src/mame/drivers/4roses.cpp
@@ -296,8 +296,8 @@ void rugby_state::rugby_map(address_map &map)
map(0x0e00, 0x0e00).w("crtc", FUNC(mc6845_device::address_w));
map(0x0e01, 0x0e01).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
map(0x2000, 0xffff).rom().region("maincpu", 0x2000);
- map(0x6000, 0x6fff).ram().w(FUNC(_4roses_state::funworld_videoram_w)).share("videoram");
- map(0x7000, 0x7fff).ram().w(FUNC(_4roses_state::funworld_colorram_w)).share("colorram");
+ map(0x6000, 0x6fff).ram().w(FUNC(rugby_state::funworld_videoram_w)).share("videoram");
+ map(0x7000, 0x7fff).ram().w(FUNC(rugby_state::funworld_colorram_w)).share("colorram");
}
READ8_MEMBER(rugby_state::rugby_opcode_r)
@@ -474,9 +474,7 @@ MACHINE_CONFIG_START(_4roses_state::_4roses)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_4roses)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_INIT_OWNER(_4roses_state,funworld)
- MCFG_VIDEO_START_OVERRIDE(_4roses_state,funworld)
+ PALETTE(config, "palette", FUNC(_4roses_state::funworld_palette), 0x1000);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8)); /* 2MHz, guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/5clown.cpp b/src/mame/drivers/5clown.cpp
index 2a7103f4f64..82097ed930b 100644
--- a/src/mame/drivers/5clown.cpp
+++ b/src/mame/drivers/5clown.cpp
@@ -459,8 +459,8 @@
class _5clown_state : public driver_device
{
public:
- _5clown_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ _5clown_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_ay8910(*this, "ay8910"),
@@ -475,6 +475,10 @@ public:
void init_fclown();
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -507,9 +511,7 @@ private:
DECLARE_READ8_MEMBER(pia1_b_r);
DECLARE_WRITE8_MEMBER(fclown_ay8910_w);
TILE_GET_INFO_MEMBER(get_fclown_tile_info);
- virtual void machine_start() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(_5clown);
+ void _5clown_palette(palette_device &palette) const;
uint32_t screen_update_fclown(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void fcaudio_map(address_map &map);
@@ -578,42 +580,36 @@ uint32_t _5clown_state::screen_update_fclown(screen_device &screen, bitmap_ind16
return 0;
}
-PALETTE_INIT_MEMBER(_5clown_state, _5clown)
+void _5clown_state::_5clown_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
-/*
- 7654 3210
- ---- ---x RED component.
- ---- --x- GREEN component.
- ---- -x-- BLUE component.
- ---- x--- background killer.
- xxxx ---- unused.
-*/
- int i;
+ /*
+ 7654 3210
+ ---- ---x RED component.
+ ---- --x- GREEN component.
+ ---- -x-- BLUE component.
+ ---- x--- background killer.
+ xxxx ---- unused.
+ */
/* 0000KBGR */
- if (color_prom == nullptr) return;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- for (i = 0;i < m_palette->entries();i++)
+ for (int i = 0; i < m_palette->entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b, bk;
-
- /* background killer */
- bit3 = (color_prom[i] >> 3) & 0x01;
- bk = bit3;
+ // background killer
+ int const bk = BIT(color_prom[i], 3);
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- r = (bit0 * 0xff);
+ // red component
+ int const r = BIT(color_prom[i], 0) * 0xff;
- /* green component */
- bit1 = (color_prom[i] >> 1) & 0x01;
- g = (bit1 * 0xff);
+ // green component
+ int const g = BIT(color_prom[i], 1) * 0xff;
- /* blue component */
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = bk * (bit2 * 0xff);
+ // blue component
+ int const b = bk * BIT(color_prom[i], 2) * 0xff;
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
@@ -1053,11 +1049,10 @@ MACHINE_CONFIG_START(_5clown_state::fclown)
MCFG_SCREEN_SIZE((39+1)*8, (31+1)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(_5clown_state, screen_update_fclown)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fclown)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(_5clown_state, _5clown)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fclown);
+ PALETTE(config, m_palette, FUNC(_5clown_state::_5clown_palette), 256);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/16)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp
index 5cb882ade9a..54acc0d8645 100644
--- a/src/mame/drivers/8080bw.cpp
+++ b/src/mame/drivers/8080bw.cpp
@@ -425,8 +425,7 @@ void _8080bw_state::invadpt2(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -544,8 +543,7 @@ void _8080bw_state::spcewarla(machine_config &config)
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count("screen", 255);
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
}
@@ -672,8 +670,7 @@ void _8080bw_state::cosmo(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_cosmo));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -838,7 +835,7 @@ void _8080bw_state::spacecom(machine_config &config)
m_screen->set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_spacecom));
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
invaders_audio(config);
@@ -952,8 +949,7 @@ void _8080bw_state::invrvnge(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1127,8 +1123,7 @@ void _8080bw_state::lrescue(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1161,7 +1156,7 @@ void _8080bw_state::escmars(machine_config &config)
m_screen->set_raw(MW8080BW_PIXEL_CLOCK, MW8080BW_HTOTAL, MW8080BW_HBEND, MW8080BW_HPIXCOUNT, MW8080BW_VTOTAL, MW8080BW_VBEND, MW8080BW_VBSTART);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_mw8080bw));
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1407,8 +1402,7 @@ void _8080bw_state::rollingc(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_rollingc));
- PALETTE(config, m_palette, 16);
- m_palette->set_init(FUNC(_8080bw_state::palette_init_rollingc));
+ PALETTE(config, m_palette, FUNC(_8080bw_state::rollingc_palette), 16);
/* sound hardware */
invaders_samples_audio(config);
@@ -1556,8 +1550,7 @@ void _8080bw_state::schaser(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_schaser));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1686,8 +1679,7 @@ void _8080bw_state::schasercv(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_schasercv));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -1787,8 +1779,7 @@ void _8080bw_state::sflush(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_sflush));
- PALETTE(config, m_palette, 8);
- m_palette->set_init(FUNC(_8080bw_state::palette_init_sflush));
+ PALETTE(config, m_palette, FUNC(_8080bw_state::sflush_palette), 8);
}
@@ -1892,8 +1883,7 @@ void _8080bw_state::lupin3(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1933,8 +1923,7 @@ void _8080bw_state::lupin3a(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_lupin3));
- PALETTE(config.replace(), m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config.replace(), m_palette, palette_device::RBG_3BIT);
}
@@ -2065,8 +2054,7 @@ void _8080bw_state::polaris(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_polaris));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -2192,8 +2180,7 @@ void _8080bw_state::ballbomb(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_ballbomb));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -2441,8 +2428,7 @@ void _8080bw_state::indianbt(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -2468,8 +2454,7 @@ void _8080bw_state::indianbtbr(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_indianbt));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -2544,8 +2529,7 @@ void _8080bw_state::steelwkr(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_invadpt2));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
invaders_samples_audio(config);
@@ -2769,7 +2753,7 @@ void _8080bw_state::shuttlei(machine_config &config)
m_screen->set_visarea(0*8, 32*8-1, 0*8, 24*8-1);
m_screen->set_screen_update(FUNC(_8080bw_state::screen_update_shuttlei));
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
invaders_samples_audio(config);
diff --git a/src/mame/drivers/88games.cpp b/src/mame/drivers/88games.cpp
index 168b401d002..ca2d5d8d2c5 100644
--- a/src/mame/drivers/88games.cpp
+++ b/src/mame/drivers/88games.cpp
@@ -325,9 +325,7 @@ void _88games_state::_88games(machine_config &config)
screen.set_palette("palette");
screen.screen_vblank().set(FUNC(_88games_state::vblank_irq));
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/a5105.cpp b/src/mame/drivers/a5105.cpp
index 6f0a31c9c9c..f52c14979aa 100644
--- a/src/mame/drivers/a5105.cpp
+++ b/src/mame/drivers/a5105.cpp
@@ -61,6 +61,10 @@ public:
void a5105(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
DECLARE_READ8_MEMBER(a5105_memsel_r);
DECLARE_READ8_MEMBER(key_r);
@@ -71,7 +75,7 @@ private:
DECLARE_WRITE8_MEMBER( a5105_upd765_w );
DECLARE_WRITE8_MEMBER(pcg_addr_w);
DECLARE_WRITE8_MEMBER(pcg_val_w);
- DECLARE_PALETTE_INIT(a5105);
+ void a5105_palette(palette_device &palette) const;
DECLARE_FLOPPY_FORMATS( floppy_formats );
UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
UPD7220_DRAW_TEXT_LINE_MEMBER( hgdc_draw_text );
@@ -87,8 +91,6 @@ private:
uint16_t m_pcg_internal_addr;
uint8_t m_key_mux;
uint8_t m_memsel[4];
- virtual void machine_reset() override;
- virtual void video_start() override;
required_device<z80_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<upd7220_device> m_hgdc;
@@ -108,16 +110,13 @@ private:
/* TODO */
UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
{
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
-
- int xi,gfx;
- uint8_t pen;
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
- gfx = m_video_ram[(address & 0x1ffff) >> 1];
+ int const gfx = m_video_ram[(address & 0x1ffff) >> 1];
- for(xi=0;xi<16;xi++)
+ for (int xi = 0; xi < 16; xi++)
{
- pen = ((gfx >> xi) & 1) ? 7 : 0;
+ int const pen = ((gfx >> xi) & 1) ? 7 : 0;
bitmap.pix32(y, x + xi) = palette[pen];
}
@@ -125,38 +124,32 @@ UPD7220_DISPLAY_PIXELS_MEMBER( a5105_state::hgdc_display_pixels )
UPD7220_DRAW_TEXT_LINE_MEMBER( a5105_state::hgdc_draw_text )
{
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
- int x;
- int xi,yi;
- int tile,color;
- uint8_t tile_data;
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
- for( x = 0; x < pitch; x++ )
+ for (int x = 0; x < pitch; x++)
{
- tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff);
- color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f);
+ int const tile = (m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] & 0xff);
+ int const color = ((m_video_ram[(((addr+x)*2) & 0x1ffff) >> 1] >> 8) & 0x0f);
- for( yi = 0; yi < lr; yi++)
+ for (int yi = 0; yi < lr; yi++)
{
- tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
+ uint8_t tile_data = m_char_ram[(tile*8+yi) & 0x7ff];
- if(cursor_on && cursor_addr == addr+x && m_screen->frame_number() & 0x10)
- tile_data^=0xff;
+ if (cursor_on && cursor_addr == addr+x && m_screen->frame_number() & 0x10)
+ tile_data ^= 0xff;
- for( xi = 0; xi < 8; xi++)
+ for (int xi = 0; xi < 8; xi++)
{
- int res_x,res_y;
int pen = (tile_data >> xi) & 1 ? color : 0;
- res_x = x * 8 + xi;
- res_y = y + yi;
+ int const res_x = x * 8 + xi;
+ int const res_y = y + yi;
- if(yi >= 8) { pen = 0; }
+ if (yi >= 8)
+ pen = 0;
- if(!m_screen->visible_area().contains(res_x+0, res_y))
- continue;
-
- bitmap.pix32(res_y, res_x) = palette[pen];
+ if (m_screen->visible_area().contains(res_x+0, res_y))
+ bitmap.pix32(res_y, res_x) = palette[pen];
}
}
}
@@ -526,18 +519,16 @@ static GFXDECODE_START( gfx_a5105 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(a5105_state, a5105)
+void a5105_state::a5105_palette(palette_device &palette) const
{
- int i;
- int r,g,b;
-
- for ( i = 0; i < 16; i++ )
+ for (int i = 0; i < 16; i++)
{
- r = i & 4 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
- g = i & 2 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
- b = i & 1 ? ((i & 8) ? 0xaa : 0xff) : 0x00;
+ int const x = (i & 8) ? 0xaa : 0xff;
+ int const r = (i & 4) ? x : 0x00;
+ int const g = (i & 2) ? x : 0x00;
+ int const b = (i & 1) ? x : 0x00;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -583,9 +574,8 @@ MACHINE_CONFIG_START(a5105_state::a5105)
MCFG_SCREEN_UPDATE_DEVICE("upd7220", upd7220_device, screen_update)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 0, 25*8-1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_a5105)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(a5105_state, a5105)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_a5105);
+ PALETTE(config, m_palette, FUNC(a5105_state::a5105_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/a51xx.cpp b/src/mame/drivers/a51xx.cpp
index 853b4ee1887..7273d616ecf 100644
--- a/src/mame/drivers/a51xx.cpp
+++ b/src/mame/drivers/a51xx.cpp
@@ -144,8 +144,7 @@ MACHINE_CONFIG_START(a51xx_state::a5120)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_a51xx)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
-
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(a51xx_state::a5130)
diff --git a/src/mame/drivers/a7150.cpp b/src/mame/drivers/a7150.cpp
index c4145243659..1ab66db66bd 100644
--- a/src/mame/drivers/a7150.cpp
+++ b/src/mame/drivers/a7150.cpp
@@ -562,7 +562,7 @@ void a7150_state::a7150(machine_config &config)
screen.set_screen_update(FUNC(a7150_state::screen_update_k7072));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/a7800.cpp b/src/mame/drivers/a7800.cpp
index 46894076830..1ac1a0e2f7d 100644
--- a/src/mame/drivers/a7800.cpp
+++ b/src/mame/drivers/a7800.cpp
@@ -136,7 +136,7 @@ protected:
DECLARE_READ8_MEMBER(bios_or_cart_r);
DECLARE_READ8_MEMBER(tia_r);
DECLARE_WRITE8_MEMBER(tia_w);
- DECLARE_PALETTE_INIT(a7800);
+ void a7800_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
TIMER_CALLBACK_MEMBER(maria_startdma);
DECLARE_READ8_MEMBER(riot_joystick_r);
@@ -183,7 +183,7 @@ public:
void a7800_pal(machine_config &config);
protected:
- DECLARE_PALETTE_INIT(a7800p);
+ void a7800p_palette(palette_device &palette) const;
};
@@ -553,7 +553,7 @@ upon display type.
rgb_t(0xA1,0x8F,0x1A), rgb_t(0xB2,0xA0,0x2B), rgb_t(0xC3,0xB1,0x3C), rgb_t(0xD4,0xC2,0x4D), \
rgb_t(0xE5,0xD3,0x5E), rgb_t(0xF6,0xE4,0x6F), rgb_t(0xFF,0xF5,0x82), rgb_t(0xFF,0xFF,0x96 )
-static const rgb_t a7800_palette[256] =
+static constexpr rgb_t a7800_colors[256] =
{
NTSC_GREY,
NTSC_GOLD,
@@ -573,7 +573,7 @@ static const rgb_t a7800_palette[256] =
NTSC_LIGHT_ORANGE
};
-static const rgb_t a7800p_palette[256] =
+static constexpr rgb_t a7800p_colors[256] =
{
NTSC_GREY,
NTSC_ORANGE_GREEN,
@@ -1307,15 +1307,15 @@ define NTSC_LIGHT_ORANGE
***************************************************************************/
/* Initialise the palette */
-PALETTE_INIT_MEMBER(a7800_state, a7800)
+void a7800_state::a7800_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, a7800_palette, ARRAY_LENGTH(a7800_palette));
+ palette.set_pen_colors(0, a7800_colors);
}
-PALETTE_INIT_MEMBER(a7800_pal_state,a7800p)
+void a7800_pal_state::a7800p_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, a7800p_palette, ARRAY_LENGTH(a7800p_palette));
+ palette.set_pen_colors(0, a7800p_colors);
}
@@ -1388,7 +1388,7 @@ void a7800_state::a7800_ntsc(machine_config &config)
m_screen->set_screen_update("maria", FUNC(atari_maria_device::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", ARRAY_LENGTH(a7800_palette)).set_init(FUNC(a7800_state::palette_init_a7800));
+ PALETTE(config, "palette", FUNC(a7800_state::a7800_palette), ARRAY_LENGTH(a7800_colors));
ATARI_MARIA(config, m_maria, 0);
m_maria->set_dmacpu_tag(m_maincpu);
@@ -1420,7 +1420,7 @@ void a7800_pal_state::a7800_pal(machine_config &config)
m_screen->set_raw(7093788, 454, 0, 320, 313, 35, 35 + 228 + 32);
- subdevice<palette_device>("palette")->set_init(FUNC(a7800_pal_state::palette_init_a7800p));
+ subdevice<palette_device>("palette")->set_init(FUNC(a7800_pal_state::a7800p_palette));
/* devices */
subdevice<mos6532_new_device>("riot")->set_clock(CLK_PAL);
diff --git a/src/mame/drivers/aa310.cpp b/src/mame/drivers/aa310.cpp
index 8e4fbd03109..838fad59bff 100644
--- a/src/mame/drivers/aa310.cpp
+++ b/src/mame/drivers/aa310.cpp
@@ -423,7 +423,7 @@ void aa310_state::aa310(machine_config &config)
m_screen->set_raw(16_MHz_XTAL, 1024, 0, 735, 624/2, 0, 292); // RiscOS 3 default screen settings
m_screen->set_screen_update(FUNC(archimedes_state::screen_update));
- PALETTE(config, m_palette, 32768);
+ PALETTE(config, m_palette).set_entries(32768);
RAM(config, m_ram).set_default_size("1M");
diff --git a/src/mame/drivers/ac1.cpp b/src/mame/drivers/ac1.cpp
index 8493a919c6c..1b7e4329cf0 100644
--- a/src/mame/drivers/ac1.cpp
+++ b/src/mame/drivers/ac1.cpp
@@ -148,11 +148,11 @@ MACHINE_CONFIG_START(ac1_state::ac1)
MCFG_SCREEN_SIZE(64*6, 16*8)
MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 16*8-1)
MCFG_SCREEN_UPDATE_DRIVER(ac1_state, screen_update_ac1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ac1 )
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/accomm.cpp b/src/mame/drivers/accomm.cpp
index c38b093bfc2..a2d2f1e2f79 100644
--- a/src/mame/drivers/accomm.cpp
+++ b/src/mame/drivers/accomm.cpp
@@ -71,7 +71,7 @@ private:
DECLARE_READ8_MEMBER(sheila_r);
DECLARE_WRITE8_MEMBER(sheila_w);
- DECLARE_PALETTE_INIT(accomm);
+ void accomm_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(vbl_int);
virtual void machine_reset() override;
@@ -145,9 +145,9 @@ static const rgb_t electron_palette[8]=
rgb_t(0x000,0x000,0x000)
};
-PALETTE_INIT_MEMBER(accomm_state, accomm)
+void accomm_state::accomm_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, electron_palette, ARRAY_LENGTH(electron_palette));
+ palette.set_pen_colors(0, electron_palette);
}
READ8_MEMBER(accomm_state::read_keyboard1)
@@ -830,8 +830,7 @@ void accomm_state::accomm(machine_config &config)
screen.set_video_attributes(VIDEO_UPDATE_SCANLINE);
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(palette_init_delegate(FUNC(accomm_state::palette_init_accomm), this));
+ PALETTE(config, "palette", FUNC(accomm_state::accomm_palette), 16);
config.set_default_layout(layout_accomm);
diff --git a/src/mame/drivers/ace.cpp b/src/mame/drivers/ace.cpp
index 882e06f842a..91c30b4ce10 100644
--- a/src/mame/drivers/ace.cpp
+++ b/src/mame/drivers/ace.cpp
@@ -335,10 +335,10 @@ MACHINE_CONFIG_START(aceal_state::ace)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 32*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aceal_state, screen_update_ace)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ace)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
/* ???? */
diff --git a/src/mame/drivers/acefruit.cpp b/src/mame/drivers/acefruit.cpp
index d412c7c76a2..49a05bdb9bc 100644
--- a/src/mame/drivers/acefruit.cpp
+++ b/src/mame/drivers/acefruit.cpp
@@ -47,23 +47,24 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(starspnr_coinage_r);
DECLARE_CUSTOM_INPUT_MEMBER(starspnr_payout_r);
-private:
+protected:
enum
{
TIMER_ACEFRUIT_REFRESH
};
+ virtual void machine_start() override;
+ virtual void video_start() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+private:
DECLARE_WRITE8_MEMBER(acefruit_colorram_w);
DECLARE_WRITE8_MEMBER(acefruit_coin_w);
DECLARE_WRITE8_MEMBER(acefruit_sound_w);
DECLARE_WRITE8_MEMBER(acefruit_lamp_w);
DECLARE_WRITE8_MEMBER(acefruit_solenoid_w);
- virtual void machine_start() override;
- virtual void video_start() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
- DECLARE_PALETTE_INIT(acefruit);
+ void acefruit_palette(palette_device &palette) const;
uint32_t screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(acefruit_vblank);
void acefruit_update_irq(int vpos);
@@ -309,7 +310,7 @@ WRITE8_MEMBER(acefruit_state::acefruit_solenoid_w)
m_solenoids[i] = BIT(data, i);
}
-PALETTE_INIT_MEMBER(acefruit_state, acefruit)
+void acefruit_state::acefruit_palette(palette_device &palette) const
{
/* sprites */
palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00) );
@@ -635,7 +636,7 @@ MACHINE_CONFIG_START(acefruit_state::acefruit)
WATCHDOG_TIMER(config, "watchdog");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acefruit)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_acefruit);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -644,14 +645,12 @@ MACHINE_CONFIG_START(acefruit_state::acefruit)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 255)
MCFG_SCREEN_UPDATE_DRIVER(acefruit_state, screen_update_acefruit)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(acefruit_state, acefruit)
+ PALETTE(config, m_palette, FUNC(acefruit_state::acefruit_palette), 16);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
-
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/acommand.cpp b/src/mame/drivers/acommand.cpp
index 1cfa048011a..2f3174ff42d 100644
--- a/src/mame/drivers/acommand.cpp
+++ b/src/mame/drivers/acommand.cpp
@@ -72,8 +72,8 @@ JALCF1 BIN 1,048,576 02-07-99 1:11a JALCF1.BIN
class acommand_state : public driver_device
{
public:
- acommand_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ acommand_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_oki1(*this, "oki1"),
@@ -482,11 +482,10 @@ MACHINE_CONFIG_START(acommand_state::acommand)
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(acommand_state, screen_update_acommand)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_acommand)
- MCFG_PALETTE_ADD("palette", 0x4000)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_acommand);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x4000);
MEGASYS1_TILEMAP(config, m_bgtmap, m_palette, 0x0f00);
MEGASYS1_TILEMAP(config, m_txtmap, m_palette, 0x2700);
diff --git a/src/mame/drivers/actfancr.cpp b/src/mame/drivers/actfancr.cpp
index 80b3dc6f046..6b587da3219 100644
--- a/src/mame/drivers/actfancr.cpp
+++ b/src/mame/drivers/actfancr.cpp
@@ -307,8 +307,7 @@ MACHINE_CONFIG_START(actfancr_state::actfancr)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_actfan)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 768);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(2, 2, 2);
@@ -369,8 +368,7 @@ MACHINE_CONFIG_START(actfancr_state::triothep)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_triothep)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 768);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(2, 2, 0);
diff --git a/src/mame/drivers/adp.cpp b/src/mame/drivers/adp.cpp
index 65eacd3364b..0c5317b7b0f 100644
--- a/src/mame/drivers/adp.cpp
+++ b/src/mame/drivers/adp.cpp
@@ -172,8 +172,8 @@ Quick Jack administration/service mode:
class adp_state : public driver_device
{
public:
- adp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ adp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_microtouch(*this, "microtouch"),
m_maincpu(*this, "maincpu"),
m_duart(*this, "duart"),
@@ -207,8 +207,8 @@ private:
DECLARE_WRITE16_MEMBER(input_w);
DECLARE_MACHINE_START(skattv);
DECLARE_MACHINE_RESET(skattv);
- DECLARE_PALETTE_INIT(adp);
- DECLARE_PALETTE_INIT(fstation);
+ void adp_palette(palette_device &device) const;
+ void fstation_palette(palette_device &device) const;
IRQ_CALLBACK_MEMBER(duart_iack_handler);
//INTERRUPT_GEN_MEMBER(adp_int);
void skattva_nvram_init(nvram_device &nvram, void *base, size_t size);
@@ -263,35 +263,19 @@ MACHINE_RESET_MEMBER(adp_state,skattv)
m_mux_data = 0;
}
-PALETTE_INIT_MEMBER(adp_state,adp)
+void adp_state::adp_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- // red component
- bit0 = (i >> 0) & 0x01;
- bit1 = (i >> 3) & 0x01;
- bit2 = (i >> 0) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- // green component
- bit0 = (i >> 1) & 0x01;
- bit1 = (i >> 3) & 0x01;
- bit2 = (i >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- // blue component
- bit0 = (i >> 2) & 0x01;
- bit1 = (i >> 3) & 0x01;
- bit2 = (i >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_pen_color(i, rgb_t(r,g,b));
+ int const r = 0x21 * BIT(i, 0) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 0);
+ int const g = 0x21 * BIT(i, 1) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 1);
+ int const b = 0x21 * BIT(i, 2) + 0x47 * BIT(i, 3) + 0x97 * BIT(i, 2);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(adp_state,fstation)
+void adp_state::fstation_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
palette.set_pen_color(i, rgb_t(pal3bit(i>>5), pal3bit(i>>2), pal2bit(i>>0)));
@@ -583,11 +567,9 @@ MACHINE_CONFIG_START(adp_state::quickjac)
MCFG_SCREEN_SIZE(384, 280)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 280-1)
MCFG_SCREEN_UPDATE_DEVICE("acrtc", hd63484_device, update_screen)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10)
-
- MCFG_PALETTE_INIT_OWNER(adp_state,adp)
+ PALETTE(config, m_palette, FUNC(adp_state::adp_palette), 0x10);
HD63484(config, m_acrtc, 0).set_addrmap(0, &adp_state::adp_hd63484_map);
@@ -624,11 +606,11 @@ void adp_state::ramdac_map(address_map &map)
MACHINE_CONFIG_START(adp_state::funland)
quickjac(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(funland_mem)
- MCFG_DEVICE_REMOVE("palette")
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x100)
+ PALETTE(config.replace(), m_palette, palette_device::BLACK, 0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &adp_state::ramdac_map);
@@ -638,6 +620,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(adp_state::fstation)
funland(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(fstation_mem)
@@ -645,8 +628,7 @@ MACHINE_CONFIG_START(adp_state::fstation)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(adp_state, fstation)
+ m_palette->set_init(FUNC(adp_state::fstation_palette));
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/advision.cpp b/src/mame/drivers/advision.cpp
index bbe2e64d6ee..a2a4498e31f 100644
--- a/src/mame/drivers/advision.cpp
+++ b/src/mame/drivers/advision.cpp
@@ -87,7 +87,7 @@ void advision_state::advision(machine_config &config)
screen.set_visarea(84, 235, 60, 142);
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8).set_init(FUNC(advision_state::palette_init_advision));
+ PALETTE(config, m_palette, FUNC(advision_state::advision_palette), 8);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/aeroboto.cpp b/src/mame/drivers/aeroboto.cpp
index 17a51ef8997..45a7daa8de6 100644
--- a/src/mame/drivers/aeroboto.cpp
+++ b/src/mame/drivers/aeroboto.cpp
@@ -265,7 +265,7 @@ MACHINE_CONFIG_START(aeroboto_state::formatz)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aeroboto)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp
index dbc94eddb10..c3751024c86 100644
--- a/src/mame/drivers/aerofgt.cpp
+++ b/src/mame/drivers/aerofgt.cpp
@@ -1483,11 +1483,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikes)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikes)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@@ -1533,11 +1532,10 @@ MACHINE_CONFIG_START(aerofgt_state::spikes91)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 320-1, 0*8+4, 224+4-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spikes91)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spikes91)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_spikes91);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@@ -1569,11 +1567,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikesb)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikesb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikesb)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikesb);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@@ -1614,11 +1611,10 @@ MACHINE_CONFIG_START(aerofgt_state::kickball)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kickball)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_kickball);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@@ -1661,11 +1657,10 @@ MACHINE_CONFIG_START(aerofgt_state::pspikesc)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 44*8+4-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_pspikes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pspikes)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pspikes);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
@@ -1705,11 +1700,10 @@ MACHINE_CONFIG_START(aerofgt_state::karatblz)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_karatblz)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@@ -1762,11 +1756,10 @@ MACHINE_CONFIG_START(aerofgt_state::karatblzbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_karatblz)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_SPR2(config, m_spr_old[0], 0);
m_spr_old[0]->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_old_tile_callback), this);
@@ -1819,11 +1812,10 @@ MACHINE_CONFIG_START(aerofgt_state::spinlbrk)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 45*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_spinlbrk)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 1024) // doesn't fully initialize palette at start-up ...
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xRGB_555, 1024); // doesn't fully initialize palette at start-up ...
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@@ -1878,11 +1870,10 @@ MACHINE_CONFIG_START(aerofgt_state::turbofrc)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@@ -1937,11 +1928,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerofgtb)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_turbofrc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbofrc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_turbofrc);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@@ -2008,11 +1998,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerofgt)
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(aerofgt_state, screen_update_aerofgt)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerofgt)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerofgt);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_tile_indirect_cb(FUNC(aerofgt_state::aerofgt_tile_callback), this);
@@ -2058,11 +2047,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerfboot)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboot)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerfboot)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerfboot);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
//VSYSTEM_GGA(config, "gga", 0);
@@ -2097,11 +2085,10 @@ MACHINE_CONFIG_START(aerofgt_state::aerfboo2)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+12, 40*8-1+12, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_aerfboo2)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aerfboo2)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_aerfboo2);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
//VSYSTEM_GGA(config, "gga", 0);
@@ -2135,9 +2122,8 @@ MACHINE_CONFIG_START(aerofgt_state::wbbc97)
MCFG_SCREEN_VISIBLE_AREA(0*8+14, 44*8-1+4, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aerofgt_state, screen_update_wbbc97)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wbbc97)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wbbc97);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
diff --git a/src/mame/drivers/airbustr.cpp b/src/mame/drivers/airbustr.cpp
index dac0bb2ab59..88294b4bdc4 100644
--- a/src/mame/drivers/airbustr.cpp
+++ b/src/mame/drivers/airbustr.cpp
@@ -593,11 +593,10 @@ MACHINE_CONFIG_START(airbustr_state::airbustr)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(airbustr_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, airbustr_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_airbustr)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_airbustr);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 768);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_gfx_region(1);
diff --git a/src/mame/drivers/airraid.cpp b/src/mame/drivers/airraid.cpp
index c296c5b33a1..bf405a0441c 100644
--- a/src/mame/drivers/airraid.cpp
+++ b/src/mame/drivers/airraid.cpp
@@ -392,7 +392,7 @@ INPUT_PORTS_END
MACHINE_CONFIG_START(airraid_state::airraid)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", Z80,XTAL(12'000'000)/2) /* verified on pcb */
+ MCFG_DEVICE_ADD(m_maincpu, Z80,XTAL(12'000'000)/2) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(airraid_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", airraid_state, cshooter_scanline, "airraid_vid:screen", 0, 1)
@@ -403,8 +403,7 @@ MACHINE_CONFIG_START(airraid_state::airraid)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x100);
AIRRAID_VIDEO(config, m_airraid_video, 0);
diff --git a/src/mame/drivers/ajax.cpp b/src/mame/drivers/ajax.cpp
index 7de45bc6e92..44f90bdb3f3 100644
--- a/src/mame/drivers/ajax.cpp
+++ b/src/mame/drivers/ajax.cpp
@@ -194,9 +194,8 @@ void ajax_state::ajax(machine_config &config)
screen.set_screen_update(FUNC(ajax_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/albazc.cpp b/src/mame/drivers/albazc.cpp
index c612485c4ef..35f5d547210 100644
--- a/src/mame/drivers/albazc.cpp
+++ b/src/mame/drivers/albazc.cpp
@@ -44,7 +44,7 @@ private:
DECLARE_WRITE8_MEMBER(hanaroku_out_2_w);
DECLARE_WRITE8_MEMBER(albazc_vregs_w);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(albazc);
+ void albazc_palette(palette_device &palette) const;
uint32_t screen_update_hanaroku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void hanaroku_map(address_map &map);
@@ -63,17 +63,14 @@ private:
/* video */
-PALETTE_INIT_MEMBER(albazc_state, albazc)
+void albazc_state::albazc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int r, g, b;
-
- for (i = 0; i < 0x200; i++)
+ uint8_t const *const color_prom(memregion("proms")->base());
+ for (int i = 0; i < 0x200; i++)
{
- b = (color_prom[i * 2 + 1] & 0x1f);
- g = ((color_prom[i * 2 + 1] & 0xe0) | ((color_prom[i * 2 + 0]& 0x03) <<8)) >> 5;
- r = (color_prom[i * 2 + 0] & 0x7c) >> 2;
+ int const b = (color_prom[i * 2 + 1] & 0x1f);
+ int const g = ((color_prom[i * 2 + 1] & 0xe0) | ((color_prom[i * 2 + 0] & 0x03) <<8)) >> 5;
+ int const r = (color_prom[i * 2 + 0] & 0x7c) >> 2;
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
@@ -296,12 +293,11 @@ MACHINE_CONFIG_START(albazc_state::hanaroku)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(albazc_state, screen_update_hanaroku)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hanaroku)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_hanaroku)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(albazc_state, albazc)
+ PALETTE(config, "palette", FUNC(albazc_state::albazc_palette), 0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/albazg.cpp b/src/mame/drivers/albazg.cpp
index 6ba6aaf7913..52c05ed8d9e 100644
--- a/src/mame/drivers/albazg.cpp
+++ b/src/mame/drivers/albazg.cpp
@@ -390,9 +390,8 @@ MACHINE_CONFIG_START(albazg_state::yumefuda)
crtc.set_show_border_area(false);
crtc.set_char_width(8);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yumefuda )
- MCFG_PALETTE_ADD("palette", 0x80)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yumefuda)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x80);
/* sound hardware */
diff --git a/src/mame/drivers/aleck64.cpp b/src/mame/drivers/aleck64.cpp
index 77b1883d10a..6fee3124b73 100644
--- a/src/mame/drivers/aleck64.cpp
+++ b/src/mame/drivers/aleck64.cpp
@@ -1000,7 +1000,7 @@ void aleck64_state::aleck64(machine_config &config)
screen.set_screen_update(FUNC(aleck64_state::screen_update_n64));
screen.screen_vblank().set(FUNC(aleck64_state::screen_vblank_n64));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp
index bc4b576c284..33da94d7999 100644
--- a/src/mame/drivers/alesis.cpp
+++ b/src/mame/drivers/alesis.cpp
@@ -329,7 +329,7 @@ static INPUT_PORTS_START( sr16 )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(alesis_state, alesis)
+void alesis_state::alesis_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -432,8 +432,7 @@ MACHINE_CONFIG_START(alesis_state::hr16)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
- MCFG_PALETTE_INIT_OWNER(alesis_state, alesis)
+ PALETTE(config, "palette", FUNC(alesis_state::alesis_palette), 2);
MCFG_CASSETTE_ADD( "cassette" )
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED)
diff --git a/src/mame/drivers/alg.cpp b/src/mame/drivers/alg.cpp
index 96578f72bfa..48939844779 100644
--- a/src/mame/drivers/alg.cpp
+++ b/src/mame/drivers/alg.cpp
@@ -322,10 +322,9 @@ MACHINE_CONFIG_START(alg_state::alg_r1)
MCFG_LASERDISC_SCREEN("screen")
MCFG_LASERDISC_OVERLAY_DRIVER(512*2, 262, amiga_state, screen_update_amiga)
MCFG_LASERDISC_OVERLAY_CLIP((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4097)
- MCFG_PALETTE_INIT_OWNER(alg_state,amiga)
+ PALETTE(config, m_palette, FUNC(alg_state::amiga_palette), 4097);
MCFG_VIDEO_START_OVERRIDE(alg_state,alg)
diff --git a/src/mame/drivers/aliens.cpp b/src/mame/drivers/aliens.cpp
index 803b69aa106..f99907d2e3a 100644
--- a/src/mame/drivers/aliens.cpp
+++ b/src/mame/drivers/aliens.cpp
@@ -216,9 +216,7 @@ void aliens_state::aliens(machine_config &config)
screen.set_screen_update(FUNC(aliens_state::screen_update_aliens));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 512));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 512).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/alpha68k.cpp b/src/mame/drivers/alpha68k.cpp
index 7492d076caf..10a8119af82 100644
--- a/src/mame/drivers/alpha68k.cpp
+++ b/src/mame/drivers/alpha68k.cpp
@@ -1927,13 +1927,11 @@ MACHINE_CONFIG_START(alpha68k_state::sstingry)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_sstingry)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sstingry)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sstingry)
- MCFG_PALETTE_ADD("palette", 256 + 1)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
+ PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1979,13 +1977,11 @@ MACHINE_CONFIG_START(alpha68k_state::kyros)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kyros)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_kyros)
- MCFG_PALETTE_ADD("palette", 256 + 1)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
+ PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -2030,13 +2026,11 @@ MACHINE_CONFIG_START(alpha68k_state::jongbou)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_kyros)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jongbou)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_jongbou)
- MCFG_PALETTE_ADD("palette", 256 + 1)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(alpha68k_state,kyros)
+ PALETTE(config, m_palette, FUNC(alpha68k_state::kyros_palette), 256 + 1, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -2069,13 +2063,11 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_I)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_I)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_I)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
+ PALETTE(config, m_palette, FUNC(alpha68k_state::paddlem_palette), 1024, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -2122,9 +2114,9 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_II)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_II)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_II)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_II)
MCFG_PALETTE_ADD("palette", 2048)
MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0)
@@ -2188,9 +2180,9 @@ MACHINE_CONFIG_START(alpha68k_state::alpha68k_V)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_V)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_V)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_V)
MCFG_PALETTE_ADD("palette", 4096)
MCFG_PALETTE_FORMAT(xRGBRRRRGGGGBBBB_bit0)
@@ -2243,13 +2235,11 @@ MACHINE_CONFIG_START(alpha68k_state::tnextspc)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ALPHA68K_PIXEL_CLOCK,ALPHA68K_HTOTAL,ALPHA68K_HBEND,ALPHA68K_HBSTART,ALPHA68K_VTOTAL,ALPHA68K_VBEND,ALPHA68K_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(alpha68k_state, screen_update_alpha68k_I)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alpha68k_I)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_alpha68k_I)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(alpha68k_state,paddlem)
+ PALETTE(config, m_palette, FUNC(alpha68k_state::paddlem_palette), 1024, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/alphasma.cpp b/src/mame/drivers/alphasma.cpp
index 64d1557ffcd..3487869370d 100644
--- a/src/mame/drivers/alphasma.cpp
+++ b/src/mame/drivers/alphasma.cpp
@@ -52,7 +52,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(alphasmart);
+ void alphasmart_palette(palette_device &palette) const;
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(kb_r);
@@ -398,7 +398,7 @@ static INPUT_PORTS_START( alphasmart )
PORT_CONFSETTING (0x01, DEF_STR(Normal))
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(alphasmart_state, alphasmart)
+void alphasmart_state::alphasmart_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -454,8 +454,7 @@ MACHINE_CONFIG_START(alphasmart_state::alphasmart)
MCFG_SCREEN_VISIBLE_AREA(0, (6*40)-1, 0, (9*4)-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(alphasmart_state, alphasmart)
+ PALETTE(config, "palette", FUNC(alphasmart_state::alphasmart_palette), 2);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/alphatpx.cpp b/src/mame/drivers/alphatpx.cpp
index 1d15c544dfe..8fc6ee5dee5 100644
--- a/src/mame/drivers/alphatpx.cpp
+++ b/src/mame/drivers/alphatpx.cpp
@@ -1224,7 +1224,7 @@ MACHINE_CONFIG_START(alphatp_12_state::alphatp2)
MCFG_SCREEN_RAW_PARAMS(12.8544_MHz_XTAL, 824, 0, 640, 312, 0, 288)
MCFG_SCREEN_UPDATE_DRIVER(alphatp_12_state, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
CRT5027(config, m_crtc, 12.8544_MHz_XTAL / 8);
m_crtc->set_char_width(8);
@@ -1301,7 +1301,7 @@ MACHINE_CONFIG_START(alphatp_34_state::alphatp3)
MCFG_SCREEN_RAW_PARAMS(12.8544_MHz_XTAL, 824, 0, 640, 312, 0, 288)
MCFG_SCREEN_UPDATE_DRIVER(alphatp_34_state, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
CRT5037(config, m_crtc, 12.8544_MHz_XTAL / 8);
m_crtc->set_char_width(8);
diff --git a/src/mame/drivers/alphatro.cpp b/src/mame/drivers/alphatro.cpp
index 815272e277c..d173a2928c9 100644
--- a/src/mame/drivers/alphatro.cpp
+++ b/src/mame/drivers/alphatro.cpp
@@ -78,6 +78,11 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(alphatro_break);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
enum
{
@@ -102,7 +107,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(txdata_callback);
DECLARE_WRITE_LINE_MEMBER(hrq_w);
DECLARE_WRITE_LINE_MEMBER(fdc_irq_w);
- DECLARE_PALETTE_INIT(alphatro);
+ void alphatro_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(timer_c);
TIMER_DEVICE_CALLBACK_MEMBER(timer_p);
MC6845_UPDATE_ROW(crtc_update_row);
@@ -116,6 +121,7 @@ private:
void cartbank_map(address_map &map);
void monbank_map(address_map &map);
void rombank_map(address_map &map);
+ void update_banking();
const bool m_is_ntsc;
uint8_t *m_ram_ptr;
@@ -127,10 +133,6 @@ private:
u8 m_port_10, m_port_20, m_port_30, m_port_f0;
bool m_cass_state;
bool m_cassold, m_fdc_irq;
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- void update_banking();
required_region_ptr<u8> m_p_chargen;
required_device<cpu_device> m_maincpu;
required_device<mc6845_device> m_crtc;
@@ -660,7 +662,7 @@ image_init_result alphatro_state::load_cart(device_image_interface &image, gener
return image_init_result::PASS;
}
-PALETTE_INIT_MEMBER(alphatro_state, alphatro)
+void alphatro_state::alphatro_palette(palette_device &palette) const
{
// RGB colours
palette.set_pen_color(0, 0x00, 0x00, 0x00);
@@ -741,9 +743,8 @@ MACHINE_CONFIG_START(alphatro_state::alphatro)
screen.set_raw(16_MHz_XTAL, 1016, 0, 640, 314, 0, 240);
screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_alphatro)
- MCFG_PALETTE_ADD("palette", 9) // 8 colours + amber
- MCFG_PALETTE_INIT_OWNER(alphatro_state, alphatro)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_alphatro);
+ PALETTE(config, m_palette, FUNC(alphatro_state::alphatro_palette), 9); // 8 colours + amber
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/alto2.cpp b/src/mame/drivers/alto2.cpp
index 2fcfa30f009..21681a5131a 100644
--- a/src/mame/drivers/alto2.cpp
+++ b/src/mame/drivers/alto2.cpp
@@ -298,7 +298,7 @@ MACHINE_CONFIG_START(alto2_state::alto2)
screen.set_screen_update("maincpu", FUNC(alto2_cpu_device::screen_update));
screen.set_palette("palette");
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// Sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/amaticmg.cpp b/src/mame/drivers/amaticmg.cpp
index fd6a449271d..7f6547c4133 100644
--- a/src/mame/drivers/amaticmg.cpp
+++ b/src/mame/drivers/amaticmg.cpp
@@ -432,8 +432,8 @@
class amaticmg_state : public driver_device
{
public:
- amaticmg_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ amaticmg_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_attr(*this, "attr"),
m_vram(*this, "vram"),
m_maincpu(*this, "maincpu"),
@@ -446,27 +446,36 @@ public:
void amaticmg2(machine_config &config);
void amaticmg(machine_config &config);
void amaticmg4(machine_config &config);
+
void init_ama8000_3_o();
void init_ama8000_2_i();
void init_ama8000_2_v();
void init_ama8000_1_x();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_attr;
required_shared_ptr<uint8_t> m_vram;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ output_finder<7> m_lamps;
+
+ uint8_t m_nmi_mask;
+
DECLARE_WRITE8_MEMBER(rombank_w);
DECLARE_WRITE8_MEMBER(nmi_mask_w);
DECLARE_WRITE8_MEMBER(unk80_w);
- uint8_t m_nmi_mask;
DECLARE_WRITE8_MEMBER(out_a_w);
DECLARE_WRITE8_MEMBER(out_c_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(amaticmg);
- DECLARE_PALETTE_INIT(amaticmg2);
+ void amaticmg_palette(palette_device &palette) const;
+ void amaticmg2_palette(palette_device &palette) const;
uint32_t screen_update_amaticmg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_amaticmg2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(amaticmg2_irq);
@@ -477,11 +486,6 @@ private:
void amaticmg4_portmap(address_map &map);
void amaticmg_map(address_map &map);
void amaticmg_portmap(address_map &map);
-
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- output_finder<7> m_lamps;
};
@@ -542,47 +546,46 @@ uint32_t amaticmg_state::screen_update_amaticmg2(screen_device &screen, bitmap_i
return 0;
}
-PALETTE_INIT_MEMBER(amaticmg_state, amaticmg)
+void amaticmg_state::amaticmg_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x200; ++i)
+ for (int i = 0; i < 0x200; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 7) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[0] >> 4) & 0x01;
- bit2 = (color_prom[0] >> 5) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
-PALETTE_INIT_MEMBER(amaticmg_state,amaticmg2)
+void amaticmg_state::amaticmg2_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int r, g, b;
- int i;
- for (i = 0; i < memregion("proms")->bytes(); i+=2)
+ for (int i = 0, n = memregion("proms")->bytes(); i < n; i += 2)
{
- b = ((color_prom[1] & 0xf8) >> 3);
- g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
- r = ((color_prom[0] & 0x3e) >> 1);
+ int const b = ((color_prom[1] & 0xf8) >> 3);
+ int const g = ((color_prom[0] & 0xc0) >> 6) | ((color_prom[1] & 0x7) << 2);
+ int const r = ((color_prom[0] & 0x3e) >> 1);
palette.set_pen_color(i >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
- color_prom+=2;
+ color_prom += 2;
}
}
@@ -869,7 +872,7 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(amaticmg_state, screen_update_amaticmg)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK));
crtc.set_screen("screen");
@@ -877,10 +880,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg)
crtc.set_char_width(4);
crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI); // no NMI mask?
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amaticmg)
-
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(amaticmg_state, amaticmg)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_amaticmg);
+ PALETTE(config, m_palette, FUNC(amaticmg_state::amaticmg_palette), 0x200);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -911,9 +912,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg2)
subdevice<mc6845_device>("crtc")->out_vsync_callback().set(FUNC(amaticmg_state::amaticmg2_irq));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_amaticmg2)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x10000)
- MCFG_PALETTE_INIT_OWNER(amaticmg_state,amaticmg2)
+ m_palette->set_init(FUNC(amaticmg_state::amaticmg2_palette));
+ m_palette->set_entries(0x10000);
MACHINE_CONFIG_END
@@ -931,9 +931,8 @@ MACHINE_CONFIG_START(amaticmg_state::amaticmg4)
subdevice<mc6845_device>("crtc")->out_vsync_callback().set(FUNC(amaticmg_state::amaticmg2_irq));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_amaticmg2)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x10000)
- MCFG_PALETTE_INIT_OWNER(amaticmg_state,amaticmg2)
+ m_palette->set_init(FUNC(amaticmg_state::amaticmg2_palette));
+ m_palette->set_entries(0x10000);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ambush.cpp b/src/mame/drivers/ambush.cpp
index df19028c1a9..2b37533538a 100644
--- a/src/mame/drivers/ambush.cpp
+++ b/src/mame/drivers/ambush.cpp
@@ -60,8 +60,8 @@
class ambush_state : public driver_device
{
public:
- ambush_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ambush_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_gfxdecode(*this, "gfxdecode"),
m_outlatch(*this, "outlatch%u", 1),
m_video_ram(*this, "video_ram"),
@@ -79,10 +79,10 @@ public:
void dkong3abl(machine_config &config);
private:
- DECLARE_PALETTE_INIT(ambush);
- DECLARE_PALETTE_INIT(mario);
- DECLARE_PALETTE_INIT(mariobla);
- DECLARE_PALETTE_INIT(dkong3);
+ void ambush_palette(palette_device &palette) const;
+ void mario_palette(palette_device &palette) const;
+ void mariobla_palette(palette_device &palette) const;
+ void dkong3_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -306,126 +306,126 @@ INPUT_PORTS_END
// PALETTES
//**************************************************************************
-PALETTE_INIT_MEMBER( ambush_state, ambush )
+void ambush_state::ambush_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("colors")->base();
+ uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
// red component
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER( ambush_state, mario )
+void ambush_state::mario_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("colors")->base();
+ uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
// red component
- bit0 = (color_prom[i] >> 5) & 1;
- bit1 = (color_prom[i] >> 6) & 1;
- bit2 = (color_prom[i] >> 7) & 1;
- r = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
// green component
- bit0 = (color_prom[i] >> 2) & 1;
- bit1 = (color_prom[i] >> 3) & 1;
- bit2 = (color_prom[i] >> 4) & 1;
- g = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 4);
+ int const g = 255 - (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
// blue component
- bit0 = (color_prom[i] >> 0) & 1;
- bit1 = (color_prom[i] >> 1) & 1;
- b = 255 - (0x55 * bit0 + 0xaa * bit1);
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const b = 255 - (0x55 * bit0 + 0xaa * bit1);
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(ambush_state, mariobla)
+void ambush_state::mariobla_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("colors")->base();
+ uint8_t const *const color_prom = memregion("colors")->base();
for (int c = 0; c < palette.entries(); c++)
{
- int i = bitswap<9>(c, 2, 7, 6, 8, 5, 4, 3, 1, 0);
- int bit0, bit1, bit2, r, g, b;
+ int const i = bitswap<9>(c, 2, 7, 6, 8, 5, 4, 3, 1, 0);
+ int bit0, bit1, bit2;
// red component
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// green component
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
// blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(c, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER( ambush_state, dkong3 )
+void ambush_state::dkong3_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("colors")->base();
+ uint8_t const *const color_prom = memregion("colors")->base();
for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
+ int bit0, bit1, bit2, bit3;
// red component
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 5) & 0x01;
- bit2 = (color_prom[i] >> 6) & 0x01;
- bit3 = (color_prom[i] >> 7) & 0x01;
- r = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ bit2 = BIT(color_prom[i], 6);
+ bit3 = BIT(color_prom[i], 7);
+ int const r = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
// green component
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- g = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const g = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
// blue component
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
+ bit0 = BIT(color_prom[i + 0x200], 0);
+ bit1 = BIT(color_prom[i + 0x200], 1);
+ bit2 = BIT(color_prom[i + 0x200], 2);
+ bit3 = BIT(color_prom[i + 0x200], 3);
+ int const b = 255 - (0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3);
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -740,10 +740,9 @@ MACHINE_CONFIG_START(ambush_state::ambush_base)
MCFG_SCREEN_UPDATE_DRIVER(ambush_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ambush)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ambush);
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(ambush_state, ambush)
+ PALETTE(config, "palette", FUNC(ambush_state::ambush_palette), 256);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -788,8 +787,7 @@ MACHINE_CONFIG_START(ambush_state::mariobl)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_mariobl)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(ambush_state, mario)
+ subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::mario_palette));
ay8910_device &ay1(AY8910(config.replace(), "ay1", XTAL(18'432'000)/6/2));
ay1.port_a_read_callback().set_ioport("buttons");
@@ -803,8 +801,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(ambush_state::mariobla)
mariobl(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(ambush_state, mariobla)
+ subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::mariobla_palette));
auto &outlatch(*subdevice<ls259_device>("outlatch"));
outlatch.q_out_cb<5>().set(FUNC(ambush_state::color_bank_1_w));
@@ -813,12 +810,12 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(ambush_state::dkong3abl)
mariobl(config);
+
MCFG_MACHINE_START_OVERRIDE(ambush_state, dkong3abl)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_dkong3abl)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(ambush_state, dkong3)
+ subdevice<palette_device>("palette")->set_init(FUNC(ambush_state::dkong3_palette));
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/amiga.cpp b/src/mame/drivers/amiga.cpp
index adcd3b1c9ab..a8d41f300ae 100644
--- a/src/mame/drivers/amiga.cpp
+++ b/src/mame/drivers/amiga.cpp
@@ -1561,8 +1561,7 @@ MACHINE_CONFIG_START(amiga_state::amiga_base)
// video
pal_video(config);
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INIT_OWNER(amiga_state, amiga)
+ PALETTE(config, m_palette, FUNC(amiga_state::amiga_palette), 4096);
MCFG_VIDEO_START_OVERRIDE(amiga_state, amiga)
diff --git a/src/mame/drivers/ampoker2.cpp b/src/mame/drivers/ampoker2.cpp
index 207b150f3b2..1a89b0c45c4 100644
--- a/src/mame/drivers/ampoker2.cpp
+++ b/src/mame/drivers/ampoker2.cpp
@@ -391,9 +391,6 @@
*********************************************************************************/
-
-#define MASTER_CLOCK XTAL(6'000'000)
-
#include "emu.h"
#include "includes/ampoker2.h"
@@ -407,6 +404,9 @@
#include "sigmapkr.lh"
+#define MASTER_CLOCK XTAL(6'000'000)
+
+
void ampoker2_state::machine_start()
{
m_lamps.resolve();
@@ -1189,9 +1189,8 @@ MACHINE_CONFIG_START(ampoker2_state::ampoker2)
MCFG_SCREEN_UPDATE_DRIVER(ampoker2_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ampoker2)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(ampoker2_state, ampoker2)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ampoker2);
+ PALETTE(config, "palette", FUNC(ampoker2_state::ampoker2_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/amspdwy.cpp b/src/mame/drivers/amspdwy.cpp
index 1fc92a6e013..6e5d3fd4e4c 100644
--- a/src/mame/drivers/amspdwy.cpp
+++ b/src/mame/drivers/amspdwy.cpp
@@ -267,11 +267,10 @@ MACHINE_CONFIG_START(amspdwy_state::amspdwy)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(amspdwy_state, screen_update_amspdwy)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amspdwy)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_amspdwy);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/amstrad.cpp b/src/mame/drivers/amstrad.cpp
index 9020c38f273..8fcdc8732fa 100644
--- a/src/mame/drivers/amstrad.cpp
+++ b/src/mame/drivers/amstrad.cpp
@@ -267,14 +267,10 @@ INPUT_PORTS_END
/* Steph 2000-10-27 I remapped the 'Machine Name' Dip Switches (easier to understand) */
INPUT_CHANGED_MEMBER(amstrad_state::cpc_monitor_changed)
{
- if ( (m_io_green_display->read()) & 0x01 )
- {
- PALETTE_INIT_NAME( amstrad_cpc_green )(*m_palette);
- }
+ if ((m_io_green_display->read()) & 0x01)
+ amstrad_cpc_green_palette(*m_palette);
else
- {
- PALETTE_INIT_NAME( amstrad_cpc )(*m_palette);
- }
+ amstrad_cpc_palette(*m_palette);
}
@@ -931,10 +927,9 @@ MACHINE_CONFIG_START(amstrad_state::amstrad_base)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_cpc)
+ PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_cpc_palette), 32);
HD6845(config, m_crtc, 16_MHz_XTAL / 16);
m_crtc->set_screen(nullptr);
@@ -1026,8 +1021,7 @@ MACHINE_CONFIG_START(amstrad_state::kccomp)
MCFG_MACHINE_START_OVERRIDE(amstrad_state,kccomp)
MCFG_MACHINE_RESET_OVERRIDE(amstrad_state,kccomp)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(amstrad_state,kccomp)
+ m_palette->set_init(FUNC(amstrad_state::kccomp_palette));
MACHINE_CONFIG_END
@@ -1055,10 +1049,9 @@ MACHINE_CONFIG_START(amstrad_state::cpcplus)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus)
+ PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_plus_palette), 4096);
AMS40489(config, m_crtc, 40_MHz_XTAL / 40);
m_crtc->set_screen(nullptr);
@@ -1134,10 +1127,9 @@ MACHINE_CONFIG_START(amstrad_state::gx4000)
MCFG_SCREEN_UPDATE_DRIVER(amstrad_state, screen_update_amstrad)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, amstrad_state, screen_vblank_amstrad))
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INIT_OWNER(amstrad_state,amstrad_plus)
+ PALETTE(config, m_palette, FUNC(amstrad_state::amstrad_plus_palette), 4096);
AMS40489(config, m_crtc, 40_MHz_XTAL / 40);
m_crtc->set_screen(nullptr);
@@ -1171,9 +1163,8 @@ MACHINE_CONFIG_START(amstrad_state::aleste)
m_ay->port_a_read_callback().set(FUNC(amstrad_state::amstrad_psg_porta_read));
m_ay->add_route(ALL_OUTPUTS, "mono", 0.25);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64)
- MCFG_PALETTE_INIT_OWNER(amstrad_state,aleste)
+ m_palette->set_entries(32+64);
+ m_palette->set_init(FUNC(amstrad_state::aleste_palette));
MCFG_DEVICE_ADD("rtc", MC146818, 4.194304_MHz_XTAL)
diff --git a/src/mame/drivers/amusco.cpp b/src/mame/drivers/amusco.cpp
index 99a25d346dc..e349c69ccc5 100644
--- a/src/mame/drivers/amusco.cpp
+++ b/src/mame/drivers/amusco.cpp
@@ -102,8 +102,8 @@
class amusco_state : public driver_device
{
public:
- amusco_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ amusco_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_pit(*this, "pit8253"),
@@ -120,6 +120,10 @@ public:
DECLARE_WRITE_LINE_MEMBER(coin_irq);
+protected:
+ virtual void video_start() override;
+ virtual void machine_start() override;
+
private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_READ8_MEMBER(mc6845_r);
@@ -133,10 +137,7 @@ private:
DECLARE_WRITE8_MEMBER(rtc_control_w);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
MC6845_UPDATE_ROW(update_row);
- DECLARE_PALETTE_INIT(amusco);
-
- virtual void video_start() override;
- virtual void machine_start() override;
+ void amusco_palette(palette_device &palette) const;
void amusco_mem_map(address_map &map);
void amusco_io_map(address_map &map);
@@ -483,13 +484,13 @@ MC6845_UPDATE_ROW(amusco_state::update_row)
m_bg_tilemap->draw(*m_screen, bitmap, rowrect, 0, 0);
}
-PALETTE_INIT_MEMBER(amusco_state,amusco)
+void amusco_state::amusco_palette(palette_device &palette) const
{
// add some templates first
for (int i = 0; i < 8; i++)
{
- for(int j=0;j<8;j++)
- palette.set_pen_color(i*8+j, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
+ for (int j = 0; j < 8; j++)
+ palette.set_pen_color((i * 8) + j, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
// override colors
@@ -580,10 +581,8 @@ MACHINE_CONFIG_START(amusco_state::amusco)
MCFG_SCREEN_VISIBLE_AREA(0*8, 74*8-1, 0*10, 24*10-1) // visible scr: 74*8 24*10
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amusco)
-
- MCFG_PALETTE_ADD("palette",8*8)
- MCFG_PALETTE_INIT_OWNER(amusco_state, amusco)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_amusco);
+ PALETTE(config, "palette", FUNC(amusco_state::amusco_palette), 8*8);
R6545_1(config, m_crtc, CRTC_CLOCK); /* guess */
m_crtc->set_screen(m_screen);
diff --git a/src/mame/drivers/amust.cpp b/src/mame/drivers/amust.cpp
index aaaff1b6707..146ac9ed961 100644
--- a/src/mame/drivers/amust.cpp
+++ b/src/mame/drivers/amust.cpp
@@ -446,7 +446,7 @@ MACHINE_CONFIG_START(amust_state::amust)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amust)
/* sound hardware */
diff --git a/src/mame/drivers/angelkds.cpp b/src/mame/drivers/angelkds.cpp
index f5835bd438a..a9848d90c41 100644
--- a/src/mame/drivers/angelkds.cpp
+++ b/src/mame/drivers/angelkds.cpp
@@ -550,10 +550,8 @@ MACHINE_CONFIG_START(angelkds_state::angelkds)
MCFG_SCREEN_UPDATE_DRIVER(angelkds_state, screen_update_angelkds)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_angelkds)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
-
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_angelkds);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 0x100);
SPEAKER(config, "mono").front_center();
@@ -574,6 +572,7 @@ MACHINE_CONFIG_END
void angelkds_state::spcpostn(machine_config &config)
{
angelkds(config);
+
/* encryption */
sega_317_0005_device &maincpu(SEGA_317_0005(config.replace(), m_maincpu, XTAL(6'000'000)));
maincpu.set_addrmap(AS_PROGRAM, &angelkds_state::main_map);
diff --git a/src/mame/drivers/anzterm.cpp b/src/mame/drivers/anzterm.cpp
index c9031a13f11..c2d72c10133 100644
--- a/src/mame/drivers/anzterm.cpp
+++ b/src/mame/drivers/anzterm.cpp
@@ -429,7 +429,7 @@ MACHINE_CONFIG_START(anzterm_state::anzterm)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_RAW_PARAMS(15974400/4, 1024, 0, 104*8, 260, 0, 24*10) // this is totally wrong, it just stops a validation error
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_anzterm)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp
index d55c88424ba..49dcf2f071a 100644
--- a/src/mame/drivers/apc.cpp
+++ b/src/mame/drivers/apc.cpp
@@ -74,8 +74,8 @@
class apc_state : public driver_device
{
public:
- apc_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ apc_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_hgdc1(*this, "upd7220_chr"),
m_hgdc2(*this, "upd7220_btm"),
@@ -989,7 +989,7 @@ MACHINE_CONFIG_START(apc_state::apc)
m_screen->set_size(640, 494);
m_screen->set_visarea(0*8, 640-1, 0*8, 494-1);
- MCFG_PALETTE_ADD_3BIT_BRG(m_palette)
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_apc)
diff --git a/src/mame/drivers/apexc.cpp b/src/mame/drivers/apexc.cpp
index 55a00b4acae..f426671f772 100644
--- a/src/mame/drivers/apexc.cpp
+++ b/src/mame/drivers/apexc.cpp
@@ -377,7 +377,7 @@ void apexc_state::apexc(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_apexc);
- PALETTE(config, m_palette, ARRAY_LENGTH(palette_table)).set_init(FUNC(apexc_state::palette_init_apexc));
+ PALETTE(config, m_palette, FUNC(apexc_state::apexc_palette), ARRAY_LENGTH(palette_table));
APEXC_CYLINDER(config, m_cylinder);
APEXC_TAPE_PUNCHER(config, m_tape_puncher);
diff --git a/src/mame/drivers/apogee.cpp b/src/mame/drivers/apogee.cpp
index 4d12d4af250..c8aea01fc8d 100644
--- a/src/mame/drivers/apogee.cpp
+++ b/src/mame/drivers/apogee.cpp
@@ -30,8 +30,9 @@ class apogee_state : public radio86_state
{
public:
apogee_state(const machine_config &mconfig, device_type type, const char *tag)
- : radio86_state(mconfig, type, tag),
- m_speaker(*this, "speaker") { }
+ : radio86_state(mconfig, type, tag)
+ , m_speaker(*this, "speaker")
+ { }
void apogee(machine_config &config);
@@ -177,9 +178,8 @@ WRITE_LINE_MEMBER(apogee_state::pit8253_out2_changed)
I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels)
{
- int i;
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
- const uint8_t *charmap = m_charmap + (gpa & 1) * 0x400;
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
+ uint8_t const *const charmap = &m_charmap[(gpa & 1) * 0x400];
uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
if (vsp) {
pixels = 0;
@@ -190,7 +190,7 @@ I8275_DRAW_CHARACTER_MEMBER(apogee_state::display_pixels)
if (rvv) {
pixels ^= 0xff;
}
- for(i=0;i<6;i++) {
+ for(int i=0;i<6;i++) {
bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0];
}
}
@@ -250,7 +250,7 @@ void apogee_state::apogee(machine_config &config)
screen.set_visarea(0, 78*6-1, 0, 30*10-1);
GFXDECODE(config, "gfxdecode", m_palette, gfx_apogee);
- PALETTE(config, m_palette, 3).set_init(FUNC(apogee_state::palette_init_radio86));
+ PALETTE(config, m_palette, FUNC(apogee_state::radio86_palette), 3);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/apple1.cpp b/src/mame/drivers/apple1.cpp
index 2041e5b506b..258c0b5465d 100644
--- a/src/mame/drivers/apple1.cpp
+++ b/src/mame/drivers/apple1.cpp
@@ -134,7 +134,6 @@ private:
emu_timer *m_ready_start_timer, *m_ready_end_timer, *m_kbd_strobe_timer;
- DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(ram_r);
@@ -605,7 +604,7 @@ MACHINE_CONFIG_START(apple1_state::apple1)
MCFG_SCREEN_UPDATE_DRIVER(apple1_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
PIA6821(config, m_pia, 0);
m_pia->readpa_handler().set(FUNC(apple1_state::pia_keyboard_r));
diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp
index 5ecfb8f093a..4c8354f67b1 100644
--- a/src/mame/drivers/apple2.cpp
+++ b/src/mame/drivers/apple2.cpp
@@ -103,8 +103,8 @@ II Plus: RAM options reduced to 16/32/48 KB.
class apple2_state : public driver_device
{
public:
- apple2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ apple2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_screen(*this, "screen"),
m_scantimer(*this, "scantimer"),
@@ -150,7 +150,6 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_jp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -400,10 +399,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2_state::apple2_interrupt)
}
}
-PALETTE_INIT_MEMBER(apple2_state, apple2)
-{
- m_video->palette_init_apple2(palette);
-}
uint32_t apple2_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
@@ -1387,10 +1382,7 @@ MACHINE_CONFIG_START(apple2_state::apple2_common)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple2_state::screen_update));
- m_screen->set_palette("palette");
-
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(DEVICE_SELF, FUNC(apple2_state::palette_init_apple2));
+ m_screen->set_palette(m_video);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index 59b6c9d361e..814e8b335a4 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -204,12 +204,11 @@ Address bus A0-A11 is Y0-Y11
class apple2e_state : public driver_device
{
public:
- apple2e_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ apple2e_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_screen(*this, "screen"),
m_scantimer(*this, "scantimer"),
- m_palette(*this, "palette"),
m_ram(*this, RAM_TAG),
m_rom(*this, "maincpu"),
m_cecbanks(*this, "cecexp"),
@@ -252,7 +251,6 @@ public:
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<timer_device> m_scantimer;
- required_device<palette_device> m_palette;
required_device<ram_device> m_ram;
required_memory_region m_rom;
optional_memory_region m_cecbanks;
@@ -290,7 +288,6 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(apple2);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(ram0000_r);
@@ -1041,11 +1038,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2e_state::apple2_interrupt)
}
}
-PALETTE_INIT_MEMBER(apple2e_state, apple2)
-{
- m_video->palette_init_apple2(palette);
-}
-
uint32_t apple2e_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
bool old_page2 = m_video->m_page2;
@@ -3977,10 +3969,7 @@ MACHINE_CONFIG_START(apple2e_state::apple2e)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(1021800*14, (65*7)*2, 0, (40*7)*2, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple2e_state::screen_update));
- m_screen->set_palette("palette");
-
- PALETTE(config, m_palette, 16);
- m_palette->set_init(DEVICE_SELF, FUNC(apple2e_state::palette_init_apple2));
+ m_screen->set_palette(m_video);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp
index dd2e049a01c..50d6c4c7de0 100644
--- a/src/mame/drivers/apple2gs.cpp
+++ b/src/mame/drivers/apple2gs.cpp
@@ -357,7 +357,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(apple2gs);
+ void palette_init(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void apple2gs(machine_config &config);
@@ -1579,7 +1579,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(apple2gs_state::apple2_interrupt)
}
}
-PALETTE_INIT_MEMBER(apple2gs_state, apple2gs)
+void apple2gs_state::palette_init(palette_device &palette)
{
static const unsigned char apple2gs_palette[] =
{
@@ -4583,8 +4583,7 @@ void apple2gs_state::apple2gs(machine_config &config)
m_screen->set_visarea(0,703,0,230);
m_screen->set_screen_update(FUNC(apple2gs_state::screen_update));
- palette_device &palette(PALETTE(config, "palette", 256));
- palette.set_init(DEVICE_SELF, FUNC(apple2gs_state::palette_init_apple2gs));
+ PALETTE(config, "palette", FUNC(apple2gs_state::palette_init), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/apple3.cpp b/src/mame/drivers/apple3.cpp
index 1b046a39128..48557d211f9 100644
--- a/src/mame/drivers/apple3.cpp
+++ b/src/mame/drivers/apple3.cpp
@@ -72,12 +72,12 @@ void apple3_state::apple3(machine_config &config)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(14.318181_MHz_XTAL, 910, 0, 560, 262, 0, 192);
m_screen->set_screen_update(FUNC(apple3_state::screen_update));
- m_screen->set_palette("palette");
+ m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(m_via[1], FUNC(via6522_device::write_cb1));
m_screen->screen_vblank().append(m_via[1], FUNC(via6522_device::write_cb2));
m_screen->screen_vblank().append(FUNC(apple3_state::vbl_w));
- PALETTE(config, m_palette, 32).set_init(FUNC(apple3_state::palette_init_apple3));
+ PALETTE(config, m_palette, FUNC(apple3_state::palette_init), 32);
/* keyboard controller */
AY3600(config, m_ay3600, 0);
diff --git a/src/mame/drivers/applix.cpp b/src/mame/drivers/applix.cpp
index f0bdabb9ec8..2176f468202 100644
--- a/src/mame/drivers/applix.cpp
+++ b/src/mame/drivers/applix.cpp
@@ -100,12 +100,17 @@ public:
m_io_k3b0(*this, "K3b_0"),
m_io_k0b(*this, "K0b"),
m_expansion(*this, "expansion"),
- m_palette(*this, "palette"){ }
+ m_palette(*this, "palette")
+ { }
void applix(machine_config &config);
void init_applix();
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
DECLARE_READ16_MEMBER(applix_inputs_r);
DECLARE_WRITE16_MEMBER(palette_w);
@@ -143,11 +148,10 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(cass_timer);
MC6845_UPDATE_ROW(crtc_update_row);
+ void applix_palette(palette_device &palette) const;
+
uint8_t m_video_latch;
uint8_t m_pa;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(applix);
uint8_t m_palette_latch[4];
required_shared_ptr<uint16_t> m_base;
@@ -756,33 +760,28 @@ static void applix_floppies(device_slot_interface &device)
}
-PALETTE_INIT_MEMBER(applix_state, applix)
-{ // shades need to be verified - the names on the right are from the manual
- const uint8_t colors[16*3] = {
- 0x00, 0x00, 0x00, // 0 Black
- 0x40, 0x40, 0x40, // 1 Dark Grey
- 0x00, 0x00, 0x80, // 2 Dark Blue
- 0x00, 0x00, 0xff, // 3 Mid Blue
- 0x00, 0x80, 0x00, // 4 Dark Green
- 0x00, 0xff, 0x00, // 5 Green
- 0x00, 0xff, 0xff, // 6 Blue Grey
- 0x00, 0x7f, 0x7f, // 7 Light Blue
- 0x7f, 0x00, 0x00, // 8 Dark Red
- 0xff, 0x00, 0x00, // 9 Red
- 0x7f, 0x00, 0x7f, // 10 Dark Violet
- 0xff, 0x00, 0xff, // 11 Violet
- 0x7f, 0x7f, 0x00, // 12 Brown
- 0xff, 0xff, 0x00, // 13 Yellow
- 0xbf, 0xbf, 0xbf, // 14 Light Grey
- 0xff, 0xff, 0xff }; // 15 White
-
- uint8_t r, b, g, i, color_count = 0;
-
- for (i = 0; i < 48; color_count++)
- {
- r = colors[i++]; g = colors[i++]; b = colors[i++];
- palette.set_pen_color(color_count, rgb_t(r, g, b));
- }
+void applix_state::applix_palette(palette_device &palette) const
+{
+ // shades need to be verified - the names on the right are from the manual
+ constexpr rgb_t colors[16] = {
+ { 0x00, 0x00, 0x00 }, // 0 Black
+ { 0x40, 0x40, 0x40 }, // 1 Dark Grey
+ { 0x00, 0x00, 0x80 }, // 2 Dark Blue
+ { 0x00, 0x00, 0xff }, // 3 Mid Blue
+ { 0x00, 0x80, 0x00 }, // 4 Dark Green
+ { 0x00, 0xff, 0x00 }, // 5 Green
+ { 0x00, 0xff, 0xff }, // 6 Blue Grey
+ { 0x00, 0x7f, 0x7f }, // 7 Light Blue
+ { 0x7f, 0x00, 0x00 }, // 8 Dark Red
+ { 0xff, 0x00, 0x00 }, // 9 Red
+ { 0x7f, 0x00, 0x7f }, // 10 Dark Violet
+ { 0xff, 0x00, 0xff }, // 11 Violet
+ { 0x7f, 0x7f, 0x00 }, // 12 Brown
+ { 0xff, 0xff, 0x00 }, // 13 Yellow
+ { 0xbf, 0xbf, 0xbf }, // 14 Light Grey
+ { 0xff, 0xff, 0xff } }; // 15 White
+
+ palette.set_pen_colors(0, colors);
}
@@ -792,32 +791,31 @@ void applix_state::video_start()
MC6845_UPDATE_ROW( applix_state::crtc_update_row )
{
-// The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4.
-// Need to display a border colour.
-// There is a monochrome mode, but no info found as yet.
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
- uint8_t i;
- uint16_t chr,x;
- uint32_t mem, vidbase = (m_video_latch & 15) << 14, *p = &bitmap.pix32(y);
-
- for (x = 0; x < x_count; x++)
+ // The display is bitmapped. 2 modes are supported here, 320x200x16 and 640x200x4.
+ // Need to display a border colour.
+ // There is a monochrome mode, but no info found as yet.
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
+ uint32_t const vidbase = (m_video_latch & 15) << 14;
+ uint32_t *p = &bitmap.pix32(y);
+
+ for (uint16_t x = 0; x < x_count; x++)
{
- mem = vidbase + ma + x + (ra<<12);
- chr = m_base[mem];
+ uint32_t const mem = vidbase + ma + x + (ra<<12);
+ uint16_t chr = m_base[mem];
if (BIT(m_pa, 3))
- // 640 x 200 x 4of16 mode
{
- for (i = 0; i < 8; i++)
+ // 640 x 200 x 4of16 mode
+ for (int i = 0; i < 8; i++)
{
*p++ = palette[m_palette_latch[chr>>14]];
chr <<= 2;
}
}
else
- // 320 x 200 x 16 mode
{
- for (i = 0; i < 4; i++)
+ // 320 x 200 x 16 mode
+ for (int i = 0; i < 4; i++)
{
*p++ = palette[chr>>12];
*p++ = palette[chr>>12];
@@ -875,8 +873,7 @@ MACHINE_CONFIG_START(applix_state::applix)
MCFG_SCREEN_SIZE(640, 200)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(applix_state, applix)
+ PALETTE(config, m_palette, FUNC(applix_state::applix_palette), 16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/appoooh.cpp b/src/mame/drivers/appoooh.cpp
index 4fbd4eaaff7..13d0bf38bde 100644
--- a/src/mame/drivers/appoooh.cpp
+++ b/src/mame/drivers/appoooh.cpp
@@ -457,12 +457,10 @@ MACHINE_CONFIG_START(appoooh_state::appoooh)
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(appoooh_state, screen_update_appoooh)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_appoooh)
- MCFG_PALETTE_ADD("palette", 32*8+32*8)
-
- MCFG_PALETTE_INIT_OWNER(appoooh_state,appoooh)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_appoooh);
+ PALETTE(config, m_palette, FUNC(appoooh_state::appoooh_palette), 32*8+32*8);
MACHINE_CONFIG_END
@@ -479,12 +477,10 @@ MACHINE_CONFIG_START(appoooh_state::robowres)
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(appoooh_state, screen_update_robowres)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_robowres)
- MCFG_PALETTE_ADD("palette", 32*8+32*8)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_INIT_OWNER(appoooh_state,robowres)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_robowres);
+ PALETTE(config, m_palette, FUNC(appoooh_state::robowres_palette), 32*8+32*8);
MACHINE_CONFIG_END
void appoooh_state::robowrese(machine_config &config)
diff --git a/src/mame/drivers/apricot.cpp b/src/mame/drivers/apricot.cpp
index 77d1e46ffc7..5ccd0e5c225 100644
--- a/src/mame/drivers/apricot.cpp
+++ b/src/mame/drivers/apricot.cpp
@@ -385,8 +385,7 @@ void apricot_state::apricot(machine_config &config)
screen.set_refresh_hz(72);
screen.set_screen_update(FUNC(apricot_state::screen_update_apricot));
- PALETTE(config, m_palette, 3);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
HD6845(config, m_crtc, 15_MHz_XTAL / 10);
m_crtc->set_screen("screen");
diff --git a/src/mame/drivers/aquarium.cpp b/src/mame/drivers/aquarium.cpp
index 362a36be814..0f3dd904512 100644
--- a/src/mame/drivers/aquarium.cpp
+++ b/src/mame/drivers/aquarium.cpp
@@ -308,11 +308,10 @@ MACHINE_CONFIG_START(aquarium_state::aquarium)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 42*8-1, 2*8, 34*8-1)
MCFG_SCREEN_UPDATE_DRIVER(aquarium_state, screen_update_aquarium)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aquarium)
- MCFG_PALETTE_ADD("palette", 0x1000/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_aquarium)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x1000/2);
MCFG_DEVICE_ADD("spritegen", EXCELLENT_SPRITE, 0)
diff --git a/src/mame/drivers/aquarius.cpp b/src/mame/drivers/aquarius.cpp
index 582f7233628..e7eb7728d4f 100644
--- a/src/mame/drivers/aquarius.cpp
+++ b/src/mame/drivers/aquarius.cpp
@@ -363,18 +363,15 @@ MACHINE_CONFIG_START(aquarius_state::aquarius)
MCFG_SCREEN_SIZE(40 * 8, 25 * 8)
MCFG_SCREEN_VISIBLE_AREA(0, 40 * 8 - 1, 0 * 8, 25 * 8 - 1)
MCFG_SCREEN_UPDATE_DRIVER(aquarius_state, screen_update_aquarius)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_aquarius)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_aquarius);
MCFG_TEA1002_ADD("encoder", XTAL(8'867'238))
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(aquarius_state, aquarius)
+ PALETTE(config, m_palette, FUNC(aquarius_state::aquarius_palette), 512, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
ay8910_device &ay8910(AY8910(config, "ay8910", XTAL(3'579'545)/2)); // ??? AY-3-8914
ay8910.port_a_read_callback().set_ioport("RIGHT");
diff --git a/src/mame/drivers/arabian.cpp b/src/mame/drivers/arabian.cpp
index fa4f494b14c..b667760b5cf 100644
--- a/src/mame/drivers/arabian.cpp
+++ b/src/mame/drivers/arabian.cpp
@@ -386,7 +386,7 @@ void arabian_state::arabian(machine_config &config)
screen.set_screen_update(FUNC(arabian_state::screen_update_arabian));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 256*32).set_init(FUNC(arabian_state::palette_init_arabian));
+ PALETTE(config, m_palette, FUNC(arabian_state::arabian_palette), 256 * 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/arcadecl.cpp b/src/mame/drivers/arcadecl.cpp
index f56a090ed1e..944b0305ad4 100644
--- a/src/mame/drivers/arcadecl.cpp
+++ b/src/mame/drivers/arcadecl.cpp
@@ -332,9 +332,9 @@ MACHINE_CONFIG_START(sparkz_state::sparkz)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_arcadecl)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
+ palette_device &palette(PALETTE(config, "palette"));
+ palette.set_format(palette_device::IRGB_1555, 512);
+ palette.set_membits(8);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
diff --git a/src/mame/drivers/arcadia.cpp b/src/mame/drivers/arcadia.cpp
index 445ba4bcb4a..a385743900a 100644
--- a/src/mame/drivers/arcadia.cpp
+++ b/src/mame/drivers/arcadia.cpp
@@ -439,7 +439,7 @@ static const unsigned short arcadia_palette[128+8] = /* bgnd, fgnd */
7,0, 7,1, 7,2, 7,3, 7,4, 7,5, 7,6, 7,7
};
-PALETTE_INIT_MEMBER(arcadia_state, arcadia)
+void arcadia_state::palette_init(palette_device &palette) const
{
for (int i = 0; i < 8; i++)
palette.set_indirect_color(i, arcadia_colors[i]);
@@ -491,14 +491,11 @@ void arcadia_state::arcadia(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_arcadia);
- PALETTE(config, m_palette, ARRAY_LENGTH(arcadia_palette));
- m_palette->set_indirect_entries(8);
- m_palette->set_init(FUNC(arcadia_state::palette_init_arcadia));
+ PALETTE(config, m_palette, FUNC(arcadia_state::palette_init), ARRAY_LENGTH(arcadia_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- ARCADIA_SOUND(config, m_custom);
- m_custom->add_route(ALL_OUTPUTS, "mono", 1.00);
+ ARCADIA_SOUND(config, m_custom).add_route(ALL_OUTPUTS, "mono", 1.00);
/* cartridge */
EA2001_CART_SLOT(config, "cartslot", arcadia_cart, nullptr);
diff --git a/src/mame/drivers/aristmk4.cpp b/src/mame/drivers/aristmk4.cpp
index 5c19ba0b82c..3c2b35a11e9 100644
--- a/src/mame/drivers/aristmk4.cpp
+++ b/src/mame/drivers/aristmk4.cpp
@@ -355,8 +355,8 @@ uint8_t crtc_reg = 0;
class aristmk4_state : public driver_device
{
public:
- aristmk4_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ aristmk4_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_rtc(*this, "rtc"),
m_ay1(*this, "ay1"),
@@ -451,8 +451,8 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- void aristmk4_palette(palette_device &palette);
- void lions_palette(palette_device &palette);
+ void aristmk4_palette(palette_device &palette) const;
+ void lions_palette(palette_device &palette) const;
uint32_t screen_update_aristmk4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(note_input_reset);
TIMER_CALLBACK_MEMBER(coin_input_reset);
@@ -1701,7 +1701,7 @@ READ8_MEMBER(aristmk4_state::pc1_r)
}
/* same as Casino Winner HW */
-void aristmk4_state::aristmk4_palette(palette_device &palette)
+void aristmk4_state::aristmk4_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -1801,8 +1801,7 @@ void aristmk4_state::aristmk4(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_aristmk4);
- PALETTE(config, m_palette, 512);
- m_palette->set_init(DEVICE_SELF, FUNC(aristmk4_state::aristmk4_palette));
+ PALETTE(config, m_palette, FUNC(aristmk4_state::aristmk4_palette), 512);
i8255_device &ppi(I8255A(config, "ppi8255_0"));
ppi.in_pa_callback().set(FUNC(aristmk4_state::pa1_r));
@@ -1861,7 +1860,7 @@ void aristmk4_state::aristmk4_poker(machine_config &config)
}
/* same as Aristocrat Mark-IV HW color offset 7 */
-void aristmk4_state::lions_palette(palette_device &palette)
+void aristmk4_state::lions_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
{
@@ -1876,7 +1875,7 @@ void aristmk4_state::lions_palette(palette_device &palette)
void aristmk4_state::_86lions(machine_config &config)
{
aristmk4(config);
- m_palette->set_init(DEVICE_SELF, FUNC(aristmk4_state::lions_palette));
+ m_palette->set_init(FUNC(aristmk4_state::lions_palette));
}
ROM_START( 3bagflvt )
diff --git a/src/mame/drivers/aristmk5.cpp b/src/mame/drivers/aristmk5.cpp
index aaa50342aaa..d23c73f8cd0 100644
--- a/src/mame/drivers/aristmk5.cpp
+++ b/src/mame/drivers/aristmk5.cpp
@@ -2286,7 +2286,7 @@ void aristmk5_state::aristmk5(machine_config &config)
m_screen->set_visarea(0, 640-1, 0, 400-1);
m_screen->set_screen_update(FUNC(archimedes_state::screen_update));
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
EEPROM_93C56_16BIT(config, m_eeprom[0]);
EEPROM_93C56_16BIT(config, m_eeprom[1]);
diff --git a/src/mame/drivers/aristmk6.cpp b/src/mame/drivers/aristmk6.cpp
index c731c6c6554..e78eda78a1c 100644
--- a/src/mame/drivers/aristmk6.cpp
+++ b/src/mame/drivers/aristmk6.cpp
@@ -364,7 +364,7 @@ void aristmk6_state::aristmk6(machine_config &config)
screen.set_visarea(0, 640-1, 0, 480-1);
screen.set_screen_update(FUNC(aristmk6_state::screen_update_aristmk6));
- PALETTE(config, m_palette, 0x1000);
+ PALETTE(config, m_palette).set_entries(0x1000);
}
#define ROM_LOAD32_WORD_BIOS(bios, name, offset, length, hash) \
diff --git a/src/mame/drivers/arkanoid.cpp b/src/mame/drivers/arkanoid.cpp
index 60aeee05d60..f66b40b9867 100644
--- a/src/mame/drivers/arkanoid.cpp
+++ b/src/mame/drivers/arkanoid.cpp
@@ -1366,10 +1366,10 @@ MACHINE_CONFIG_START(arkanoid_state::arkanoid)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ARKANOID_PIXEL_CLOCK,ARKANOID_HTOTAL,ARKANOID_HBEND,ARKANOID_HBSTART,ARKANOID_VTOTAL,ARKANOID_VBEND,ARKANOID_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(arkanoid_state, screen_update_arkanoid)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_arkanoid)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 512)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1440,10 +1440,10 @@ MACHINE_CONFIG_START(arkanoid_state::hexa)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ARKANOID_PIXEL_CLOCK,ARKANOID_HTOTAL,ARKANOID_HBEND,ARKANOID_HBSTART,ARKANOID_VTOTAL,ARKANOID_VBEND,ARKANOID_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(arkanoid_state, screen_update_hexa)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hexa)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1483,10 +1483,10 @@ MACHINE_CONFIG_START(arkanoid_state::brixian)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(ARKANOID_PIXEL_CLOCK,ARKANOID_HTOTAL,ARKANOID_HBEND,ARKANOID_HBSTART,ARKANOID_VTOTAL,ARKANOID_VBEND,ARKANOID_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(arkanoid_state, screen_update_hexa)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_arkanoid)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 512)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/armedf.cpp b/src/mame/drivers/armedf.cpp
index 82e63e58ac2..17b1766d8ed 100644
--- a/src/mame/drivers/armedf.cpp
+++ b/src/mame/drivers/armedf.cpp
@@ -1286,18 +1286,16 @@ MACHINE_CONFIG_START(armedf_state::terraf)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 1*8, 31*8-1 )
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
-
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
@@ -1325,17 +1323,16 @@ MACHINE_CONFIG_START(armedf_state::terrafjb)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 1*8, 31*8-1 )
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1372,17 +1369,16 @@ MACHINE_CONFIG_START(armedf_state::kozure)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 1*8, 31*8-1 ) // 320 x 240, trusted
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
@@ -1406,17 +1402,16 @@ MACHINE_CONFIG_START(armedf_state::armedf)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 1*8, 31*8-1 )
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,armedf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1453,17 +1448,16 @@ MACHINE_CONFIG_START(armedf_state::cclimbr2)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 )
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1495,17 +1489,16 @@ MACHINE_CONFIG_START(armedf_state::legion_common)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(14*8, (64-14)*8-1, 2*8, 30*8-1 )
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,terraf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1568,17 +1561,16 @@ MACHINE_CONFIG_START(bigfghtr_state::bigfghtr)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(16'000'000)/2,531,12*8,(64-12)*8, 254, 1*8, 31*8) // guess, matches 59.3 Hz from reference - measured at 59.1358Hz
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(armedf_state,armedf)
MCFG_SCREEN_UPDATE_DRIVER(armedf_state, screen_update_armedf)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_armedf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_armedf);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
terraf_sound(config);
diff --git a/src/mame/drivers/arsystems.cpp b/src/mame/drivers/arsystems.cpp
index b69cd520ac9..65fc15671c8 100644
--- a/src/mame/drivers/arsystems.cpp
+++ b/src/mame/drivers/arsystems.cpp
@@ -313,8 +313,7 @@ MACHINE_CONFIG_START(arcadia_amiga_state::arcadia)
/* video hardware */
ntsc_video(config);
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INIT_OWNER(arcadia_amiga_state,amiga)
+ PALETTE(config, m_palette, FUNC(arcadia_amiga_state::amiga_palette), 4096);
MCFG_VIDEO_START_OVERRIDE(arcadia_amiga_state,amiga)
diff --git a/src/mame/drivers/ashnojoe.cpp b/src/mame/drivers/ashnojoe.cpp
index 36a7c215834..5833f8c1f62 100644
--- a/src/mame/drivers/ashnojoe.cpp
+++ b/src/mame/drivers/ashnojoe.cpp
@@ -316,7 +316,6 @@ MACHINE_CONFIG_START(ashnojoe_state::ashnojoe)
MCFG_DEVICE_PROGRAM_MAP(sound_map)
MCFG_DEVICE_IO_MAP(sound_portmap)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -326,9 +325,8 @@ MACHINE_CONFIG_START(ashnojoe_state::ashnojoe)
MCFG_SCREEN_UPDATE_DRIVER(ashnojoe_state, screen_update_ashnojoe)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ashnojoe)
- MCFG_PALETTE_ADD("palette", 0x1000/2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ashnojoe);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x1000/2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/asterix.cpp b/src/mame/drivers/asterix.cpp
index ea2e9b92fe8..3c1bb313420 100644
--- a/src/mame/drivers/asterix.cpp
+++ b/src/mame/drivers/asterix.cpp
@@ -281,9 +281,7 @@ void asterix_state::asterix(machine_config &config)
screen.set_screen_update(FUNC(asterix_state::screen_update_asterix));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- palette.enable_shadows();
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(asterix_state::tile_callback), this);
diff --git a/src/mame/drivers/astinvad.cpp b/src/mame/drivers/astinvad.cpp
index 5ef752ce9b8..81af8cee125 100644
--- a/src/mame/drivers/astinvad.cpp
+++ b/src/mame/drivers/astinvad.cpp
@@ -60,7 +60,7 @@ public:
, m_samples(*this, "samples")
, m_screen(*this, "screen")
, m_color_prom(*this, "proms")
- { }
+ { }
void spcking2(machine_config &config);
void spaceint(machine_config &config);
@@ -692,8 +692,7 @@ void astinvad_state::kamikaze(machine_config &config)
m_screen->set_raw(VIDEO_CLOCK, 320, 0, 256, 256, 32, 256);
m_screen->set_screen_update(FUNC(astinvad_state::screen_update_astinvad));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -738,8 +737,7 @@ void astinvad_state::spaceint(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->set_screen_update(FUNC(astinvad_state::screen_update_spaceint));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rbg));
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/astrcorp.cpp b/src/mame/drivers/astrcorp.cpp
index fd77b86e208..9ed45d4c9ba 100644
--- a/src/mame/drivers/astrcorp.cpp
+++ b/src/mame/drivers/astrcorp.cpp
@@ -51,8 +51,8 @@ To do:
class astrocorp_state : public driver_device
{
public:
- astrocorp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ astrocorp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
@@ -73,6 +73,10 @@ public:
void init_showhanc();
void init_showhand();
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
// devices
required_device<cpu_device> m_maincpu;
@@ -90,6 +94,9 @@ private:
bitmap_ind16 m_bitmap;
uint16_t m_screen_enable;
uint16_t m_draw_sprites;
+
+ output_finder<7> m_lamps;
+
DECLARE_WRITE16_MEMBER(astrocorp_draw_sprites_w);
DECLARE_WRITE16_MEMBER(astrocorp_eeprom_w);
DECLARE_WRITE16_MEMBER(showhand_outputs_w);
@@ -98,7 +105,6 @@ private:
DECLARE_READ16_MEMBER(astrocorp_unk_r);
DECLARE_WRITE16_MEMBER(astrocorp_sound_bank_w);
DECLARE_WRITE16_MEMBER(skilldrp_sound_bank_w);
- DECLARE_VIDEO_START(astrocorp);
uint32_t screen_update_astrocorp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(skilldrp_scanline);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -107,17 +113,13 @@ private:
void showhand_map(address_map &map);
void skilldrp_map(address_map &map);
void speeddrp_map(address_map &map);
-
- virtual void machine_start() override;
-
- output_finder<7> m_lamps;
};
/***************************************************************************
Video
***************************************************************************/
-VIDEO_START_MEMBER(astrocorp_state,astrocorp)
+void astrocorp_state::video_start()
{
m_screen->register_screen_bitmap(m_bitmap);
@@ -542,13 +544,10 @@ MACHINE_CONFIG_START(astrocorp_state::showhand)
// MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 240-1)
MCFG_SCREEN_RAW_PARAMS(ASTROCORP_PIXEL_CLOCK,ASTROCORP_HTOTAL,ASTROCORP_HBEND,320,ASTROCORP_VTOTAL,ASTROCORP_VBEND,ASTROCORP_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(astrocorp_state, screen_update_astrocorp)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_astrocorp)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(BBBBBGGGGGGRRRRR)
-
- MCFG_VIDEO_START_OVERRIDE(astrocorp_state,astrocorp)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_astrocorp);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_565, 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -597,13 +596,10 @@ MACHINE_CONFIG_START(astrocorp_state::skilldrp)
// MCFG_SCREEN_VISIBLE_AREA(0, 0x200-1, 0, 0xf0-1)
MCFG_SCREEN_RAW_PARAMS(ASTROCORP_PIXEL_CLOCK,ASTROCORP_HTOTAL,ASTROCORP_HBEND,512,ASTROCORP_VTOTAL,ASTROCORP_VBEND,ASTROCORP_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(astrocorp_state, screen_update_astrocorp)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_astrocorp)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(BBBBBGGGGGGRRRRR)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_VIDEO_START_OVERRIDE(astrocorp_state,astrocorp)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_astrocorp);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_565, 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/astrocde.cpp b/src/mame/drivers/astrocde.cpp
index 21f8df3503e..087a24728d5 100644
--- a/src/mame/drivers/astrocde.cpp
+++ b/src/mame/drivers/astrocde.cpp
@@ -1183,7 +1183,7 @@ void astrocde_state::astrocade_base(machine_config &config)
/* each game has its own map */
/* video hardware */
- PALETTE(config, m_palette, 512).set_init(FUNC(astrocde_state::palette_init_astrocde));
+ PALETTE(config, m_palette, FUNC(astrocde_state::astrocade_palette), 512);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(ASTROCADE_CLOCK, 455, 0, 352, 262, 0, 240);
@@ -1203,7 +1203,7 @@ void astrocde_state::astrocade_16color_base(machine_config &config)
/* video hardware */
m_palette->set_entries(4096);
- m_palette->set_init(FUNC(astrocde_state::palette_init_profpac));
+ m_palette->set_init(FUNC(astrocde_state::profpac_palette));
MCFG_VIDEO_START_OVERRIDE(astrocde_state,profpac)
diff --git a/src/mame/drivers/astrohome.cpp b/src/mame/drivers/astrohome.cpp
index 8284bd1312f..ceceb0c6dc5 100644
--- a/src/mame/drivers/astrohome.cpp
+++ b/src/mame/drivers/astrohome.cpp
@@ -229,7 +229,7 @@ void astrocde_home_state::astrocde(machine_config &config)
m_screen->set_screen_update(FUNC(astrocde_state::screen_update_astrocde));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 512).set_init(FUNC(astrocde_state::palette_init_astrocde));
+ PALETTE(config, "palette", FUNC(astrocde_home_state::astrocade_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/at.cpp b/src/mame/drivers/at.cpp
index db41a117bd9..4203aa68285 100644
--- a/src/mame/drivers/at.cpp
+++ b/src/mame/drivers/at.cpp
@@ -706,7 +706,7 @@ void megapc_state::megapc(machine_config &config)
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50);
// video hardware
- PALETTE(config, "palette", 256); // todo: really needed?
+ PALETTE(config, "palette").set_entries(256); // todo: really needed?
/* software lists */
SOFTWARE_LIST(config, "disk_list").set_original("megapc");
diff --git a/src/mame/drivers/atari400.cpp b/src/mame/drivers/atari400.cpp
index e5867a55297..03a5c7ba990 100644
--- a/src/mame/drivers/atari400.cpp
+++ b/src/mame/drivers/atari400.cpp
@@ -42,6 +42,7 @@
#include "emu.h"
#include "includes/atari400.h"
+
#include "cpu/m6502/m6502.h"
#include "machine/6821pia.h"
#include "machine/ram.h"
@@ -50,9 +51,11 @@
#include "sound/dac.h"
#include "sound/pokey.h"
#include "sound/volt_reg.h"
+
#include "bus/a800/a800_slot.h"
#include "bus/a800/a800_carts.h"
#include "bus/a800/a8sio.h"
+
#include "screen.h"
#include "softlist.h"
#include "speaker.h"
@@ -278,7 +281,7 @@ private:
DECLARE_MACHINE_START(a800);
DECLARE_MACHINE_START(a800xl);
DECLARE_MACHINE_START(a5200);
- DECLARE_PALETTE_INIT(a400);
+ void a400_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(a400);
@@ -1032,7 +1035,7 @@ dependent upon display type.
*
**************************************************************/
-static const uint8_t atari_palette[256*3] =
+static const uint8_t atari_colors[256*3] =
{
/* Grey */
0x00,0x00,0x00, 0x11,0x11,0x11, 0x22,0x22,0x22, 0x33,0x33,0x33,
@@ -1118,12 +1121,10 @@ static const uint8_t atari_palette[256*3] =
/* Initialise the palette */
-PALETTE_INIT_MEMBER(a400_state, a400)
+void a400_state::a400_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(atari_palette) / 3; i++ )
- {
- palette.set_pen_color(i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]);
- }
+ for (unsigned i = 0; i < ARRAY_LENGTH(atari_colors) / 3; i++)
+ palette.set_pen_color(i, atari_colors[i * 3], atari_colors[i * 3 + 1], atari_colors[i * 3 + 2]);
}
/******************************************************************
PALETTE - PHASE 24.7 SHIFT
@@ -2123,7 +2124,7 @@ void a400_state::atari_common_nodac(machine_config &config)
m_screen->set_screen_update("antic", FUNC(antic_device::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", sizeof(atari_palette) / 3).set_init(FUNC(a400_state::palette_init_a400));
+ PALETTE(config, "palette", FUNC(a400_state::a400_palette), ARRAY_LENGTH(atari_colors) / 3);
PIA6821(config, m_pia, 0);
m_pia->readpa_handler().set_ioport("djoy_0_1");
@@ -2155,10 +2156,9 @@ void a400_state::atari_common_nodac(machine_config &config)
void a400_state::atari_common(machine_config &config)
{
atari_common_nodac(config);
+
DAC_1BIT(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.03);
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref", 0));
- vref.set_output(5.0);
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
+ VOLTAGE_REGULATOR(config, "vref", 0).set_output(5.0).add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
/* internal ram */
RAM(config, m_ram).set_default_size("48K");
diff --git a/src/mame/drivers/atarifb.cpp b/src/mame/drivers/atarifb.cpp
index 633d3f2322a..578b377fcac 100644
--- a/src/mame/drivers/atarifb.cpp
+++ b/src/mame/drivers/atarifb.cpp
@@ -106,6 +106,7 @@
#include "emu.h"
#include "includes/atarifb.h"
+
#include "cpu/m6502/m6502.h"
#include "machine/watchdog.h"
#include "sound/discrete.h"
@@ -121,25 +122,25 @@
*
*************************************/
-PALETTE_INIT_MEMBER(atarifb_state, atarifb)
+void atarifb_state::atarifb_palette(palette_device &palette) const
{
- /* chars */
- palette.set_pen_color(0, rgb_t(0xff,0xff,0xff)); /* white */
- palette.set_pen_color(1, rgb_t(0x00,0x00,0x00)); /* black */
-
- /* sprites */
- palette.set_pen_color(2, rgb_t(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
- palette.set_pen_color(3, rgb_t(0xff,0xff,0xff)); /* white */
- palette.set_pen_color(4, rgb_t(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
- palette.set_pen_color(5, rgb_t(0x00,0x00,0x00)); /* black */
-
- /* sprite masks */
- palette.set_pen_color(6, rgb_t(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
- palette.set_pen_color(7, rgb_t(0x80,0x80,0x80)); /* grey */
- palette.set_pen_color(8, rgb_t(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
- palette.set_pen_color(9, rgb_t(0x00,0x00,0x00)); /* black */
- palette.set_pen_color(10, rgb_t(0x40,0x40,0x40)); /* dark grey (?) - used in Soccer only */
- palette.set_pen_color(11, rgb_t(0xff,0xff,0xff)); /* white */
+ // chars
+ palette.set_pen_color(0, rgb_t(0xff,0xff,0xff)); // white
+ palette.set_pen_color(1, rgb_t(0x00,0x00,0x00)); // black
+
+ // sprites
+ palette.set_pen_color(2, rgb_t(0x40,0x40,0x40)); // dark grey (?) - used in Soccer only
+ palette.set_pen_color(3, rgb_t(0xff,0xff,0xff)); // white
+ palette.set_pen_color(4, rgb_t(0x40,0x40,0x40)); // dark grey (?) - used in Soccer only
+ palette.set_pen_color(5, rgb_t(0x00,0x00,0x00)); // black
+
+ // sprite masks
+ palette.set_pen_color(6, rgb_t(0x40,0x40,0x40)); // dark grey (?) - used in Soccer only
+ palette.set_pen_color(7, rgb_t(0x80,0x80,0x80)); // grey
+ palette.set_pen_color(8, rgb_t(0x40,0x40,0x40)); // dark grey (?) - used in Soccer only
+ palette.set_pen_color(9, rgb_t(0x00,0x00,0x00)); // black
+ palette.set_pen_color(10, rgb_t(0x40,0x40,0x40)); // dark grey (?) - used in Soccer only
+ palette.set_pen_color(11, rgb_t(0xff,0xff,0xff)); // white
}
@@ -572,11 +573,10 @@ MACHINE_CONFIG_START(atarifb_state::atarifb)
MCFG_SCREEN_SIZE(38*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 38*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(atarifb_state, screen_update_atarifb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_atarifb)
- MCFG_PALETTE_ADD("palette", 12)
- MCFG_PALETTE_INIT_OWNER(atarifb_state, atarifb)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_atarifb)
+ PALETTE(config, m_palette, FUNC(atarifb_state::atarifb_palette), 12);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/atarig1.cpp b/src/mame/drivers/atarig1.cpp
index c8d614d4607..4e360ca8267 100644
--- a/src/mame/drivers/atarig1.cpp
+++ b/src/mame/drivers/atarig1.cpp
@@ -411,8 +411,7 @@ MACHINE_CONFIG_START(atarig1_state::atarig1)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_atarig1)
- MCFG_PALETTE_ADD("palette", 1280)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 1280);
/* initialize the playfield */
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, atarig1_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,64)
diff --git a/src/mame/drivers/atarig42.cpp b/src/mame/drivers/atarig42.cpp
index 91db2497096..520a76e39a8 100644
--- a/src/mame/drivers/atarig42.cpp
+++ b/src/mame/drivers/atarig42.cpp
@@ -526,8 +526,7 @@ MACHINE_CONFIG_START(atarig42_state::atarig42)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_atarig42)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
MCFG_TILEMAP_ADD_CUSTOM("playfield", "gfxdecode", 2, atarig42_state, get_playfield_tile_info, 8,8, atarig42_playfield_scan, 128,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, atarig42_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
diff --git a/src/mame/drivers/atarigx2.cpp b/src/mame/drivers/atarigx2.cpp
index 6dc89438469..330245e37e5 100644
--- a/src/mame/drivers/atarigx2.cpp
+++ b/src/mame/drivers/atarigx2.cpp
@@ -1505,8 +1505,7 @@ MACHINE_CONFIG_START(atarigx2_state::atarigx2)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_atarigx2)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
MCFG_TILEMAP_ADD_CUSTOM("playfield", "gfxdecode", 2, atarigx2_state, get_playfield_tile_info, 8,8, atarigx2_playfield_scan, 128,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, atarigx2_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
diff --git a/src/mame/drivers/atarist.cpp b/src/mame/drivers/atarist.cpp
index 4b86c5348d4..c50ddb578ff 100644
--- a/src/mame/drivers/atarist.cpp
+++ b/src/mame/drivers/atarist.cpp
@@ -2089,7 +2089,7 @@ void st_state::st(machine_config &config)
m_screen->set_screen_update(FUNC(st_state::screen_update));
m_screen->set_raw(Y2/2, ATARIST_HTOT_PAL*2, ATARIST_HBEND_PAL*2, ATARIST_HBSTART_PAL*2, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -2121,7 +2121,7 @@ void megast_state::megast(machine_config &config)
m_screen->set_screen_update(FUNC(megast_state::screen_update));
m_screen->set_raw(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -2156,7 +2156,7 @@ void ste_state::ste(machine_config &config)
m_screen->set_screen_update(FUNC(ste_state::screen_update));
m_screen->set_raw(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
// sound hardware
SPEAKER(config, "lspeaker").front_left();
@@ -2217,7 +2217,7 @@ void stbook_state::stbook(machine_config &config)
m_screen->set_size(640, 400);
m_screen->set_visarea(0, 639, 0, 399);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/atarisy1.cpp b/src/mame/drivers/atarisy1.cpp
index 4c5f7dab455..251ecf21fb5 100644
--- a/src/mame/drivers/atarisy1.cpp
+++ b/src/mame/drivers/atarisy1.cpp
@@ -754,8 +754,7 @@ MACHINE_CONFIG_START(atarisy1_state::atarisy1)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_atarisy1)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(IIIIRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::IRGB_4444, 1024);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, atarisy1_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, atarisy1_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
@@ -769,7 +768,7 @@ MACHINE_CONFIG_START(atarisy1_state::atarisy1)
/* video timing comes from an 82S163 (H) and an 82S129 (V) */
MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(atarisy1_state, screen_update_atarisy1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, atarisy1_state, video_int_write_line))
MCFG_VIDEO_START_OVERRIDE(atarisy1_state,atarisy1)
diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp
index 837ac387cfe..94af07033f9 100644
--- a/src/mame/drivers/atarisy2.cpp
+++ b/src/mame/drivers/atarisy2.cpp
@@ -1212,7 +1212,7 @@ void atarisy2_state::atarisy2(machine_config &config)
/* video hardware */
GFXDECODE(config, "gfxdecode", "palette", gfx_atarisy2);
- PALETTE(config, "palette", 256).set_format(raw_to_rgb_converter(2, &atarisy2_state::RRRRGGGGBBBBIIII_decoder));
+ PALETTE(config, "palette").set_format(2, &atarisy2_state::RRRRGGGGBBBBIIII, 256);
TILEMAP(config, m_playfield_tilemap, "gfxdecode", 2, 8,8, TILEMAP_SCAN_ROWS, 128,64).set_info_callback(FUNC(atarisy2_state::get_playfield_tile_info));
TILEMAP(config, m_alpha_tilemap, "gfxdecode", 2, 8,8, TILEMAP_SCAN_ROWS, 64,48, 0).set_info_callback(FUNC(atarisy2_state::get_alpha_tile_info));
diff --git a/src/mame/drivers/atarisy4.cpp b/src/mame/drivers/atarisy4.cpp
index fc86e10a9c9..03efd5cb788 100644
--- a/src/mame/drivers/atarisy4.cpp
+++ b/src/mame/drivers/atarisy4.cpp
@@ -823,7 +823,7 @@ void atarisy4_state::atarisy4(machine_config &config)
m_screen->set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK);
m_screen->set_screen_update(FUNC(atarisy4_state::screen_update_atarisy4));
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
}
void airrace_state::airrace(machine_config &config)
diff --git a/src/mame/drivers/atetris.cpp b/src/mame/drivers/atetris.cpp
index 0c90710891d..1f87ca5c03a 100644
--- a/src/mame/drivers/atetris.cpp
+++ b/src/mame/drivers/atetris.cpp
@@ -354,7 +354,7 @@ void atetris_state::atetris_base(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, "palette", gfx_atetris);
- PALETTE(config, "palette", 256).set_format(PALETTE_FORMAT_RRRGGGBB);
+ PALETTE(config, "palette").set_format(palette_device::RGB_332, 256);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
/* note: these parameters are from published specs, not derived */
diff --git a/src/mame/drivers/att4425.cpp b/src/mame/drivers/att4425.cpp
index 494c6e47aad..358703a5c43 100644
--- a/src/mame/drivers/att4425.cpp
+++ b/src/mame/drivers/att4425.cpp
@@ -253,7 +253,7 @@ MACHINE_CONFIG_START(att4425_state::att4425)
MCFG_SCREEN_SIZE(720, 351)
MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 351-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_att4425)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME_HIGHLIGHT);
// ch.3 -- timer?
z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, XTAL(32'000'000))); // XXX;
diff --git a/src/mame/drivers/attache.cpp b/src/mame/drivers/attache.cpp
index 6797007386c..027b4f252a9 100644
--- a/src/mame/drivers/attache.cpp
+++ b/src/mame/drivers/attache.cpp
@@ -1133,7 +1133,7 @@ MACHINE_CONFIG_START(attache_state::attache)
MCFG_SCREEN_RAW_PARAMS(12.324_MHz_XTAL, 784, 0, 640, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(attache_state, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
SPEAKER(config, "mono").front_center();
AY8912(config, m_psg, 8_MHz_XTAL / 4);
@@ -1214,7 +1214,7 @@ MACHINE_CONFIG_START(attache816_state::attache816)
MCFG_SCREEN_RAW_PARAMS(12.324_MHz_XTAL, 784, 0, 640, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(attache_state, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
SPEAKER(config, "mono").front_center();
AY8912(config, m_psg, 8_MHz_XTAL / 4);
diff --git a/src/mame/drivers/atvtrack.cpp b/src/mame/drivers/atvtrack.cpp
index 337c3f1bbf8..9ee4449a795 100644
--- a/src/mame/drivers/atvtrack.cpp
+++ b/src/mame/drivers/atvtrack.cpp
@@ -612,7 +612,7 @@ void atvtrack_state::atvtrack(machine_config &config)
screen.set_visarea(0, 640-1, 0, 480-1);
screen.set_screen_update(FUNC(atvtrack_state::screen_update_atvtrack));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
}
void smashdrv_state::smashdrv(machine_config &config)
diff --git a/src/mame/drivers/aussiebyte.cpp b/src/mame/drivers/aussiebyte.cpp
index bfad6e7bda4..e92a8d691a4 100644
--- a/src/mame/drivers/aussiebyte.cpp
+++ b/src/mame/drivers/aussiebyte.cpp
@@ -508,7 +508,7 @@ MACHINE_CONFIG_START(aussiebyte_state::aussiebyte)
screen.set_screen_update("crtc", FUNC(sy6545_1_device::screen_update));
GFXDECODE(config, "gfxdecode", "palette", gfx_crt8002);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/avigo.cpp b/src/mame/drivers/avigo.cpp
index c7524c1a6bd..797564ebbf9 100644
--- a/src/mame/drivers/avigo.cpp
+++ b/src/mame/drivers/avigo.cpp
@@ -776,18 +776,16 @@ MACHINE_CONFIG_START(avigo_state::avigo)
MCFG_SCREEN_UPDATE_DRIVER(avigo_state, screen_update)
MCFG_SCREEN_SIZE(AVIGO_SCREEN_WIDTH, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT)
MCFG_SCREEN_VISIBLE_AREA(0, AVIGO_SCREEN_WIDTH-1, 0, AVIGO_SCREEN_HEIGHT + AVIGO_PANEL_HEIGHT -1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
config.set_default_layout(layout_avigo);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_avigo)
- MCFG_PALETTE_ADD("palette", AVIGO_NUM_COLOURS)
- MCFG_PALETTE_INIT_OWNER(avigo_state, avigo)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_avigo);
+ PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
/* real time clock */
tc8521_device &rtc(TC8521(config, "rtc", XTAL(32'768)));
diff --git a/src/mame/drivers/avt.cpp b/src/mame/drivers/avt.cpp
index 14f97761e85..b1d9b9767f3 100644
--- a/src/mame/drivers/avt.cpp
+++ b/src/mame/drivers/avt.cpp
@@ -452,6 +452,9 @@ public:
void avtnfl(machine_config &config);
void avt(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(avt_6845_address_w);
DECLARE_WRITE8_MEMBER(avt_6845_data_w);
@@ -461,7 +464,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(avtnfl_w);
DECLARE_WRITE_LINE_MEMBER(avtbingo_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(avt);
+ void avt_palette(palette_device &palette) const;
uint32_t screen_update_avt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void avt_map(address_map &map);
@@ -469,7 +472,6 @@ private:
tilemap_t *m_bg_tilemap;
uint8_t m_crtc_vreg[0x100],m_crtc_index;
- virtual void video_start() override;
required_device<z80_device> m_maincpu;
required_device<mc6845_device> m_crtc;
required_device<z80pio_device> m_pio0;
@@ -563,50 +565,43 @@ uint32_t avt_state::screen_update_avt(screen_device &screen, bitmap_ind16 &bitma
}
-PALETTE_INIT_MEMBER(avt_state, avt)
+void avt_state::avt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
-/* prom bits
- 7654 3210
- ---- ---x Intensity?.
- ---- --x- Red component.
- ---- -x-- Green component.
- ---- x--- Blue component.
- xxxx ---- Unused.
-*/
- int j;
+ /* prom bits
+ 7654 3210
+ ---- ---x Intensity?.
+ ---- --x- Red component.
+ ---- -x-- Green component.
+ ---- x--- Blue component.
+ xxxx ---- Unused.
+ */
/* 0000BGRI */
- if (color_prom == nullptr) return;
+ const uint8_t *color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- for (j = 0; j < palette.entries(); j++)
+ for (int j = 0; j < palette.entries(); j++)
{
- int bit1, bit2, bit3, r, g, b, inten, intenmin, intenmax, i;
-
- intenmin = 0xe0;
- intenmax = 0xff;
+ constexpr int intenmin = 0xe0;
+ constexpr int intenmax = 0xff;
- i = ((j & 0x7) << 4) | ((j & 0x78) >> 3);
+ int const i = ((j & 0x7) << 4) | ((j & 0x78) >> 3);
+ // intensity component
+// int const inten = BIT(~color_prom[i], 0);
+ int const inten = BIT(color_prom[i], 0);
- /* intensity component */
-// inten = 1 - (color_prom[i] & 0x01);
- inten = (color_prom[i] & 0x01);
+ // red component
+ int const r = BIT(color_prom[i], 1) * (inten ? intenmax : intenmin);
- /* red component */
- bit1 = (color_prom[i] >> 1) & 0x01;
- r = (bit1 * intenmin) + (inten * (bit1 * (intenmax - intenmin)));
+ // green component
+ int const g = BIT(color_prom[i], 2) * (inten ? intenmax : intenmin);
- /* green component */
- bit2 = (color_prom[i] >> 2) & 0x01;
- g = (bit2 * intenmin) + (inten * (bit2 * (intenmax - intenmin)));
+ // blue component
+ int const b = BIT(color_prom[i], 3) * (inten ? intenmax : intenmin);
- /* blue component */
- bit3 = (color_prom[i] >> 3) & 0x01;
- b = (bit3 * intenmin) + (inten * (bit3 * (intenmax - intenmin)));
-
-
- /* hack to switch cyan->magenta for highlighted background */
+ // hack to switch cyan->magenta for highlighted background
if (j == 0x40)
palette.set_pen_color(j, rgb_t(g, r, b)); // Why this one has R-G swapped?...
else
@@ -975,11 +970,10 @@ MACHINE_CONFIG_START(avt_state::avt)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1) /* 240x224 (through CRTC) */
MCFG_SCREEN_UPDATE_DRIVER(avt_state, screen_update_avt)
- MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_avt)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 8*16)
- MCFG_PALETTE_INIT_OWNER(avt_state, avt)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_avt);
+ PALETTE(config, m_palette, FUNC(avt_state::avt_palette), 8*16);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); // guess
crtc.set_screen("screen");
@@ -1021,6 +1015,7 @@ WRITE_LINE_MEMBER( avt_state::avtnfl_w )
void avt_state::avtnfl(machine_config &config)
{
avt(config);
+
mc6845_device &crtc(MC6845(config.replace(), "crtc", CRTC_CLOCK)); // guess
crtc.set_screen("screen");
crtc.set_show_border_area(false);
diff --git a/src/mame/drivers/ax20.cpp b/src/mame/drivers/ax20.cpp
index 0803fe9f5b3..7cb4ff858f6 100644
--- a/src/mame/drivers/ax20.cpp
+++ b/src/mame/drivers/ax20.cpp
@@ -25,13 +25,14 @@
class ax20_state : public driver_device
{
public:
- ax20_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ax20_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_p_vram(*this, "p_vram"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_fdc(*this, "fdc") { }
+ m_fdc(*this, "fdc")
+ { }
void ax20(machine_config &config);
@@ -145,9 +146,9 @@ MACHINE_CONFIG_START(ax20_state::ax20)
MCFG_SCREEN_UPDATE_DRIVER(ax20_state, screen_update)
MCFG_SCREEN_SIZE(80*8, 24*12)
MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ax20)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
I8272A(config, m_fdc, 8'000'000, true);
diff --git a/src/mame/drivers/b2m.cpp b/src/mame/drivers/b2m.cpp
index bc22a8bfefd..96ba19c551d 100644
--- a/src/mame/drivers/b2m.cpp
+++ b/src/mame/drivers/b2m.cpp
@@ -202,10 +202,9 @@ MACHINE_CONFIG_START(b2m_state::b2m)
MCFG_SCREEN_SIZE(384, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(b2m_state, screen_update_b2m)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(b2m_state, b2m)
+ PALETTE(config, m_palette, FUNC(b2m_state::b2m_palette), 4);
PIT8253(config, m_pit, 0);
m_pit->set_clk<0>(0);
diff --git a/src/mame/drivers/backfire.cpp b/src/mame/drivers/backfire.cpp
index e429a00e632..7cc6d9a3bc7 100644
--- a/src/mame/drivers/backfire.cpp
+++ b/src/mame/drivers/backfire.cpp
@@ -12,7 +12,6 @@
*/
-#define DE156CPU ARM
#include "emu.h"
#include "machine/adc0808.h"
#include "machine/decocrpt.h"
@@ -376,8 +375,7 @@ MACHINE_CONFIG_START(backfire_state::backfire)
m_adc->in_callback<1>().set_ioport("PADDLE1");
/* video hardware */
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_backfire)
config.set_default_layout(layout_dualhsxs);
@@ -388,7 +386,7 @@ MACHINE_CONFIG_START(backfire_state::backfire)
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(backfire_state, screen_update_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, backfire_state, vbl_interrupt))
MCFG_SCREEN_ADD("rscreen", RASTER)
@@ -397,7 +395,7 @@ MACHINE_CONFIG_START(backfire_state::backfire)
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(backfire_state, screen_update_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO16IC(config, m_deco_tilegen[0], 0);
m_deco_tilegen[0]->set_screen(m_lscreen);
diff --git a/src/mame/drivers/badlands.cpp b/src/mame/drivers/badlands.cpp
index b2fb30b383b..9c5eedaa968 100644
--- a/src/mame/drivers/badlands.cpp
+++ b/src/mame/drivers/badlands.cpp
@@ -460,9 +460,9 @@ MACHINE_CONFIG_START(badlands_state::badlands)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_badlands)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
+ palette_device &palette(PALETTE(config, "palette"));
+ palette.set_format(palette_device::IRGB_1555, 256);
+ palette.set_membits(8);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, badlands_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
diff --git a/src/mame/drivers/badlandsbl.cpp b/src/mame/drivers/badlandsbl.cpp
index f5435cdab74..a4c5acfd147 100644
--- a/src/mame/drivers/badlandsbl.cpp
+++ b/src/mame/drivers/badlandsbl.cpp
@@ -237,9 +237,9 @@ MACHINE_CONFIG_START(badlandsbl_state::badlandsb)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_badlandsb)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
+ palette_device &palette(PALETTE(config, "palette"));
+ palette.set_format(palette_device::IRGB_1555, 256);
+ palette.set_membits(8);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, badlands_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
diff --git a/src/mame/drivers/bagman.cpp b/src/mame/drivers/bagman.cpp
index 2383dd10e19..58c9a16f9b6 100644
--- a/src/mame/drivers/bagman.cpp
+++ b/src/mame/drivers/bagman.cpp
@@ -457,13 +457,11 @@ void bagman_state::bagman_base(machine_config &config)
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(BAGMAN_HCLK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
screen.set_screen_update(FUNC(bagman_state::screen_update));
- screen.set_palette("palette");
+ screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(bagman_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, "palette", gfx_bagman);
-
- PALETTE(config, m_palette, 64);
- m_palette->set_init(DEVICE_SELF, FUNC(bagman_state::palette_init_bagman));
+ PALETTE(config, m_palette, FUNC(bagman_state::bagman_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -543,7 +541,7 @@ void bagman_state::pickin(machine_config &config)
screen.screen_vblank().set(FUNC(bagman_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pickin);
- PALETTE(config, m_palette, 64).set_init(FUNC(bagman_state::palette_init_bagman));
+ PALETTE(config, m_palette, FUNC(bagman_state::bagman_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -600,7 +598,7 @@ void bagman_state::botanic(machine_config &config)
screen.screen_vblank().set(FUNC(bagman_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bagman);
- PALETTE(config, m_palette, 64).set_init(FUNC(bagman_state::palette_init_bagman));
+ PALETTE(config, m_palette, FUNC(bagman_state::bagman_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/balsente.cpp b/src/mame/drivers/balsente.cpp
index 55685a5dc79..8ca45f6c9ee 100644
--- a/src/mame/drivers/balsente.cpp
+++ b/src/mame/drivers/balsente.cpp
@@ -1374,7 +1374,7 @@ void balsente_state::balsente(machine_config &config)
m_screen->set_screen_update(FUNC(balsente_state::screen_update_balsente));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_entries(1024);
/* sound hardware */
@@ -1436,6 +1436,7 @@ void balsente_state::rescraid(machine_config &config)
void balsente_state::triviamb(machine_config &config)
{
balsente(config);
+
config.device_remove("outlatch");
config.device_remove("acia");
config.device_remove("audio6vb");
@@ -1461,7 +1462,7 @@ void balsente_state::triviamb(machine_config &config)
crtc.set_show_border_area(false);
crtc.set_char_width(4);
- m_palette->set_format(PALETTE_FORMAT_BBGGGRRR);
+ m_palette->set_format(palette_device::BGR_233, 1024);
// sound PCB has: 2x Z80CTC, 2x AY8910A, 1x M5205, 1x 8MHz XTAL (divisor unknown for every device)
Z80(config, m_audiocpu, 8_MHz_XTAL / 2);
diff --git a/src/mame/drivers/banctec.cpp b/src/mame/drivers/banctec.cpp
index c22150aa974..ca00bb3ec98 100644
--- a/src/mame/drivers/banctec.cpp
+++ b/src/mame/drivers/banctec.cpp
@@ -154,7 +154,7 @@ MACHINE_CONFIG_START(banctec_state::banctec)
MCFG_SCREEN_SIZE((52+1)*8, (31+1)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 25*8-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_banctec)
r6545_1_device &crtc(R6545_1(config, "crtc", XTAL(2'000'000))); /* (?) */
diff --git a/src/mame/drivers/bankp.cpp b/src/mame/drivers/bankp.cpp
index 1a7188ff771..adc9223bfbc 100644
--- a/src/mame/drivers/bankp.cpp
+++ b/src/mame/drivers/bankp.cpp
@@ -306,12 +306,10 @@ MACHINE_CONFIG_START(bankp_state::bankp)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(bankp_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bankp)
- MCFG_PALETTE_ADD("palette", 32*4+16*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(bankp_state, bankp)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bankp);
+ PALETTE(config, m_palette, FUNC(bankp_state::bankp_palette), 32*4+16*8, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/baraduke.cpp b/src/mame/drivers/baraduke.cpp
index 08f5262567d..2bcdb32d38c 100644
--- a/src/mame/drivers/baraduke.cpp
+++ b/src/mame/drivers/baraduke.cpp
@@ -388,8 +388,7 @@ void baraduke_state::baraduke(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_baraduke);
- PALETTE(config, m_palette, 2048);
- m_palette->set_init(FUNC(baraduke_state::palette_init_baraduke));
+ PALETTE(config, m_palette, FUNC(baraduke_state::baraduke_palette), 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bartop52.cpp b/src/mame/drivers/bartop52.cpp
index f43f5872506..0fd035e6c41 100644
--- a/src/mame/drivers/bartop52.cpp
+++ b/src/mame/drivers/bartop52.cpp
@@ -148,7 +148,7 @@ void bartop52_state::a5200(machine_config &config)
m_screen->set_screen_update("antic", FUNC(antic_device::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", 256).set_init(FUNC(bartop52_state::palette_init_atari));
+ PALETTE(config, "palette", FUNC(bartop52_state::atari_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/batman.cpp b/src/mame/drivers/batman.cpp
index 635108e3418..f2d15cb1737 100644
--- a/src/mame/drivers/batman.cpp
+++ b/src/mame/drivers/batman.cpp
@@ -195,8 +195,7 @@ MACHINE_CONFIG_START(batman_state::batman)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_batman)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
ATARI_VAD(config, m_vad, 0, m_screen);
m_vad->scanline_int_cb().set_inputline(m_maincpu, M68K_IRQ_4);
diff --git a/src/mame/drivers/battlnts.cpp b/src/mame/drivers/battlnts.cpp
index 3c10dc438d0..63108a148de 100644
--- a/src/mame/drivers/battlnts.cpp
+++ b/src/mame/drivers/battlnts.cpp
@@ -252,9 +252,8 @@ MACHINE_CONFIG_START(battlnts_state::battlnts)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, battlnts_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_battlnts)
- MCFG_PALETTE_ADD("palette", 128)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_battlnts);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 128);
K007342(config, m_k007342, 0);
m_k007342->set_gfxnum(0);
diff --git a/src/mame/drivers/bbc.cpp b/src/mame/drivers/bbc.cpp
index 30f09247c97..3452810516c 100644
--- a/src/mame/drivers/bbc.cpp
+++ b/src/mame/drivers/bbc.cpp
@@ -848,8 +848,7 @@ void bbc_state::bbca(machine_config &config)
m_screen->set_raw(16_MHz_XTAL, 1024, 0, 640, 312, 0, 256);
m_screen->set_screen_update("hd6845", FUNC(hd6845_device::screen_update));
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(palette_init_delegate(FUNC(bbc_state::palette_init_bbc), this));
+ PALETTE(config, m_palette, FUNC(bbc_state::bbc_colours), 16);
SAA5050(config, m_trom, 12_MHz_XTAL / 2);
m_trom->set_screen_size(40, 25, 40);
@@ -1352,8 +1351,7 @@ void bbcm_state::bbcm(machine_config &config)
m_screen->set_raw(16_MHz_XTAL, 1024, 0, 640, 312, 0, 256);
m_screen->set_screen_update("hd6845", FUNC(hd6845_device::screen_update));
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(palette_init_delegate(FUNC(bbc_state::palette_init_bbc), this));
+ PALETTE(config, m_palette, FUNC(bbc_state::bbc_colours), 16);
SAA5050(config, m_trom, 12_MHz_XTAL / 2);
m_trom->set_screen_size(40, 25, 40);
diff --git a/src/mame/drivers/bbusters.cpp b/src/mame/drivers/bbusters.cpp
index 33d33e7d1b1..74bd3c49273 100644
--- a/src/mame/drivers/bbusters.cpp
+++ b/src/mame/drivers/bbusters.cpp
@@ -656,9 +656,8 @@ MACHINE_CONFIG_START(bbusters_state::bbusters)
screen.screen_vblank().append(m_spriteram[1], FUNC(buffered_spriteram16_device::vblank_copy_rising));
screen.set_palette("palette");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bbusters)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_bbusters);
+ PALETTE(config, "palette").set_format(palette_device::RGBx_444, 2048);
BUFFERED_SPRITERAM16(config, m_spriteram[0]);
BUFFERED_SPRITERAM16(config, m_spriteram[1]);
@@ -698,9 +697,8 @@ MACHINE_CONFIG_START(mechatt_state::mechatt)
screen.screen_vblank().set(m_spriteram[0], FUNC(buffered_spriteram16_device::vblank_copy_rising));
screen.set_palette("palette");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mechatt)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mechatt);
+ PALETTE(config, "palette").set_format(palette_device::RGBx_444, 1024);
BUFFERED_SPRITERAM16(config, m_spriteram[0]);
diff --git a/src/mame/drivers/bcs3.cpp b/src/mame/drivers/bcs3.cpp
index a26837128f7..7e7fbca8d44 100644
--- a/src/mame/drivers/bcs3.cpp
+++ b/src/mame/drivers/bcs3.cpp
@@ -401,7 +401,7 @@ MACHINE_CONFIG_START(bcs3_state::bcs3)
MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bcs3)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
Z80CTC(config, m_ctc, XTAL(5'000'000) / 2);
m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
@@ -428,7 +428,7 @@ MACHINE_CONFIG_START(bcs3_state::bcs3a)
MCFG_SCREEN_UPDATE_DRIVER(bcs3_state, screen_update_bcs3a)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bcs3)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
Z80CTC(config, m_ctc, XTAL(7'000'000) / 2);
m_ctc->intr_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
diff --git a/src/mame/drivers/beathead.cpp b/src/mame/drivers/beathead.cpp
index f8bbe4363a1..23456f11fdc 100644
--- a/src/mame/drivers/beathead.cpp
+++ b/src/mame/drivers/beathead.cpp
@@ -352,11 +352,11 @@ MACHINE_CONFIG_START(beathead_state::beathead)
MCFG_SCREEN_UPDATE_DRIVER(beathead_state, screen_update)
MCFG_SCREEN_SIZE(42*8, 262)
MCFG_SCREEN_VISIBLE_AREA(0*8, 42*8-1, 0*8, 30*8-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 32768)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(16)
+ PALETTE(config, m_palette);
+ m_palette->set_format(palette_device::IRGB_1555, 32768);
+ m_palette->set_membits(16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/beehive.cpp b/src/mame/drivers/beehive.cpp
index a2939fd9a80..9d5983ff196 100644
--- a/src/mame/drivers/beehive.cpp
+++ b/src/mame/drivers/beehive.cpp
@@ -34,7 +34,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_p_videoram(*this, "videoram")
, m_p_chargen(*this, "chargen")
- { }
+ { }
DECLARE_READ8_MEMBER(beehive_60_r);
DECLARE_WRITE8_MEMBER(beehive_62_w);
@@ -306,7 +306,7 @@ MACHINE_CONFIG_START(beehive_state::beehive)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/beezer.cpp b/src/mame/drivers/beezer.cpp
index be125b43d51..12eedb3a903 100644
--- a/src/mame/drivers/beezer.cpp
+++ b/src/mame/drivers/beezer.cpp
@@ -527,8 +527,7 @@ void beezer_state::beezer(machine_config &config)
m_screen->set_screen_update(FUNC(beezer_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 16);
- m_palette->set_init(DEVICE_SELF, FUNC(beezer_state::palette_init));
+ PALETTE(config, m_palette, FUNC(beezer_state::palette_init), 16);
// sound hardware
MC6809(config, m_audiocpu, XTAL(4'000'000));
diff --git a/src/mame/drivers/bestleag.cpp b/src/mame/drivers/bestleag.cpp
index 39e2529db26..d8907d8e910 100644
--- a/src/mame/drivers/bestleag.cpp
+++ b/src/mame/drivers/bestleag.cpp
@@ -31,8 +31,8 @@ Dip Locations added according to Service Mode
class bestleag_state : public driver_device
{
public:
- bestleag_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ bestleag_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
@@ -41,7 +41,8 @@ public:
m_fgram(*this, "fgram"),
m_txram(*this, "txram"),
m_vregs(*this, "vregs"),
- m_spriteram(*this, "spriteram") { }
+ m_spriteram(*this, "spriteram")
+ { }
required_device<cpu_device> m_maincpu;
required_device<okim6295_device> m_oki;
@@ -391,11 +392,10 @@ MACHINE_CONFIG_START(bestleag_state::bestleag)
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(bestleag_state, screen_update_bestleag)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bestleag)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bestleag);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x800);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp
index 44bbd8a9943..c1656a00c19 100644
--- a/src/mame/drivers/bigbord2.cpp
+++ b/src/mame/drivers/bigbord2.cpp
@@ -560,10 +560,9 @@ MACHINE_CONFIG_START(bigbord2_state::bigbord2)
MCFG_SCREEN_RAW_PARAMS(10.69425_MHz_XTAL, 700, 0, 560, 260, 0, 240)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_crt8002)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
- MCFG_DEVICE_ADD("ctc_clock", CLOCK, MAIN_CLOCK)
- MCFG_CLOCK_SIGNAL_HANDLER(WRITELINE(*this, bigbord2_state, clock_w))
+ CLOCK(config, "ctc_clock", MAIN_CLOCK).signal_handler().set(FUNC(bigbord2_state::clock_w));
/* devices */
Z80DMA(config, m_dma, MAIN_CLOCK);
diff --git a/src/mame/drivers/bigevglf.cpp b/src/mame/drivers/bigevglf.cpp
index 256cd079c04..abd4c2f179f 100644
--- a/src/mame/drivers/bigevglf.cpp
+++ b/src/mame/drivers/bigevglf.cpp
@@ -417,7 +417,7 @@ void bigevglf_state::bigevglf(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bigevglf);
- PALETTE(config, m_palette, 0x800);
+ PALETTE(config, m_palette).set_entries(0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bigstrkb.cpp b/src/mame/drivers/bigstrkb.cpp
index 07907a455f8..e77eedb6992 100644
--- a/src/mame/drivers/bigstrkb.cpp
+++ b/src/mame/drivers/bigstrkb.cpp
@@ -206,7 +206,7 @@ MACHINE_CONFIG_START(bigstrkb_state::bigstrkb)
MCFG_DEVICE_PROGRAM_MAP(bigstrkb_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", bigstrkb_state, irq6_line_hold)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bigstrkb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bigstrkb);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -214,11 +214,9 @@ MACHINE_CONFIG_START(bigstrkb_state::bigstrkb)
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(bigstrkb_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ MCFG_SCREEN_PALETTE(m_palette)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x400);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/binbug.cpp b/src/mame/drivers/binbug.cpp
index aca8741fc06..58d130d8e4e 100644
--- a/src/mame/drivers/binbug.cpp
+++ b/src/mame/drivers/binbug.cpp
@@ -313,7 +313,7 @@ void binbug_state::binbug_base(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_dg640);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Cassette */
CASSETTE(config, m_cass);
diff --git a/src/mame/drivers/bingoman.cpp b/src/mame/drivers/bingoman.cpp
index 01193b71e4e..17da5720752 100644
--- a/src/mame/drivers/bingoman.cpp
+++ b/src/mame/drivers/bingoman.cpp
@@ -250,25 +250,27 @@ class bingoman_state : public driver_device
{
public:
bingoman_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
+ void bingoman(machine_config &config);
+
+protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
// devices
required_device<cpu_device> m_maincpu;
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(bingoman);
- void bingoman(machine_config &config);
+ void bingoman_palette(palette_device &palette) const;
void bingoman_io_map(address_map &map);
void bingoman_prg_map(address_map &map);
-protected:
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void video_start() override;
};
void bingoman_state::video_start()
@@ -373,7 +375,7 @@ void bingoman_state::machine_reset()
}
-PALETTE_INIT_MEMBER(bingoman_state, bingoman)
+void bingoman_state::bingoman_palette(palette_device &palette) const
{
}
@@ -393,10 +395,8 @@ MACHINE_CONFIG_START(bingoman_state::bingoman)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bingoman)
-
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(bingoman_state, bingoman)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_bingoman);
+ PALETTE(config, "palette", FUNC(bingoman_state::bingoman_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bingor.cpp b/src/mame/drivers/bingor.cpp
index d8b6b5e6e7b..d9c8f3014cd 100644
--- a/src/mame/drivers/bingor.cpp
+++ b/src/mame/drivers/bingor.cpp
@@ -509,6 +509,7 @@
#include "cpu/i86/i186.h"
#include "cpu/mcs51/mcs51.h"
#include "cpu/pic16c5x/pic16c5x.h"
+#include "machine/gen_latch.h"
#include "machine/intelfsh.h"
#include "machine/msm6242.h"
#include "sound/ay8910.h"
@@ -521,30 +522,31 @@
class bingor_state : public driver_device
{
public:
- bingor_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ bingor_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_blit_ram(*this, "blit_ram"),
m_maincpu(*this, "maincpu"),
m_slavecpu(*this, "slavecpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
- required_shared_ptr<uint16_t> m_blit_ram;
+ void bingor(machine_config &config);
+ void bingor2(machine_config &config);
+ void vip2000(machine_config &config);
+
+protected:
virtual void video_start() override;
- uint32_t screen_update_bingor(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
+private:
+ required_shared_ptr<uint16_t> m_blit_ram;
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_slavecpu;
required_device<palette_device> m_palette;
- DECLARE_WRITE8_MEMBER(toslave_w);
- DECLARE_READ8_MEMBER(toslave_r);
- DECLARE_WRITE8_MEMBER(fromslave_w);
- DECLARE_READ8_MEMBER(fromslave_r);
+ uint32_t screen_update_bingor(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+
DECLARE_WRITE16_MEMBER(vip2000_outputs_w);
- u8 m_toslave;
- u8 m_fromslave;
- void bingor(machine_config &config);
- void bingor2(machine_config &config);
- void vip2000(machine_config &config);
+
void bingor2_map(address_map &map);
void bingor_io(address_map &map);
void bingor_map(address_map &map);
@@ -711,7 +713,7 @@ void bingor_state::bingor(machine_config &config)
screen.set_visarea(0, 400-1, 0, 300-1);
screen.set_screen_update(FUNC(bingor_state::screen_update_bingor));
- PALETTE(config, m_palette, 0x100).set_format(PALETTE_FORMAT_RRRRGGGGBBBBIIII);
+ PALETTE(config, m_palette).set_format(palette_device::RGBI_4444, 0x100);
SPEAKER(config, "mono").front_center();
SAA1099(config, "saa", 6000000).add_route(ALL_OUTPUTS, "mono", 0.50);
@@ -738,30 +740,10 @@ void bingor_state::vip2000_io(address_map &map)
{
map(0x0000, 0x0001).nopr(); // watchdog
map(0x0080, 0x009f).rw("rtc", FUNC(msm6242_device::read), FUNC(msm6242_device::write)).umask16(0x00ff);
- map(0x0100, 0x0100).rw(FUNC(bingor_state::fromslave_r), FUNC(bingor_state::toslave_w));
+ map(0x0100, 0x0100).r("fromslave", FUNC(generic_latch_8_device::read)).w("toslave", FUNC(generic_latch_8_device::write));
map(0x0280, 0x0281).w(FUNC(bingor_state::vip2000_outputs_w));
}
-WRITE8_MEMBER(bingor_state::toslave_w)
-{
- m_toslave = data;
-}
-
-READ8_MEMBER(bingor_state::toslave_r)
-{
- return m_toslave;
-}
-
-WRITE8_MEMBER(bingor_state::fromslave_w)
-{
- m_fromslave = data;
-}
-
-READ8_MEMBER(bingor_state::fromslave_r)
-{
- return m_fromslave;
-}
-
WRITE16_MEMBER(bingor_state::vip2000_outputs_w)
{
m_slavecpu->set_input_line(MCS51_INT0_LINE, BIT(data, 15) ? CLEAR_LINE : ASSERT_LINE);
@@ -774,7 +756,7 @@ void bingor_state::slave_map(address_map &map)
void bingor_state::slave_io(address_map &map)
{
- map(0x0000, 0x0000).rw(FUNC(bingor_state::toslave_r), FUNC(bingor_state::fromslave_w));
+ map(0x0000, 0x0000).r("toslave", FUNC(generic_latch_8_device::read)).w("fromslave", FUNC(generic_latch_8_device::write));
map(0xc000, 0xcfff).ram();
}
@@ -801,15 +783,18 @@ void bingor_state::vip2000(machine_config &config)
screen.set_visarea(0, 400-1, 0, 300-1);
screen.set_screen_update(FUNC(bingor_state::screen_update_bingor));
- PALETTE(config, m_palette, 0x100).set_format(PALETTE_FORMAT_RRRRGGGGBBBBIIII);
+ PALETTE(config, m_palette).set_format(palette_device::RGBI_4444, 0x100);
SPEAKER(config, "mono").front_center();
+ GENERIC_LATCH_8(config, "toslave");
+ GENERIC_LATCH_8(config, "fromslave");
+
ymz284_device &ymz(YMZ284(config, "ymz", 1250000)); // probably clocked by square wave output of 80186 timer 0
ymz.add_route(ALL_OUTPUTS, "mono", 0.50);
}
-// I doubt we need to load the eeproms
+// I doubt we need to load the EEPROMs
ROM_START( bingor1 )
ROM_REGION( 0x10000, "boot_prg", ROMREGION_ERASE00 ) /* i186 code */
diff --git a/src/mame/drivers/bionicc.cpp b/src/mame/drivers/bionicc.cpp
index 003dccc8ea1..35c0fa36d9d 100644
--- a/src/mame/drivers/bionicc.cpp
+++ b/src/mame/drivers/bionicc.cpp
@@ -416,14 +416,13 @@ MACHINE_CONFIG_START(bionicc_state::bionicc)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000) / 4, 386, 0, 256, 260, 16, 240)
MCFG_SCREEN_UPDATE_DRIVER(bionicc_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bionicc)
MCFG_DEVICE_ADD("spritegen", TIGEROAD_SPRITE, 0)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT_CLASS(2, bionicc_state, RRRRGGGGBBBBIIII)
+ PALETTE(config, m_palette).set_format(2, &bionicc_state::RRRRGGGGBBBBIIII, 1024);
MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
diff --git a/src/mame/drivers/bishi.cpp b/src/mame/drivers/bishi.cpp
index e64a90d1878..6a54c78bfcb 100644
--- a/src/mame/drivers/bishi.cpp
+++ b/src/mame/drivers/bishi.cpp
@@ -461,8 +461,7 @@ void bishi_state::bishi(machine_config &config)
m_screen->set_visarea(29, 29+288-1, 16, 16+224-1);
m_screen->set_screen_update(FUNC(bishi_state::screen_update_bishi));
- PALETTE(config, m_palette, 4096);
- m_palette->set_format(PALETTE_FORMAT_XBGR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 4096);
m_palette->enable_shadows();
m_palette->enable_hilights();
diff --git a/src/mame/drivers/bitgraph.cpp b/src/mame/drivers/bitgraph.cpp
index 1269870ef16..be66a7c5163 100644
--- a/src/mame/drivers/bitgraph.cpp
+++ b/src/mame/drivers/bitgraph.cpp
@@ -498,9 +498,9 @@ MACHINE_CONFIG_START(bitgraph_state::bg_motherboard)
MCFG_SCREEN_SIZE(1024, 768)
MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
MCFG_SCREEN_UPDATE_DRIVER(bitgraph_state, screen_update)
-
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+
+ PALETTE(config, "palette", palette_device::MONOCHROME);
ACIA6850(config, m_acia0, 0);
m_acia0->txd_handler().set(RS232_H_TAG, FUNC(rs232_port_device::write_txd));
diff --git a/src/mame/drivers/bk.cpp b/src/mame/drivers/bk.cpp
index e2d4650a84c..60dd90a8033 100644
--- a/src/mame/drivers/bk.cpp
+++ b/src/mame/drivers/bk.cpp
@@ -181,7 +181,7 @@ void bk_state::bk0010(machine_config &config)
screen.set_screen_update(FUNC(bk_state::screen_update_bk0010));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/bking.cpp b/src/mame/drivers/bking.cpp
index b5c7f43ef5d..d9344ee4259 100644
--- a/src/mame/drivers/bking.cpp
+++ b/src/mame/drivers/bking.cpp
@@ -415,20 +415,17 @@ MACHINE_CONFIG_START(bking_state::bking)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(bking_state, screen_update_bking)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, bking_state, screen_vblank_bking))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bking)
- MCFG_PALETTE_ADD("palette", 4*8+4*4+4*2+4*2)
- MCFG_PALETTE_INIT_OWNER(bking_state, bking)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bking);
+ PALETTE(config, m_palette, FUNC(bking_state::bking_palette), 4*8 + 4*4 + 4*2 + 4*2);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
AY8910(config, "ay1", XTAL(6'000'000)/4).add_route(ALL_OUTPUTS, "speaker", 0.25);
diff --git a/src/mame/drivers/blackt96.cpp b/src/mame/drivers/blackt96.cpp
index 5176757f2d4..28bb8f2f685 100644
--- a/src/mame/drivers/blackt96.cpp
+++ b/src/mame/drivers/blackt96.cpp
@@ -90,8 +90,8 @@ Bugs (all of these looks BTANBs):
class blackt96_state : public driver_device
{
public:
- blackt96_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ blackt96_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_tilemapram(*this, "tilemapram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
@@ -99,7 +99,7 @@ public:
m_sprites(*this, "sprites"),
m_oki(*this, "oki%u", 1U),
m_oki1bank(*this, "oki1bank")
- { }
+ { }
// read/write handlers
DECLARE_WRITE8_MEMBER(output_w);
@@ -498,10 +498,9 @@ MACHINE_CONFIG_START(blackt96_state::blackt96)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 16*32-1, 0*8, 16*32-1)
MCFG_SCREEN_VISIBLE_AREA(0*8, 256-1, 2*8, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(blackt96_state, screen_update_blackt96)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x800);
SNK68_SPR(config, m_sprites, 0);
m_sprites->set_gfxdecode_tag(m_gfxdecode);
diff --git a/src/mame/drivers/bladestl.cpp b/src/mame/drivers/bladestl.cpp
index c1702bac07d..8c64fb7ad7d 100644
--- a/src/mame/drivers/bladestl.cpp
+++ b/src/mame/drivers/bladestl.cpp
@@ -326,11 +326,8 @@ MACHINE_CONFIG_START(bladestl_state::bladestl)
MCFG_SCREEN_UPDATE_DRIVER(bladestl_state, screen_update_bladestl)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_bladestl)
- MCFG_PALETTE_ADD("palette", 32 + 16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32+16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_INIT_OWNER(bladestl_state, bladestl)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_bladestl);
+ PALETTE(config, "palette", FUNC(bladestl_state::bladestl_palette)).set_format(palette_device::xBGR_555, 32 + 16*16, 32+16);
K007342(config, m_k007342, 0);
m_k007342->set_gfxnum(0);
diff --git a/src/mame/drivers/blitz68k.cpp b/src/mame/drivers/blitz68k.cpp
index 80290b35841..944a3cdd7c8 100644
--- a/src/mame/drivers/blitz68k.cpp
+++ b/src/mame/drivers/blitz68k.cpp
@@ -1715,7 +1715,7 @@ void blitz68k_state::ramdac_map(address_map &map)
void blitz68k_state::ramdac_config(machine_config &config)
{
- PALETTE(config, m_palette, 0x100);
+ PALETTE(config, m_palette).set_entries(0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &blitz68k_state::ramdac_map);
}
diff --git a/src/mame/drivers/blktiger.cpp b/src/mame/drivers/blktiger.cpp
index ae241fc20bd..646a6272b9b 100644
--- a/src/mame/drivers/blktiger.cpp
+++ b/src/mame/drivers/blktiger.cpp
@@ -316,14 +316,13 @@ MACHINE_CONFIG_START(blktiger_state::blktiger)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(blktiger_state, screen_update_blktiger)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_blktiger)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8)
+ BUFFERED_SPRITERAM8(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/blmbycar.cpp b/src/mame/drivers/blmbycar.cpp
index cdc71fd67af..82c428c8e57 100644
--- a/src/mame/drivers/blmbycar.cpp
+++ b/src/mame/drivers/blmbycar.cpp
@@ -381,12 +381,11 @@ MACHINE_CONFIG_START(blmbycar_state::blmbycar)
MCFG_SCREEN_SIZE(0x180, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0, 0x180-1, 0, 0x100-1)
MCFG_SCREEN_UPDATE_DRIVER(blmbycar_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_blmbycar)
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 0x2000);
BLMBYCAR_SPRITES(config, m_sprites, 0);
m_sprites->set_gfxdecode_tag("gfxdecode");
diff --git a/src/mame/drivers/blockade.cpp b/src/mame/drivers/blockade.cpp
index 9b5ee5d52a7..92de164c655 100644
--- a/src/mame/drivers/blockade.cpp
+++ b/src/mame/drivers/blockade.cpp
@@ -30,8 +30,8 @@
class blockade_state : public driver_device
{
public:
- blockade_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ blockade_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_videoram(*this, "videoram"),
m_gfxdecode(*this, "gfxdecode"),
@@ -482,7 +482,7 @@ void blockade_state::blockade(machine_config &config)
GFXDECODE(config, m_gfxdecode, "palette", gfx_blockade);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/blockhl.cpp b/src/mame/drivers/blockhl.cpp
index 274c3ab0e2e..9cad56653c4 100644
--- a/src/mame/drivers/blockhl.cpp
+++ b/src/mame/drivers/blockhl.cpp
@@ -40,14 +40,15 @@
class blockhl_state : public driver_device
{
public:
- blockhl_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ blockhl_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_bank5800(*this, "bank5800"),
m_audiocpu(*this, "audiocpu"),
m_k052109(*this, "k052109"),
m_k051960(*this, "k051960"),
- m_rombank(*this, "rombank") { }
+ m_rombank(*this, "rombank")
+ { }
K052109_CB_MEMBER(tile_callback);
K051960_CB_MEMBER(sprite_callback);
@@ -300,9 +301,7 @@ void blockhl_state::blockhl(machine_config &config)
screen.set_screen_update(FUNC(blockhl_state::screen_update_blockhl));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 1024));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 1024).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/blocktax.cpp b/src/mame/drivers/blocktax.cpp
index e37a116297a..396213fb843 100644
--- a/src/mame/drivers/blocktax.cpp
+++ b/src/mame/drivers/blocktax.cpp
@@ -41,8 +41,8 @@ class blocktax_state : public driver_device
{
public:
blocktax_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
void blocktax(machine_config &config);
@@ -84,8 +84,7 @@ MACHINE_CONFIG_START(blocktax_state::blocktax)
MCFG_SCREEN_UPDATE_DRIVER(blocktax_state, screen_update_blocktax)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/bloodbro.cpp b/src/mame/drivers/bloodbro.cpp
index e261593be26..c47a4723024 100644
--- a/src/mame/drivers/bloodbro.cpp
+++ b/src/mame/drivers/bloodbro.cpp
@@ -546,9 +546,8 @@ MACHINE_CONFIG_START(bloodbro_state::bloodbro)
crtc.layer_en_callback().set(FUNC(bloodbro_state::layer_en_w));
crtc.layer_scroll_callback().set(FUNC(bloodbro_state::layer_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bloodbro)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bloodbro);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -581,9 +580,7 @@ MACHINE_CONFIG_START(bloodbro_state::weststry)
MCFG_DEVICE_IRQ_ACKNOWLEDGE_REMOVE()
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_weststry)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ m_palette->set_format(palette_device::xBGR_444, 1024);
// Bootleg video hardware is non-Seibu
MCFG_SCREEN_MODIFY("screen")
diff --git a/src/mame/drivers/blstroid.cpp b/src/mame/drivers/blstroid.cpp
index 50162ad1578..bbbeb3f719c 100644
--- a/src/mame/drivers/blstroid.cpp
+++ b/src/mame/drivers/blstroid.cpp
@@ -186,10 +186,9 @@ MACHINE_CONFIG_START(blstroid_state::blstroid)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_blstroid)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_blstroid);
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 512);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, blstroid_state, get_playfield_tile_info, 16,8, SCAN_ROWS, 64,64)
diff --git a/src/mame/drivers/blueprnt.cpp b/src/mame/drivers/blueprnt.cpp
index e2f5472da41..f501af0d40d 100644
--- a/src/mame/drivers/blueprnt.cpp
+++ b/src/mame/drivers/blueprnt.cpp
@@ -371,11 +371,10 @@ MACHINE_CONFIG_START(blueprnt_state::blueprnt)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_VIDEO_START_OVERRIDE(blueprnt_state, blueprnt)
MCFG_SCREEN_UPDATE_DRIVER(blueprnt_state, screen_update_blueprnt)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_blueprnt)
- MCFG_PALETTE_ADD("palette", 128*4+8)
- MCFG_PALETTE_INIT_OWNER(blueprnt_state, blueprnt)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_blueprnt)
+ PALETTE(config, m_palette, FUNC(blueprnt_state::blueprnt_palette), 128*4+8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bmcbowl.cpp b/src/mame/drivers/bmcbowl.cpp
index fd4a9a355d9..aff71818afe 100644
--- a/src/mame/drivers/bmcbowl.cpp
+++ b/src/mame/drivers/bmcbowl.cpp
@@ -119,8 +119,8 @@ Main board:
class bmcbowl_state : public driver_device
{
public:
- bmcbowl_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ bmcbowl_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_stats_ram(*this, "nvram", 16),
m_vid1(*this, "vid1"),
@@ -476,7 +476,7 @@ void bmcbowl_state::bmcbowl(machine_config &config)
screen.set_palette(m_palette);
screen.screen_vblank().set_inputline(m_maincpu, M68K_IRQ_2, HOLD_LINE);
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &bmcbowl_state::ramdac_map);
diff --git a/src/mame/drivers/bmcpokr.cpp b/src/mame/drivers/bmcpokr.cpp
index 33e49c2eee9..2c38363c6b9 100644
--- a/src/mame/drivers/bmcpokr.cpp
+++ b/src/mame/drivers/bmcpokr.cpp
@@ -808,7 +808,7 @@ void bmcpokr_state::bmcpokr(machine_config &config)
screen.set_visarea(0*8, 60*8-1, 0*8, 30*8-1);
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &bmcpokr_state::ramdac_map);
diff --git a/src/mame/drivers/bmjr.cpp b/src/mame/drivers/bmjr.cpp
index ed44996f891..e2f14a49778 100644
--- a/src/mame/drivers/bmjr.cpp
+++ b/src/mame/drivers/bmjr.cpp
@@ -353,7 +353,7 @@ MACHINE_CONFIG_START(bmjr_state::bmjr)
MCFG_SCREEN_UPDATE_DRIVER(bmjr_state, screen_update_bmjr)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, "palette", palette_device::BRG_3BIT);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bmjr)
/* Audio */
diff --git a/src/mame/drivers/bml3.cpp b/src/mame/drivers/bml3.cpp
index 53da182aac9..600ee5e2b3b 100644
--- a/src/mame/drivers/bml3.cpp
+++ b/src/mame/drivers/bml3.cpp
@@ -972,7 +972,7 @@ MACHINE_CONFIG_START(bml3_state::bml3_common)
MCFG_SCREEN_SIZE(640, 400)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
/* Devices */
// CRTC clock should be synchronous with the CPU clock.
diff --git a/src/mame/drivers/bnstars.cpp b/src/mame/drivers/bnstars.cpp
index 5db86cc2948..00d1aaf266e 100644
--- a/src/mame/drivers/bnstars.cpp
+++ b/src/mame/drivers/bnstars.cpp
@@ -104,21 +104,22 @@ class bnstars_state : public ms32_state
{
public:
bnstars_state(const machine_config &mconfig, device_type type, const char *tag)
- : ms32_state(mconfig, type, tag),
- m_ms32_tx0_ram(*this, "tx0_ram"),
- m_ms32_tx1_ram(*this, "tx1_ram"),
- m_ms32_bg0_ram(*this, "bg0_ram"),
- m_ms32_bg1_ram(*this, "bg1_ram"),
- m_ms32_roz0_ram(*this, "roz0_ram"),
- m_ms32_roz1_ram(*this, "roz1_ram"),
- m_ms32_roz_ctrl(*this, "roz_ctrl.%u", 0),
- m_ms32_spram(*this, "spram"),
- m_ms32_tx0_scroll(*this, "tx0_scroll"),
- m_ms32_bg0_scroll(*this, "bg0_scroll"),
- m_ms32_tx1_scroll(*this, "tx1_scroll"),
- m_ms32_bg1_scroll(*this, "bg1_scroll"),
- m_p1_keys(*this, "P1KEY.%u", 0),
- m_p2_keys(*this, "P2KEY.%u", 0) { }
+ : ms32_state(mconfig, type, tag)
+ , m_ms32_tx0_ram(*this, "tx0_ram")
+ , m_ms32_tx1_ram(*this, "tx1_ram")
+ , m_ms32_bg0_ram(*this, "bg0_ram")
+ , m_ms32_bg1_ram(*this, "bg1_ram")
+ , m_ms32_roz0_ram(*this, "roz0_ram")
+ , m_ms32_roz1_ram(*this, "roz1_ram")
+ , m_ms32_roz_ctrl(*this, "roz_ctrl.%u", 0)
+ , m_ms32_spram(*this, "spram")
+ , m_ms32_tx0_scroll(*this, "tx0_scroll")
+ , m_ms32_bg0_scroll(*this, "bg0_scroll")
+ , m_ms32_tx1_scroll(*this, "tx1_scroll")
+ , m_ms32_bg1_scroll(*this, "bg1_scroll")
+ , m_p1_keys(*this, "P1KEY.%u", 0)
+ , m_p2_keys(*this, "P2KEY.%u", 0)
+ { }
void bnstars(machine_config &config);
@@ -824,13 +825,13 @@ MACHINE_CONFIG_START(bnstars_state::bnstars)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bnstars)
- MCFG_PALETTE_ADD("palette", 0x8000)
- MCFG_PALETTE_FORMAT(XBRG)
- MCFG_PALETTE_MEMBITS(16)
+ auto &palette(PALETTE(config, "palette"));
+ palette.set_format(palette_device::xBRG_888, 0x8000);
+ palette.set_membits(16);
- MCFG_PALETTE_ADD("palette2", 0x8000)
- MCFG_PALETTE_FORMAT(XBRG)
- MCFG_PALETTE_MEMBITS(16)
+ auto &palette2(PALETTE(config, "palette2"));
+ palette2.set_format(palette_device::xBRG_888, 0x8000);
+ palette2.set_membits(16);
config.set_default_layout(layout_dualhsxs);
diff --git a/src/mame/drivers/bogeyman.cpp b/src/mame/drivers/bogeyman.cpp
index 32e5e7f7892..6768a55426a 100644
--- a/src/mame/drivers/bogeyman.cpp
+++ b/src/mame/drivers/bogeyman.cpp
@@ -246,12 +246,10 @@ MACHINE_CONFIG_START(bogeyman_state::bogeyman)
// DECO video CRTC, unverified
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2,384,0,256,272,8,248)
MCFG_SCREEN_UPDATE_DRIVER(bogeyman_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bogeyman)
- MCFG_PALETTE_ADD("palette", 16+256)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
- MCFG_PALETTE_INIT_OWNER(bogeyman_state, bogeyman)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bogeyman);
+ PALETTE(config, m_palette, FUNC(bogeyman_state::bogeyman_palette)).set_format(palette_device::BGR_233_inverted, 16 + 256);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bombjack.cpp b/src/mame/drivers/bombjack.cpp
index f3646ad5166..b7a57d5e765 100644
--- a/src/mame/drivers/bombjack.cpp
+++ b/src/mame/drivers/bombjack.cpp
@@ -372,9 +372,8 @@ MACHINE_CONFIG_START(bombjack_state::bombjack)
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)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bombjack);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 128);
/* sound hardware */
diff --git a/src/mame/drivers/bottom9.cpp b/src/mame/drivers/bottom9.cpp
index fa72a86bbc9..15e3c7f6167 100644
--- a/src/mame/drivers/bottom9.cpp
+++ b/src/mame/drivers/bottom9.cpp
@@ -322,9 +322,8 @@ void bottom9_state::bottom9(machine_config &config)
screen.screen_vblank().set(FUNC(bottom9_state::vblank_irq));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0); // 051961 on schematics
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/boxer.cpp b/src/mame/drivers/boxer.cpp
index 210abfdd6e3..cae7b4900d1 100644
--- a/src/mame/drivers/boxer.cpp
+++ b/src/mame/drivers/boxer.cpp
@@ -55,7 +55,7 @@ protected:
DECLARE_WRITE8_MEMBER(irq_reset_w);
DECLARE_WRITE8_MEMBER(crowd_w);
DECLARE_WRITE8_MEMBER(led_w);
- DECLARE_PALETTE_INIT(boxer);
+ void boxer_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pot_interrupt);
TIMER_CALLBACK_MEMBER(periodic_callback);
@@ -161,7 +161,7 @@ TIMER_CALLBACK_MEMBER(boxer_state::periodic_callback)
*
*************************************/
-PALETTE_INIT_MEMBER(boxer_state, boxer)
+void boxer_state::boxer_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x00,0x00,0x00));
palette.set_pen_color(1, rgb_t(0xff,0xff,0xff));
@@ -505,11 +505,10 @@ MACHINE_CONFIG_START(boxer_state::boxer)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(8, 247, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(boxer_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_boxer)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(boxer_state, boxer)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_boxer)
+ PALETTE(config, m_palette, FUNC(boxer_state::boxer_palette), 4);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/brkthru.cpp b/src/mame/drivers/brkthru.cpp
index 80788e9a28c..c4b1a3e7868 100644
--- a/src/mame/drivers/brkthru.cpp
+++ b/src/mame/drivers/brkthru.cpp
@@ -468,16 +468,15 @@ MACHINE_CONFIG_START(brkthru_state::brkthru)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_brkthru)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_brkthru)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(brkthru_state, brkthru)
+ PALETTE(config, m_palette, FUNC(brkthru_state::brkthru_palette), 256);
/* not sure; assuming to be the same as darwin */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 384, 8, 248, 272, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(brkthru_state, screen_update_brkthru)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, brkthru_state, vblank_irq))
/* sound hardware */
@@ -509,10 +508,9 @@ MACHINE_CONFIG_START(brkthru_state::darwin)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_brkthru)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_brkthru)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(brkthru_state, brkthru)
+ PALETTE(config, m_palette, FUNC(brkthru_state::brkthru_palette), 256);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 384, 8, 248, 272, 8, 248)
@@ -529,7 +527,7 @@ MACHINE_CONFIG_START(brkthru_state::darwin)
= 57.444855Hz
tuned by Shingo SUZUKI(VSyncMAME Project) 2000/10/19 */
MCFG_SCREEN_UPDATE_DRIVER(brkthru_state, screen_update_brkthru)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, brkthru_state, vblank_irq))
/* sound hardware */
diff --git a/src/mame/drivers/bsktball.cpp b/src/mame/drivers/bsktball.cpp
index d917977a5dd..14787c96615 100644
--- a/src/mame/drivers/bsktball.cpp
+++ b/src/mame/drivers/bsktball.cpp
@@ -26,8 +26,9 @@
***************************************************************************/
#include "emu.h"
-#include "cpu/m6502/m6502.h"
#include "includes/bsktball.h"
+
+#include "cpu/m6502/m6502.h"
#include "machine/74259.h"
#include "sound/discrete.h"
#include "screen.h"
@@ -40,17 +41,15 @@
*
*************************************/
-PALETTE_INIT_MEMBER(bsktball_state, bsktball)
+void bsktball_state::bsktball_palette(palette_device &palette) const
{
- int i;
-
- palette.set_indirect_color(0,rgb_t(0x00,0x00,0x00)); /* BLACK */
- palette.set_indirect_color(1,rgb_t(0x80,0x80,0x80)); /* LIGHT GREY */
- palette.set_indirect_color(2,rgb_t(0x50,0x50,0x50)); /* DARK GREY */
- palette.set_indirect_color(3,rgb_t(0xff,0xff,0xff)); /* WHITE */
+ palette.set_indirect_color(0,rgb_t(0x00,0x00,0x00)); // BLACK
+ palette.set_indirect_color(1,rgb_t(0x80,0x80,0x80)); // LIGHT GREY
+ palette.set_indirect_color(2,rgb_t(0x50,0x50,0x50)); // DARK GREY
+ palette.set_indirect_color(3,rgb_t(0xff,0xff,0xff)); // WHITE
/* playfield */
- for (i = 0; i < 2; i++)
+ for (int i = 0; i < 2; i++)
{
palette.set_pen_indirect(i*4 + 0, 1);
palette.set_pen_indirect(i*4 + 1, 3 * i);
@@ -59,7 +58,7 @@ PALETTE_INIT_MEMBER(bsktball_state, bsktball)
}
/* motion */
- for (i = 0; i < 4*4*4; i++)
+ for (int i = 0; i < 4*4*4; i++)
{
palette.set_pen_indirect(2*4 + i*4 + 0, 1);
palette.set_pen_indirect(2*4 + i*4 + 1, (i >> 2) & 3);
@@ -262,18 +261,15 @@ MACHINE_CONFIG_START(bsktball_state::bsktball)
MCFG_SCREEN_SIZE(32*8, 28*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(bsktball_state, screen_update_bsktball)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bsktball)
- MCFG_PALETTE_ADD("palette", 2*4 + 4*4*4*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(4)
- MCFG_PALETTE_INIT_OWNER(bsktball_state, bsktball)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_bsktball)
+ PALETTE(config, m_palette, FUNC(bsktball_state::bsktball_palette), 2*4 + 4*4*4*4, 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("discrete", DISCRETE, bsktball_discrete)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ DISCRETE(config, m_discrete, bsktball_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/btime.cpp b/src/mame/drivers/btime.cpp
index 7624c4ba7e3..e0b1873f6b6 100644
--- a/src/mame/drivers/btime.cpp
+++ b/src/mame/drivers/btime.cpp
@@ -1294,16 +1294,14 @@ MACHINE_CONFIG_START(btime_state::btime)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(HCLK, 384, 8, 248, 272, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(btime_state, screen_update_btime)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_MACHINE_START_OVERRIDE(btime_state,btime)
MCFG_MACHINE_RESET_OVERRIDE(btime_state,btime)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_btime)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_btime)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(btime_state,btime)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
+ PALETTE(config, m_palette, FUNC(btime_state::btime_palette)).set_format(palette_device::BGR_233_inverted, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1361,9 +1359,8 @@ MACHINE_CONFIG_START(btime_state::lnc)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_lnc)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(8)
- MCFG_PALETTE_INIT_OWNER(btime_state,lnc)
+ m_palette->set_entries(8);
+ m_palette->set_init(FUNC(btime_state::lnc_palette));
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(btime_state, screen_update_lnc)
@@ -1430,8 +1427,7 @@ MACHINE_CONFIG_START(btime_state::zoar)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_zoar)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(64)
+ m_palette->set_entries(64);
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(btime_state, screen_update_zoar)
@@ -1465,8 +1461,7 @@ MACHINE_CONFIG_START(btime_state::disco)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_disco)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32)
+ m_palette->set_entries(32);
MCFG_VIDEO_START_OVERRIDE(btime_state,disco)
diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp
index 3863035dff4..8faa3e66df6 100644
--- a/src/mame/drivers/bublbobl.cpp
+++ b/src/mame/drivers/bublbobl.cpp
@@ -874,22 +874,17 @@ MACHINE_CONFIG_START(bublbobl_state::tokio)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MAIN_XTAL/4, 384, 0, 256, 264, 16, 240)
MCFG_SCREEN_UPDATE_DRIVER(bublbobl_state, screen_update_bublbobl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bublbobl)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bublbobl);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
-
- GENERIC_LATCH_8(config, m_main_to_sound);
- m_main_to_sound->data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<1>));
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
+ GENERIC_LATCH_8(config, m_main_to_sound).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<1>));
GENERIC_LATCH_8(config, m_sound_to_main);
MCFG_DEVICE_ADD("ymsnd", YM2203, MAIN_XTAL/8)
@@ -986,25 +981,18 @@ MACHINE_CONFIG_START(bublbobl_state::bublbobl_nomcu)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MAIN_XTAL/4, 384, 0, 256, 264, 16, 240)
MCFG_SCREEN_UPDATE_DRIVER(bublbobl_state, screen_update_bublbobl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bublbobl)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bublbobl);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_INPUT_MERGER_ANY_HIGH("soundirq")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_IRQ0))
-
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
-
- GENERIC_LATCH_8(config, m_main_to_sound);
- m_main_to_sound->data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<1>));
+ INPUT_MERGER_ANY_HIGH(config, m_soundirq).output_handler().set_inputline(m_audiocpu, INPUT_LINE_IRQ0);
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
+ GENERIC_LATCH_8(config, m_main_to_sound).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<1>));
GENERIC_LATCH_8(config, m_sound_to_main);
MCFG_DEVICE_ADD("ym1", YM2203, MAIN_XTAL/8)
diff --git a/src/mame/drivers/buggychl.cpp b/src/mame/drivers/buggychl.cpp
index 538b98fe447..475fe490f3d 100644
--- a/src/mame/drivers/buggychl.cpp
+++ b/src/mame/drivers/buggychl.cpp
@@ -546,21 +546,17 @@ void buggychl_state::buggychl(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_buggychl);
- PALETTE(config, m_palette, 128+128);
- m_palette->set_format(PALETTE_FORMAT_xxxxRRRRGGGGBBBB);
+ PALETTE(config, m_palette, FUNC(buggychl_state::buggychl_palette)).set_format(palette_device::xRGB_444, 128 + 128);
m_palette->set_endianness(ENDIANNESS_BIG);
- m_palette->set_init(FUNC(buggychl_state::palette_init_buggychl));
/* sound hardware */
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
-
- INPUT_MERGER_ALL_HIGH(config, "soundnmi").output_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
-
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
GENERIC_LATCH_8(config, m_soundlatch2);
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
+
TA7630(config, m_ta7630);
YM2149(config, m_ay1, 8_MHz_XTAL/4);
diff --git a/src/mame/drivers/busicom.cpp b/src/mame/drivers/busicom.cpp
index b0c3261dd85..8ac487f27c4 100644
--- a/src/mame/drivers/busicom.cpp
+++ b/src/mame/drivers/busicom.cpp
@@ -240,10 +240,9 @@ MACHINE_CONFIG_START(busicom_state::busicom)
MCFG_SCREEN_SIZE(40*17, 44*11)
MCFG_SCREEN_VISIBLE_AREA(0, 40*17-1, 0, 44*11-1)
MCFG_SCREEN_UPDATE_DRIVER(busicom_state, screen_update_busicom)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(busicom_state, busicom)
+ PALETTE(config, m_palette, FUNC(busicom_state::busicom_palette), 16);
MCFG_TIMER_DRIVER_ADD_PERIODIC("busicom_timer", busicom_state, timer_callback, attotime::from_msec(28*2))
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/buster.cpp b/src/mame/drivers/buster.cpp
index 27260e5d660..b2777b70680 100644
--- a/src/mame/drivers/buster.cpp
+++ b/src/mame/drivers/buster.cpp
@@ -25,12 +25,13 @@ TODO:
class buster_state : public driver_device
{
public:
- buster_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ buster_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_vram(*this, "vram"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
DECLARE_WRITE8_MEMBER(coin_output_w);
uint32_t screen_update_buster(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -334,7 +335,7 @@ MACHINE_CONFIG_START(buster_state::buster)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(buster_state, screen_update_buster)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", XTAL(3'579'545)/4)); //unknown clock / type
crtc.set_screen("screen");
@@ -343,7 +344,7 @@ MACHINE_CONFIG_START(buster_state::buster)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_buster)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/bw12.cpp b/src/mame/drivers/bw12.cpp
index 4af465d7974..cd9f2ba1423 100644
--- a/src/mame/drivers/bw12.cpp
+++ b/src/mame/drivers/bw12.cpp
@@ -564,7 +564,7 @@ MACHINE_CONFIG_START(bw12_state::common)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bw12)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, XTAL(16'000'000)/8);
m_crtc->set_screen(SCREEN_TAG);
diff --git a/src/mame/drivers/bw2.cpp b/src/mame/drivers/bw2.cpp
index 4840fde41f5..b65590f0f4e 100644
--- a/src/mame/drivers/bw2.cpp
+++ b/src/mame/drivers/bw2.cpp
@@ -511,7 +511,7 @@ static void bw2_floppies(device_slot_interface &device)
//**************************************************************************
-PALETTE_INIT_MEMBER(bw2_state, bw2)
+void bw2_state::bw2_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xa5, 0xad, 0xa5);
palette.set_pen_color(1, 0x31, 0x39, 0x10);
@@ -555,8 +555,7 @@ MACHINE_CONFIG_START(bw2_state::bw2)
MCFG_SCREEN_SIZE(640, 200)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(bw2_state, bw2)
+ PALETTE(config, "palette", FUNC(bw2_state::bw2_palette), 2);
// devices
PIT8253(config, m_pit, 0);
diff --git a/src/mame/drivers/c10.cpp b/src/mame/drivers/c10.cpp
index bde2d2c15d0..c47ca0e0d43 100644
--- a/src/mame/drivers/c10.cpp
+++ b/src/mame/drivers/c10.cpp
@@ -174,7 +174,7 @@ MACHINE_CONFIG_START(c10_state::c10)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c10)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
void c10_state::init_c10()
diff --git a/src/mame/drivers/c65.cpp b/src/mame/drivers/c65.cpp
index 597a6ed16c1..2795a1861ef 100644
--- a/src/mame/drivers/c65.cpp
+++ b/src/mame/drivers/c65.cpp
@@ -94,7 +94,7 @@ public:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(c65);
+ void c65_palette(palette_device &palette);
void init_c65();
void init_c65pal();
@@ -632,7 +632,7 @@ void c65_state::machine_reset()
}
-PALETTE_INIT_MEMBER(c65_state, c65)
+void c65_state::c65_palette(palette_device &palette)
{
for (int i = 0; i < 0x100; i++)
PalEntryFlush(i);
@@ -714,12 +714,11 @@ MACHINE_CONFIG_START(c65_state::c65)
// MCFG_SCREEN_SIZE(32*8, 32*8)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK*4, 910, 0, 640, 262, 0, 200) // mods needed
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c65)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_c65)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(c65_state, c65)
+ PALETTE(config, m_palette, FUNC(c65_state::c65_palette), 0x100);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/c900.cpp b/src/mame/drivers/c900.cpp
index 6be497e54ce..3e969f1df97 100644
--- a/src/mame/drivers/c900.cpp
+++ b/src/mame/drivers/c900.cpp
@@ -101,7 +101,7 @@ MACHINE_CONFIG_START(c900_state::c900)
MCFG_DEVICE_IO_MAP(io_map)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_c900)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
Z8036(config, "cio", 6'000'000);
diff --git a/src/mame/drivers/cabal.cpp b/src/mame/drivers/cabal.cpp
index def1ebdb952..81c28ec9354 100644
--- a/src/mame/drivers/cabal.cpp
+++ b/src/mame/drivers/cabal.cpp
@@ -522,11 +522,10 @@ MACHINE_CONFIG_START(cabal_state::cabal)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cabal_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cabal)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cabal);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
/* sound hardware */
SEIBU_SOUND(config, m_seibu_sound, 0);
@@ -604,11 +603,10 @@ MACHINE_CONFIG_START(cabal_state::cabalbl)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cabal_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cabal)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cabal);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cabaret.cpp b/src/mame/drivers/cabaret.cpp
index 8174eb50152..ed7a8357389 100644
--- a/src/mame/drivers/cabaret.cpp
+++ b/src/mame/drivers/cabaret.cpp
@@ -395,11 +395,10 @@ MACHINE_CONFIG_START(cabaret_state::cabaret)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(cabaret_state, screen_update_cabaret)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cabaret)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_cabaret)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/calomega.cpp b/src/mame/drivers/calomega.cpp
index 94a985b47ea..ab1c504dae1 100644
--- a/src/mame/drivers/calomega.cpp
+++ b/src/mame/drivers/calomega.cpp
@@ -2594,11 +2594,10 @@ MACHINE_CONFIG_START(calomega_state::sys903)
MCFG_SCREEN_SIZE((39+1)*8, (31+1)*8) /* Taken from MC6845 init, registers 00 & 04. Normally programmed with (value-1) */
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 31*8-1) /* Taken from MC6845 init, registers 01 & 06 */
MCFG_SCREEN_UPDATE_DRIVER(calomega_state, screen_update_calomega)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_calomega)
- MCFG_PALETTE_ADD("palette", 256) /* or 128? is the upper half of the PROMs really valid colors? */
- MCFG_PALETTE_INIT_OWNER(calomega_state, calomega)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_calomega);
+ PALETTE(config, m_palette, FUNC(calomega_state::calomega_palette), 256); // or 128? is the upper half of the PROMs really valid colors?
mc6845_device &crtc(MC6845(config, "crtc", CPU_CLOCK)); /* 6845 @ CPU clock */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/calorie.cpp b/src/mame/drivers/calorie.cpp
index 7bae3130d80..7f834415829 100644
--- a/src/mame/drivers/calorie.cpp
+++ b/src/mame/drivers/calorie.cpp
@@ -92,15 +92,16 @@ Notes:
class calorie_state : public driver_device
{
public:
- calorie_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ calorie_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_fg_ram(*this, "fg_ram"),
m_sprites(*this, "sprites"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
- m_decrypted_opcodes(*this, "decrypted_opcodes") { }
+ m_decrypted_opcodes(*this, "decrypted_opcodes")
+ { }
/* memory pointers */
required_shared_ptr<uint8_t> m_fg_ram;
@@ -485,11 +486,10 @@ MACHINE_CONFIG_START(calorie_state::calorie)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(calorie_state, screen_update_calorie)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_calorie)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_calorie);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp
index 74497fa726d..7f05a0cfd4c 100644
--- a/src/mame/drivers/camplynx.cpp
+++ b/src/mame/drivers/camplynx.cpp
@@ -849,16 +849,17 @@ static void camplynx_floppies(device_slot_interface &device)
device.option_add("525qd", FLOPPY_525_QD);
}
-MACHINE_CONFIG_START(camplynx_state::lynx_common)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+void camplynx_state::lynx_common(machine_config &config)
+{
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- MCFG_DEVICE_ADD("dac", DAC_6BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.375) // unknown DAC
- 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)
+ DAC_6BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.375); // unknown DAC
+ VOLTAGE_REGULATOR(config, "vref").set_output(5.0)
+ .add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT).add_route(0, m_dac, -1.0, DAC_VREF_NEG_INPUT);
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "speaker", 0.02);
-MACHINE_CONFIG_END
+}
void camplynx_state::lynx_disk(machine_config &config)
{
diff --git a/src/mame/drivers/candela.cpp b/src/mame/drivers/candela.cpp
index 4ea2db992c1..d08f6cb02f5 100644
--- a/src/mame/drivers/candela.cpp
+++ b/src/mame/drivers/candela.cpp
@@ -757,7 +757,7 @@ MACHINE_CONFIG_START(can09_state::can09)
MCFG_SCREEN_RAW_PARAMS(4_MHz_XTAL / 2, 512, 0, 512, 576, 0, 576)
MCFG_SCREEN_UPDATE_DRIVER(can09_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Floppy */
WD1770(config, "wd1770", 8_MHz_XTAL); // TODO: Verify 8MHz UKI crystal assumed to be used
diff --git a/src/mame/drivers/canyon.cpp b/src/mame/drivers/canyon.cpp
index f6e17338242..cbb137f3ec6 100644
--- a/src/mame/drivers/canyon.cpp
+++ b/src/mame/drivers/canyon.cpp
@@ -40,6 +40,7 @@
#include "emu.h"
#include "includes/canyon.h"
+
#include "cpu/m6502/m6502.h"
#include "sound/discrete.h"
#include "screen.h"
@@ -52,12 +53,12 @@
*
*************************************/
-PALETTE_INIT_MEMBER(canyon_state, canyon)
+void canyon_state::canyon_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x80, 0x80, 0x80)); /* GREY */
- palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); /* BLACK */
- palette.set_pen_color(2, rgb_t(0x80, 0x80, 0x80)); /* GREY */
- palette.set_pen_color(3, rgb_t(0xff, 0xff, 0xff)); /* WHITE */
+ palette.set_pen_color(0, rgb_t(0x80, 0x80, 0x80)); // GREY
+ palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); // BLACK
+ palette.set_pen_color(2, rgb_t(0x80, 0x80, 0x80)); // GREY
+ palette.set_pen_color(3, rgb_t(0xff, 0xff, 0xff)); // WHITE
}
@@ -258,12 +259,11 @@ MACHINE_CONFIG_START(canyon_state::canyon)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(12.096_MHz_XTAL / 2, 384, 0, 256, 262, 0, 240) // HSYNC = 15,750 Hz
MCFG_SCREEN_UPDATE_DRIVER(canyon_state, screen_update_canyon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", m6502_device::NMI_LINE))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_canyon)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(canyon_state, canyon)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_canyon)
+ PALETTE(config, m_palette, FUNC(canyon_state::canyon_palette), 4);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/cardline.cpp b/src/mame/drivers/cardline.cpp
index f120bd28803..2b41aedbbf6 100644
--- a/src/mame/drivers/cardline.cpp
+++ b/src/mame/drivers/cardline.cpp
@@ -20,7 +20,6 @@
***********************************/
-
#include "emu.h"
#include "cpu/mcs51/mcs51.h"
#include "sound/okim6295.h"
@@ -48,6 +47,12 @@ public:
m_lamps(*this, "lamp%u", 0U)
{ }
+ void cardline(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+
+private:
DECLARE_WRITE8_MEMBER(vram_w);
DECLARE_WRITE8_MEMBER(attr_w);
DECLARE_WRITE8_MEMBER(video_w);
@@ -58,20 +63,16 @@ public:
DECLARE_WRITE8_MEMBER(asic_w);
DECLARE_WRITE8_MEMBER(a3003_w);
- DECLARE_PALETTE_INIT(cardline);
+ void cardline_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(hsync_changed);
DECLARE_WRITE_LINE_MEMBER(vsync_changed);
MC6845_BEGIN_UPDATE(crtc_begin_update);
MC6845_UPDATE_ROW(crtc_update_row);
- void cardline(machine_config &config);
void mem_io(address_map &map);
void mem_prg(address_map &map);
-protected:
- virtual void machine_start() override;
-
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
@@ -295,30 +296,33 @@ static GFXDECODE_START( gfx_cardline )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 2 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(cardline_state, cardline)
+void cardline_state::cardline_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b,data;
- int bit0,bit1,bit2;
- for (i = 0;i < palette.entries();i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < palette.entries(); i++)
{
- data=color_prom[i];
-
- /* red component */
- bit0 = (data >> 5) & 0x01;
- bit1 = (data >> 6) & 0x01;
- bit2 = (data >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (data >> 2) & 0x01;
- bit1 = (data >> 3) & 0x01;
- bit2 = (data >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (data >> 0) & 0x01;
- bit1 = (data >> 1) & 0x01;
- b = 0x55 * bit0 + 0xaa * bit1;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int const data = color_prom[i];
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(data, 5);
+ bit1 = BIT(data, 6);
+ bit2 = BIT(data, 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(data, 2);
+ bit1 = BIT(data, 3);
+ bit2 = BIT(data, 4);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(data, 0);
+ bit1 = BIT(data, 1);
+ int const b = 0x55 * bit0 + 0xaa * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -340,12 +344,11 @@ MACHINE_CONFIG_START(cardline_state::cardline)
MCFG_SCREEN_SIZE(64*8, 35*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
//MCFG_SCREEN_UPDATE_DRIVER(cardline_state, screen_update_cardline)
- //MCFG_SCREEN_PALETTE("palette")
+ //MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cardline)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(cardline_state, cardline)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cardline);
+ PALETTE(config, m_palette, FUNC(cardline_state::cardline_palette), 512);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8)); /* divisor guessed - result is 56 Hz */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/carjmbre.cpp b/src/mame/drivers/carjmbre.cpp
index 0c6a3b88e9e..57be932e911 100644
--- a/src/mame/drivers/carjmbre.cpp
+++ b/src/mame/drivers/carjmbre.cpp
@@ -53,8 +53,8 @@
class carjmbre_state : public driver_device
{
public:
- carjmbre_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ carjmbre_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_videoram(*this, "videoram"),
@@ -81,7 +81,7 @@ public:
DECLARE_WRITE8_MEMBER(flipscreen_w);
INTERRUPT_GEN_MEMBER(vblank_nmi);
- DECLARE_PALETTE_INIT(carjmbre);
+ void carjmbre_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(get_tile_info);
@@ -118,10 +118,10 @@ static const res_net_decode_info carjmbre_decode_info =
{
1, // there may be two proms needed to construct color
0, 63, // start/end
- // R, G, B,
- { 0, 0, 0, }, // offsets
- { 0, 3, 6, }, // shifts
- {0x07,0x07,0x03, } // masks
+ // R, G, B
+ { 0, 0, 0 }, // offsets
+ { 0, 3, 6 }, // shifts
+ {0x07,0x07,0x03 } // masks
};
static const res_net_info carjmbre_net_info =
@@ -134,7 +134,7 @@ static const res_net_info carjmbre_net_info =
}
};
-PALETTE_INIT_MEMBER(carjmbre_state, carjmbre)
+void carjmbre_state::carjmbre_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
@@ -374,11 +374,10 @@ MACHINE_CONFIG_START(carjmbre_state::carjmbre)
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(carjmbre_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_carjmbre)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(carjmbre_state, carjmbre)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_carjmbre);
+ PALETTE(config, m_palette, FUNC(carjmbre_state::carjmbre_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/carpolo.cpp b/src/mame/drivers/carpolo.cpp
index 85d02df92cb..07f3b2906e9 100644
--- a/src/mame/drivers/carpolo.cpp
+++ b/src/mame/drivers/carpolo.cpp
@@ -286,12 +286,10 @@ MACHINE_CONFIG_START(carpolo_state::carpolo)
MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 255)
MCFG_SCREEN_UPDATE_DRIVER(carpolo_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, carpolo_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_carpolo)
- MCFG_PALETTE_ADD("palette", 12*2+2*16+4*2)
- MCFG_PALETTE_INIT_OWNER(carpolo_state,carpolo)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_carpolo);
+ PALETTE(config, m_palette, FUNC(carpolo_state::carpolo_palette), 12*2+2*16+4*2);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/carrera.cpp b/src/mame/drivers/carrera.cpp
index 83706460abe..6ba9a74ecc3 100644
--- a/src/mame/drivers/carrera.cpp
+++ b/src/mame/drivers/carrera.cpp
@@ -46,8 +46,6 @@ TODO:
*/
-#define MASTER_CLOCK XTAL(22'118'400)
-
#include "emu.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
@@ -56,27 +54,33 @@ TODO:
#include "screen.h"
#include "speaker.h"
+#define MASTER_CLOCK XTAL(22'118'400)
+
class carrera_state : public driver_device
{
public:
- carrera_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ carrera_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_tileram(*this, "tileram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
- required_shared_ptr<uint8_t> m_tileram;
+ void carrera(machine_config &config);
+
+private:
DECLARE_READ8_MEMBER(unknown_r);
- DECLARE_PALETTE_INIT(carrera);
+ void carrera_palette(palette_device &palette) const;
uint32_t screen_update_carrera(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void carrera_map(address_map &map);
+ void io_map(address_map &map);
+
+ required_shared_ptr<uint8_t> m_tileram;
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- void carrera(machine_config &config);
- void carrera_map(address_map &map);
- void io_map(address_map &map);
};
@@ -287,29 +291,26 @@ READ8_MEMBER(carrera_state::unknown_r)
return machine().rand();
}
-PALETTE_INIT_MEMBER(carrera_state, carrera)
+void carrera_state::carrera_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int br_bit0, br_bit1, bit0, bit1, r, g, b;
- int i;
-
- for (i = 0; i < 0x20; ++i)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x20; ++i)
{
- br_bit0 = (color_prom[0] >> 6) & 0x01;
- br_bit1 = (color_prom[0] >> 7) & 0x01;
-
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- b = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 1) & 0x01;
- bit1 = (color_prom[0] >> 4) & 0x01;
- g = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 2) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- r = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
+ int bit0, bit1;
+ int const br_bit0 = BIT(color_prom[i], 6);
+ int const br_bit1 = BIT(color_prom[i], 7);
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 3);
+ int const b = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
+ bit0 = BIT(color_prom[i], 1);
+ bit1 = BIT(color_prom[i], 4);
+ int const g = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 5);
+ int const r = 0x0e * br_bit0 + 0x1f * br_bit1 + 0x43 * bit0 + 0x8f * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -327,7 +328,7 @@ MACHINE_CONFIG_START(carrera_state::carrera)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(carrera_state, screen_update_carrera)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK / 16));
crtc.set_screen("screen");
@@ -335,9 +336,8 @@ MACHINE_CONFIG_START(carrera_state::carrera)
crtc.set_char_width(8);
crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_carrera)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(carrera_state, carrera)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_carrera);
+ PALETTE(config, m_palette, FUNC(carrera_state::carrera_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/caswin.cpp b/src/mame/drivers/caswin.cpp
index 9b666f71de7..3482f04c3e3 100644
--- a/src/mame/drivers/caswin.cpp
+++ b/src/mame/drivers/caswin.cpp
@@ -99,7 +99,7 @@ protected:
DECLARE_WRITE8_MEMBER(vvillage_output_w);
DECLARE_WRITE8_MEMBER(vvillage_lamps_w);
TILE_GET_INFO_MEMBER(get_sc0_tile_info);
- DECLARE_PALETTE_INIT(caswin);
+ void caswin_palette(palette_device &palette) const;
uint32_t screen_update_vvillage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual void video_start() override;
@@ -307,26 +307,25 @@ static GFXDECODE_START( gfx_vvillage )
GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 16 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(caswin_state, caswin)
+void caswin_state::caswin_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
-
- for (i = 0; i < 0x40; ++i)
+ for (int i = 0; i < 0x40; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
bit1 = (color_prom[0] >> 0) & 0x01;
bit2 = (color_prom[0] >> 1) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[0] >> 2) & 0x01;
bit1 = (color_prom[0] >> 3) & 0x01;
bit2 = (color_prom[0] >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[0] >> 5) & 0x01;
bit1 = (color_prom[0] >> 6) & 0x01;
bit2 = (color_prom[0] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
@@ -353,8 +352,7 @@ MACHINE_CONFIG_START(caswin_state::vvillage)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vvillage)
- MCFG_PALETTE_ADD("palette", 0x40)
- MCFG_PALETTE_INIT_OWNER(caswin_state, caswin)
+ PALETTE(config, "palette", FUNC(caswin_state::caswin_palette), 0x40);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp
index cd04adfe2fe..54047855bc0 100644
--- a/src/mame/drivers/cave.cpp
+++ b/src/mame/drivers/cave.cpp
@@ -2024,8 +2024,7 @@ void cave_state::add_base_config(machine_config &config)
m_screen->set_visarea(0, 320-1, 0, 240-1);
m_screen->set_screen_update(FUNC(cave_state::screen_update));
- PALETTE(config, m_palette, 0x8000);
- m_palette->set_init(FUNC(cave_state::palette_init_cave));
+ PALETTE(config, m_palette, FUNC(cave_state::cave_palette), 0x8000);
}
void cave_state::add_ymz(machine_config &config)
@@ -2052,9 +2051,7 @@ void cave_state::dfeveron(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_dfeveron);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_dfeveron));
+ m_palette->set_init(FUNC(cave_state::dfeveron_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_2_layers)
@@ -2101,9 +2098,7 @@ void cave_state::donpachi(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_donpachi);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_dfeveron));
+ m_palette->set_init(FUNC(cave_state::dfeveron_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_3_layers)
@@ -2216,9 +2211,7 @@ void cave_state::hotdogst(machine_config &config)
m_screen->set_visarea(0, 384-1, 0, 240-1);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hotdogst);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_dfeveron));
+ m_palette->set_init(FUNC(cave_state::dfeveron_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_3_layers)
@@ -2258,9 +2251,7 @@ void cave_state::korokoro(machine_config &config)
m_screen->set_visarea(0, 320-1-2, 0, 240-1-1);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_korokoro);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_korokoro));
+ m_palette->set_init(FUNC(cave_state::korokoro_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_1_layer)
@@ -2299,9 +2290,7 @@ void cave_state::mazinger(machine_config &config)
m_screen->set_visarea(0, 384-1, 0, 240-1);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mazinger);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_mazinger));
+ m_palette->set_init(FUNC(cave_state::mazinger_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_2_layers)
@@ -2349,9 +2338,7 @@ void cave_state::metmqstr(machine_config &config)
m_screen->set_visarea(0x7d, 0x7d + 0x180-1, 0, 240-1);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_donpachi);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_dfeveron));
+ m_palette->set_init(FUNC(cave_state::dfeveron_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_3_layers)
@@ -2467,7 +2454,7 @@ void cave_state::ppsatan(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ppsatan);
- m_palette->set_init(FUNC(cave_state::palette_init_ppsatan));
+ m_palette->set_init(FUNC(cave_state::ppsatan_palette));
config.set_default_layout(layout_ppsatan);
@@ -2507,9 +2494,8 @@ void cave_state::pwrinst2(machine_config &config)
m_screen->set_visarea(0x70, 0x70 + 0x140-1, 0, 240-1);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pwrinst2);
-
m_palette->set_entries(0x8000+0x2800);
- m_palette->set_init(FUNC(cave_state::palette_init_pwrinst2));
+ m_palette->set_init(FUNC(cave_state::pwrinst2_palette));
MCFG_VIDEO_START_OVERRIDE(cave_state,cave_4_layers)
@@ -2576,10 +2562,8 @@ void cave_state::sailormn(machine_config &config)
m_screen->set_size(320+1, 240);
m_screen->set_visarea(0+1, 320+1-1, 0, 240-1);
- GFXDECODE(config, m_gfxdecode, m_palette, gfx_sailormn);
-
- /* $8000 palette entries for consistency with the other games */
- m_palette->set_init(FUNC(cave_state::palette_init_sailormn)); // 4 bit sprites, 6 bit tiles
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sailormn); // 4 bit sprites, 6 bit tiles
+ m_palette->set_init(FUNC(cave_state::sailormn_palette)); // $8000 palette entries for consistency with the other games
MCFG_VIDEO_START_OVERRIDE(cave_state,sailormn_3_layers) /* Layer 2 has 1 banked ROM */
diff --git a/src/mame/drivers/cb2001.cpp b/src/mame/drivers/cb2001.cpp
index 9d8a46ed970..62af00fb8d5 100644
--- a/src/mame/drivers/cb2001.cpp
+++ b/src/mame/drivers/cb2001.cpp
@@ -54,16 +54,27 @@ this seems more like 8-bit hardware, maybe it should be v25, not v35...
class cb2001_state : public driver_device
{
public:
- cb2001_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ cb2001_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vram_fg(*this, "vrafg"),
m_vram_bg(*this, "vrabg"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
+ void cb2001(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
required_shared_ptr<uint16_t> m_vram_fg;
required_shared_ptr<uint16_t> m_vram_bg;
+ required_device<v35_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
int m_videobank;
int m_videomode;
tilemap_t *m_reel1_tilemap;
@@ -71,21 +82,17 @@ public:
tilemap_t *m_reel3_tilemap;
int m_other1;
int m_other2;
+
DECLARE_WRITE16_MEMBER(cb2001_vidctrl_w);
DECLARE_WRITE16_MEMBER(cb2001_vidctrl2_w);
DECLARE_WRITE16_MEMBER(cb2001_bg_w);
TILE_GET_INFO_MEMBER(get_cb2001_reel1_tile_info);
TILE_GET_INFO_MEMBER(get_cb2001_reel2_tile_info);
TILE_GET_INFO_MEMBER(get_cb2001_reel3_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(cb2001);
+ void cb2001_palette(palette_device &palette) const;
uint32_t screen_update_cb2001(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
DECLARE_READ8_MEMBER(irq_ack_r);
- required_device<v35_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- void cb2001(machine_config &config);
void cb2001_io(address_map &map);
void cb2001_map(address_map &map);
};
@@ -792,25 +799,20 @@ static GFXDECODE_START( gfx_cb2001 )
GFXDECODE_ENTRY( "gfx", 0, cb2001_layout32, 0x0, 32 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(cb2001_state, cb2001)
+void cb2001_state::cb2001_palette(palette_device &palette) const
{
- int i;
- for (i = 0; i < 0x200; i++)
- {
- int r,g,b;
-
- uint8_t*proms = memregion("proms")->base();
- int length = memregion("proms")->bytes();
- uint16_t dat;
-
- dat = (proms[0x000+i] << 8) | proms[0x200+i];
+ uint8_t const *const proms = memregion("proms")->base();
+ int const length = memregion("proms")->bytes();
+ for (int i = 0; i < 0x200; i++)
+ {
+ uint16_t dat = (proms[0x000+i] << 8) | proms[0x200+i];
- b = ((dat >> 1) & 0x1f)<<3;
- r = ((dat >> 6 )& 0x1f)<<3;
- g = ((dat >> 11 ) & 0x1f)<<3;
+ int const b = ((dat >> 1) & 0x1f) << 3;
+ int const r = ((dat >> 6 )& 0x1f) << 3;
+ int const g = ((dat >> 11 ) & 0x1f) << 3;
- if (length==0x400) // are the cb2001 proms dumped incorrectly?
+ if (length == 0x400) // are the cb2001 proms dumped incorrectly?
{
if (!(i&0x20)) palette.set_pen_color((i&0x1f) | ((i&~0x3f)>>1), rgb_t(r, g, b));
}
@@ -848,7 +850,7 @@ void cb2001_state::cb2001(machine_config &config)
screen.set_visarea(0, 64*8-1, 0, 32*8-1);
screen.set_screen_update(FUNC(cb2001_state::screen_update_cb2001));
- PALETTE(config, m_palette, 0x100).set_init(FUNC(cb2001_state::palette_init_cb2001));
+ PALETTE(config, m_palette, FUNC(cb2001_state::cb2001_palette), 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cball.cpp b/src/mame/drivers/cball.cpp
index 07f26abfe6a..9cd61182816 100644
--- a/src/mame/drivers/cball.cpp
+++ b/src/mame/drivers/cball.cpp
@@ -20,13 +20,14 @@ public:
TIMER_INTERRUPT
};
- cball_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ cball_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
- m_video_ram(*this, "video_ram") { }
+ m_video_ram(*this, "video_ram")
+ { }
/* devices */
required_device<cpu_device> m_maincpu;
@@ -52,7 +53,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(cball);
+ void cball_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -139,7 +140,7 @@ void cball_state::machine_reset()
}
-PALETTE_INIT_MEMBER(cball_state, cball)
+void cball_state::cball_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x80, 0x80, 0x80));
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00));
@@ -276,11 +277,11 @@ MACHINE_CONFIG_START(cball_state::cball)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 223)
MCFG_SCREEN_UPDATE_DRIVER(cball_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cball)
- MCFG_PALETTE_ADD("palette", 6)
- MCFG_PALETTE_INIT_OWNER(cball_state, cball)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_cball)
+
+ PALETTE(config, m_palette, FUNC(cball_state::cball_palette), 6);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/cbasebal.cpp b/src/mame/drivers/cbasebal.cpp
index 2a0cfa56650..c508d933452 100644
--- a/src/mame/drivers/cbasebal.cpp
+++ b/src/mame/drivers/cbasebal.cpp
@@ -280,12 +280,11 @@ MACHINE_CONFIG_START(cbasebal_state::cbasebal)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(cbasebal_state, screen_update_cbasebal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cbasebal)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cbm2.cpp b/src/mame/drivers/cbm2.cpp
index 4926cb11007..ce010831c67 100644
--- a/src/mame/drivers/cbm2.cpp
+++ b/src/mame/drivers/cbm2.cpp
@@ -2535,7 +2535,7 @@ void cbm2_state::cbm2lp_ntsc(machine_config &config)
screen.set_size(768, 312);
screen.set_visarea(0, 768-1, 0, 312-1);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, XTAL(18'000'000)/9);
m_crtc->set_screen(SCREEN_TAG);
diff --git a/src/mame/drivers/cbuster.cpp b/src/mame/drivers/cbuster.cpp
index ae309f0bad2..725689db30d 100644
--- a/src/mame/drivers/cbuster.cpp
+++ b/src/mame/drivers/cbuster.cpp
@@ -318,8 +318,7 @@ MACHINE_CONFIG_START(cbuster_state::twocrude)
MCFG_SCREEN_UPDATE_DRIVER(cbuster_state, screen_update_twocrude)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cbuster)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
diff --git a/src/mame/drivers/cc40.cpp b/src/mame/drivers/cc40.cpp
index c9a10c48f53..9440d942c8a 100644
--- a/src/mame/drivers/cc40.cpp
+++ b/src/mame/drivers/cc40.cpp
@@ -105,6 +105,15 @@ public:
m_sysram[1] = nullptr;
}
+ DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed);
+
+ void cc40(machine_config &config);
+
+protected:
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
+private:
void postload();
void init_sysram(int chip, u16 size);
void update_lcd_indicator(u8 y, u8 x, int state);
@@ -123,18 +132,12 @@ public:
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_WRITE8_MEMBER(keyboard_w);
- DECLARE_PALETTE_INIT(cc40);
- DECLARE_INPUT_CHANGED_MEMBER(sysram_size_changed);
+ void cc40_palette(palette_device &palette) const;
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(cc40_cartridge);
HD44780_PIXEL_UPDATE(cc40_pixel_update);
- void cc40(machine_config &config);
- void main_map(address_map &map);
-protected:
- virtual void machine_reset() override;
- virtual void machine_start() override;
+ void main_map(address_map &map);
-private:
required_device<tms70c20_device> m_maincpu;
required_device<generic_slot_device> m_cart;
required_ioport_array<8> m_key_matrix;
@@ -190,7 +193,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cc40_state, cc40_cartridge)
***************************************************************************/
-PALETTE_INIT_MEMBER(cc40_state, cc40)
+void cc40_state::cc40_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on
@@ -604,8 +607,7 @@ MACHINE_CONFIG_START(cc40_state::cc40)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(cc40_state, cc40)
+ PALETTE(config, "palette", FUNC(cc40_state::cc40_palette), 3);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal
diff --git a/src/mame/drivers/ccastles.cpp b/src/mame/drivers/ccastles.cpp
index f3d68ab9f04..ba6150d8616 100644
--- a/src/mame/drivers/ccastles.cpp
+++ b/src/mame/drivers/ccastles.cpp
@@ -455,7 +455,7 @@ void ccastles_state::ccastles(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ccastles);
- PALETTE(config, m_palette, 32);
+ PALETTE(config, m_palette).set_entries(32);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, 0, HTOTAL - 1, VTOTAL, 0, VTOTAL - 1); /* will be adjusted later */
diff --git a/src/mame/drivers/cchance.cpp b/src/mame/drivers/cchance.cpp
index f55bc9cde2c..e3d9a4cd3af 100644
--- a/src/mame/drivers/cchance.cpp
+++ b/src/mame/drivers/cchance.cpp
@@ -47,18 +47,23 @@ class cchance_state : public tnzs_base_state
{
public:
cchance_state(const machine_config &mconfig, device_type type, const char *tag)
- : tnzs_base_state(mconfig, type, tag) { }
+ : tnzs_base_state(mconfig, type, tag)
+ { }
+ void cchance(machine_config &config);
+
+protected:
void machine_reset() override;
void machine_start() override;
- uint8_t m_hop_io;
- uint8_t m_bell_io;
+private:
DECLARE_WRITE8_MEMBER(output_0_w);
DECLARE_READ8_MEMBER(input_1_r);
DECLARE_WRITE8_MEMBER(output_1_w);
- void cchance(machine_config &config);
void main_map(address_map &map);
+
+ uint8_t m_hop_io;
+ uint8_t m_bell_io;
};
@@ -218,7 +223,7 @@ MACHINE_CONFIG_START(cchance_state::cchance)
MCFG_DEVICE_PROGRAM_MAP(main_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", cchance_state, irq0_line_hold)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cchance)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_cchance);
SETA001_SPRITE(config, m_seta001, 0);
m_seta001->set_gfxdecode_tag("gfxdecode");
@@ -231,10 +236,9 @@ MACHINE_CONFIG_START(cchance_state::cchance)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cchance_state, screen_update_tnzs)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cchance_state, screen_vblank_tnzs))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(cchance_state, prompalette)
+ PALETTE(config, m_palette, FUNC(cchance_state::prompalette), 512);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cclimber.cpp b/src/mame/drivers/cclimber.cpp
index d7d757d4ed5..8a7d325b701 100644
--- a/src/mame/drivers/cclimber.cpp
+++ b/src/mame/drivers/cclimber.cpp
@@ -1124,13 +1124,12 @@ MACHINE_CONFIG_START(cclimber_state::root)
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(cclimber_state, screen_update_cclimber)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cclimber_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cclimber)
- MCFG_PALETTE_ADD("palette", 16*4+8*4)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cclimber);
+ PALETTE(config, m_palette, FUNC(cclimber_state::cclimber_palette), 16*4+8*4);
- MCFG_PALETTE_INIT_OWNER(cclimber_state,cclimber)
MCFG_VIDEO_START_OVERRIDE(cclimber_state,cclimber)
MACHINE_CONFIG_END
@@ -1201,9 +1200,8 @@ MACHINE_CONFIG_START(cclimber_state::yamato)
MCFG_DEVICE_IO_MAP(yamato_audio_portmap)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(16*4+8*4+256)
- MCFG_PALETTE_INIT_OWNER(cclimber_state,yamato)
+ m_palette->set_entries(16*4+8*4+256);
+ m_palette->set_init(FUNC(cclimber_state::yamato_palette));
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(cclimber_state, screen_update_yamato)
@@ -1232,9 +1230,8 @@ MACHINE_CONFIG_START(cclimber_state::toprollr)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_toprollr)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32*5)
- MCFG_PALETTE_INIT_OWNER(cclimber_state,toprollr)
+ m_palette->set_entries(32*5);
+ m_palette->set_init(FUNC(cclimber_state::toprollr_palette));
MCFG_VIDEO_START_OVERRIDE(cclimber_state,toprollr)
MCFG_SCREEN_MODIFY("screen")
@@ -1267,13 +1264,12 @@ MACHINE_CONFIG_START(cclimber_state::swimmer)
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(cclimber_state, screen_update_swimmer)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cclimber_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_swimmer)
- MCFG_PALETTE_ADD("palette", 32*8+4*8+1)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_swimmer);
+ PALETTE(config, m_palette, FUNC(cclimber_state::swimmer_palette), 32*8+4*8+1);
- MCFG_PALETTE_INIT_OWNER(cclimber_state,swimmer)
MCFG_VIDEO_START_OVERRIDE(cclimber_state,swimmer)
/* audio hardware */
diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp
index 39d751370c1..a0520110d61 100644
--- a/src/mame/drivers/cd2650.cpp
+++ b/src/mame/drivers/cd2650.cpp
@@ -311,7 +311,7 @@ void cd2650_state::cd2650(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_cd2650);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* quickload */
quickload_image_device &quickload(QUICKLOAD(config, "quickload", 0));
diff --git a/src/mame/drivers/cdc721.cpp b/src/mame/drivers/cdc721.cpp
index 28e6a5eb39c..aa0a75f986b 100644
--- a/src/mame/drivers/cdc721.cpp
+++ b/src/mame/drivers/cdc721.cpp
@@ -39,9 +39,14 @@ public:
{ }
void cdc721(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(cdc721);
+ void cdc721_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(interrupt_mask_w);
DECLARE_WRITE8_MEMBER(misc_w);
DECLARE_WRITE8_MEMBER(lights_w);
@@ -61,9 +66,6 @@ private:
void block8_map(address_map &map);
void blockc_map(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
u8 m_flashcnt;
u8 m_foreign_char_bank;
@@ -249,11 +251,11 @@ static GFXDECODE_START( gfx_cdc721 )
GFXDECODE_ENTRY( "chargen", 0x0000, cdc721_charlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER( cdc721_state, cdc721 )
+void cdc721_state::cdc721_palette(palette_device &palette) const
{
- palette.set_pen_color(0, 0, 0, 0 ); /* Black */
- palette.set_pen_color(1, 0, 255, 0 ); /* Full */
- palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */
+ palette.set_pen_color(0, 0, 0, 0 ); // Black
+ palette.set_pen_color(1, 0, 255, 0 ); // Full
+ palette.set_pen_color(2, 0, 128, 0 ); // Dimmed
}
uint32_t cdc721_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -324,8 +326,7 @@ MACHINE_CONFIG_START(cdc721_state::cdc721)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(cdc721_state, cdc721)
+ PALETTE(config, "palette", FUNC(cdc721_state::cdc721_palette), 3);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cdc721)
CRT5037(config, m_crtc, 12.936_MHz_XTAL / 8).set_char_width(8);
diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp
index fe0795b1862..e887a21948b 100644
--- a/src/mame/drivers/centiped.cpp
+++ b/src/mame/drivers/centiped.cpp
@@ -1769,7 +1769,7 @@ void centiped_state::centiped_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_centiped);
- PALETTE(config, m_palette, 4+4*4*4*4);
+ PALETTE(config, m_palette).set_entries(4+4*4*4*4);
MCFG_VIDEO_START_OVERRIDE(centiped_state,centiped)
}
@@ -1907,7 +1907,7 @@ void centiped_state::warlords(machine_config &config)
/* video hardware */
m_gfxdecode->set_info(gfx_warlords);
m_palette->set_entries(8*4+8*4);
- m_palette->set_init(FUNC(centiped_state::palette_init_warlords));
+ m_palette->set_init(FUNC(centiped_state::warlords_palette));
MCFG_VIDEO_START_OVERRIDE(centiped_state,warlords)
@@ -1963,7 +1963,7 @@ void centiped_state::bullsdrt(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_centiped);
- PALETTE(config, m_palette, 4+4*4*4*4);
+ PALETTE(config, m_palette).set_entries(4+4*4*4*4);
MCFG_VIDEO_START_OVERRIDE(centiped_state,bullsdrt)
diff --git a/src/mame/drivers/cesclass.cpp b/src/mame/drivers/cesclass.cpp
index 93609c3f34b..abbe6c160c1 100644
--- a/src/mame/drivers/cesclass.cpp
+++ b/src/mame/drivers/cesclass.cpp
@@ -48,7 +48,7 @@ public:
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(cesclassic);
+ void cesclassic_palette(palette_device &palette) const;
void cesclassic(machine_config &config);
void cesclassic_map(address_map &map);
protected:
@@ -242,11 +242,9 @@ static INPUT_PORTS_START( cesclassic )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_VBLANK("l_lcd")
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(cesclassic_state, cesclassic)
+void cesclassic_state::cesclassic_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
palette.set_pen_color(i, pal2bit(i), 0, 0);
}
@@ -267,8 +265,7 @@ MACHINE_CONFIG_START(cesclassic_state::cesclassic)
MCFG_SCREEN_SIZE(8*16*2, 8*8+3*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 8*16*2-1, 0*8, 8*8-1)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(cesclassic_state, cesclassic)
+ PALETTE(config, m_palette, FUNC(cesclassic_state::cesclassic_palette), 4);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 24000000/16, okim6295_device::PIN7_LOW)
diff --git a/src/mame/drivers/cfx9850.cpp b/src/mame/drivers/cfx9850.cpp
index c345ed544b4..fa965bbdae8 100644
--- a/src/mame/drivers/cfx9850.cpp
+++ b/src/mame/drivers/cfx9850.cpp
@@ -52,7 +52,7 @@ public:
DECLARE_READ8_MEMBER(in0_r);
required_shared_ptr<u8> m_video_ram;
required_shared_ptr<u8> m_display_ram;
- DECLARE_PALETTE_INIT(cfx9850);
+ void cfx9850_palette(palette_device &palette) const;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void cfx9850(machine_config &config);
@@ -245,7 +245,7 @@ static INPUT_PORTS_START(cfx9850)
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(cfx9850_state, cfx9850)
+void cfx9850_state::cfx9850_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xff, 0xff, 0xff);
palette.set_pen_color(1, 0x00, 0x00, 0xff);
@@ -301,7 +301,7 @@ void cfx9850_state::cfx9850(machine_config &config)
screen.set_palette("palette");
// TODO: Verify amount of colors and palette. Colors can be changed by changing the contrast.
- PALETTE(config, "palette", 4).set_init(FUNC(cfx9850_state::palette_init_cfx9850));
+ PALETTE(config, "palette", FUNC(cfx9850_state::cfx9850_palette), 4);
}
diff --git a/src/mame/drivers/chaknpop.cpp b/src/mame/drivers/chaknpop.cpp
index 2f3f2034dd3..9da44e2bae3 100644
--- a/src/mame/drivers/chaknpop.cpp
+++ b/src/mame/drivers/chaknpop.cpp
@@ -379,11 +379,10 @@ MACHINE_CONFIG_START(chaknpop_state::chaknpop)
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(chaknpop_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chaknpop)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INIT_OWNER(chaknpop_state, chaknpop)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_chaknpop);
+ PALETTE(config, m_palette, FUNC(chaknpop_state::chaknpop_palette), 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/champbas.cpp b/src/mame/drivers/champbas.cpp
index 85b1e8564e9..0d928689e43 100644
--- a/src/mame/drivers/champbas.cpp
+++ b/src/mame/drivers/champbas.cpp
@@ -554,12 +554,10 @@ MACHINE_CONFIG_START(champbas_state::talbot)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(champbas_state, screen_update_champbas)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_talbot)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(champbas_state,champbas)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_talbot)
+ PALETTE(config, m_palette, FUNC(champbas_state::champbas_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -598,12 +596,10 @@ MACHINE_CONFIG_START(champbas_state::champbas)
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(champbas_state, screen_update_champbas)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_champbas)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(champbas_state,champbas)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_champbas)
+ PALETTE(config, m_palette, FUNC(champbas_state::champbas_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -709,12 +705,10 @@ MACHINE_CONFIG_START(exctsccr_state::exctsccr)
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(exctsccr_state, screen_update_exctsccr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exctsccr)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(exctsccr_state,exctsccr)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_exctsccr)
+ PALETTE(config, m_palette, FUNC(exctsccr_state::exctsccr_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -769,12 +763,10 @@ MACHINE_CONFIG_START(exctsccr_state::exctsccrb)
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(exctsccr_state, screen_update_exctsccr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exctsccr)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(exctsccr_state,exctsccr)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_exctsccr)
+ PALETTE(config, m_palette, FUNC(exctsccr_state::exctsccr_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/champbwl.cpp b/src/mame/drivers/champbwl.cpp
index a011293d49b..5ef96219ec0 100644
--- a/src/mame/drivers/champbwl.cpp
+++ b/src/mame/drivers/champbwl.cpp
@@ -174,7 +174,8 @@ public:
m_hopper(*this, "hopper"),
m_mainbank(*this, "mainbank"),
m_fakex(*this, "FAKEX"),
- m_fakey(*this, "FAKEY") { }
+ m_fakey(*this, "FAKEY")
+ { }
int m_screenflip;
@@ -196,7 +197,7 @@ public:
DECLARE_MACHINE_START(champbwl);
DECLARE_MACHINE_RESET(champbwl);
DECLARE_MACHINE_START(doraemon);
- DECLARE_PALETTE_INIT(champbwl);
+ void champbwl_palette(palette_device &palette) const;
uint32_t screen_update_champbwl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_doraemon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_champbwl);
@@ -207,14 +208,12 @@ public:
void doraemon_map(address_map &map);
};
-PALETTE_INIT_MEMBER(champbwl_state,champbwl)
+void champbwl_state::champbwl_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, col;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- col = (color_prom[i] << 8) + color_prom[i + 512];
+ int const col = (color_prom[i] << 8) + color_prom[i + 512];
palette.set_pen_color(i, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
}
}
@@ -513,12 +512,10 @@ MACHINE_CONFIG_START(champbwl_state::champbwl)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(champbwl_state, screen_update_champbwl)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, champbwl_state, screen_vblank_champbwl))
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_champbwl)
- MCFG_PALETTE_ADD("palette", 512)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_INIT_OWNER(champbwl_state,champbwl)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_champbwl);
+ PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -580,12 +577,10 @@ MACHINE_CONFIG_START(champbwl_state::doraemon)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(champbwl_state, screen_update_doraemon)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, champbwl_state, screen_vblank_doraemon))
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_champbwl)
- MCFG_PALETTE_ADD("palette", 512)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_INIT_OWNER(champbwl_state,champbwl)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_champbwl);
+ PALETTE(config, m_palette, FUNC(champbwl_state::champbwl_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/chanbara.cpp b/src/mame/drivers/chanbara.cpp
index 5ba5acf8554..4c4c8e00776 100644
--- a/src/mame/drivers/chanbara.cpp
+++ b/src/mame/drivers/chanbara.cpp
@@ -61,8 +61,8 @@ ToDo:
class chanbara_state : public driver_device
{
public:
- chanbara_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ chanbara_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
@@ -70,7 +70,31 @@ public:
m_colorram2(*this, "colorram2"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"){ }
+ m_palette(*this, "palette")
+ { }
+
+ void init_chanbara();
+
+ void chanbara(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ DECLARE_WRITE8_MEMBER(chanbara_videoram_w);
+ DECLARE_WRITE8_MEMBER(chanbara_colorram_w);
+ DECLARE_WRITE8_MEMBER(chanbara_videoram2_w);
+ DECLARE_WRITE8_MEMBER(chanbara_colorram2_w);
+ DECLARE_WRITE8_MEMBER(chanbara_ay_out_0_w);
+ DECLARE_WRITE8_MEMBER(chanbara_ay_out_1_w);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
+ TILE_GET_INFO_MEMBER(get_bg2_tile_info);
+ void chanbara_palette(palette_device &palette) const;
+ uint32_t screen_update_chanbara(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void chanbara_map(address_map &map);
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
@@ -89,37 +113,18 @@ public:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
-
- DECLARE_WRITE8_MEMBER(chanbara_videoram_w);
- DECLARE_WRITE8_MEMBER(chanbara_colorram_w);
- DECLARE_WRITE8_MEMBER(chanbara_videoram2_w);
- DECLARE_WRITE8_MEMBER(chanbara_colorram2_w);
- DECLARE_WRITE8_MEMBER(chanbara_ay_out_0_w);
- DECLARE_WRITE8_MEMBER(chanbara_ay_out_1_w);
- void init_chanbara();
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- TILE_GET_INFO_MEMBER(get_bg2_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(chanbara);
- uint32_t screen_update_chanbara(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
- void chanbara(machine_config &config);
- void chanbara_map(address_map &map);
};
-PALETTE_INIT_MEMBER(chanbara_state, chanbara)
+void chanbara_state::chanbara_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, red, green, blue;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- red = color_prom[i];
- green = color_prom[palette.entries() + i];
- blue = color_prom[2 * palette.entries() + i];
+ int const red = color_prom[i];
+ int const green = color_prom[palette.entries() + i];
+ int const blue = color_prom[2 * palette.entries() + i];
palette.set_pen_color(i, pal4bit(red << 1), pal4bit(green << 1), pal4bit(blue << 1));
}
@@ -404,12 +409,11 @@ MACHINE_CONFIG_START(chanbara_state::chanbara)
// DECO video CRTC
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2,384,0,256,272,16,240)
MCFG_SCREEN_UPDATE_DRIVER(chanbara_state, screen_update_chanbara)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chanbara)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_chanbara)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(chanbara_state, chanbara)
+ PALETTE(config, m_palette, FUNC(chanbara_state::chanbara_palette), 256);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/chance32.cpp b/src/mame/drivers/chance32.cpp
index 31d7c2abc0b..7169627c897 100644
--- a/src/mame/drivers/chance32.cpp
+++ b/src/mame/drivers/chance32.cpp
@@ -41,6 +41,14 @@ public:
m_lamps(*this, "lamp%u", 0U)
{ }
+ void chance32(machine_config &config);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
DECLARE_WRITE8_MEMBER(chance32_fgram_w)
{
m_fgram[offset] = data;
@@ -60,15 +68,9 @@ public:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
uint32_t screen_update_chance32(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void chance32(machine_config &config);
void chance32_map(address_map &map);
void chance32_portmap(address_map &map);
-protected:
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
tilemap_t *m_fg_tilemap;
tilemap_t *m_bg_tilemap;
@@ -178,7 +180,6 @@ WRITE8_MEMBER(chance32_state::muxout_w)
*/
if (data & 1) // bit 0 is the mux selector.
-
{
m_lamps[0] = BIT(data, 1); /* Lamp 0 - Small / Big */
m_lamps[1] = BIT(data, 2); /* Lamp 1 - Big / Small */
@@ -480,9 +481,8 @@ MACHINE_CONFIG_START(chance32_state::chance32)
crtc.set_show_border_area(false);
crtc.set_char_width(16);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chance32)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_chance32);
+ PALETTE(config, "palette").set_format(palette_device::xGRB_555, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/changela.cpp b/src/mame/drivers/changela.cpp
index 36f68cafb3d..ba0966fc417 100644
--- a/src/mame/drivers/changela.cpp
+++ b/src/mame/drivers/changela.cpp
@@ -444,8 +444,7 @@ void changela_state::changela(machine_config &config)
m_screen->set_screen_update(FUNC(changela_state::screen_update_changela));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 0x40);
-
+ PALETTE(config, m_palette).set_entries(0x40);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/channelf.cpp b/src/mame/drivers/channelf.cpp
index 5d1c3979125..848dae8d73c 100644
--- a/src/mame/drivers/channelf.cpp
+++ b/src/mame/drivers/channelf.cpp
@@ -21,12 +21,6 @@
#include "softlist.h"
#include "speaker.h"
-#ifndef VERBOSE
-#define VERBOSE 0
-#endif
-
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
-
#define MASTER_CLOCK_PAL 2000000 /* PAL unit has a separate crystal at 4.000 MHz */
#define PAL_VBLANK_TIME 4623
@@ -227,8 +221,7 @@ MACHINE_CONFIG_START(channelf_state::channelf)
MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(channelf_state, channelf)
+ PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -254,8 +247,7 @@ MACHINE_CONFIG_START(channelf_state::sabavdpl)
MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(channelf_state, channelf)
+ PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -282,8 +274,7 @@ MACHINE_CONFIG_START(channelf_state::channlf2)
MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(channelf_state, channelf)
+ PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -310,8 +301,7 @@ MACHINE_CONFIG_START(channelf_state::sabavpl2)
MCFG_SCREEN_UPDATE_DRIVER(channelf_state, screen_update_channelf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(channelf_state, channelf)
+ PALETTE(config, "palette", FUNC(channelf_state::channelf_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -346,7 +336,7 @@ ROM_END
***************************************************************************/
-/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
CONS( 1976, channelf, 0, 0, channelf, channelf, channelf_state, empty_init, "Fairchild", "Channel F", 0 )
CONS( 1977, sabavdpl, channelf, 0, sabavdpl, channelf, channelf_state, empty_init, "SABA", "SABA Videoplay", 0 )
CONS( 197?, luxorves, channelf, 0, sabavdpl, channelf, channelf_state, empty_init, "Luxor", "Luxor Video Entertainment System", 0 )
diff --git a/src/mame/drivers/cheekyms.cpp b/src/mame/drivers/cheekyms.cpp
index a712de57db1..a13c1bc7f9f 100644
--- a/src/mame/drivers/cheekyms.cpp
+++ b/src/mame/drivers/cheekyms.cpp
@@ -137,35 +137,13 @@ MACHINE_CONFIG_START(cheekyms_state::cheekyms)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cheekyms_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cheekyms)
- MCFG_PALETTE_ADD("palette", 0xc0)
- MCFG_PALETTE_INIT_OWNER(cheekyms_state, cheekyms)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cheekyms);
+ PALETTE(config, m_palette, FUNC(cheekyms_state::cheekyms_palette), 0xc0);
/* audio hardware */
- MCFG_DEVICE_ADD("soundboard", CHEEKY_MOUSE_AUDIO, 0)
-#if 0
- SPEAKER(config, "speaker").front_center();
-
- MCFG_DEVICE_ADD("dac0", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac1", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac2", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac3", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac4", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac5", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac6", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("dac7", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25)
- MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
- MCFG_SOUND_ROUTE(0, "dac0", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac1", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac2", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac3", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac4", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac5", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac6", 1.0, DAC_VREF_POS_INPUT)
- MCFG_SOUND_ROUTE(0, "dac7", 1.0, DAC_VREF_POS_INPUT)
-#endif
+ CHEEKY_MOUSE_AUDIO(config, m_sound_board, 0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/chinagat.cpp b/src/mame/drivers/chinagat.cpp
index dd766e19a75..e7280b4014e 100644
--- a/src/mame/drivers/chinagat.cpp
+++ b/src/mame/drivers/chinagat.cpp
@@ -90,41 +90,51 @@ class chinagat_state : public ddragon_state
{
public:
chinagat_state(const machine_config &mconfig, device_type type, const char *tag)
- : ddragon_state(mconfig, type, tag),
- m_adpcm(*this, "adpcm") { };
+ : ddragon_state(mconfig, type, tag)
+ , m_adpcm(*this, "adpcm")
+ { }
+
+ void chinagat(machine_config &config);
+ void saiyugoub1(machine_config &config);
+ void saiyugoub2(machine_config &config);
- TIMER_DEVICE_CALLBACK_MEMBER(chinagat_scanline);
void init_chinagat();
- DECLARE_MACHINE_START(chinagat);
- DECLARE_MACHINE_RESET(chinagat);
- DECLARE_VIDEO_START(chinagat);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ TIMER_DEVICE_CALLBACK_MEMBER(chinagat_scanline);
DECLARE_WRITE8_MEMBER(interrupt_w);
DECLARE_WRITE8_MEMBER(video_ctrl_w);
DECLARE_WRITE8_MEMBER(bankswitch_w);
DECLARE_WRITE8_MEMBER(sub_bankswitch_w);
DECLARE_WRITE8_MEMBER(sub_irq_ack_w);
- DECLARE_READ8_MEMBER( saiyugoub1_mcu_command_r );
- DECLARE_WRITE8_MEMBER( saiyugoub1_mcu_command_w );
- DECLARE_WRITE8_MEMBER( saiyugoub1_adpcm_rom_addr_w );
- DECLARE_WRITE8_MEMBER( saiyugoub1_adpcm_control_w );
- DECLARE_WRITE8_MEMBER( saiyugoub1_m5205_clk_w );
+ DECLARE_READ8_MEMBER(saiyugoub1_mcu_command_r);
+ DECLARE_WRITE8_MEMBER(saiyugoub1_mcu_command_w);
+ DECLARE_WRITE8_MEMBER(saiyugoub1_adpcm_rom_addr_w);
+ DECLARE_WRITE8_MEMBER(saiyugoub1_adpcm_control_w);
+ DECLARE_WRITE8_MEMBER(saiyugoub1_m5205_clk_w);
DECLARE_READ_LINE_MEMBER(saiyugoub1_m5205_irq_r);
DECLARE_WRITE_LINE_MEMBER(saiyugoub1_m5205_irq_w);
- optional_device<msm5205_device> m_adpcm;
- void saiyugoub2(machine_config &config);
- void saiyugoub1(machine_config &config);
- void chinagat(machine_config &config);
+
void i8748_map(address_map &map);
void main_map(address_map &map);
void saiyugoub1_sound_map(address_map &map);
void sound_map(address_map &map);
void sub_map(address_map &map);
void ym2203c_sound_map(address_map &map);
+
+ optional_device<msm5205_device> m_adpcm;
};
-VIDEO_START_MEMBER(chinagat_state,chinagat)
+void chinagat_state::video_start()
{
+ ddragon_state::video_start();
+
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(chinagat_state::get_bg_tile_info),this),tilemap_mapper_delegate(FUNC(chinagat_state::background_scan),this), 16, 16, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(chinagat_state::get_fg_16color_tile_info),this),TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
@@ -519,8 +529,10 @@ static GFXDECODE_START( gfx_chinagat )
GFXDECODE_END
-MACHINE_START_MEMBER(chinagat_state,chinagat)
+void chinagat_state::machine_start()
{
+ ddragon_state::machine_start();
+
/* configure banks */
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
@@ -540,8 +552,10 @@ MACHINE_START_MEMBER(chinagat_state,chinagat)
}
-MACHINE_RESET_MEMBER(chinagat_state,chinagat)
+void chinagat_state::machine_reset()
{
+ ddragon_state::machine_reset();
+
m_scrollx_hi = 0;
m_scrolly_hi = 0;
m_adpcm_sound_irq = 0;
@@ -572,20 +586,14 @@ MACHINE_CONFIG_START(chinagat_state::chinagat)
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */
- MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat)
- MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */
MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chinagat)
- MCFG_PALETTE_ADD("palette", 384)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_chinagat);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 384);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -626,20 +634,14 @@ MACHINE_CONFIG_START(chinagat_state::saiyugoub1)
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */
- MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat)
- MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */
MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chinagat)
- MCFG_PALETTE_ADD("palette", 384)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
-
- MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_chinagat);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 384);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -673,20 +675,14 @@ MACHINE_CONFIG_START(chinagat_state::saiyugoub2)
MCFG_QUANTUM_TIME(attotime::from_hz(6000)) /* heavy interleaving to sync up sprite<->main cpu's */
- MCFG_MACHINE_START_OVERRIDE(chinagat_state,chinagat)
- MCFG_MACHINE_RESET_OVERRIDE(chinagat_state,chinagat)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240) /* based on ddragon driver */
MCFG_SCREEN_UPDATE_DRIVER(chinagat_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chinagat)
- MCFG_PALETTE_ADD("palette", 384)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_VIDEO_START_OVERRIDE(chinagat_state,chinagat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_chinagat);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 384);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/chinsan.cpp b/src/mame/drivers/chinsan.cpp
index 39d1ad84d7d..55de3adef19 100644
--- a/src/mame/drivers/chinsan.cpp
+++ b/src/mame/drivers/chinsan.cpp
@@ -530,7 +530,7 @@ MACHINE_CONFIG_START(chinsan_state::chinsan)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chinsan)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 256);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/chqflag.cpp b/src/mame/drivers/chqflag.cpp
index 79bb8b0f4ea..62517565017 100644
--- a/src/mame/drivers/chqflag.cpp
+++ b/src/mame/drivers/chqflag.cpp
@@ -339,9 +339,8 @@ void chqflag_state::chqflag(machine_config &config)
screen.set_screen_update(FUNC(chqflag_state::screen_update_chqflag));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K051960(config, m_k051960, 0);
m_k051960->set_palette(m_palette);
diff --git a/src/mame/drivers/circus.cpp b/src/mame/drivers/circus.cpp
index 4c7cd546801..2a1f9bd0c0d 100644
--- a/src/mame/drivers/circus.cpp
+++ b/src/mame/drivers/circus.cpp
@@ -301,7 +301,7 @@ void circus_state::circus(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -333,7 +333,7 @@ void circus_state::robotbwl(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_robotbwl);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -373,7 +373,7 @@ void circus_state::crash(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -405,7 +405,7 @@ void circus_state::ripcord(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_circus);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/circusc.cpp b/src/mame/drivers/circusc.cpp
index e9ab2c931f6..2dc7bbfb542 100644
--- a/src/mame/drivers/circusc.cpp
+++ b/src/mame/drivers/circusc.cpp
@@ -363,7 +363,6 @@ MACHINE_CONFIG_START(circusc_state::circusc)
MCFG_DEVICE_ADD("audiocpu", Z80, XTAL(14'318'181)/4)
MCFG_DEVICE_PROGRAM_MAP(sound_map)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -371,13 +370,11 @@ MACHINE_CONFIG_START(circusc_state::circusc)
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(circusc_state, screen_update_circusc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, circusc_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_circusc)
- MCFG_PALETTE_ADD("palette", 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(circusc_state, circusc)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_circusc);
+ PALETTE(config, m_palette, FUNC(circusc_state::circusc_palette), 16*16 + 16*16, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cischeat.cpp b/src/mame/drivers/cischeat.cpp
index bad87328cf2..5095e5590df 100644
--- a/src/mame/drivers/cischeat.cpp
+++ b/src/mame/drivers/cischeat.cpp
@@ -1979,12 +1979,11 @@ MACHINE_CONFIG_START(cischeat_state::bigrun)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(cischeat_state, screen_update_bigrun)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bigrun)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x4000/2)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x4000/2);
+ m_palette->enable_shadows();
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 0x0e00/2);
MEGASYS1_TILEMAP(config, m_tmap[1], m_palette, 0x1600/2);
@@ -2035,9 +2034,7 @@ MACHINE_CONFIG_START(cischeat_state::cischeat)
MCFG_SCREEN_UPDATE_DRIVER(cischeat_state, screen_update_cischeat)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_cischeat)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x8000/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 0x8000/2);
m_tmap[0]->set_colorbase(0x1c00/2);
m_tmap[0]->set_bits_per_color_code(5);
@@ -2071,9 +2068,7 @@ MACHINE_CONFIG_START(cischeat_state::f1gpstar)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_f1gpstar)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x8000/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 0x8000/2);
m_tmap[0]->set_colorbase(0x1e00/2);
@@ -2150,12 +2145,11 @@ MACHINE_CONFIG_START(cischeat_state::scudhamm)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0 +16, 256-1 -16)
MCFG_SCREEN_UPDATE_DRIVER(cischeat_state, screen_update_scudhamm)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scudhamm)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x8000/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
- MCFG_PALETTE_ENABLE_SHADOWS()
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x8000/2);
+ m_palette->enable_shadows();
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 0x1e00/2);
MEGASYS1_TILEMAP(config, m_tmap[2], m_palette, 0x4e00/2);
@@ -2245,9 +2239,8 @@ MACHINE_CONFIG_START(cischeat_state::captflag)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scudhamm)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x8000/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
- MCFG_PALETTE_ENABLE_SHADOWS()
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x8000/2);
+ m_palette->enable_shadows();
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 0x1e00/2);
MEGASYS1_TILEMAP(config, m_tmap[2], m_palette, 0x4e00/2);
diff --git a/src/mame/drivers/citycon.cpp b/src/mame/drivers/citycon.cpp
index 5fe5234e7c6..307978e89dc 100644
--- a/src/mame/drivers/citycon.cpp
+++ b/src/mame/drivers/citycon.cpp
@@ -213,11 +213,10 @@ MACHINE_CONFIG_START(citycon_state::citycon)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(citycon_state, screen_update_citycon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_citycon)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 640+1024) /* 640 real palette + 1024 virtual palette */
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_citycon)
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::RGBx_444, 640+1024); // 640 real palette + 1024 virtual palette
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/clcd.cpp b/src/mame/drivers/clcd.cpp
index e65106d4198..136ccc419de 100644
--- a/src/mame/drivers/clcd.cpp
+++ b/src/mame/drivers/clcd.cpp
@@ -89,7 +89,7 @@ public:
m_nvram->set_base(ram()->pointer(), ram()->size());
}
- DECLARE_PALETTE_INIT(clcd)
+ void clcd_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(36,72,36));
palette.set_pen_color(1, rgb_t(2,4,2));
@@ -719,8 +719,7 @@ MACHINE_CONFIG_START(clcd_state::clcd)
MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 128-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(clcd_state, clcd)
+ PALETTE(config, "palette", FUNC(clcd_state::clcd_palette), 2);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cloak.cpp b/src/mame/drivers/cloak.cpp
index 3825566f4ad..12380e6dfde 100644
--- a/src/mame/drivers/cloak.cpp
+++ b/src/mame/drivers/cloak.cpp
@@ -348,7 +348,7 @@ void cloak_state::cloak(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cloak);
- PALETTE(config, m_palette, 64);
+ PALETTE(config, m_palette).set_entries(64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cloud9.cpp b/src/mame/drivers/cloud9.cpp
index 73bd173edfb..cf3855fe764 100644
--- a/src/mame/drivers/cloud9.cpp
+++ b/src/mame/drivers/cloud9.cpp
@@ -410,7 +410,7 @@ void cloud9_state::cloud9(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cloud9);
- PALETTE(config, m_palette, 64);
+ PALETTE(config, m_palette).set_entries(64);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz((float)PIXEL_CLOCK / (float)VTOTAL / (float)HTOTAL);
diff --git a/src/mame/drivers/clshroad.cpp b/src/mame/drivers/clshroad.cpp
index e30127ebc0b..4c443919ac8 100644
--- a/src/mame/drivers/clshroad.cpp
+++ b/src/mame/drivers/clshroad.cpp
@@ -296,12 +296,10 @@ MACHINE_CONFIG_START(clshroad_state::firebatl)
MCFG_SCREEN_SIZE(0x120, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0, 0x120-1, 0x0+16, 0x100-16-1)
MCFG_SCREEN_UPDATE_DRIVER(clshroad_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_firebatl)
- MCFG_PALETTE_ADD("palette", 512+64*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(clshroad_state,firebatl)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_firebatl);
+ PALETTE(config, m_palette, FUNC(clshroad_state::firebatl_palette), 512+64*4, 256);
MCFG_VIDEO_START_OVERRIDE(clshroad_state,firebatl)
@@ -337,12 +335,11 @@ MACHINE_CONFIG_START(clshroad_state::clshroad)
MCFG_SCREEN_SIZE(0x120, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0, 0x120-1, 0x0+16, 0x100-16-1)
MCFG_SCREEN_UPDATE_DRIVER(clshroad_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_clshroad)
- MCFG_PALETTE_ADD("palette", 256)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_clshroad);
+ PALETTE(config, m_palette, FUNC(clshroad_state::clshroad_palette), 256);
- MCFG_PALETTE_INIT_OWNER(clshroad_state,clshroad)
MCFG_VIDEO_START_OVERRIDE(clshroad_state,clshroad)
/* sound hardware */
diff --git a/src/mame/drivers/cmi.cpp b/src/mame/drivers/cmi.cpp
index 76de34572e5..cb7cbc5eca0 100644
--- a/src/mame/drivers/cmi.cpp
+++ b/src/mame/drivers/cmi.cpp
@@ -2196,9 +2196,9 @@ MACHINE_CONFIG_START(cmi_state::cmi2x)
MCFG_SCREEN_UPDATE_DRIVER(cmi_state, screen_update_cmi2x)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cmi_state, cmi_iix_vblank))
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
- MCFG_DEVICE_ADD("msm5832", MSM5832, 32.768_kHz_XTAL)
+ MSM5832(config, m_msm5832, 32.768_kHz_XTAL);
I8214(config, m_i8214[0], 1000000); // cmi_8214_intf_1
m_i8214[0]->int_wr_callback().set(FUNC(cmi_state::i8214_1_int_w));
diff --git a/src/mame/drivers/cmmb.cpp b/src/mame/drivers/cmmb.cpp
index 5966afe2e6b..ecf1a90ca71 100644
--- a/src/mame/drivers/cmmb.cpp
+++ b/src/mame/drivers/cmmb.cpp
@@ -61,8 +61,8 @@ OSC @ 72.576MHz
class cmmb_state : public driver_device
{
public:
- cmmb_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ cmmb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_flash(*this, "at29c020" ),
m_videoram(*this, "videoram"),
@@ -431,12 +431,11 @@ MACHINE_CONFIG_START(cmmb_state::cmmb)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/12, 384, 0, 256, 264, 0, 240) // TBD, not real measurements
MCFG_SCREEN_UPDATE_DRIVER(cmmb_state, screen_update_cmmb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cmmb)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRGGGBB_inverted)
+ PALETTE(config, m_palette).set_format(palette_device::RGB_332_inverted, 512);
/* sound hardware */
// SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cninja.cpp b/src/mame/drivers/cninja.cpp
index 1bbcb210374..6f2b1e92b90 100644
--- a/src/mame/drivers/cninja.cpp
+++ b/src/mame/drivers/cninja.cpp
@@ -811,11 +811,10 @@ MACHINE_CONFIG_START(cninja_state::cninja)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000) / 4, 376, 0, 256, 274, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(cninja_state, screen_update_cninja)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cninja)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
@@ -900,11 +899,10 @@ MACHINE_CONFIG_START(cninja_state::stoneage)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000) / 4, 376, 0, 256, 274, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(cninja_state, screen_update_cninja)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cninja)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_VIDEO_START_OVERRIDE(cninja_state,stoneage)
@@ -1000,11 +998,10 @@ MACHINE_CONFIG_START(cninja_state::cninjabl)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000) / 4, 376, 0, 256, 274, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(cninja_state, screen_update_cninjabl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cninjabl)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
@@ -1074,11 +1071,10 @@ MACHINE_CONFIG_START(cninja_state::edrandy)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000) / 4, 376, 0, 256, 274, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(cninja_state, screen_update_edrandy)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cninja)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
@@ -1164,14 +1160,13 @@ MACHINE_CONFIG_START(cninja_state::robocop2)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(28'000'000) / 4, 442, 0, 320, 274, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(cninja_state, screen_update_robocop2)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_MACHINE_START_OVERRIDE(cninja_state,robocop2)
MCFG_MACHINE_RESET_OVERRIDE(cninja_state,robocop2)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_robocop2)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
@@ -1264,8 +1259,7 @@ MACHINE_CONFIG_START(cninja_state::mutantf)
MCFG_VIDEO_START_OVERRIDE(cninja_state,mutantf)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mutantf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
MCFG_DEVICE_ADD("spriteram2", BUFFERED_SPRITERAM16)
diff --git a/src/mame/drivers/cntsteer.cpp b/src/mame/drivers/cntsteer.cpp
index d65e10d470a..5e79d57521d 100644
--- a/src/mame/drivers/cntsteer.cpp
+++ b/src/mame/drivers/cntsteer.cpp
@@ -114,7 +114,7 @@ public:
DECLARE_MACHINE_START(zerotrgt);
DECLARE_MACHINE_RESET(zerotrgt);
DECLARE_VIDEO_START(zerotrgt);
- DECLARE_PALETTE_INIT(zerotrgt);
+ void zerotrgt_palette(palette_device &palette) const;
uint32_t screen_update_cntsteer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_zerotrgt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(subcpu_vblank_irq);
@@ -132,31 +132,30 @@ public:
};
-PALETTE_INIT_MEMBER(cntsteer_state,zerotrgt)
+void cntsteer_state::zerotrgt_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- g = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
- /* green component */
+ int const g = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
+ // green component
bit0 = (color_prom[i] >> 4) & 0x01;
bit1 = (color_prom[i] >> 5) & 0x01;
bit2 = (color_prom[i] >> 6) & 0x01;
- r = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
- /* blue component */
+ int const r = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
+ // blue component
bit0 = (color_prom[i + 256] >> 0) & 0x01;
bit1 = (color_prom[i + 256] >> 1) & 0x01;
bit2 = (color_prom[i + 256] >> 2) & 0x01;
- b = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
+ int const b = (0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2);
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -951,8 +950,8 @@ MACHINE_CONFIG_START(cntsteer_state::cntsteer)
MCFG_QUANTUM_PERFECT_CPU("maincpu")
MCFG_QUANTUM_PERFECT_CPU("subcpu")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cntsteer)
- MCFG_PALETTE_ADD("palette", 256)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cntsteer);
+ PALETTE(config, m_palette).set_entries(256);
// MCFG_PALETTE_INIT_OWNER(cntsteer_state,zerotrgt)
MCFG_VIDEO_START_OVERRIDE(cntsteer_state,cntsteer)
@@ -998,13 +997,12 @@ MACHINE_CONFIG_START(cntsteer_state::zerotrgt)
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_zerotrgt)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) // ?
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_zerotrgt)
- MCFG_PALETTE_ADD("palette", 256)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_zerotrgt);
+ PALETTE(config, m_palette, FUNC(cntsteer_state::zerotrgt_palette), 256);
- MCFG_PALETTE_INIT_OWNER(cntsteer_state,zerotrgt)
MCFG_VIDEO_START_OVERRIDE(cntsteer_state,zerotrgt)
/* sound hardware */
diff --git a/src/mame/drivers/cocoloco.cpp b/src/mame/drivers/cocoloco.cpp
index 7e71a0a32b4..6b1f8bbd68a 100644
--- a/src/mame/drivers/cocoloco.cpp
+++ b/src/mame/drivers/cocoloco.cpp
@@ -197,11 +197,20 @@
class cocoloco_state : public driver_device
{
public:
- cocoloco_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ cocoloco_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
+ DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
+
+ void cocoloco(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
@@ -214,13 +223,9 @@ public:
DECLARE_WRITE8_MEMBER(vram_clear_w);
DECLARE_WRITE8_MEMBER(coincounter_w);
- DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
-
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(cocoloco);
+ void cocoloco_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void cocoloco(machine_config &config);
void cocoloco_map(address_map &map);
};
@@ -275,15 +280,13 @@ NETLIST_END()
* Video Hardware *
***********************************/
-PALETTE_INIT_MEMBER(cocoloco_state, cocoloco)
+void cocoloco_state::cocoloco_palette(palette_device &palette) const
{
- for(int i = 0; i < 0x10; i += 2)
+ for (int i = 0; i < 0x10; i += 2)
{
- int r,g,b;
-
- r = pal2bit(i & 3);
- g = pal2bit((i >> 1) & 3);
- b = pal2bit((i >> 2) & 3);
+ int const r = pal2bit(i & 3);
+ int const g = pal2bit((i >> 1) & 3);
+ int const b = pal2bit((i >> 2) & 3);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -310,17 +313,15 @@ void cocoloco_state::video_start()
uint32_t cocoloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y, count, xi;
-
bitmap.fill(m_palette->black_pen(), cliprect);
- count = 0;
+ int count = 0;
- for(x = 0; x < 256; x += 8)
+ for (int x = 0; x < 256; x += 8)
{
- for(y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
- for (xi = 0; xi < 8; xi++)
+ for (int xi = 0; xi < 8; xi++)
{
int color;
color = (m_videoram[count|0x0000] >> (xi)) & 1;
@@ -328,7 +329,7 @@ uint32_t cocoloco_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
color |= ((m_videoram[count|0x4000] >> (xi)) & 1) << 2;
color |= ((m_videoram[count|0x6000] >> (xi)) & 1) << 3;
- if(cliprect.contains(x + xi, 256 - y))
+ if (cliprect.contains(x + xi, 256 - y))
bitmap.pix16(256 - y, x + xi) = m_palette->pen(color & 0x0f);
}
@@ -520,10 +521,9 @@ MACHINE_CONFIG_START(cocoloco_state::cocoloco)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(CPU_CLOCK * 4, 384, 0, 256, 262, 0, 256) // TODO: not accurate, ~50 Hz
MCFG_SCREEN_UPDATE_DRIVER(cocoloco_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10)
- MCFG_PALETTE_INIT_OWNER(cocoloco_state, cocoloco)
+ PALETTE(config, m_palette, FUNC(cocoloco_state::cocoloco_palette), 0x10);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/combatsc.cpp b/src/mame/drivers/combatsc.cpp
index 2eb89f92fda..45735cbbd11 100644
--- a/src/mame/drivers/combatsc.cpp
+++ b/src/mame/drivers/combatsc.cpp
@@ -724,14 +724,12 @@ MACHINE_CONFIG_START(combatsc_state::combatsc)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000)/3, 528, 0, 256, 256, 16, 240) // not accurate, assuming same to other Konami games (59.17)
MCFG_SCREEN_UPDATE_DRIVER(combatsc_state, screen_update_combatsc)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_combatsc)
- MCFG_PALETTE_ADD("palette", 8*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(128)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_LITTLE)
- MCFG_PALETTE_INIT_OWNER(combatsc_state,combatsc)
+ MCFG_SCREEN_PALETTE(m_palette)
+
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_combatsc);
+ PALETTE(config, m_palette, FUNC(combatsc_state::combatsc_palette));
+ m_palette->set_format(palette_device::xBGR_555, 8 * 16 * 16, 128);
+ m_palette->set_endianness(ENDIANNESS_LITTLE);
MCFG_VIDEO_START_OVERRIDE(combatsc_state,combatsc)
K007121(config, m_k007121_1, 0);
@@ -748,8 +746,7 @@ MACHINE_CONFIG_START(combatsc_state::combatsc)
ymsnd.port_a_write_callback().set(FUNC(combatsc_state::combatsc_portA_w));
ymsnd.add_route(ALL_OUTPUTS, "mono", 0.20);
- MCFG_DEVICE_ADD("upd", UPD7759)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
+ UPD7759(config, m_upd7759).add_route(ALL_OUTPUTS, "mono", 0.70);
MACHINE_CONFIG_END
@@ -775,14 +772,12 @@ MACHINE_CONFIG_START(combatsc_state::combatscb)
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(combatsc_state, screen_update_combatscb)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_combatscb)
- MCFG_PALETTE_ADD("palette", 8*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(128)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_LITTLE)
- MCFG_PALETTE_INIT_OWNER(combatsc_state,combatscb)
+ MCFG_SCREEN_PALETTE(m_palette)
+
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_combatscb);
+ PALETTE(config, m_palette, FUNC(combatsc_state::combatscb_palette));
+ m_palette->set_format(palette_device::xBGR_555, 8 * 16 * 16, 128);
+ m_palette->set_endianness(ENDIANNESS_LITTLE);
MCFG_VIDEO_START_OVERRIDE(combatsc_state,combatscb)
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/commando.cpp b/src/mame/drivers/commando.cpp
index 6b521b451a4..2400b021dda 100644
--- a/src/mame/drivers/commando.cpp
+++ b/src/mame/drivers/commando.cpp
@@ -275,20 +275,18 @@ MACHINE_CONFIG_START(commando_state::commando)
screen.set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_commando)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8)
+ BUFFERED_SPRITERAM8(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- MCFG_DEVICE_ADD("ym1", YM2203, PHI_B/2)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+ YM2203(config, "ym1", PHI_B/2).add_route(ALL_OUTPUTS, "mono", 0.15);
- MCFG_DEVICE_ADD("ym2", YM2203, PHI_B/2)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+ YM2203(config, "ym2", PHI_B/2).add_route(ALL_OUTPUTS, "mono", 0.15);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/compgolf.cpp b/src/mame/drivers/compgolf.cpp
index c07d5143123..1fef8268176 100644
--- a/src/mame/drivers/compgolf.cpp
+++ b/src/mame/drivers/compgolf.cpp
@@ -235,12 +235,11 @@ MACHINE_CONFIG_START(compgolf_state::compgolf)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(1*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(compgolf_state, screen_update_compgolf)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(compgolf_state, compgolf)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_compgolf)
+ PALETTE(config, m_palette, FUNC(compgolf_state::compgolf_palette), 0x100);
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_compgolf)
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/compucolor.cpp b/src/mame/drivers/compucolor.cpp
index 80340822e16..487298f071c 100644
--- a/src/mame/drivers/compucolor.cpp
+++ b/src/mame/drivers/compucolor.cpp
@@ -407,7 +407,7 @@ MACHINE_CONFIG_START(compucolor2_state::compucolor2)
MCFG_SCREEN_RAW_PARAMS(XTAL(17'971'200)/2, 93*6, 0, 64*6, 268, 0, 256)
MCFG_SCREEN_UPDATE_DRIVER(compucolor2_state, screen_update)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
CRT5027(config, m_vtac, XTAL(17'971'200)/2/6);
m_vtac->set_char_width(6);
diff --git a/src/mame/drivers/comquest.cpp b/src/mame/drivers/comquest.cpp
index ba4d2f88789..f0b194811e0 100644
--- a/src/mame/drivers/comquest.cpp
+++ b/src/mame/drivers/comquest.cpp
@@ -257,7 +257,7 @@ MACHINE_CONFIG_START(comquest_state::comquest)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_comquest )
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
diff --git a/src/mame/drivers/concept.cpp b/src/mame/drivers/concept.cpp
index 68a168b01d6..4251ecd123c 100644
--- a/src/mame/drivers/concept.cpp
+++ b/src/mame/drivers/concept.cpp
@@ -225,13 +225,11 @@ void concept_state::concept(machine_config &config)
screen.set_palette("palette");
/* Is the palette black on white or white on black??? */
- palette_device &palette(PALETTE(config, "palette", 2));
- palette.set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound */
SPEAKER(config, "mono").front_center();
- SPEAKER_SOUND(config, m_speaker);
- m_speaker->add_route(ALL_OUTPUTS, "mono", 1.00);
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
/* rtc */
MM58274C(config, m_mm58274, 0);
diff --git a/src/mame/drivers/contra.cpp b/src/mame/drivers/contra.cpp
index b1da3d9dbde..56f86ed6c26 100644
--- a/src/mame/drivers/contra.cpp
+++ b/src/mame/drivers/contra.cpp
@@ -226,15 +226,14 @@ MACHINE_CONFIG_START(contra_state::contra)
MCFG_SCREEN_SIZE(37*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 35*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(contra_state, screen_update_contra)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_contra)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_contra);
- MCFG_PALETTE_ADD("palette", 2*8*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(128)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_LITTLE)
- MCFG_PALETTE_INIT_OWNER(contra_state, contra)
+ PALETTE(config, m_palette, FUNC(contra_state::contra_palette));
+ m_palette->set_format(palette_device::xBGR_555, 2 * 8 * 16 * 16);
+ m_palette->set_indirect_entries(128);
+ m_palette->set_endianness(ENDIANNESS_LITTLE);
K007121(config, m_k007121_1, 0);
m_k007121_1->set_palette_tag(m_palette);
diff --git a/src/mame/drivers/controlid.cpp b/src/mame/drivers/controlid.cpp
index 2ae522d8f27..926eaea65f2 100644
--- a/src/mame/drivers/controlid.cpp
+++ b/src/mame/drivers/controlid.cpp
@@ -43,16 +43,18 @@ public:
{ }
void controlidx628(machine_config &config);
-private:
+
+protected:
virtual void machine_start() override;
+private:
DECLARE_WRITE8_MEMBER(p0_w);
DECLARE_READ8_MEMBER(p1_r);
DECLARE_WRITE8_MEMBER(p1_w);
DECLARE_READ8_MEMBER(p2_r);
DECLARE_READ8_MEMBER(p3_r);
DECLARE_WRITE8_MEMBER(p3_w);
- DECLARE_PALETTE_INIT(controlidx628);
+ void controlidx628_palette(palette_device &palette) const;
void io_map(address_map &map);
@@ -130,12 +132,12 @@ WRITE8_MEMBER(controlidx628_state::p3_w)
//static INPUT_PORTS_START( controlidx628 )
//INPUT_PORTS_END
-PALETTE_INIT_MEMBER(controlidx628_state, controlidx628)
+void controlidx628_state::controlidx628_palette(palette_device &palette) const
{
// These colors were selected from a photo of the display
// using the color-picker in Inkscape:
- palette.set_pen_color(0, rgb_t(0x06, 0x61, 0xEE));
- palette.set_pen_color(1, rgb_t(0x00, 0x23, 0x84));
+ palette.set_pen_color(0, rgb_t(0x06, 0x61, 0xee));
+ palette.set_pen_color(1, rgb_t(0x00, 0x23, 0x84));
}
/*************************
@@ -162,8 +164,7 @@ MACHINE_CONFIG_START(controlidx628_state::controlidx628)
MCFG_SCREEN_UPDATE_DEVICE("nt7534", nt7534_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(controlidx628_state, controlidx628)
+ PALETTE(config, "palette", FUNC(controlidx628_state::controlidx628_palette), 2);
NT7534(config, m_lcdc);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/coolridr.cpp b/src/mame/drivers/coolridr.cpp
index ffe1c748555..5e0840bd651 100644
--- a/src/mame/drivers/coolridr.cpp
+++ b/src/mame/drivers/coolridr.cpp
@@ -3252,16 +3252,16 @@ MACHINE_CONFIG_START(coolridr_state::coolridr)
MCFG_SCREEN_SIZE(640, 512)
MCFG_SCREEN_VISIBLE_AREA(CLIPMINX_FULL,CLIPMAXX_FULL, CLIPMINY_FULL, CLIPMAXY_FULL)
MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update<0>)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("screen2", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(640, 512)
MCFG_SCREEN_VISIBLE_AREA(CLIPMINX_FULL,CLIPMAXX_FULL, CLIPMINY_FULL, CLIPMAXY_FULL)
MCFG_SCREEN_UPDATE_DRIVER(coolridr_state, screen_update<1>)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_555);
config.set_default_layout(layout_dualhsxs);
diff --git a/src/mame/drivers/cop01.cpp b/src/mame/drivers/cop01.cpp
index d305611a6c9..31fe01d33ea 100644
--- a/src/mame/drivers/cop01.cpp
+++ b/src/mame/drivers/cop01.cpp
@@ -466,12 +466,10 @@ MACHINE_CONFIG_START(cop01_state::cop01)
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(cop01_state, screen_update_cop01)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cop01)
- MCFG_PALETTE_ADD("palette", 16+8*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(cop01_state, cop01)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cop01);
+ PALETTE(config, m_palette, FUNC(cop01_state::cop01_palette), 16+8*16+16*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -507,12 +505,10 @@ MACHINE_CONFIG_START(mightguy_state::mightguy)
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(cop01_state, screen_update_cop01)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cop01)
- MCFG_PALETTE_ADD("palette", 16+8*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(cop01_state, cop01)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cop01);
+ PALETTE(config, m_palette, FUNC(cop01_state::cop01_palette), 16+8*16+16*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -526,7 +522,6 @@ MACHINE_CONFIG_START(mightguy_state::mightguy)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 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/copsnrob.cpp b/src/mame/drivers/copsnrob.cpp
index b78ce672c06..f55533f8aa3 100644
--- a/src/mame/drivers/copsnrob.cpp
+++ b/src/mame/drivers/copsnrob.cpp
@@ -255,16 +255,16 @@ MACHINE_CONFIG_START(copsnrob_state::copsnrob)
MCFG_DEVICE_PROGRAM_MAP(main_map)
/* 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*8, 32*8-1, 0*8, 26*8-1)
- MCFG_SCREEN_UPDATE_DRIVER(copsnrob_state, screen_update_copsnrob)
- MCFG_SCREEN_PALETTE("palette")
+ 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(32*8, 32*8);
+ m_screen->set_visarea(0*8, 32*8-1, 0*8, 26*8-1);
+ m_screen->set_screen_update(FUNC(copsnrob_state::screen_update_copsnrob));
+ m_screen->set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_copsnrob)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
copsnrob_audio(config);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/corona.cpp b/src/mame/drivers/corona.cpp
index 7e7718fd070..83e220434c4 100644
--- a/src/mame/drivers/corona.cpp
+++ b/src/mame/drivers/corona.cpp
@@ -334,6 +334,17 @@ public:
m_lamps(*this, "lamp%u", 0U)
{ }
+ void winner81(machine_config &config);
+ void winner82(machine_config &config);
+ void rcirulet(machine_config &config);
+ void luckyrlt(machine_config &config);
+ void re800(machine_config &config);
+
+protected:
+ virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void video_start() override;
+
+private:
DECLARE_WRITE8_MEMBER(blitter_y_w);
DECLARE_WRITE8_MEMBER(blitter_unk_w);
DECLARE_WRITE8_MEMBER(blitter_x_w);
@@ -347,15 +358,9 @@ public:
DECLARE_WRITE8_MEMBER(mux_port_w);
DECLARE_WRITE8_MEMBER(wc_meters_w);
void blitter_execute(int x, int y, int color, int width, int flag);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(corona);
+ void corona_palette(palette_device &palette) const;
uint32_t screen_update_winner(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_luckyrlt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void winner81(machine_config &config);
- void winner82(machine_config &config);
- void rcirulet(machine_config &config);
- void luckyrlt(machine_config &config);
- void re800(machine_config &config);
void luckyrlt_cpu_io_map(address_map &map);
void luckyrlt_map(address_map &map);
void luckyrlt_sound_cpu_io_map(address_map &map);
@@ -373,9 +378,6 @@ public:
void winner82_sound_cpu_io_map(address_map &map);
void winner82_sound_map(address_map &map);
-protected:
- virtual void machine_start() override { m_lamps.resolve(); }
-
uint8_t m_blitter_x_reg;
uint8_t m_blitter_y_reg;
uint8_t m_blitter_aux_reg;
@@ -396,31 +398,29 @@ protected:
* Video Hardware *
*********************************************/
-PALETTE_INIT_MEMBER(corona_state, corona)
+void corona_state::corona_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit6, bit7, bit0, bit1, r, g, b;
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
- bit7 = (color_prom[0] >> 7) & 0x01;
- bit6 = (color_prom[0] >> 6) & 0x01;
+ int bit0, bit1;
+ int const bit7 = BIT(color_prom[i], 7);
+ int const bit6 = BIT(color_prom[i], 6);
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- b = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const b = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 2) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- g = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ int const g = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- r = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ int const r = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -458,29 +458,26 @@ READ8_MEMBER(corona_state::blitter_status_r)
void corona_state::blitter_execute(int x, int y, int color, int width, int flag)
{
- int i;
- int xdir = (flag & 0x10) ? -1 : 1;
- int ydir = (!(flag & 0x20)) ? -1 : 1;
+ int const xdir = (flag & 0x10) ? -1 : 1;
+ int const ydir = (!(flag & 0x20)) ? -1 : 1;
if(width == 0) //ignored
return;
if((flag & 0xc0) == 0) /* square shape / layer clearance */
{
- int xp, yp;
-
if(x != 128 || y != 128 || width != 8)
printf("%02x %02x %02x %02x %02x\n", x, y, color, width, flag);
- for(yp = 0; yp < 0x100; yp++)
- for(xp = 0; xp < 0x100; xp++)
+ for(int yp = 0; yp < 0x100; yp++)
+ for(int xp = 0; xp < 0x100; xp++)
m_videobuf[(yp & 0x1ff) * 512 + (xp & 0x1ff)] = color;
}
else /* line shape */
{
//printf("%02x %02x %02x %02x %02x\n",x,y,color,width,flag);
- for(i = 0; i < width; i++)
+ for(int i = 0; i < width; i++)
{
m_videobuf[(y & 0x1ff) * 512 + (x & 0x1ff)] = color;
@@ -1411,8 +1408,7 @@ MACHINE_CONFIG_START(corona_state::winner81)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(corona_state, corona)
+ PALETTE(config, "palette", FUNC(corona_state::corona_palette), 0x100);
SPEAKER(config, "mono").front_center();
@@ -1444,8 +1440,7 @@ MACHINE_CONFIG_START(corona_state::winner82)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(corona_state, corona)
+ PALETTE(config, "palette", FUNC(corona_state::corona_palette), 0x100);
SPEAKER(config, "mono").front_center();
@@ -1478,8 +1473,7 @@ MACHINE_CONFIG_START(corona_state::re800)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(corona_state, corona)
+ PALETTE(config, "palette", FUNC(corona_state::corona_palette), 0x100);
SPEAKER(config, "mono").front_center();
@@ -1511,8 +1505,7 @@ MACHINE_CONFIG_START(corona_state::rcirulet)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(corona_state, corona)
+ PALETTE(config, "palette", FUNC(corona_state::corona_palette), 0x100);
SPEAKER(config, "mono").front_center();
@@ -1545,8 +1538,7 @@ MACHINE_CONFIG_START(corona_state::luckyrlt)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(corona_state, corona)
+ PALETTE(config, "palette", FUNC(corona_state::corona_palette), 0x100);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cosmic.cpp b/src/mame/drivers/cosmic.cpp
index 46f7906e704..3ef350824df 100644
--- a/src/mame/drivers/cosmic.cpp
+++ b/src/mame/drivers/cosmic.cpp
@@ -1043,9 +1043,7 @@ void cosmic_state::panic(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_panic);
- PALETTE(config, m_palette, 16+8*4);
- m_palette->set_indirect_entries(16);
- m_palette->set_init(FUNC(cosmic_state::palette_init_panic));
+ PALETTE(config, m_palette, FUNC(cosmic_state::panic_palette), 16 + 8*4, 16);
m_screen->set_screen_update(FUNC(cosmic_state::screen_update_panic));
@@ -1072,9 +1070,7 @@ void cosmic_state::cosmica(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cosmica);
- PALETTE(config, m_palette, 8+16*4);
- m_palette->set_indirect_entries(8);
- m_palette->set_init(FUNC(cosmic_state::palette_init_cosmica));
+ PALETTE(config, m_palette, FUNC(cosmic_state::cosmica_palette), 8 + 16*4, 8);
m_screen->set_screen_update(FUNC(cosmic_state::screen_update_cosmica));
@@ -1105,8 +1101,7 @@ void cosmic_state::cosmicg(machine_config &config)
m_screen->set_screen_update(FUNC(cosmic_state::screen_update_cosmicg));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 16);
- m_palette->set_init(FUNC(cosmic_state::palette_init_cosmicg));
+ PALETTE(config, m_palette, FUNC(cosmic_state::cosmicg_palette), 16);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1133,9 +1128,7 @@ void cosmic_state::magspot(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_panic);
- PALETTE(config, m_palette, 16+8*4);
- m_palette->set_indirect_entries(16);
- m_palette->set_init(FUNC(cosmic_state::palette_init_magspot));
+ PALETTE(config, m_palette, FUNC(cosmic_state::magspot_palette), 16 + 8*4, 16);
m_screen->set_screen_update(FUNC(cosmic_state::screen_update_magspot));
@@ -1165,9 +1158,7 @@ void cosmic_state::nomnlnd(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_panic);
- PALETTE(config, m_palette, 16+8*4);
- m_palette->set_indirect_entries(16);
- m_palette->set_init(FUNC(cosmic_state::palette_init_nomnlnd));
+ PALETTE(config, m_palette, FUNC(cosmic_state::nomnlnd_palette), 16 + 8*4, 16);
m_screen->set_screen_update(FUNC(cosmic_state::screen_update_nomnlnd));
diff --git a/src/mame/drivers/cps3.cpp b/src/mame/drivers/cps3.cpp
index 96117b50377..7c47db79f20 100644
--- a/src/mame/drivers/cps3.cpp
+++ b/src/mame/drivers/cps3.cpp
@@ -2525,7 +2525,7 @@ void cps3_state::cps3(machine_config &config)
*/
NVRAM(config, "eeprom", nvram_device::DEFAULT_ALL_0);
- PALETTE(config, m_palette, 0x10000); // actually 0x20000 ...
+ PALETTE(config, m_palette).set_entries(0x10000); // actually 0x20000 ...
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
diff --git a/src/mame/drivers/craft.cpp b/src/mame/drivers/craft.cpp
index dfc01eeb26c..e04f678cc80 100644
--- a/src/mame/drivers/craft.cpp
+++ b/src/mame/drivers/craft.cpp
@@ -261,7 +261,7 @@ void craft_state::craft(machine_config &config)
screen.set_size(635, 525);
screen.set_visarea(47, 526, 36, 515);
screen.set_screen_update(FUNC(craft_state::screen_update_craft));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
/* sound hardware */
SPEAKER(config, "avr8").front_center();
diff --git a/src/mame/drivers/crbaloon.cpp b/src/mame/drivers/crbaloon.cpp
index d79823c375a..4d24798c54b 100644
--- a/src/mame/drivers/crbaloon.cpp
+++ b/src/mame/drivers/crbaloon.cpp
@@ -369,11 +369,9 @@ MACHINE_CONFIG_START(crbaloon_state::crbaloon)
MCFG_DEVICE_IO_MAP(main_io_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", crbaloon_state, vblank_irq)
-
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_crbaloon)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(crbaloon_state, crbaloon)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_crbaloon);
+ PALETTE(config, "palette", FUNC(crbaloon_state::crbaloon_palette), 32);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
diff --git a/src/mame/drivers/crgolf.cpp b/src/mame/drivers/crgolf.cpp
index b8317049bf5..28245fd6cbc 100644
--- a/src/mame/drivers/crgolf.cpp
+++ b/src/mame/drivers/crgolf.cpp
@@ -493,8 +493,7 @@ MACHINE_CONFIG_START(crgolf_state::crgolf)
/* stride is technically 0x6000, but powers of 2 makes the memory map / address masking cleaner. */
ADDRESS_MAP_BANK(config, "vrambank").set_map(&crgolf_state::vrambank_map).set_options(ENDIANNESS_LITTLE, 8, 16, 0x8000);
- MCFG_PALETTE_ADD("palette", 0x20)
- MCFG_PALETTE_INIT_OWNER(crgolf_state, crgolf)
+ PALETTE(config, m_palette, FUNC(crgolf_state::crgolf_palette), 0x20);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -535,12 +534,7 @@ MACHINE_CONFIG_START(crgolf_state::mastrglf)
MCFG_DEVICE_IO_MAP(mastrglf_subio)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", crgolf_state, irq0_line_hold)
- MCFG_DEVICE_REMOVE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(crgolf_state, mastrglf)
-
-
+ PALETTE(config.replace(), m_palette, FUNC(crgolf_state::mastrglf_palette), 0x100);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/crimfght.cpp b/src/mame/drivers/crimfght.cpp
index 4537003ea74..861696da537 100644
--- a/src/mame/drivers/crimfght.cpp
+++ b/src/mame/drivers/crimfght.cpp
@@ -322,9 +322,8 @@ void crimfght_state::crimfght(machine_config &config)
screen.set_screen_update(FUNC(crimfght_state::screen_update_crimfght));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 512);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/crospang.cpp b/src/mame/drivers/crospang.cpp
index 970b70fb39d..869d08ae2f0 100644
--- a/src/mame/drivers/crospang.cpp
+++ b/src/mame/drivers/crospang.cpp
@@ -443,8 +443,7 @@ MACHINE_CONFIG_START(crospang_state::crospang)
MCFG_SCREEN_UPDATE_DRIVER(crospang_state, screen_update_crospang)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x300)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x300);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_crospang)
DECO_SPRITE(config, m_sprgen, 0);
diff --git a/src/mame/drivers/crshrace.cpp b/src/mame/drivers/crshrace.cpp
index 2a4d2d84083..551f03a7859 100644
--- a/src/mame/drivers/crshrace.cpp
+++ b/src/mame/drivers/crshrace.cpp
@@ -424,9 +424,8 @@ MACHINE_CONFIG_START(crshrace_state::crshrace)
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)
- MCFG_PALETTE_FORMAT(xGGGGGBBBBBRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_crshrace);
+ PALETTE(config, m_palette).set_format(palette_device::xGBR_555, 2048);
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_tile_indirect_cb(FUNC(crshrace_state::crshrace_tile_callback), this);
diff --git a/src/mame/drivers/crystal.cpp b/src/mame/drivers/crystal.cpp
index 7f8e8326e6f..5b051606dca 100644
--- a/src/mame/drivers/crystal.cpp
+++ b/src/mame/drivers/crystal.cpp
@@ -1560,7 +1560,7 @@ void crystal_state::crystal(machine_config &config)
VIDEO_VRENDER0(config, m_vr0vid, 14318180, m_maincpu);
- PALETTE(config, "palette", 65536).set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGGBBBBB));
+ PALETTE(config, "palette", palette_device::RGB_565);
DS1302(config, m_ds1302, 32.768_kHz_XTAL);
diff --git a/src/mame/drivers/cv1k.cpp b/src/mame/drivers/cv1k.cpp
index 1c0537d6bcc..6bcc9041821 100644
--- a/src/mame/drivers/cv1k.cpp
+++ b/src/mame/drivers/cv1k.cpp
@@ -486,7 +486,7 @@ void cv1k_state::cv1k(machine_config &config)
screen.set_visarea(0, 0x140-1, 0, 0xf0-1);
screen.set_screen_update(FUNC(cv1k_state::screen_update));
- PALETTE(config, "palette", 0x10000);
+ PALETTE(config, "palette").set_entries(0x10000);
SPEAKER(config, "mono").front_center();
YMZ770(config, "ymz770", 16.384_MHz_XTAL).add_route(1, "mono", 1.0); // only Right output used, Left is not connected
diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp
index 57253f34103..ed4b04ca199 100644
--- a/src/mame/drivers/cvs.cpp
+++ b/src/mame/drivers/cvs.cpp
@@ -990,9 +990,7 @@ void cvs_state::cvs(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_cvs);
- PALETTE(config, m_palette, (256+4)*8+8+1);
- m_palette->set_indirect_entries(16);
- m_palette->set_init(FUNC(cvs_state::palette_init_cvs));
+ PALETTE(config, m_palette, FUNC(cvs_state::cvs_palette), (256 + 4) * 8 + 8 + 1, 16);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE);
diff --git a/src/mame/drivers/cxhumax.cpp b/src/mame/drivers/cxhumax.cpp
index 631b0d1ef10..cd3ad8feaa8 100644
--- a/src/mame/drivers/cxhumax.cpp
+++ b/src/mame/drivers/cxhumax.cpp
@@ -1071,7 +1071,7 @@ MACHINE_CONFIG_START(cxhumax_state::cxhumax)
MCFG_SCREEN_VISIBLE_AREA(0, 1920-1, 0, 1080-1)
MCFG_SCREEN_UPDATE_DRIVER(cxhumax_state, screen_update_cxhumax)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
GENERIC_TERMINAL(config, m_terminal, 0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/cyberbal.cpp b/src/mame/drivers/cyberbal.cpp
index 25aeb9aa6a5..172eda403d4 100644
--- a/src/mame/drivers/cyberbal.cpp
+++ b/src/mame/drivers/cyberbal.cpp
@@ -416,8 +416,8 @@ MACHINE_CONFIG_START(cyberbal_state::cyberbal_base)
/* video hardware */
GFXDECODE(config, m_gfxdecode, "lpalette", gfx_interleaved);
- PALETTE(config, "lpalette", 2048).set_format(PALETTE_FORMAT_IRRRRRGGGGGBBBBB);
- PALETTE(config, "rpalette", 2048).set_format(PALETTE_FORMAT_IRRRRRGGGGGBBBBB);
+ PALETTE(config, "lpalette").set_format(palette_device::IRGB_1555, 2048);
+ PALETTE(config, "rpalette").set_format(palette_device::IRGB_1555, 2048);
TILEMAP(config, m_playfield, "gfxdecode", 2, 16,8, TILEMAP_SCAN_ROWS, 64,64)
.set_info_callback(FUNC(cyberbal_state::get_playfield_tile_info));
@@ -499,9 +499,8 @@ MACHINE_CONFIG_START(cyberbal2p_state::cyberbal2p)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cyberbal)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_cyberbal);
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
TILEMAP(config, m_playfield, "gfxdecode", 2, 16,8, TILEMAP_SCAN_ROWS, 64,64)
.set_info_callback(FUNC(cyberbal2p_state::get_playfield_tile_info));
diff --git a/src/mame/drivers/cybertnk.cpp b/src/mame/drivers/cybertnk.cpp
index 98f53b1e43d..1a590d59513 100644
--- a/src/mame/drivers/cybertnk.cpp
+++ b/src/mame/drivers/cybertnk.cpp
@@ -38,7 +38,7 @@ IC22 (1F4*2 bytes starting @ 0x0c0000, code at 0x0000069E) \ Tested as 0x3e8 (10
IC23 (1F4*2 bytes starting @ 0x0c0001, code at 0x000006AA) / Cleared at 0x00000440 as 0x4000 bytes.
IC24 (1F4*2 bytes starting @ 0x100001, code at 0x000006B8) > Shared RAM
-The shared ram is tested and cleared almost the same as the other RAM,
+The shared RAM is tested and cleared almost the same as the other RAM,
and is mapped into the master at E0000. Only every odd byte is used.
The first 0x10 bytes are used heavily as registers
@@ -198,8 +198,17 @@ public:
m_traverse_io(*this, "TRAVERSE"),
m_elevate_io(*this, "ELEVATE"),
m_accel_io(*this, "ACCEL"),
- m_handle_io(*this, "HANDLE") { }
+ m_handle_io(*this, "HANDLE")
+ { }
+ void init_cybertnk();
+
+ void cybertnk(machine_config &config);
+
+protected:
+ virtual void video_start() override;
+
+private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -228,15 +237,12 @@ public:
DECLARE_READ8_MEMBER(mux_r);
DECLARE_WRITE8_MEMBER(irq_ack_w);
DECLARE_WRITE8_MEMBER(cnt_w);
- void init_cybertnk();
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void video_start() override;
void draw_road(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift, int pri);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift);
uint32_t update_screen(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int screen_shift);
uint32_t screen_update_cybertnk_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cybertnk_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void cybertnk(machine_config &config);
void master_mem(address_map &map);
void slave_mem(address_map &map);
void sound_mem(address_map &map);
@@ -836,7 +842,7 @@ MACHINE_CONFIG_START(cybertnk_state::cybertnk)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cybertnk_state, screen_update_cybertnk_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -844,11 +850,10 @@ MACHINE_CONFIG_START(cybertnk_state::cybertnk)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(cybertnk_state, screen_update_cybertnk_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cybertnk)
- MCFG_PALETTE_ADD("palette", 0x4000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cybertnk);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x4000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/cybstorm.cpp b/src/mame/drivers/cybstorm.cpp
index 46083346386..6310ef3755d 100644
--- a/src/mame/drivers/cybstorm.cpp
+++ b/src/mame/drivers/cybstorm.cpp
@@ -243,8 +243,7 @@ MACHINE_CONFIG_START(cybstorm_state::round2)
ADDRESS_MAP_BANK(config, "vadbank").set_map(&cybstorm_state::vadbank_map).set_options(ENDIANNESS_BIG, 16, 32, 0x90000);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cybstorm)
- MCFG_PALETTE_ADD("palette", 32768)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 32768);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_PALETTE("palette")
diff --git a/src/mame/drivers/cyclemb.cpp b/src/mame/drivers/cyclemb.cpp
index 95721e1cab7..a41c93dca08 100644
--- a/src/mame/drivers/cyclemb.cpp
+++ b/src/mame/drivers/cyclemb.cpp
@@ -84,8 +84,8 @@ Dumped by Chack'n
class cyclemb_state : public driver_device
{
public:
- cyclemb_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ cyclemb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
@@ -140,7 +140,7 @@ public:
void init_cyclemb();
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(cyclemb);
+ void cyclemb_palette(palette_device &palette) const;
uint32_t screen_update_cyclemb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_skydest(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -160,28 +160,29 @@ public:
-PALETTE_INIT_MEMBER(cyclemb_state, cyclemb)
+void cyclemb_state::cyclemb_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b,val;
- int bit0,bit1,bit2;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- val = (color_prom[i+0x100]) | (color_prom[i+0x000]<<4);
+ int const val = color_prom[i | 0x100] | (color_prom[i | 0x000] << 4);
+ int bit0, bit1, bit2;
bit0 = 0;
- bit1 = (val >> 6) & 0x01;
- bit2 = (val >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 3) & 0x01;
- bit1 = (val >> 4) & 0x01;
- bit2 = (val >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 0) & 0x01;
- bit1 = (val >> 1) & 0x01;
- bit2 = (val >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(val, 6);
+ bit2 = BIT(val, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 3);
+ bit1 = BIT(val, 4);
+ bit2 = BIT(val, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 0);
+ bit1 = BIT(val, 1);
+ bit2 = BIT(val, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -994,12 +995,10 @@ MACHINE_CONFIG_START(cyclemb_state::cyclemb)
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(cyclemb_state, screen_update_cyclemb)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cyclemb)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(cyclemb_state, cyclemb)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cyclemb);
+ PALETTE(config, m_palette, FUNC(cyclemb_state::cyclemb_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/cz101.cpp b/src/mame/drivers/cz101.cpp
index 9854296ebf3..93268c9dba6 100644
--- a/src/mame/drivers/cz101.cpp
+++ b/src/mame/drivers/cz101.cpp
@@ -45,7 +45,7 @@ public:
void cz101(machine_config &config);
- DECLARE_PALETTE_INIT(cz101);
+ void cz101_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(lcd_pixel_update);
protected:
@@ -250,7 +250,7 @@ INPUT_PORTS_END
// MACHINE EMULATION
//**************************************************************************
-PALETTE_INIT_MEMBER( cz101_state, cz101 )
+void cz101_state::cz101_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
palette.set_pen_color(1, rgb_t( 92, 83, 88)); // lcd pixel on
@@ -400,8 +400,7 @@ MACHINE_CONFIG_START( cz101_state::cz101 )
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(cz101_state, cz101)
+ PALETTE(config, "palette", FUNC(cz101_state::cz101_palette), 3);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
diff --git a/src/mame/drivers/d6800.cpp b/src/mame/drivers/d6800.cpp
index c69760542db..d0776d1ee56 100644
--- a/src/mame/drivers/d6800.cpp
+++ b/src/mame/drivers/d6800.cpp
@@ -402,7 +402,7 @@ MACHINE_CONFIG_START(d6800_state::d6800)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(25))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/d9final.cpp b/src/mame/drivers/d9final.cpp
index d1c766bdc8f..e1704b33ee1 100644
--- a/src/mame/drivers/d9final.cpp
+++ b/src/mame/drivers/d9final.cpp
@@ -37,13 +37,14 @@
class d9final_state : public driver_device
{
public:
- d9final_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ d9final_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_lo_vram(*this, "lo_vram"),
m_hi_vram(*this, "hi_vram"),
- m_cram(*this, "cram") { }
+ m_cram(*this, "cram")
+ { }
void d9final(machine_config &config);
@@ -320,8 +321,7 @@ MACHINE_CONFIG_START(d9final_state::d9final)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_d9final)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x400)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, "palette", palette_device::BLACK).set_format(palette_device::xBRG_444, 0x400);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dacholer.cpp b/src/mame/drivers/dacholer.cpp
index 630e420932f..14b9f91aceb 100644
--- a/src/mame/drivers/dacholer.cpp
+++ b/src/mame/drivers/dacholer.cpp
@@ -78,7 +78,7 @@ private:
DECLARE_WRITE8_MEMBER(music_irq_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(dacholer);
+ void dacholer_palette(palette_device &palette) const;
uint32_t screen_update_dacholer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(sound_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
@@ -627,42 +627,40 @@ void dacholer_state::machine_reset()
m_snd_ack = 0;
}
-/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
-PALETTE_INIT_MEMBER(dacholer_state, dacholer)
+// guess: use the same resistor values as Crazy Climber (needs checking on the real hardware)
+void dacholer_state::dacholer_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_rg[3], weights_b[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
- for (i = 0;i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -682,7 +680,6 @@ MACHINE_CONFIG_START(dacholer_state::dacholer)
MCFG_DEVICE_IO_MAP(snd_io_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", dacholer_state, sound_irq)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -690,18 +687,15 @@ MACHINE_CONFIG_START(dacholer_state::dacholer)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-1-16)
MCFG_SCREEN_UPDATE_DRIVER(dacholer_state, screen_update_dacholer)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(dacholer_state, dacholer)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dacholer)
+ MCFG_SCREEN_PALETTE(m_palette)
+ PALETTE(config, m_palette, FUNC(dacholer_state::dacholer_palette), 32);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dacholer);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
+ GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
AY8910(config, "ay1", XTAL(19'968'000)/16).add_route(ALL_OUTPUTS, "mono", 0.15);
diff --git a/src/mame/drivers/dai.cpp b/src/mame/drivers/dai.cpp
index 2c08f556e9f..42425d3f928 100644
--- a/src/mame/drivers/dai.cpp
+++ b/src/mame/drivers/dai.cpp
@@ -212,11 +212,10 @@ MACHINE_CONFIG_START(dai_state::dai)
MCFG_SCREEN_SIZE(1056, 542)
MCFG_SCREEN_VISIBLE_AREA(0, 1056-1, 0, 302-1)
MCFG_SCREEN_UPDATE_DRIVER(dai_state, screen_update_dai)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dai)
- MCFG_PALETTE_ADD("palette", sizeof (dai_palette) / 3)
- MCFG_PALETTE_INIT_OWNER(dai_state, dai)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dai)
+ PALETTE(config, m_palette, FUNC(dai_state::dai_palette), ARRAY_LENGTH(s_palette));
/* sound hardware */
diff --git a/src/mame/drivers/dai3wksi.cpp b/src/mame/drivers/dai3wksi.cpp
index 71a1b08a5ea..5f434b5eced 100644
--- a/src/mame/drivers/dai3wksi.cpp
+++ b/src/mame/drivers/dai3wksi.cpp
@@ -54,8 +54,8 @@ Driver Notes:
class dai3wksi_state : public driver_device
{
public:
- dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dai3wksi_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_samples(*this, "samples"),
m_ic77(*this, "ic77"),
@@ -65,7 +65,8 @@ public:
m_ic81(*this, "ic81"),
m_palette(*this, "palette"),
m_dai3wksi_videoram(*this, "videoram"),
- m_in2(*this, "IN2") { }
+ m_in2(*this, "IN2")
+ { }
void dai3wksi(machine_config &config);
@@ -420,7 +421,7 @@ void dai3wksi_state::dai3wksi(machine_config &config)
screen.set_refresh_hz(60);
screen.set_screen_update(FUNC(dai3wksi_state::screen_update_dai3wksi));
- PALETTE(config, m_palette, 8).set_init("palette", FUNC(palette_device::palette_init_3bit_brg));
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dambustr.cpp b/src/mame/drivers/dambustr.cpp
index 72a5bdf3566..a2b7a52340a 100644
--- a/src/mame/drivers/dambustr.cpp
+++ b/src/mame/drivers/dambustr.cpp
@@ -63,8 +63,9 @@ class dambustr_state : public galaxold_state
{
public:
dambustr_state(const machine_config &mconfig, device_type type, const char *tag)
- : galaxold_state(mconfig, type, tag),
- m_custom(*this, "cust") { }
+ : galaxold_state(mconfig, type, tag)
+ , m_custom(*this, "cust")
+ { }
void dambustr(machine_config &config);
@@ -280,12 +281,11 @@ MACHINE_CONFIG_START(dambustr_state::dambustr)
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(dambustr_state, screen_update_dambustr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dambustr)
- MCFG_PALETTE_ADD("palette", 32+2+64+8) /* 32 for the characters, 2 for the bullets, 64 for the stars, 8 for the background */
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dambustr);
+ PALETTE(config, m_palette, FUNC(dambustr_state::dambustr_palette), 32+2+64+8); // 32 for the characters, 2 for the bullets, 64 for the stars, 8 for the background
- MCFG_PALETTE_INIT_OWNER(dambustr_state,dambustr)
MCFG_VIDEO_START_OVERRIDE(dambustr_state,dambustr)
/* sound hardware */
diff --git a/src/mame/drivers/darius.cpp b/src/mame/drivers/darius.cpp
index 0a36276016a..e07d5b8ae0c 100644
--- a/src/mame/drivers/darius.cpp
+++ b/src/mame/drivers/darius.cpp
@@ -727,9 +727,8 @@ MACHINE_CONFIG_START(darius_state::darius)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_darius)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_darius);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
config.set_default_layout(layout_darius);
MCFG_SCREEN_ADD("lscreen", RASTER)
@@ -738,7 +737,7 @@ MACHINE_CONFIG_START(darius_state::darius)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 1*8, 29*8-1)
MCFG_SCREEN_UPDATE_DRIVER(darius_state, screen_update_darius_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("mscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -746,7 +745,7 @@ MACHINE_CONFIG_START(darius_state::darius)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 1*8, 29*8-1)
MCFG_SCREEN_UPDATE_DRIVER(darius_state, screen_update_darius_middle)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -754,7 +753,7 @@ MACHINE_CONFIG_START(darius_state::darius)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 1*8, 29*8-1)
MCFG_SCREEN_UPDATE_DRIVER(darius_state, screen_update_darius_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
PC080SN(config, m_pc080sn, 0);
m_pc080sn->set_gfx_region(1);
diff --git a/src/mame/drivers/darkmist.cpp b/src/mame/drivers/darkmist.cpp
index 84f4548c729..fd2c10f808e 100644
--- a/src/mame/drivers/darkmist.cpp
+++ b/src/mame/drivers/darkmist.cpp
@@ -255,13 +255,12 @@ MACHINE_CONFIG_START(darkmist_state::darkmist)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(darkmist_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_darkmist)
- MCFG_PALETTE_ADD("palette", 0x100*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+1)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
- MCFG_PALETTE_INIT_OWNER(darkmist_state, darkmist)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_darkmist);
+ PALETTE(config, m_palette, FUNC(darkmist_state::darkmist_palette));
+ m_palette->set_format(palette_device::xRGB_444, 0x100*4);
+ m_palette->set_indirect_entries(256+1);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dassault.cpp b/src/mame/drivers/dassault.cpp
index eebab1d122b..f69aba9b005 100644
--- a/src/mame/drivers/dassault.cpp
+++ b/src/mame/drivers/dassault.cpp
@@ -551,8 +551,7 @@ MACHINE_CONFIG_START(dassault_state::dassault)
MCFG_SCREEN_UPDATE_DRIVER(dassault_state, screen_update_dassault)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dassault)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 4096);
MCFG_DEVICE_ADD("spriteram1", BUFFERED_SPRITERAM16)
MCFG_DEVICE_ADD("spriteram2", BUFFERED_SPRITERAM16)
diff --git a/src/mame/drivers/dblcrown.cpp b/src/mame/drivers/dblcrown.cpp
index 043709baac6..77399816668 100644
--- a/src/mame/drivers/dblcrown.cpp
+++ b/src/mame/drivers/dblcrown.cpp
@@ -62,13 +62,13 @@ class dblcrown_state : public driver_device
{
public:
dblcrown_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_watchdog(*this, "watchdog"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
- m_inputs(*this, "IN%u", 0U),
- m_lamps(*this, "lamp%u", 0U)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_watchdog(*this, "watchdog")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_palette(*this, "palette")
+ , m_inputs(*this, "IN%u", 0U)
+ , m_lamps(*this, "lamp%u", 0U)
{ }
void dblcrown(machine_config &config);
@@ -100,7 +100,7 @@ private:
DECLARE_WRITE8_MEMBER(watchdog_w);
TIMER_DEVICE_CALLBACK_MEMBER(dblcrown_irq_scanline);
- DECLARE_PALETTE_INIT(dblcrown);
+ void dblcrown_palette(palette_device &palette) const;
void dblcrown_io(address_map &map);
void dblcrown_map(address_map &map);
@@ -552,7 +552,7 @@ void dblcrown_state::machine_reset()
}
-PALETTE_INIT_MEMBER(dblcrown_state, dblcrown)
+void dblcrown_state::dblcrown_palette(palette_device &palette) const
{
}
@@ -616,12 +616,11 @@ MACHINE_CONFIG_START(dblcrown_state::dblcrown)
MCFG_SCREEN_UPDATE_DRIVER(dblcrown_state, screen_update)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dblcrown)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dblcrown)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(dblcrown_state, dblcrown)
+ PALETTE(config, m_palette, FUNC(dblcrown_state::dblcrown_palette), 0x100);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp
index 439f4f090f5..f973a632dcd 100644
--- a/src/mame/drivers/dblewing.cpp
+++ b/src/mame/drivers/dblewing.cpp
@@ -379,8 +379,7 @@ MACHINE_CONFIG_START(dblewing_state::dblewing)
MCFG_SCREEN_UPDATE_DRIVER(dblewing_state, screen_update_dblewing)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 4096);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dblewing)
DECO16IC(config, m_deco_tilegen, 0);
diff --git a/src/mame/drivers/dbz.cpp b/src/mame/drivers/dbz.cpp
index fdfce43cc09..0044a9b50f5 100644
--- a/src/mame/drivers/dbz.cpp
+++ b/src/mame/drivers/dbz.cpp
@@ -344,11 +344,9 @@ MACHINE_CONFIG_START(dbz_state::dbz)
MCFG_SCREEN_UPDATE_DRIVER(dbz_state, screen_update_dbz)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dbz)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_dbz);
- MCFG_PALETTE_ADD("palette", 0x4000/2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ENABLE_SHADOWS()
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x4000/2).enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(dbz_state::tile_callback), this);
diff --git a/src/mame/drivers/dcheese.cpp b/src/mame/drivers/dcheese.cpp
index d11233aeebd..beda6b290d3 100644
--- a/src/mame/drivers/dcheese.cpp
+++ b/src/mame/drivers/dcheese.cpp
@@ -53,8 +53,7 @@
void dcheese_state::update_irq_state()
{
- int i;
- for (i = 1; i < 5; i++)
+ for (int i = 1; i < 5; i++)
m_maincpu->set_input_line(i, m_irq_state[i] ? ASSERT_LINE : CLEAR_LINE);
}
@@ -398,8 +397,7 @@ MACHINE_CONFIG_START(dcheese_state::dcheese)
MCFG_SCREEN_UPDATE_DRIVER(dcheese_state, screen_update_dcheese)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 65536)
- MCFG_PALETTE_INIT_OWNER(dcheese_state, dcheese)
+ PALETTE(config, "palette", FUNC(dcheese_state::dcheese_palette), 65536);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/dcon.cpp b/src/mame/drivers/dcon.cpp
index 5423c71d718..5c6bf9f7d66 100644
--- a/src/mame/drivers/dcon.cpp
+++ b/src/mame/drivers/dcon.cpp
@@ -293,15 +293,14 @@ MACHINE_CONFIG_START(dcon_state::dcon)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(dcon_state, screen_update_dcon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(dcon_state::layer_en_w));
crtc.layer_scroll_callback().set(FUNC(dcon_state::layer_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dcon)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dcon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -339,15 +338,14 @@ MACHINE_CONFIG_START(dcon_state::sdgndmps) /* PCB number is PB91008 */
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(dcon_state, screen_update_sdgndmps)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(dcon_state::layer_en_w));
crtc.layer_scroll_callback().set(FUNC(dcon_state::layer_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dcon)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dcon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dct11em.cpp b/src/mame/drivers/dct11em.cpp
index c2f843e5c55..29f03b71d49 100644
--- a/src/mame/drivers/dct11em.cpp
+++ b/src/mame/drivers/dct11em.cpp
@@ -78,7 +78,7 @@ void dct11em_state::dct11em(machine_config &config)
screen.set_screen_update(FUNC(dct11em_state::screen_update_dct11em));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/dday.cpp b/src/mame/drivers/dday.cpp
index d0239efaa17..00d67128fb4 100644
--- a/src/mame/drivers/dday.cpp
+++ b/src/mame/drivers/dday.cpp
@@ -268,19 +268,16 @@ MACHINE_CONFIG_START(dday_state::dday)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(dday_state, screen_update_dday)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dday)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INDIRECT_ENTRIES(256) /* HACK!!! */
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_INIT_OWNER(dday_state, dday)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dday);
+ PALETTE(config, m_palette, FUNC(dday_state::dday_palette), 256).enable_shadows();
+ m_palette->set_indirect_entries(256); // HACK!!!
/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay1, 1000000).add_route(ALL_OUTPUTS, "mono", 0.25);
-
AY8910(config, "ay2", 1000000).add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ddayjlc.cpp b/src/mame/drivers/ddayjlc.cpp
index a5973ecb877..1e4c1f1e2ea 100644
--- a/src/mame/drivers/ddayjlc.cpp
+++ b/src/mame/drivers/ddayjlc.cpp
@@ -72,8 +72,8 @@ $842f = lives
class ddayjlc_state : public driver_device
{
public:
- ddayjlc_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ddayjlc_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_mainram(*this, "mainram"),
m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"),
@@ -82,7 +82,8 @@ public:
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void ddayjlc(machine_config &config);
@@ -106,7 +107,7 @@ private:
DECLARE_WRITE8_MEMBER(i8257_LMSR_w);
TILE_GET_INFO_MEMBER(get_tile_info_bg);
TILE_GET_INFO_MEMBER(get_tile_info_fg);
- DECLARE_PALETTE_INIT(ddayjlc);
+ void ddayjlc_palette(palette_device &palette) const;
uint32_t screen_update_ddayjlc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void main_map(address_map &map);
@@ -566,28 +567,27 @@ void ddayjlc_state::machine_reset()
}
}
-PALETTE_INIT_MEMBER(ddayjlc_state, ddayjlc)
+void ddayjlc_state::ddayjlc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b,val;
- int bit0,bit1,bit2;
-
- for (i = 0; i < 0x200; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x200; i++)
{
- val = (color_prom[i+0x000]) | (color_prom[i+0x200]<<4);
+ int bit0, bit1, bit2;
+
+ int const val = (color_prom[i + 0x000]) | (color_prom[i + 0x200] << 4);
bit0 = 0;
- bit1 = (val >> 6) & 0x01;
- bit2 = (val >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 3) & 0x01;
- bit1 = (val >> 4) & 0x01;
- bit2 = (val >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 0) & 0x01;
- bit1 = (val >> 1) & 0x01;
- bit2 = (val >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(val, 6);
+ bit2 = BIT(val, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(val, 3);
+ bit1 = BIT(val, 4);
+ bit2 = BIT(val, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(val, 0);
+ bit1 = BIT(val, 1);
+ bit2 = BIT(val, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -617,12 +617,11 @@ MACHINE_CONFIG_START(ddayjlc_state::ddayjlc)
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(ddayjlc_state, screen_update_ddayjlc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ddayjlc_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddayjlc)
- MCFG_PALETTE_ADD("palette", 0x200+4)
- MCFG_PALETTE_INIT_OWNER(ddayjlc_state, ddayjlc)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_ddayjlc)
+ PALETTE(config, m_palette, FUNC(ddayjlc_state::ddayjlc_palette), 0x200+4);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ddealer.cpp b/src/mame/drivers/ddealer.cpp
index 8e2d8b5df65..834f0a91ddf 100644
--- a/src/mame/drivers/ddealer.cpp
+++ b/src/mame/drivers/ddealer.cpp
@@ -124,8 +124,8 @@
class ddealer_state : public driver_device
{
public:
- ddealer_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ddealer_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vregs(*this, "vregs"),
m_left_fg_vram_top(*this, "left_fg_vratop"),
m_right_fg_vram_top(*this, "right_fg_vratop"),
@@ -136,7 +136,8 @@ public:
m_mcu_shared_ram(*this, "mcu_shared_ram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void ddealer(machine_config &config);
@@ -636,7 +637,7 @@ MACHINE_CONFIG_START(ddealer_state::ddealer)
// M50747 or NMK-110 8131 MCU
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddealer)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ddealer);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -644,10 +645,9 @@ MACHINE_CONFIG_START(ddealer_state::ddealer)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(ddealer_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x200);
MCFG_TIMER_DRIVER_ADD_PERIODIC("coinsim", ddealer_state, mcu_sim, attotime::from_hz(10000))
diff --git a/src/mame/drivers/ddenlovr.cpp b/src/mame/drivers/ddenlovr.cpp
index 561e9adb008..ef3e339ba7f 100644
--- a/src/mame/drivers/ddenlovr.cpp
+++ b/src/mame/drivers/ddenlovr.cpp
@@ -4375,7 +4375,7 @@ MACHINE_CONFIG_START(ddenlovr_state::htengoku)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
- PALETTE(config, m_palette, 16*256);
+ PALETTE(config, m_palette).set_entries(16*256);
MCFG_VIDEO_START_OVERRIDE(ddenlovr_state,htengoku)
@@ -9717,7 +9717,7 @@ MACHINE_CONFIG_START(ddenlovr_state::ddenlovr)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(ddenlovr_state::ddenlovr_irq));
- PALETTE(config, m_palette, 0x100);
+ PALETTE(config, m_palette).set_entries(0x100);
blitter_irq().set(FUNC(ddenlovr_state::ddenlovr_blitter_irq));
@@ -9842,7 +9842,7 @@ void ddenlovr_state::quizchq(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(m_maincpu, FUNC(tmpz84c015_device::strobe_a)).invert();
- PALETTE(config, m_palette, 0x100);
+ PALETTE(config, m_palette).set_entries(0x100);
blitter_irq().set("maincpu", FUNC(tmpz84c015_device::trg0));
blitter_irq().append("maincpu", FUNC(tmpz84c015_device::trg1));
@@ -9932,7 +9932,7 @@ void ddenlovr_state::mmpanic(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(ddenlovr_state::mmpanic_irq));
- PALETTE(config, m_palette, 0x100);
+ PALETTE(config, m_palette).set_entries(0x100);
blitter_irq().set(FUNC(ddenlovr_state::mmpanic_blitter_irq));
@@ -10018,7 +10018,7 @@ void ddenlovr_state::hanakanz(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set(FUNC(ddenlovr_state::hanakanz_irq));
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
MCFG_VIDEO_START_OVERRIDE(ddenlovr_state,hanakanz) // blitter commands in the roms are shuffled around
@@ -10064,7 +10064,7 @@ void ddenlovr_state::kotbinyo(machine_config &config)
m_screen->set_palette("palette");
m_screen->screen_vblank().set(FUNC(ddenlovr_state::hanakanz_irq));
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
MCFG_VIDEO_START_OVERRIDE(ddenlovr_state,hanakanz) // blitter commands in the roms are shuffled around
@@ -10183,7 +10183,7 @@ void ddenlovr_state::mjschuka(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->screen_vblank().set("maincpu", FUNC(tmpz84c015_device::trg0));
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
blitter_irq().set("maincpu", FUNC(tmpz84c015_device::trg1));
blitter_irq().append("maincpu", FUNC(tmpz84c015_device::trg2));
diff --git a/src/mame/drivers/ddragon.cpp b/src/mame/drivers/ddragon.cpp
index 7d620e4a7e9..fd423826143 100644
--- a/src/mame/drivers/ddragon.cpp
+++ b/src/mame/drivers/ddragon.cpp
@@ -960,14 +960,13 @@ MACHINE_CONFIG_START(ddragon_state::ddragon)
MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,ddragon)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddragon)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ddragon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(ddragon_state,ddragon)
@@ -1033,14 +1032,13 @@ MACHINE_CONFIG_START(ddragon_state::ddragon6809)
MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,ddragon)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddragon)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ddragon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(ddragon_state,ddragon)
@@ -1086,14 +1084,13 @@ MACHINE_CONFIG_START(ddragon_state::ddragon2)
MCFG_MACHINE_RESET_OVERRIDE(ddragon_state,ddragon)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddragon)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ddragon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(ddragon_state, screen_update_ddragon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(ddragon_state,ddragon)
diff --git a/src/mame/drivers/ddragon3.cpp b/src/mame/drivers/ddragon3.cpp
index c54d94c3d6b..deee7c6d491 100644
--- a/src/mame/drivers/ddragon3.cpp
+++ b/src/mame/drivers/ddragon3.cpp
@@ -835,13 +835,12 @@ MACHINE_CONFIG_START(ddragon3_state::ddragon3)
MCFG_SCREEN_RAW_PARAMS(28_MHz_XTAL / 4, 448, 0, 320, 272, 8, 248) /* HTOTAL and VTOTAL are guessed */
MCFG_SCREEN_UPDATE_DRIVER(ddragon3_state, screen_update_ddragon3)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ddragon3)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ddragon3);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 768);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -879,8 +878,7 @@ MACHINE_CONFIG_START(ddragon3_state::ctribe)
MCFG_DEVICE_MODIFY("audiocpu")
MCFG_DEVICE_PROGRAM_MAP(ctribe_sound_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ m_palette->set_format(palette_device::xBGR_444, 768);
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(ddragon3_state, screen_update_ctribe)
@@ -909,17 +907,16 @@ MACHINE_CONFIG_START(wwfwfest_state::wwfwfest)
MCFG_DEVICE_PROGRAM_MAP(sound_map)
/* video hardware */
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(28_MHz_XTAL / 4, 448, 0, 320, 272, 8, 248) /* HTOTAL and VTOTAL are guessed */
MCFG_SCREEN_UPDATE_DRIVER(wwfwfest_state, screen_update_wwfwfest)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wwfwfest)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wwfwfest);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 8192);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ddribble.cpp b/src/mame/drivers/ddribble.cpp
index 2736713103b..83cf4e806d0 100644
--- a/src/mame/drivers/ddribble.cpp
+++ b/src/mame/drivers/ddribble.cpp
@@ -285,11 +285,8 @@ MACHINE_CONFIG_START(ddribble_state::ddribble)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ddribble_state, vblank_irq))
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_ddribble)
- MCFG_PALETTE_ADD("palette", 64 + 256)
- MCFG_PALETTE_INDIRECT_ENTRIES(64)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_INIT_OWNER(ddribble_state, ddribble)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ddribble);
+ PALETTE(config, "palette", FUNC(ddribble_state::ddribble_palette)).set_format(palette_device::xBGR_555, 64 + 256, 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/deadang.cpp b/src/mame/drivers/deadang.cpp
index 287f1a3fe30..14cc5b78b46 100644
--- a/src/mame/drivers/deadang.cpp
+++ b/src/mame/drivers/deadang.cpp
@@ -373,11 +373,10 @@ MACHINE_CONFIG_START(deadang_state::deadang)
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(deadang_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_deadang)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_deadang);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dec0.cpp b/src/mame/drivers/dec0.cpp
index 1a12ba87611..8bf10cf762d 100644
--- a/src/mame/drivers/dec0.cpp
+++ b/src/mame/drivers/dec0.cpp
@@ -1616,10 +1616,10 @@ MACHINE_CONFIG_START(dec0_state::dec0_base)
//MCFG_SCREEN_SIZE(32*8, 32*8)
//MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
//MCFG_SCREEN_UPDATE_DRIVER differs per game
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dec0)
- MCFG_PALETTE_ADD("palette", 1024)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dec0)
+ PALETTE(config, m_palette);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(0, 0, 0);
@@ -1655,8 +1655,7 @@ MACHINE_CONFIG_START(dec0_state::dec0)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(dec0_state,dec0)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(XBGR)
+ m_palette->set_format(palette_device::xBGR_888, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1684,8 +1683,7 @@ MACHINE_CONFIG_START(dec0_state::dec1)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(dec0_state,dec0_nodma)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ m_palette->set_format(palette_device::xBGR_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1753,7 +1751,7 @@ MACHINE_CONFIG_START(dec0_automat_state::automat)
// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
MCFG_SCREEN_RAW_PARAMS_DATA_EAST
MCFG_SCREEN_UPDATE_DRIVER(dec0_automat_state, screen_update_automat)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(0, 0, 0);
@@ -1771,10 +1769,9 @@ MACHINE_CONFIG_START(dec0_automat_state::automat)
m_spritegen->set_gfx_region(3);
m_spritegen->set_gfxdecode_tag("gfxdecode");
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_automat)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_automat)
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1832,7 +1829,7 @@ MACHINE_CONFIG_START(dec0_automat_state::secretab)
// MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(529) /* 57.41 Hz, 529us Vblank */)
MCFG_SCREEN_RAW_PARAMS_DATA_EAST
MCFG_SCREEN_UPDATE_DRIVER(dec0_automat_state, screen_update_secretab)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(0, 0, 0);
@@ -1850,10 +1847,9 @@ MACHINE_CONFIG_START(dec0_automat_state::secretab)
m_spritegen->set_gfx_region(3);
m_spritegen->set_gfxdecode_tag("gfxdecode");
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_secretab)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_secretab)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/deco156.cpp b/src/mame/drivers/deco156.cpp
index 299811b9bea..83c64367d83 100644
--- a/src/mame/drivers/deco156.cpp
+++ b/src/mame/drivers/deco156.cpp
@@ -15,8 +15,6 @@
Emulation by Bryan McPhail, mish@tendril.co.uk
*/
-#define DE156CPU ARM
-
#include "emu.h"
#include "cpu/arm/arm.h"
#include "machine/decocrpt.h"
@@ -348,8 +346,7 @@ MACHINE_CONFIG_START(deco156_state::hvysmsh)
MCFG_SCREEN_UPDATE_DRIVER(deco156_state, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hvysmsh)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 1024);
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
@@ -402,8 +399,7 @@ MACHINE_CONFIG_START(deco156_state::wcvol95)
MCFG_SCREEN_UPDATE_DRIVER(deco156_state, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hvysmsh)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp
index b80fb9746ee..2670ac4dd12 100644
--- a/src/mame/drivers/deco32.cpp
+++ b/src/mame/drivers/deco32.cpp
@@ -1865,7 +1865,7 @@ void captaven_state::captaven(machine_config &config)
audiocpu.add_route(ALL_OUTPUTS, "lspeaker", 0); // internal sound unused
audiocpu.add_route(ALL_OUTPUTS, "rspeaker", 0);
- INPUT_MERGER_ANY_HIGH(config, "irq_merger").output_handler().set_inputline("maincpu", ARM_IRQ_LINE);
+ INPUT_MERGER_ANY_HIGH(config, "irq_merger").output_handler().set_inputline(m_maincpu, ARM_IRQ_LINE);
DECO_IRQ(config, m_deco_irq, 0);
m_deco_irq->set_screen_tag(m_screen);
@@ -1878,8 +1878,7 @@ void captaven_state::captaven(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_captaven);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_XBGR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 2048);
DECO16IC(config, m_deco_tilegen[0], 0);
m_deco_tilegen[0]->set_split(0);
@@ -1960,7 +1959,7 @@ void fghthist_state::fghthist(machine_config &config)
m_screen->set_screen_update(FUNC(fghthist_state::screen_update));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fghthist);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
DECO16IC(config, m_deco_tilegen[0], 0);
m_deco_tilegen[0]->set_split(0);
@@ -2123,7 +2122,7 @@ void dragngun_state::dragngun(machine_config &config)
m_sprgenzoom->set_gfxdecode(m_gfxdecode);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_dragngun);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
DECO146PROT(config, m_ioprot, 0);
m_ioprot->port_a_cb().set_ioport("INPUTS");
@@ -2213,7 +2212,7 @@ void dragngun_state::lockload(machine_config &config)
BUFFERED_SPRITERAM32(config, m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_dragngun);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
DECO16IC(config, m_deco_tilegen[0], 0);
m_deco_tilegen[0]->set_split(0);
diff --git a/src/mame/drivers/deco_ld.cpp b/src/mame/drivers/deco_ld.cpp
index 8c3fccf9c99..bde3b0fcdc2 100644
--- a/src/mame/drivers/deco_ld.cpp
+++ b/src/mame/drivers/deco_ld.cpp
@@ -122,21 +122,21 @@ class deco_ld_state : public driver_device
{
public:
deco_ld_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_laserdisc(*this, "laserdisc"),
- //m_acia(*this, "acia"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen"),
- m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch"),
- m_soundlatch2(*this, "soundlatch2"),
- m_vram0(*this, "vram0"),
- m_attr0(*this, "attr0"),
- m_vram1(*this, "vram1"),
- m_attr1(*this, "attr1")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_audiocpu(*this, "audiocpu")
+ , m_laserdisc(*this, "laserdisc")
+ //, m_acia(*this, "acia")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_screen(*this, "screen")
+ , m_palette(*this, "palette")
+ , m_soundlatch(*this, "soundlatch")
+ , m_soundlatch2(*this, "soundlatch2")
+ , m_vram0(*this, "vram0")
+ , m_attr0(*this, "attr0")
+ , m_vram1(*this, "vram1")
+ , m_attr1(*this, "attr1")
+ { }
void rblaster(machine_config &config);
@@ -144,7 +144,6 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
private:
-
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_audiocpu;
required_device<sony_ldp1000_device> m_laserdisc;
@@ -479,13 +478,12 @@ MACHINE_CONFIG_START(deco_ld_state::rblaster)
MCFG_LASERDISC_LDP1000_ADD("laserdisc")
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, deco_ld_state, screen_update_rblaster)
//MCFG_LASERDISC_OVERLAY_CLIP(0, 256-1, 8, 240-1)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rblaster)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 0x800);
//ACIA6850(config, m_acia, 0);
//m_acia->txd_handler().set("laserdisc", FUNC(sony_ldp1000_device::write));
diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp
index 81961e8b46f..bf49ae120e8 100644
--- a/src/mame/drivers/deco_mlc.cpp
+++ b/src/mame/drivers/deco_mlc.cpp
@@ -527,9 +527,9 @@ MACHINE_CONFIG_START(deco_mlc_state::avengrgs)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_deco_mlc)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_MEMBITS(16)
+ PALETTE(config, m_palette);
+ m_palette->set_format(palette_device::xBGR_555, 2048);
+ m_palette->set_membits(16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -560,9 +560,9 @@ MACHINE_CONFIG_START(deco_mlc_state::mlc)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_deco_mlc)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_MEMBITS(16)
+ PALETTE(config, m_palette);
+ m_palette->set_format(palette_device::xBGR_555, 2048);
+ m_palette->set_membits(16);
DECO146PROT(config, m_deco146, 0);
m_deco146->set_use_magic_read_address_xor(true);
diff --git a/src/mame/drivers/decocass.cpp b/src/mame/drivers/decocass.cpp
index d694a84645d..305ae5f7889 100644
--- a/src/mame/drivers/decocass.cpp
+++ b/src/mame/drivers/decocass.cpp
@@ -939,15 +939,13 @@ static GFXDECODE_START( gfx_decocass )
GFXDECODE_ENTRY( nullptr, 0xd800, objlayout, 0, 64 ) /* object */
GFXDECODE_END
-PALETTE_INIT_MEMBER(decocass_state, decocass)
+void decocass_state::decocass_palette(palette_device &palette) const
{
- int i;
-
// set up 32 colors 1:1 pens and flipped colors for background tiles (D7 of color_center_bot)
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
palette.set_pen_indirect(i, i);
- palette.set_pen_indirect(32+i, bitswap<8>(i, 7, 6, 5, 4, 3, 1, 2, 0));
+ palette.set_pen_indirect(32 + i, bitswap<8>(i, 7, 6, 5, 4, 3, 1, 2, 0));
}
}
@@ -978,12 +976,10 @@ MACHINE_CONFIG_START(decocass_state::decocass)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(HCLK, 384, 0*8, 256, 272, 1*8, 248)
MCFG_SCREEN_UPDATE_DRIVER(decocass_state, screen_update_decocass)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_decocass)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(decocass_state, decocass)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_decocass)
+ PALETTE(config, m_palette, FUNC(decocass_state::decocass_palette), 64, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/deshoros.cpp b/src/mame/drivers/deshoros.cpp
index 99e797a710a..cb489a945da 100644
--- a/src/mame/drivers/deshoros.cpp
+++ b/src/mame/drivers/deshoros.cpp
@@ -39,8 +39,8 @@ TODO:
class destiny_state : public driver_device
{
public:
- destiny_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ destiny_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beeper(*this, "beeper")
{ }
@@ -282,12 +282,12 @@ MACHINE_CONFIG_START(destiny_state::destiny)
MCFG_SCREEN_UPDATE_DRIVER(destiny_state, screen_update_destiny)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 800) // TODO: determine exact frequency thru schematics
- MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
+ BEEP(config, m_beeper, 800); // TODO: determine exact frequency thru schematics
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/destroyr.cpp b/src/mame/drivers/destroyr.cpp
index d9268fc9436..bd91789eef2 100644
--- a/src/mame/drivers/destroyr.cpp
+++ b/src/mame/drivers/destroyr.cpp
@@ -53,7 +53,7 @@ private:
DECLARE_READ8_MEMBER(input_r);
DECLARE_READ8_MEMBER(scanline_r);
- DECLARE_PALETTE_INIT(destroyr);
+ void destroyr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -438,15 +438,15 @@ static GFXDECODE_START( gfx_destroyr )
GFXDECODE_END
-PALETTE_INIT_MEMBER(destroyr_state, destroyr)
+void destroyr_state::destroyr_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* major objects */
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // major objects
palette.set_pen_color(1, rgb_t(0x50, 0x50, 0x50));
palette.set_pen_color(2, rgb_t(0xAF, 0xAF, 0xAF));
palette.set_pen_color(3, rgb_t(0xFF ,0xFF, 0xFF));
- palette.set_pen_color(4, rgb_t(0x00, 0x00, 0x00)); /* alpha numerics, waves, minor objects */
+ palette.set_pen_color(4, rgb_t(0x00, 0x00, 0x00)); // alpha numerics, waves, minor objects
palette.set_pen_color(5, rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(6, rgb_t(0x00, 0x00, 0x00)); /* cursor */
+ palette.set_pen_color(6, rgb_t(0x00, 0x00, 0x00)); // cursor
palette.set_pen_color(7, rgb_t(0x78, 0x78, 0x78));
}
@@ -490,11 +490,10 @@ MACHINE_CONFIG_START(destroyr_state::destroyr)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(destroyr_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_destroyr)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(destroyr_state, destroyr)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_destroyr)
+ PALETTE(config, m_palette, FUNC(destroyr_state::destroyr_palette), 8);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dgn_beta.cpp b/src/mame/drivers/dgn_beta.cpp
index 567addc3d99..36048fc99de 100644
--- a/src/mame/drivers/dgn_beta.cpp
+++ b/src/mame/drivers/dgn_beta.cpp
@@ -68,27 +68,27 @@ These are yet to be implemented.
*/
-static const unsigned char dgnbeta_palette[] =
+static constexpr rgb_t dgnbeta_pens[] =
{
- /*normal brightness */
- 0x00,0x00,0x00, /* black */
- 0x80,0x00,0x00, /* red */
- 0x00,0x80,0x00, /* green */
- 0x80,0x80,0x00, /* yellow */
- 0x00,0x00,0x80, /* blue */
- 0x80,0x00,0x80, /* magenta */
- 0x00,0x80,0x80, /* cyan */
- 0x80,0x80,0x80, /* white */
-
- /*enhanced brightness*/
- 0x00,0x00,0x00, /* black */
- 0xFF,0x00,0x00, /* red */
- 0x00,0xFF,0x00, /* green */
- 0xFF,0xFF,0x00, /* yellow */
- 0x00,0x00,0xFF, /* blue */
- 0xFF,0x00,0xFF, /* magenta */
- 0x00,0xFF,0xFF, /* cyan */
- 0xFF,0xFF,0xFF /* white */
+ //normal brightness
+ { 0x00, 0x00, 0x00 }, // black
+ { 0x80, 0x00, 0x00 }, // red
+ { 0x00, 0x80, 0x00 }, // green
+ { 0x80, 0x80, 0x00 }, // yellow
+ { 0x00, 0x00, 0x80 }, // blue
+ { 0x80, 0x00, 0x80 }, // magenta
+ { 0x00, 0x80, 0x80 }, // cyan
+ { 0x80, 0x80, 0x80 }, // white
+
+ //enhanced brightness
+ { 0x00, 0x00, 0x00 }, // black
+ { 0xff, 0x00, 0x00 }, // red
+ { 0x00, 0xff, 0x00 }, // green
+ { 0xff, 0xff, 0x00 }, // yellow
+ { 0x00, 0x00, 0xff }, // blue
+ { 0xff, 0x00, 0xff }, // magenta
+ { 0x00, 0xff, 0xff }, // cyan
+ { 0xff, 0xff, 0xff } // white
};
/*
@@ -284,11 +284,9 @@ static INPUT_PORTS_START( dgnbeta )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(dgn_beta_state, dgn)
+void dgn_beta_state::dgn_beta_palette(palette_device &palette) const
{
- for ( int i = 0; i < sizeof(dgnbeta_palette) / 3; i++ ) {
- palette.set_pen_color(i, dgnbeta_palette[i*3], dgnbeta_palette[i*3+1], dgnbeta_palette[i*3+2]);
- }
+ palette.set_pen_colors(0, dgnbeta_pens);
}
/* F4 Character Displayer */
@@ -338,9 +336,8 @@ MACHINE_CONFIG_START(dgn_beta_state::dgnbeta)
MCFG_SCREEN_UPDATE_DEVICE( "crtc", hd6845_device, screen_update )
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dgnbeta)
- MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(dgnbeta_palette) / 3)
- MCFG_PALETTE_INIT_OWNER(dgn_beta_state, dgn)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dgnbeta)
+ PALETTE(config, m_palette, FUNC(dgn_beta_state::dgn_beta_palette), ARRAY_LENGTH(dgnbeta_pens));
/* PIA 0 at $FC20-$FC23 I46 */
PIA6821(config, m_pia_0, 0);
diff --git a/src/mame/drivers/dgpix.cpp b/src/mame/drivers/dgpix.cpp
index a8ea3a45588..ced28bd7c66 100644
--- a/src/mame/drivers/dgpix.cpp
+++ b/src/mame/drivers/dgpix.cpp
@@ -161,10 +161,11 @@ Notes:
class dgpix_state : public driver_device
{
public:
- dgpix_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dgpix_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_vblank(*this, "VBLANK") { }
+ m_vblank(*this, "VBLANK")
+ { }
void dgpix(machine_config &config);
@@ -451,8 +452,7 @@ MACHINE_CONFIG_START(dgpix_state::dgpix)
MCFG_SCREEN_UPDATE_DRIVER(dgpix_state, screen_update_dgpix)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_BBBBBGGGGGRRRRR("palette")
-
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
// KS0164 sound chip
diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp
index c0ebda6b338..12c462f31dc 100644
--- a/src/mame/drivers/dietgo.cpp
+++ b/src/mame/drivers/dietgo.cpp
@@ -226,8 +226,7 @@ MACHINE_CONFIG_START(dietgo_state::dietgo)
MCFG_SCREEN_UPDATE_DRIVER(dietgo_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_888, 1024);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dietgo)
diff --git a/src/mame/drivers/dim68k.cpp b/src/mame/drivers/dim68k.cpp
index 49e6c57aae1..52476842985 100644
--- a/src/mame/drivers/dim68k.cpp
+++ b/src/mame/drivers/dim68k.cpp
@@ -323,7 +323,7 @@ MACHINE_CONFIG_START(dim68k_state::dim68k)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 250-1)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dim68k)
/* sound hardware */
diff --git a/src/mame/drivers/divebomb.cpp b/src/mame/drivers/divebomb.cpp
index d3921858b17..842a7cb903a 100644
--- a/src/mame/drivers/divebomb.cpp
+++ b/src/mame/drivers/divebomb.cpp
@@ -441,15 +441,13 @@ MACHINE_CONFIG_START(divebomb_state::divebomb)
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.set_palette(m_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)
-
- MCFG_PALETTE_INIT_OWNER(divebomb_state, divebomb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_divebomb);
+ PALETTE(config, m_palette, FUNC(divebomb_state::divebomb_palette), 0x400+0x400+0x400+0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/diverboy.cpp b/src/mame/drivers/diverboy.cpp
index e6c8d8303de..4305aaa37e1 100644
--- a/src/mame/drivers/diverboy.cpp
+++ b/src/mame/drivers/diverboy.cpp
@@ -62,8 +62,8 @@
class diverboy_state : public driver_device
{
public:
- diverboy_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ diverboy_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
@@ -71,7 +71,8 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void diverboy(machine_config &config);
@@ -291,10 +292,9 @@ MACHINE_CONFIG_START(diverboy_state::diverboy)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8+4, 40*8+1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(diverboy_state, screen_update_diverboy)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x400);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/djmain.cpp b/src/mame/drivers/djmain.cpp
index 07faf4f62ef..1239d9c5df1 100644
--- a/src/mame/drivers/djmain.cpp
+++ b/src/mame/drivers/djmain.cpp
@@ -1399,9 +1399,8 @@ MACHINE_CONFIG_START(djmain_state::djmainj)
MCFG_SCREEN_VISIBLE_AREA(12, 512-12-1, 0, 384-1)
MCFG_SCREEN_UPDATE_DRIVER(djmain_state, screen_update_djmain)
- MCFG_PALETTE_ADD("palette", 0x4440/4)
- MCFG_PALETTE_FORMAT(XBGR)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_djmain)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 0x4440 / 4);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_djmain);
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(djmain_state::tile_callback), this);
diff --git a/src/mame/drivers/dkong.cpp b/src/mame/drivers/dkong.cpp
index 7e257d060f4..55af4b84ce7 100644
--- a/src/mame/drivers/dkong.cpp
+++ b/src/mame/drivers/dkong.cpp
@@ -1713,13 +1713,12 @@ MACHINE_CONFIG_START(dkong_state::dkong_base)
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")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dkong_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dkong)
- MCFG_PALETTE_ADD("palette", DK2B_PALETTE_LENGTH)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dkong);
+ PALETTE(config, m_palette, FUNC(dkong_state::dkong2b_palette), DK2B_PALETTE_LENGTH);
- MCFG_PALETTE_INIT_OWNER(dkong_state,dkong2b)
MCFG_VIDEO_START_OVERRIDE(dkong_state,dkong)
MACHINE_CONFIG_END
@@ -1728,9 +1727,8 @@ MACHINE_CONFIG_START(dkong_state::radarscp)
/* basic machine hardware */
MCFG_MACHINE_START_OVERRIDE(dkong_state,radarscp)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(RS_PALETTE_LENGTH)
- MCFG_PALETTE_INIT_OWNER(dkong_state,radarscp)
+ m_palette->set_init(FUNC(dkong_state::radarscp_palette));
+ m_palette->set_entries(RS_PALETTE_LENGTH);
/* sound hardware */
radarscp_audio(config);
@@ -1741,9 +1739,8 @@ MACHINE_CONFIG_START(dkong_state::radarscp1)
/* basic machine hardware */
MCFG_MACHINE_START_OVERRIDE(dkong_state,radarscp1)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(RS_PALETTE_LENGTH)
- MCFG_PALETTE_INIT_OWNER(dkong_state,radarscp1)
+ m_palette->set_init(FUNC(dkong_state::radarscp1_palette));
+ m_palette->set_entries(RS_PALETTE_LENGTH);
/* sound hardware */
radarscp1_audio(config);
@@ -1755,8 +1752,7 @@ MACHINE_CONFIG_START(dkong_state::dkong2b)
/* basic machine hardware */
MCFG_MACHINE_START_OVERRIDE(dkong_state,dkong2b)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(DK2B_PALETTE_LENGTH)
+ m_palette->set_entries(DK2B_PALETTE_LENGTH);
/* sound hardware */
dkong2b_audio(config);
@@ -1815,10 +1811,9 @@ MACHINE_CONFIG_START(dkong_state::dkong3)
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)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dkong);
+ PALETTE(config, m_palette, FUNC(dkong_state::dkong3_palette), DK3_PALETTE_LENGTH);
- MCFG_PALETTE_INIT_OWNER(dkong_state,dkong3)
MCFG_VIDEO_START_OVERRIDE(dkong_state,dkong)
/* sound hardware */
@@ -1841,18 +1836,17 @@ MACHINE_CONFIG_START(dkong_state::pestplce)
dkongjr(config);
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(dkong_state,dkong2b) /* wrong! */
+ m_palette->set_init(FUNC(dkong_state::dkong2b_palette)); // wrong!
m_screen->set_screen_update(FUNC(dkong_state::screen_update_pestplce));
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(dkong_state::dkong3b)
+void dkong_state::dkong3b(machine_config &config)
+{
dkongjr(config);
/* basic machine hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(dkong_state,dkong3)
-MACHINE_CONFIG_END
+ m_palette->set_init(FUNC(dkong_state::dkong3_palette));
+}
/*************************************
*
diff --git a/src/mame/drivers/dlair.cpp b/src/mame/drivers/dlair.cpp
index f49c65b3d76..6decd6ef2c7 100644
--- a/src/mame/drivers/dlair.cpp
+++ b/src/mame/drivers/dlair.cpp
@@ -127,7 +127,7 @@ private:
DECLARE_WRITE8_MEMBER(laserdisc_w);
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(dleuro);
+ void dleuro_palette(palette_device &palette) const;
uint32_t screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(write_speaker);
@@ -203,11 +203,9 @@ static const z80_daisy_config dleuro_daisy_chain[] =
*
*************************************/
-PALETTE_INIT_MEMBER(dlair_state,dleuro)
+void dlair_state::dleuro_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
palette.set_pen_color(2 * i + 0, rgb_t(0, 0, 0));
palette.set_pen_color(2 * i + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
@@ -224,14 +222,11 @@ PALETTE_INIT_MEMBER(dlair_state,dleuro)
uint32_t dlair_state::screen_update_dleuro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t *videoram = m_videoram;
- int x, y;
-
- /* redraw the overlay */
- for (y = 0; y < 32; y++)
- for (x = 0; x < 32; x++)
+ // redraw the overlay
+ for (int y = 0; y < 32; y++)
+ for (int x = 0; x < 32; x++)
{
- uint8_t *base = &videoram[y * 64 + x * 2 + 1];
+ uint8_t const *const base = &m_videoram[y * 64 + x * 2 + 1];
// TODO: opaque?
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, base[0], base[1], 0, 0, 10 * x, 16 * y);
}
@@ -785,15 +780,13 @@ MACHINE_CONFIG_START(dlair_state::dleuro)
MCFG_LASERDISC_22VP932_ADD("ld_22vp932")
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, dlair_state, screen_update_dleuro)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_PAL("screen", "ld_22vp932")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dlair)
- MCFG_PALETTE_ADD("palette", 16)
-
- MCFG_PALETTE_INIT_OWNER(dlair_state,dleuro)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dlair)
+ PALETTE(config, m_palette, FUNC(dlair_state::dleuro_palette), 16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/dlair2.cpp b/src/mame/drivers/dlair2.cpp
index f04abf592b5..2b0c600ed26 100644
--- a/src/mame/drivers/dlair2.cpp
+++ b/src/mame/drivers/dlair2.cpp
@@ -57,7 +57,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(dlair2_timer_irq);
- DECLARE_PALETTE_INIT(dlair2);
+ void dlair2_palette(palette_device &palette) const;
void dlair2_io(address_map &map);
void dlair2_map(address_map &map);
@@ -174,7 +174,7 @@ void dlair2_state::machine_reset()
{
}
-PALETTE_INIT_MEMBER(dlair2_state, dlair2)
+void dlair2_state::dlair2_palette(palette_device &palette) const
{
}
@@ -202,8 +202,7 @@ MACHINE_CONFIG_START(dlair2_state::dlair2)
// MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dlair2)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(dlair2_state, dlair2)
+ PALETTE(config, "palette", FUNC(dlair2_state::dlair2_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dmndrby.cpp b/src/mame/drivers/dmndrby.cpp
index 6b40b0fc807..0055bfe608d 100644
--- a/src/mame/drivers/dmndrby.cpp
+++ b/src/mame/drivers/dmndrby.cpp
@@ -65,8 +65,8 @@ DD10 DD14 DD18 H5 DD21
class dmndrby_state : public driver_device
{
public:
- dmndrby_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dmndrby_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_scroll_ram(*this, "scroll_ram"),
m_sprite_ram(*this, "sprite_ram"),
m_dderby_vidchars(*this, "vidchars"),
@@ -75,10 +75,14 @@ public:
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void dderby(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_scroll_ram;
required_shared_ptr<uint8_t> m_sprite_ram;
@@ -88,20 +92,22 @@ private:
tilemap_t *m_racetrack_tilemap;
uint8_t m_io_port[8];
int m_bg;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_audiocpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+ required_device<generic_latch_8_device> m_soundlatch;
+
DECLARE_WRITE8_MEMBER(dderby_sound_w);
DECLARE_READ8_MEMBER(input_r);
DECLARE_WRITE8_MEMBER(output_w);
TILE_GET_INFO_MEMBER(get_dmndrby_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(dmndrby);
+ void dmndrby_palette(palette_device &palette) const;
uint32_t screen_update_dderby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(dderby_irq);
INTERRUPT_GEN_MEMBER(dderby_timer_irq);
- required_device<cpu_device> m_maincpu;
- required_device<cpu_device> m_audiocpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
- required_device<generic_latch_8_device> m_soundlatch;
+
void dderby_sound_map(address_map &map);
void memmap(address_map &map);
};
@@ -469,51 +475,49 @@ wouldnt like to say its the most effective way though...
}
// copied from elsewhere. surely incorrect
-PALETTE_INIT_MEMBER(dmndrby_state, dmndrby)
+void dmndrby_state::dmndrby_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 470, 0,
3, &resistances_rg[0], gweights, 470, 0,
2, &resistances_b[0], bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component */
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom = memregion("proms2")->base();
- /* normal tiles use colors 0-15 */
- for (i = 0x000; i < 0x300; i++)
+ // normal tiles use colors 0-15
+ for (int i = 0x000; i < 0x300; i++)
{
uint8_t ctabentry = color_prom[i];
palette.set_pen_indirect(i, ctabentry);
@@ -551,12 +555,10 @@ MACHINE_CONFIG_START(dmndrby_state::dderby)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(dmndrby_state, screen_update_dderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dmndrby)
- MCFG_PALETTE_ADD("palette", 0x300)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x20)
- MCFG_PALETTE_INIT_OWNER(dmndrby_state, dmndrby)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dmndrby);
+ PALETTE(config, m_palette, FUNC(dmndrby_state::dmndrby_palette), 0x300, 0x20);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dms5000.cpp b/src/mame/drivers/dms5000.cpp
index aa1ce448966..06e14ea41c0 100644
--- a/src/mame/drivers/dms5000.cpp
+++ b/src/mame/drivers/dms5000.cpp
@@ -111,7 +111,7 @@ MACHINE_CONFIG_START(dms5000_state::dms5000)
MCFG_SCREEN_UPDATE_DRIVER(dms5000_state, screen_update_dms5000)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/dmv.cpp b/src/mame/drivers/dmv.cpp
index 21ae4639d5e..23af1f0590d 100644
--- a/src/mame/drivers/dmv.cpp
+++ b/src/mame/drivers/dmv.cpp
@@ -798,7 +798,7 @@ MACHINE_CONFIG_START(dmv_state::dmv)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dmv)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
config.set_default_layout(layout_dmv);
// devices
diff --git a/src/mame/drivers/docastle.cpp b/src/mame/drivers/docastle.cpp
index 9242d7e2a53..567663b9d05 100644
--- a/src/mame/drivers/docastle.cpp
+++ b/src/mame/drivers/docastle.cpp
@@ -626,28 +626,20 @@ MACHINE_CONFIG_START(docastle_state::docastle)
m_crtc->out_hsync_callback().set(FUNC(docastle_state::docastle_tint));
MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_RAW_PARAMS(XTAL(9'828'000)/2, 0x138, 8, 0x100-8, 0x108, 0, 0xc0) // from crtc
+ MCFG_SCREEN_RAW_PARAMS(XTAL(9'828'000)/2, 0x138, 8, 0x100-8, 0x108, 0, 0xc0) // from CRTC
MCFG_SCREEN_UPDATE_DRIVER(docastle_state, screen_update_docastle)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_docastle)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(docastle_state, docastle)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_docastle);
+ PALETTE(config, m_palette, FUNC(docastle_state::docastle_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("sn1", SN76489A, XTAL(4'000'000))
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
-
- MCFG_DEVICE_ADD("sn2", SN76489A, XTAL(4'000'000))
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
-
- MCFG_DEVICE_ADD("sn3", SN76489A, XTAL(4'000'000))
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
-
- MCFG_DEVICE_ADD("sn4", SN76489A, XTAL(4'000'000))
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ SN76489A(config, "sn1", 4_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 0.25);
+ SN76489A(config, "sn2", 4_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 0.25);
+ SN76489A(config, "sn3", 4_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 0.25);
+ SN76489A(config, "sn4", 4_MHz_XTAL).add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(docastle_state::dorunrun)
@@ -678,7 +670,7 @@ MACHINE_CONFIG_START(docastle_state::idsoccer)
MCFG_VIDEO_START_OVERRIDE(docastle_state,dorunrun)
/* sound hardware */
- MCFG_DEVICE_ADD("msm", MSM5205, XTAL(384'000)) /* Crystal verified on American Soccer board. */
+ MCFG_DEVICE_ADD("msm", MSM5205, XTAL(384'000)) // Crystal verified on American Soccer board.
MCFG_MSM5205_VCLK_CB(WRITELINE(*this, docastle_state, idsoccer_adpcm_int)) // interrupt function
MCFG_MSM5205_PRESCALER_SELECTOR(S64_4B) // 6 kHz ???
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
diff --git a/src/mame/drivers/dogfgt.cpp b/src/mame/drivers/dogfgt.cpp
index a058928713f..c588d603b85 100644
--- a/src/mame/drivers/dogfgt.cpp
+++ b/src/mame/drivers/dogfgt.cpp
@@ -246,18 +246,15 @@ MACHINE_CONFIG_START(dogfgt_state::dogfgt)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(dogfgt_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_dogfgt)
- MCFG_PALETTE_ADD(m_palette, 16+64)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
- MCFG_PALETTE_INIT_OWNER(dogfgt_state, dogfgt)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dogfgt);
+ PALETTE(config, m_palette, FUNC(dogfgt_state::dogfgt_palette)).set_format(palette_device::BGR_233, 16 + 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8910(config, m_ay[0], 1500000).add_route(ALL_OUTPUTS, "mono", 0.30);
-
AY8910(config, m_ay[1], 1500000).add_route(ALL_OUTPUTS, "mono", 0.30);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dominob.cpp b/src/mame/drivers/dominob.cpp
index 05e2fb172e4..913b7da384e 100644
--- a/src/mame/drivers/dominob.cpp
+++ b/src/mame/drivers/dominob.cpp
@@ -72,34 +72,39 @@ Notes:
class dominob_state : public driver_device
{
public:
- dominob_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dominob_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_bgram(*this, "bgram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void dominob(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_spriteram;
required_shared_ptr<uint8_t> m_bgram;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
/* input-related */
//uint8_t m_paddle_select;
//uint8_t m_paddle_value;
+
DECLARE_WRITE8_MEMBER(dominob_d008_w);
DECLARE_READ8_MEMBER(dominob_unk_port02_r);
- virtual void video_start() override;
uint32_t screen_update_dominob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void memmap(address_map &map);
void portmap(address_map &map);
};
@@ -312,12 +317,10 @@ MACHINE_CONFIG_START(dominob_state::dominob)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(dominob_state, screen_update_dominob)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dominob)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dominob);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dooyong.cpp b/src/mame/drivers/dooyong.cpp
index cf5b92ee7c4..d3545a18b82 100644
--- a/src/mame/drivers/dooyong.cpp
+++ b/src/mame/drivers/dooyong.cpp
@@ -57,7 +57,7 @@ because one of interrupt sources is _dead_ (timer never restarts).
Music tempo and audio pitch depends on (unknown) YM clocks.
Sound cpu runs currently at 8 MHz to avoid jerky music when there's (too)
-many sfx scheduled.
+many SFX scheduled.
Currently there's some workaround implemented - both YM lines are OR-ed to
allow nested (and in fact - delayed) interrupts. It's temporary solution
@@ -65,7 +65,7 @@ until we find real PCB and verify clocks and trace int lines.
Pollux:
Many (all? at least pollux, primella and flying tiger) use some kind of
-banked palette ram. Bit 1 at address 0xf008 controls banking (both palettes
+banked palette RAM. Bit 1 at address 0xf008 controls banking (both palettes
are almost identical, except for much darker BG layer colors).
@@ -1497,11 +1497,10 @@ MACHINE_CONFIG_START(dooyong_z80_ym2203_state::lastday)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_lastday)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lastday)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lastday);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 2, "gfx5", 0x00000);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 3, "gfx6", 0x00000);
m_fg[0]->set_transparent_pen(15);
@@ -1550,11 +1549,10 @@ MACHINE_CONFIG_START(dooyong_z80_ym2203_state::gulfstrm)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_gulfstrm)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lastday)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lastday);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 2, "gfx5", 0x00000);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 3, "gfx6", 0x00000);
m_fg[0]->set_transparent_pen(15);
@@ -1588,11 +1586,10 @@ MACHINE_CONFIG_START(dooyong_z80_ym2203_state::pollux)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_ym2203_state, screen_update_pollux)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lastday)
- MCFG_PALETTE_ADD("palette", 1024*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lastday);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024*2);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 2, "gfx5", 0x00000);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 3, "gfx6", 0x00000);
m_fg[0]->set_transparent_pen(15);
@@ -1626,11 +1623,10 @@ MACHINE_CONFIG_START(dooyong_z80_state::bluehawk)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_bluehawk)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bluehawk)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bluehawk);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 2, "gfx3", 0x3c000);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 3, "gfx4", 0x3c000);
m_fg[0]->set_transparent_pen(15);
@@ -1666,11 +1662,10 @@ MACHINE_CONFIG_START(dooyong_z80_state::flytiger)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_flytiger)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_flytiger)
- MCFG_PALETTE_ADD("palette", 1024*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_flytiger);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024*2);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 2, "gfx3", 0x3c000);
m_bg[0]->set_transparent_pen(15);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 3, "gfx4", 0x3c000);
@@ -1702,11 +1697,10 @@ MACHINE_CONFIG_START(dooyong_z80_state::primella)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 0*8, 32*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(dooyong_z80_state, screen_update_primella)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_primella)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_primella);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 1, "gfx2", -0x4000);
m_bg[0]->set_primella_code_bits(10);
DOOYONG_ROM_TILEMAP(config, m_fg[0], m_gfxdecode, 2, "gfx3", -0x4000);
@@ -1752,11 +1746,10 @@ MACHINE_CONFIG_START(rshark_state::dooyong_68k)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(rshark_state, screen_update_rshark)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rshark)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
RSHARK_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 4, "gfx5", 0x00000, "gfx6", 0x60000);
RSHARK_ROM_TILEMAP(config, m_bg[1], m_gfxdecode, 3, "gfx4", 0x00000, "gfx6", 0x40000);
@@ -1804,11 +1797,10 @@ MACHINE_CONFIG_START(popbingo_state::popbingo)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(popbingo_state, screen_update_popbingo)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_spriteram, buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_popbingo)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
DOOYONG_ROM_TILEMAP(config, m_bg[0], m_gfxdecode, 1, "gfx2", 0x00000);
m_bg[0]->set_primella_code_bits(11);
diff --git a/src/mame/drivers/dorachan.cpp b/src/mame/drivers/dorachan.cpp
index 71856caf1f3..a4c377f8cf2 100644
--- a/src/mame/drivers/dorachan.cpp
+++ b/src/mame/drivers/dorachan.cpp
@@ -241,7 +241,7 @@ MACHINE_CONFIG_START(dorachan_state::dorachan)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_UPDATE_DRIVER(dorachan_state, screen_update_dorachan)
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_3BIT);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dotrikun.cpp b/src/mame/drivers/dotrikun.cpp
index 1ddf44e19d9..0a224a121e5 100644
--- a/src/mame/drivers/dotrikun.cpp
+++ b/src/mame/drivers/dotrikun.cpp
@@ -40,8 +40,8 @@ TODO:
class dotrikun_state : public driver_device
{
public:
- dotrikun_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dotrikun_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_vram(*this, "vram"),
@@ -213,7 +213,7 @@ MACHINE_CONFIG_START(dotrikun_state::dotrikun)
MCFG_SCREEN_UPDATE_DRIVER(dotrikun_state, screen_update)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, "palette", palette_device::RGB_3BIT);
/* no sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/dragon.cpp b/src/mame/drivers/dragon.cpp
index 0a76935956b..17d373ef071 100644
--- a/src/mame/drivers/dragon.cpp
+++ b/src/mame/drivers/dragon.cpp
@@ -300,7 +300,7 @@ MACHINE_CONFIG_START(d64plus_state::d64plus)
MCFG_SCREEN_SIZE(640, 264)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 264-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", hd6845_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
// crtc
HD6845(config, m_crtc, 14.218_MHz_XTAL / 4 / 2);
diff --git a/src/mame/drivers/dragrace.cpp b/src/mame/drivers/dragrace.cpp
index c8dd6c96cd5..6b79539e335 100644
--- a/src/mame/drivers/dragrace.cpp
+++ b/src/mame/drivers/dragrace.cpp
@@ -8,6 +8,7 @@
#include "emu.h"
#include "includes/dragrace.h"
+
#include "cpu/m6800/m6800.h"
#include "machine/74259.h"
#include "sound/discrete.h"
@@ -239,23 +240,23 @@ static GFXDECODE_START( gfx_dragrace )
GFXDECODE_END
-PALETTE_INIT_MEMBER(dragrace_state, dragrace)
+void dragrace_state::dragrace_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0xFF, 0xFF, 0xFF)); /* 2 color tiles */
+ palette.set_pen_color(0, rgb_t(0xff, 0xff, 0xff)); // 2 color tiles
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00));
palette.set_pen_color(2, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(3, rgb_t(0xFF, 0xFF, 0xFF));
+ palette.set_pen_color(3, rgb_t(0xff, 0xff, 0xff));
palette.set_pen_color(4, rgb_t(0x00, 0x00, 0x00));
palette.set_pen_color(5, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(6, rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(7, rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(8, rgb_t(0xFF, 0xFF, 0xFF)); /* 4 color tiles */
- palette.set_pen_color(9, rgb_t(0xB0, 0xB0, 0xB0));
- palette.set_pen_color(10,rgb_t(0x5F, 0x5F, 0x5F));
+ palette.set_pen_color(6, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(7, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(8, rgb_t(0xff, 0xff, 0xff)); // 4 color tiles
+ palette.set_pen_color(9, rgb_t(0xb0, 0xb0, 0xb0));
+ palette.set_pen_color(10,rgb_t(0x5f, 0x5f, 0x5f));
palette.set_pen_color(11,rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(12,rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(13,rgb_t(0x5F, 0x5F, 0x5F));
- palette.set_pen_color(14,rgb_t(0xB0, 0xB0, 0xB0));
+ palette.set_pen_color(12,rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(13,rgb_t(0x5f, 0x5f, 0x5f));
+ palette.set_pen_color(14,rgb_t(0xb0, 0xb0, 0xb0));
palette.set_pen_color(15,rgb_t(0x00, 0x00, 0x00));
}
@@ -274,7 +275,7 @@ void dragrace_state::machine_reset()
MACHINE_CONFIG_START(dragrace_state::dragrace)
/* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", M6800, XTAL(12'096'000) / 12)
+ MCFG_DEVICE_ADD("maincpu", M6800, 12.096_MHz_XTAL / 12)
MCFG_DEVICE_PROGRAM_MAP(dragrace_map)
MCFG_DEVICE_PERIODIC_INT_DRIVER(dragrace_state, irq0_line_hold, 4*60)
@@ -291,8 +292,7 @@ MACHINE_CONFIG_START(dragrace_state::dragrace)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dragrace)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(dragrace_state, dragrace)
+ PALETTE(config, "palette", FUNC(dragrace_state::dragrace_palette), 16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/dreambal.cpp b/src/mame/drivers/dreambal.cpp
index 794a6ad47d4..5401e207ffb 100644
--- a/src/mame/drivers/dreambal.cpp
+++ b/src/mame/drivers/dreambal.cpp
@@ -327,8 +327,7 @@ MACHINE_CONFIG_START(dreambal_state::dreambal)
MCFG_SCREEN_UPDATE_DRIVER(dreambal_state, screen_update_dreambal)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x400/2)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 0x400/2);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dreambal)
EEPROM_93C46_16BIT(config, "eeprom"); // 93lc46b
diff --git a/src/mame/drivers/dreamwld.cpp b/src/mame/drivers/dreamwld.cpp
index 2ef556a2e32..cc93023d745 100644
--- a/src/mame/drivers/dreamwld.cpp
+++ b/src/mame/drivers/dreamwld.cpp
@@ -129,6 +129,11 @@ public:
void baryon(machine_config &config);
void dreamwld(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
/* memory pointers */
required_shared_ptr<uint32_t> m_spriteram;
@@ -165,9 +170,6 @@ private:
DECLARE_READ32_MEMBER(protdata_r);
template<int Chip> DECLARE_WRITE32_MEMBER(okibank_w);
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
uint32_t screen_update_dreamwld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_dreamwld);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
@@ -762,12 +764,10 @@ MACHINE_CONFIG_START(dreamwld_state::baryon)
MCFG_SCREEN_VISIBLE_AREA(0, 308-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(dreamwld_state, screen_update_dreamwld)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, dreamwld_state, screen_vblank_dreamwld))
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dreamwld)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dreamwld);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/drgnmst.cpp b/src/mame/drivers/drgnmst.cpp
index c0b3551825a..e731f9dbce3 100644
--- a/src/mame/drivers/drgnmst.cpp
+++ b/src/mame/drivers/drgnmst.cpp
@@ -387,7 +387,7 @@ MACHINE_CONFIG_START(drgnmst_state::drgnmst)
m_audiocpu->read_c().set(FUNC(drgnmst_state::snd_flag_r));
m_audiocpu->write_c().set(FUNC(drgnmst_state::snd_control_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_drgnmst)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_drgnmst);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -395,10 +395,9 @@ MACHINE_CONFIG_START(drgnmst_state::drgnmst)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, 56*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(drgnmst_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT_CLASS(2, drgnmst_state, drgnmst_IIIIRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(2, &drgnmst_state::drgnmst_IIIIRRRRGGGGBBBB, 0x2000);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dribling.cpp b/src/mame/drivers/dribling.cpp
index 93a9694ce31..736a9ed58fe 100644
--- a/src/mame/drivers/dribling.cpp
+++ b/src/mame/drivers/dribling.cpp
@@ -299,8 +299,7 @@ MACHINE_CONFIG_START(dribling_state::dribling)
MCFG_SCREEN_UPDATE_DRIVER(dribling_state, screen_update_dribling)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(dribling_state, dribling)
+ PALETTE(config, "palette", FUNC(dribling_state::dribling_palette), 256);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/drmicro.cpp b/src/mame/drivers/drmicro.cpp
index 586bd4d25b6..3aad808e81c 100644
--- a/src/mame/drivers/drmicro.cpp
+++ b/src/mame/drivers/drmicro.cpp
@@ -258,12 +258,10 @@ MACHINE_CONFIG_START(drmicro_state::drmicro)
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(drmicro_state, screen_update_drmicro)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_drmicro)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(drmicro_state, drmicro)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_drmicro);
+ PALETTE(config, m_palette, FUNC(drmicro_state::drmicro_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/drtomy.cpp b/src/mame/drivers/drtomy.cpp
index 7af1b14ef50..35e0857e9cb 100644
--- a/src/mame/drivers/drtomy.cpp
+++ b/src/mame/drivers/drtomy.cpp
@@ -19,17 +19,18 @@ similar hardware.
class drtomy_state : public driver_device
{
public:
- drtomy_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ drtomy_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram_fg(*this, "videorafg"),
m_videoram_bg(*this, "videorabg"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
- void drtomy(machine_config &config);
+ void drtomy(machine_config &config);
private:
/* memory pointers */
@@ -320,12 +321,10 @@ MACHINE_CONFIG_START(drtomy_state::drtomy)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(drtomy_state, screen_update_drtomy)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_drtomy)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_drtomy);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/drw80pkr.cpp b/src/mame/drivers/drw80pkr.cpp
index 595a45ec5c9..6396fef640c 100644
--- a/src/mame/drivers/drw80pkr.cpp
+++ b/src/mame/drivers/drw80pkr.cpp
@@ -39,12 +39,13 @@
class drw80pkr_state : public driver_device
{
public:
- drw80pkr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ drw80pkr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_aysnd(*this, "aysnd"),
- m_mainbank(*this, "mainbank") { }
+ m_mainbank(*this, "mainbank")
+ { }
void init_drw80pkr();
void drw80pkr(machine_config &config);
@@ -85,7 +86,7 @@ private:
DECLARE_READ8_MEMBER(io_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(drw80pkr);
+ void drw80pkr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void io_map(address_map &map);
@@ -345,29 +346,24 @@ uint32_t drw80pkr_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
return 0;
}
-PALETTE_INIT_MEMBER(drw80pkr_state, drw80pkr)
+void drw80pkr_state::drw80pkr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int j;
-
- for (j = 0; j < palette.entries(); j++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int j = 0; j < palette.entries(); j++)
{
- int r, g, b, tr, tg, tb, i;
-
- i = (color_prom[j] >> 3) & 0x01;
- //i = color_prom[j];
+ int const i = BIT(color_prom[j], 3);
- /* red component */
- tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
- r = tr - (i * (tr / 5));
+ // red component
+ int const tr = 0xf0 - (0xf0 * BIT(color_prom[j], 0));
+ int const r = tr - (i * (tr / 5));
- /* green component */
- tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
- g = tg - (i * (tg / 5));
+ // green component
+ int const tg = 0xf0 - (0xf0 * BIT(color_prom[j], 1));
+ int const g = tg - (i * (tg / 5));
- /* blue component */
- tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
- b = tb - (i * (tb / 5));
+ // blue component
+ int const tb = 0xf0 - (0xf0 * BIT(color_prom[j], 2));
+ int const b = tb - (i * (tb / 5));
palette.set_pen_color(j, rgb_t(r, g, b));
}
@@ -481,8 +477,7 @@ MACHINE_CONFIG_START(drw80pkr_state::drw80pkr)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_drw80pkr)
- MCFG_PALETTE_ADD("palette", 16*16)
- MCFG_PALETTE_INIT_OWNER(drw80pkr_state, drw80pkr)
+ PALETTE(config, "palette", FUNC(drw80pkr_state::drw80pkr_palette), 16 * 16);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/drivers/duet16.cpp b/src/mame/drivers/duet16.cpp
index 4943f29a49f..3fb6656fb74 100644
--- a/src/mame/drivers/duet16.cpp
+++ b/src/mame/drivers/duet16.cpp
@@ -420,7 +420,7 @@ MACHINE_CONFIG_START(duet16_state::duet16)
crtc.set_update_row_callback(FUNC(duet16_state::crtc_update_row), this);
MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_ADD_3BIT_BRG("chrpal")
+ PALETTE(config, m_chrpal, palette_device::BRG_3BIT);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "chrpal", gfx_duet16)
diff --git a/src/mame/drivers/dvk_kcgd.cpp b/src/mame/drivers/dvk_kcgd.cpp
index 68f74b371cc..713cd0fc139 100644
--- a/src/mame/drivers/dvk_kcgd.cpp
+++ b/src/mame/drivers/dvk_kcgd.cpp
@@ -75,7 +75,7 @@ private:
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline_callback);
- DECLARE_PALETTE_INIT(kcgd);
+ void kcgd_palette(palette_device &palette) const;
enum
{
@@ -178,12 +178,12 @@ void kcgd_state::video_start()
m_500hz_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
}
-PALETTE_INIT_MEMBER(kcgd_state, kcgd)
+void kcgd_state::kcgd_palette(palette_device &palette) const
{
+ // FIXME: this doesn't seem right at all - no actual black, and all the grey levels are very close to black
+ // should it just initialise everything besides the first entry to black, or should it be a greyscale ramp?
for (int i = 0; i < 16; i++)
- {
- palette.set_pen_color(i, i?i:255, i?i:255, i?i:255);
- }
+ palette.set_pen_color(i, i ? i : 255, i ? i : 255, i ? i : 255);
}
/*
@@ -359,10 +359,9 @@ MACHINE_CONFIG_START(kcgd_state::kcgd)
MCFG_SCREEN_RAW_PARAMS(XTAL(30'800'000), KCGD_TOTAL_HORZ, KCGD_HORZ_START,
KCGD_HORZ_START+KCGD_DISP_HORZ, KCGD_TOTAL_VERT, KCGD_VERT_START,
KCGD_VERT_START+KCGD_DISP_VERT);
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(kcgd_state, kcgd)
+ PALETTE(config, m_palette, FUNC(kcgd_state::kcgd_palette), 16);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kcgd)
#if 0
diff --git a/src/mame/drivers/dvk_ksm.cpp b/src/mame/drivers/dvk_ksm.cpp
index 4392ee8faad..1299bea8ee3 100644
--- a/src/mame/drivers/dvk_ksm.cpp
+++ b/src/mame/drivers/dvk_ksm.cpp
@@ -105,7 +105,7 @@ public:
, m_ms7004(*this, "ms7004")
, m_screen(*this, "screen")
, m_p_chargen(*this, "chargen")
- { }
+ { }
void ksm(machine_config &config);
@@ -433,7 +433,7 @@ MACHINE_CONFIG_START(ksm_state::ksm)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ksm)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
PIC8259(config, m_pic8259, 0);
m_pic8259->out_int_callback().set_inputline(m_maincpu, 0);
diff --git a/src/mame/drivers/dwarfd.cpp b/src/mame/drivers/dwarfd.cpp
index 248bc5d2f6e..d6c5af36717 100644
--- a/src/mame/drivers/dwarfd.cpp
+++ b/src/mame/drivers/dwarfd.cpp
@@ -308,8 +308,8 @@ uPC1352C @ N3
class dwarfd_state : public driver_device
{
public:
- dwarfd_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dwarfd_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_palette(*this, "palette"),
m_crtc(*this, "i8275"),
@@ -324,6 +324,10 @@ public:
void init_qc();
void init_dwarfd();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
/* video-related */
int m_crt_access;
@@ -345,9 +349,7 @@ private:
DECLARE_READ8_MEMBER(qc_b8_r);
DECLARE_WRITE_LINE_MEMBER(dwarfd_sod_callback);
DECLARE_WRITE_LINE_MEMBER(drq_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(dwarfd);
+ void dwarfd_palette(palette_device &palette) const;
I8275_DRAW_CHARACTER_MEMBER(display_pixels);
I8275_DRAW_CHARACTER_MEMBER(pesp_display_pixels);
I8275_DRAW_CHARACTER_MEMBER(qc_display_pixels);
@@ -700,14 +702,14 @@ static GFXDECODE_START( gfx_dwarfd )
GFXDECODE_REVERSEBITS("gfx1", 0, tiles8x8_layout, 0, 8)
GFXDECODE_END
-PALETTE_INIT_MEMBER(dwarfd_state, dwarfd)
+void dwarfd_state::dwarfd_palette(palette_device &palette) const
{
- uint8_t rgb[3];
- uint8_t *prom = memregion("proms")->base();
+ uint8_t const *const prom = memregion("proms")->base();
for (int i = 0; i < 32; i++)
{
// what are the top 2 bits?
+ uint8_t rgb[3];
rgb[0] = ((prom[i] & 0x08) >> 2) | (prom[i] & 1);
rgb[1] = ((prom[i] & 0x10) >> 3) | ((prom[i] & 2) >> 1);
rgb[2] = ((prom[i] & 0x20) >> 4) | ((prom[i] & 4) >> 2);
@@ -752,7 +754,7 @@ void dwarfd_state::dwarfd(machine_config &config)
m_crtc->drq_wr_callback().set(FUNC(dwarfd_state::drq_w));
GFXDECODE(config, "gfxdecode", m_palette, gfx_dwarfd);
- PALETTE(config, m_palette, 32).set_init(FUNC(dwarfd_state::palette_init_dwarfd));
+ PALETTE(config, m_palette, FUNC(dwarfd_state::dwarfd_palette), 32);
SPEAKER(config, "mono").front_center();
ay8910_device &aysnd(AY8910(config, "aysnd", 1500000));
@@ -764,6 +766,7 @@ void dwarfd_state::dwarfd(machine_config &config)
void dwarfd_state::pokeresp(machine_config &config)
{
dwarfd(config);
+
m_maincpu->set_addrmap(AS_PROGRAM, &dwarfd_state::pokeresp_map);
m_maincpu->set_addrmap(AS_IO, &dwarfd_state::io_map);
diff --git a/src/mame/drivers/dynadice.cpp b/src/mame/drivers/dynadice.cpp
index a38dfb20320..f1a30943fcf 100644
--- a/src/mame/drivers/dynadice.cpp
+++ b/src/mame/drivers/dynadice.cpp
@@ -47,12 +47,13 @@ dy_6.bin (near Z80)
class dynadice_state : public driver_device
{
public:
- dynadice_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ dynadice_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_ay8910(*this, "ay8910") { }
+ m_ay8910(*this, "ay8910")
+ { }
void dynadice(machine_config &config);
@@ -283,7 +284,7 @@ MACHINE_CONFIG_START(dynadice_state::dynadice)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_dynadice)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, "palette", palette_device::BRG_3BIT);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp
index 39200069a7e..f0312250ca1 100644
--- a/src/mame/drivers/dynax.cpp
+++ b/src/mame/drivers/dynax.cpp
@@ -4229,8 +4229,7 @@ MACHINE_CONFIG_START(dynax_state::cdracula)
blitter.ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
blitter.blit_dest_cb().set(FUNC(dynax_state::dynax_blit_dest_w));
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
MCFG_VIDEO_START_OVERRIDE(dynax_state,hanamai)
/* sound hardware */
@@ -4286,9 +4285,7 @@ MACHINE_CONFIG_START(dynax_state::hanamai)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
- MCFG_PALETTE_ADD("palette", 512)
-
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
MCFG_VIDEO_START_OVERRIDE(dynax_state,hanamai)
/* sound hardware */
@@ -4360,7 +4357,7 @@ MACHINE_CONFIG_START(dynax_state::hnoridur)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
- MCFG_PALETTE_ADD("palette", 16*256)
+ PALETTE(config, m_palette).set_entries(16*256);
MCFG_VIDEO_START_OVERRIDE(dynax_state,hnoridur)
@@ -4429,7 +4426,7 @@ MACHINE_CONFIG_START(dynax_state::hjingi)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
- MCFG_PALETTE_ADD("palette", 16*256)
+ PALETTE(config, m_palette).set_entries(16*256);
MCFG_VIDEO_START_OVERRIDE(dynax_state,hnoridur)
@@ -4491,9 +4488,7 @@ MACHINE_CONFIG_START(dynax_state::sprtmtch)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::sprtmtch_blitter_irq_w));
- MCFG_PALETTE_ADD("palette", 512)
-
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
MCFG_VIDEO_START_OVERRIDE(dynax_state,sprtmtch)
/* sound hardware */
@@ -4558,9 +4553,7 @@ MACHINE_CONFIG_START(dynax_state::mjfriday)
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
// No blitter IRQ
- MCFG_PALETTE_ADD("palette", 512)
-
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
MCFG_VIDEO_START_OVERRIDE(dynax_state,mjdialq2)
/* sound hardware */
@@ -4702,8 +4695,7 @@ MACHINE_CONFIG_START(dynax_state::jantouki)
m_soundlatch->set_separate_acknowledge(true);
/* video hardware */
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
config.set_default_layout(layout_dualhuov);
screen_device &top(SCREEN(config, "top", SCREEN_TYPE_RASTER));
@@ -4758,11 +4750,11 @@ MACHINE_CONFIG_START(dynax_state::jantouki)
MSM6242(config, "rtc", 32.768_kHz_XTAL);
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(dynax_state::janyuki)
+void dynax_state::janyuki(machine_config &config)
+{
jantouki(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(dynax_state,janyuki) // static palette
-MACHINE_CONFIG_END
+ m_palette->set_init(FUNC(dynax_state::janyuki_palette)); // static palette
+}
/***************************************************************************
@@ -4895,7 +4887,7 @@ MACHINE_CONFIG_START(dynax_state::tenkai)
m_blitter->scrolly_cb().set(FUNC(dynax_state::tenkai_blit_scrolly_w));
m_blitter->ready_cb().set(FUNC(dynax_state::tenkai_blitter_irq_w));
- MCFG_PALETTE_ADD("palette", 16*256)
+ PALETTE(config, m_palette).set_entries(16*256);
MCFG_VIDEO_START_OVERRIDE(dynax_state,mjelctrn)
@@ -4913,12 +4905,12 @@ MACHINE_CONFIG_START(dynax_state::tenkai)
MSM6242(config, "rtc", 32.768_kHz_XTAL).out_int_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ2);
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(dynax_state::majrjhdx)
+void dynax_state::majrjhdx(machine_config &config)
+{
tenkai(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(512)
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
-MACHINE_CONFIG_END
+ m_palette->set_entries(512);
+ m_palette->set_init(FUNC(dynax_state::sprtmtch_palette)); // static palette
+}
void dynax_state::mjreach(machine_config &config)
{
@@ -4969,8 +4961,7 @@ MACHINE_CONFIG_START(dynax_state::gekisha)
m_blitter->scrollx_cb().set(FUNC(dynax_state::dynax_blit_scrollx_w));
m_blitter->scrolly_cb().set(FUNC(dynax_state::dynax_blit_scrolly_w));
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(dynax_state,sprtmtch) // static palette
+ PALETTE(config, m_palette, FUNC(dynax_state::sprtmtch_palette), 512); // static palette
MCFG_VIDEO_START_OVERRIDE(dynax_state,mjdialq2)
/* sound hardware */
diff --git a/src/mame/drivers/dynduke.cpp b/src/mame/drivers/dynduke.cpp
index 6550ebc3c1f..d4134fe4ba7 100644
--- a/src/mame/drivers/dynduke.cpp
+++ b/src/mame/drivers/dynduke.cpp
@@ -345,10 +345,9 @@ MACHINE_CONFIG_START(dynduke_state::dynduke)
screen.screen_vblank().append(FUNC(dynduke_state::vblank_irq));
screen.set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dynduke)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dynduke);
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp
index bc954eaa86f..cd77707ade0 100644
--- a/src/mame/drivers/e100.cpp
+++ b/src/mame/drivers/e100.cpp
@@ -593,7 +593,7 @@ MACHINE_CONFIG_START(e100_state::e100)
MCFG_SCREEN_RAW_PARAMS(XTAL(4'000'000)/2, 265, 0, 265, 265, 0, 265)
MCFG_SCREEN_UPDATE_DRIVER(e100_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* There is a 50Hz signal from the video circuit to CA1 which generates interrupts and drives a software RTC */
MCFG_TIMER_DRIVER_ADD_PERIODIC("video50hz", e100_state, rtc_w, attotime::from_hz(100)) /* Will be divided by two through toggle in the handler */
diff --git a/src/mame/drivers/ec65.cpp b/src/mame/drivers/ec65.cpp
index 2a86aeb2374..1efcc82d158 100644
--- a/src/mame/drivers/ec65.cpp
+++ b/src/mame/drivers/ec65.cpp
@@ -186,7 +186,7 @@ MACHINE_CONFIG_START(ec65_state::ec65)
MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ec65)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
mc6845_device &crtc(MC6845(config, MC6845_TAG, XTAL(16'000'000) / 8));
crtc.set_screen("screen");
@@ -225,7 +225,7 @@ MACHINE_CONFIG_START(ec65k_state::ec65k)
MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ec65)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
mc6845_device &crtc(MC6845(config, MC6845_TAG, XTAL(16'000'000) / 8));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/efdt.cpp b/src/mame/drivers/efdt.cpp
index 05cce9d1eec..df5618971ac 100644
--- a/src/mame/drivers/efdt.cpp
+++ b/src/mame/drivers/efdt.cpp
@@ -157,9 +157,9 @@
**********************************************************************************/
-
#include "emu.h"
#include "includes/efdt.h"
+
#include "cpu/z80/z80.h"
#include "cpu/m6800/m6800.h"
#include "machine/watchdog.h"
@@ -179,21 +179,19 @@
* Video Hardware *
*********************************************/
-PALETTE_INIT_MEMBER(efdt_state, efdt)
+void efdt_state::efdt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("prom")->base();
+ uint8_t const *const color_prom = memregion("prom")->base();
for (int i = 0; i < 256; ++i)
{
- uint8_t r, g, b;
-
- uint8_t v = color_prom[i];
+ uint8_t const v = color_prom[i];
- g = (v & 7) << 5;
- r = ((v >> 3) & 7) << 5;
- b = ((v >> 6) & 3) << 6;
+ uint8_t const g = (v & 7) << 5;
+ uint8_t const r = ((v >> 3) & 7) << 5;
+ uint8_t const b = ((v >> 6) & 3) << 6;
- if((i & 7) == 0)
+ if ((i & 7) == 0)
palette.set_pen_color(i, 0);
else
palette.set_pen_color(i, rgb_t(r, g, b));
@@ -570,12 +568,11 @@ MACHINE_CONFIG_START( efdt_state::efdt )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_VISIBLE_AREA(0, 32*8 - 1, 16, 30*8 - 1)
MCFG_SCREEN_UPDATE_DRIVER(efdt_state, screen_update_efdt)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, efdt_state, vblank_nmi_w))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_efdt)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(efdt_state, efdt)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_efdt);
+ PALETTE(config, m_palette, FUNC(efdt_state::efdt_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/egghunt.cpp b/src/mame/drivers/egghunt.cpp
index 4fb42efedb0..41f67502fcb 100644
--- a/src/mame/drivers/egghunt.cpp
+++ b/src/mame/drivers/egghunt.cpp
@@ -54,15 +54,16 @@ I dumped it with this configuration. In case I'll redump it desoldering pin 16 f
class egghunt_state : public driver_device
{
public:
- egghunt_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ egghunt_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_audiocpu(*this, "audiocpu"),
m_atram(*this, "atram"),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void egghunt(machine_config &config);
@@ -446,12 +447,11 @@ MACHINE_CONFIG_START(egghunt_state::egghunt)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, 56*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(egghunt_state, screen_update_egghunt)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_egghunt)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/electron.cpp b/src/mame/drivers/electron.cpp
index 41e13784c7b..f05545007ce 100644
--- a/src/mame/drivers/electron.cpp
+++ b/src/mame/drivers/electron.cpp
@@ -83,9 +83,9 @@ static const rgb_t electron_palette[8]=
rgb_t(0x000,0x000,0x000)
};
-PALETTE_INIT_MEMBER(electron_state, electron)
+void electron_state::electron_colours(palette_device &palette) const
{
- palette.set_pen_colors(0, electron_palette, ARRAY_LENGTH(electron_palette));
+ palette.set_pen_colors(0, electron_palette);
}
void electron_state::electron_mem(address_map &map)
@@ -222,12 +222,10 @@ MACHINE_CONFIG_START(electron_state::electron)
m_screen->set_video_attributes(VIDEO_UPDATE_SCANLINE);
m_screen->set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(palette_init_delegate(FUNC(electron_state::palette_init_electron), this));
+ PALETTE(config, "palette", FUNC(electron_state::electron_colours), 16);
SPEAKER(config, "mono").front_center();
- BEEP(config, m_beeper, 300);
- m_beeper->add_route(ALL_OUTPUTS, "mono", 1.00);
+ BEEP(config, m_beeper, 300).add_route(ALL_OUTPUTS, "mono", 1.00);
RAM(config, m_ram).set_default_size("32K");
diff --git a/src/mame/drivers/elwro800.cpp b/src/mame/drivers/elwro800.cpp
index 33af3e7f4e9..30a59a8db30 100644
--- a/src/mame/drivers/elwro800.cpp
+++ b/src/mame/drivers/elwro800.cpp
@@ -573,9 +573,8 @@ MACHINE_CONFIG_START(elwro800_state::elwro800)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, elwro800_state, screen_vblank_spectrum))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(elwro800_state, spectrum )
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_elwro800)
+ PALETTE(config, "palette", FUNC(elwro800_state::spectrum_palette), 16);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_elwro800);
MCFG_VIDEO_START_OVERRIDE(elwro800_state, spectrum)
diff --git a/src/mame/drivers/emate.cpp b/src/mame/drivers/emate.cpp
index 233dbfff1a3..27cf321d01f 100644
--- a/src/mame/drivers/emate.cpp
+++ b/src/mame/drivers/emate.cpp
@@ -77,8 +77,7 @@ void emate_state::emate(machine_config &config)
screen.set_visarea(0, 480-1, 0, 320-1);
screen.set_screen_update(FUNC(emate_state::screen_update));
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(DEVICE_SELF, FUNC(emate_state::palette_init));
+ PALETTE(config, "palette", FUNC(emate_state::palette_init), 16);
RAM(config, m_ram);
m_ram->set_default_size("2M");
diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp
index 2453fe45acc..64cf7b590f7 100644
--- a/src/mame/drivers/enigma2.cpp
+++ b/src/mame/drivers/enigma2.cpp
@@ -61,15 +61,16 @@ TODO:
class enigma2_state : public driver_device
{
public:
- enigma2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ enigma2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_colors(*this, "colors"),
- m_stars(*this, "stars"){ }
+ m_stars(*this, "stars")
+ { }
void enigma2(machine_config &config);
void enigma2a(machine_config &config);
@@ -620,7 +621,7 @@ MACHINE_CONFIG_START(enigma2_state::enigma2)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(enigma2_state, screen_update_enigma2)
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_3BIT);
/* audio hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/eolith.cpp b/src/mame/drivers/eolith.cpp
index 98a936e4a41..2f812b13f8d 100644
--- a/src/mame/drivers/eolith.cpp
+++ b/src/mame/drivers/eolith.cpp
@@ -569,7 +569,7 @@ void eolith_state::eolith45(machine_config &config)
m_screen->set_screen_update(FUNC(eolith_state::screen_update_eolith));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 32768).set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB));
+ PALETTE(config, m_palette, palette_device::RGB_555);
MCFG_VIDEO_START_OVERRIDE(eolith_state,eolith)
diff --git a/src/mame/drivers/eolith16.cpp b/src/mame/drivers/eolith16.cpp
index 0f96db14d53..d7b6bac7c49 100644
--- a/src/mame/drivers/eolith16.cpp
+++ b/src/mame/drivers/eolith16.cpp
@@ -48,7 +48,7 @@ private:
DECLARE_WRITE16_MEMBER(eeprom_w);
DECLARE_READ16_MEMBER(eolith16_custom_r);
- DECLARE_PALETTE_INIT(eolith16);
+ void eolith16_palette(palette_device &palette) const;
uint32_t screen_update_eolith16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void eolith16_map(address_map &map);
@@ -137,24 +137,24 @@ uint32_t eolith16_state::screen_update_eolith16(screen_device &screen, bitmap_in
// setup a custom palette because pixels use 8 bits per color
-PALETTE_INIT_MEMBER(eolith16_state,eolith16)
+void eolith16_state::eolith16_palette(palette_device &palette) const
{
for (int c = 0; c < 256; c++)
{
- int bit0,bit1,bit2,r,g,b;
- bit0 = (c >> 0) & 0x01;
- bit1 = (c >> 1) & 0x01;
- bit2 = (c >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (c >> 3) & 0x01;
- bit1 = (c >> 4) & 0x01;
- bit2 = (c >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (c >> 6) & 0x01;
- bit1 = (c >> 7) & 0x01;
- b = 0x55 * bit0 + 0xaa * bit1;
-
- palette.set_pen_color(c,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+ bit0 = BIT(c, 0);
+ bit1 = BIT(c, 1);
+ bit2 = BIT(c, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(c, 3);
+ bit1 = BIT(c, 4);
+ bit2 = BIT(c, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(c, 6);
+ bit1 = BIT(c, 7);
+ int const b = 0x55 * bit0 + 0xaa * bit1;
+
+ palette.set_pen_color(c, rgb_t(r, g, b));
}
}
@@ -175,9 +175,7 @@ MACHINE_CONFIG_START(eolith16_state::eolith16)
MCFG_SCREEN_UPDATE_DRIVER(eolith16_state, screen_update_eolith16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
-
- MCFG_PALETTE_INIT_OWNER(eolith16_state,eolith16)
+ PALETTE(config, "palette", FUNC(eolith16_state::eolith16_palette), 256);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/epos.cpp b/src/mame/drivers/epos.cpp
index 319e88a202d..65a4f7c3d9f 100644
--- a/src/mame/drivers/epos.cpp
+++ b/src/mame/drivers/epos.cpp
@@ -475,8 +475,7 @@ MACHINE_CONFIG_START(epos_state::epos) /* EPOS TRISTAR 8000 PCB */
MCFG_SCREEN_VISIBLE_AREA(0, 271, 0, 235)
MCFG_SCREEN_UPDATE_DRIVER(epos_state, screen_update)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(epos_state, epos)
+ PALETTE(config, m_palette, FUNC(epos_state::epos_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -501,8 +500,7 @@ MACHINE_CONFIG_START(epos_state::dealer) /* EPOS TRISTAR 9000 PCB */
MCFG_MACHINE_START_OVERRIDE(epos_state,dealer)
// RAM-based palette instead of prom
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 32)
-// MCFG_PALETTE_INIT_OWNER(epos_state, epos)
+ PALETTE(config, m_palette, palette_device::BLACK, 32);
WATCHDOG_TIMER(config, "watchdog");
diff --git a/src/mame/drivers/equites.cpp b/src/mame/drivers/equites.cpp
index ac783bbb00b..4996ea32a97 100644
--- a/src/mame/drivers/equites.cpp
+++ b/src/mame/drivers/equites.cpp
@@ -1184,9 +1184,7 @@ void equites_state::equites(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_equites);
- PALETTE(config, m_palette, 0x180);
- m_palette->set_indirect_entries(0x100);
- m_palette->set_init(FUNC(equites_state::palette_init_equites));
+ PALETTE(config, m_palette, FUNC(equites_state::equites_palette), 0x180, 0x100);
MCFG_VIDEO_START_OVERRIDE(equites_state,equites)
}
@@ -1232,9 +1230,7 @@ void splndrbt_state::splndrbt(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_splndrbt);
- PALETTE(config, m_palette, 0x280);
- m_palette->set_indirect_entries(0x100);
- m_palette->set_init(FUNC(splndrbt_state::palette_init_splndrbt));
+ PALETTE(config, m_palette, FUNC(splndrbt_state::splndrbt_palette), 0x280, 0x100);
MCFG_VIDEO_START_OVERRIDE(splndrbt_state,splndrbt)
}
diff --git a/src/mame/drivers/ertictac.cpp b/src/mame/drivers/ertictac.cpp
index d6f8db79a67..7e3b1205c24 100644
--- a/src/mame/drivers/ertictac.cpp
+++ b/src/mame/drivers/ertictac.cpp
@@ -237,7 +237,7 @@ void ertictac_state::ertictac(machine_config &config)
m_screen->set_raw(XTAL(16'000'000), 1024,0,735, 624/2,0,292); // RiscOS 3 default screen settings
m_screen->set_screen_update(FUNC(archimedes_state::screen_update));
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
SPEAKER(config, "speaker").front_center();
for (int i = 0; i < 8; i++)
diff --git a/src/mame/drivers/esd16.cpp b/src/mame/drivers/esd16.cpp
index 11e5014fd9a..ba3ae9dd816 100644
--- a/src/mame/drivers/esd16.cpp
+++ b/src/mame/drivers/esd16.cpp
@@ -660,9 +660,8 @@ MACHINE_CONFIG_START(esd16_state::esd16)
m_sprgen->set_flipallx(1);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_esd16)
- MCFG_PALETTE_ADD("palette", 0x1000/2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_esd16);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x1000/2);
/* sound hardware */
diff --git a/src/mame/drivers/esh.cpp b/src/mame/drivers/esh.cpp
index 3205ce6a38a..4137a8e7b12 100644
--- a/src/mame/drivers/esh.cpp
+++ b/src/mame/drivers/esh.cpp
@@ -38,21 +38,25 @@ class esh_state : public driver_device
{
public:
esh_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_laserdisc(*this, "laserdisc"),
- m_screen(*this, "screen"),
- m_tile_ram(*this, "tile_ram"),
- m_tile_control_ram(*this, "tile_ctrl_ram"),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_beep(*this, "beeper"),
- m_palette(*this, "palette") { }
-
+ : driver_device(mconfig, type, tag)
+ , m_laserdisc(*this, "laserdisc")
+ , m_screen(*this, "screen")
+ , m_tile_ram(*this, "tile_ram")
+ , m_tile_control_ram(*this, "tile_ctrl_ram")
+ , m_maincpu(*this, "maincpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_beep(*this, "beeper")
+ , m_palette(*this, "palette")
+ { }
void esh(machine_config &config);
void init_esh();
+protected:
+ virtual void machine_start() override;
+ //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
required_device<pioneer_ldv1000_device> m_laserdisc;
required_device<screen_device> m_screen;
@@ -65,8 +69,7 @@ private:
DECLARE_WRITE8_MEMBER(led_writes);
DECLARE_WRITE8_MEMBER(nmi_line_w);
bool m_nmi_enable;
- virtual void machine_start() override;
- DECLARE_PALETTE_INIT(esh);
+ void esh_palette(palette_device &palette) const;
uint32_t screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_callback_esh);
DECLARE_WRITE_LINE_MEMBER(ld_command_strobe_cb);
@@ -77,8 +80,6 @@ private:
void z80_0_io(address_map &map);
void z80_0_mem(address_map &map);
-protected:
- //virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
@@ -283,46 +284,44 @@ static INPUT_PORTS_START( esh )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(esh_state, esh)
+void esh_state::esh_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* Oddly enough, the top 4 bits of each byte is 0 <- ??? */
- for (i = 0; i < palette.entries(); i++)
+ // Oddly enough, the top 4 bits of each byte is 0 <- ???
+ for (int i = 0; i < palette.entries(); i++)
{
- int r,g,b;
- int bit0,bit1,bit2;
+ int bit0, bit1, bit2;
- /* Presumably resistor values would help here */
+ // Presumably resistor values would help here
- /* red component */
- bit0 = (color_prom[i+0x100] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 1) & 0x01;
- bit2 = (color_prom[i+0x100] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i+0x100], 0);
+ bit1 = BIT(color_prom[i+0x100], 1);
+ bit2 = BIT(color_prom[i+0x100], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = 0; //(color_prom[i+0x100] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 3) & 0x01;
- bit2 = (color_prom[i+0x100] >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = 0; //BIT(color_prom[i+0x100], 0);
+ bit1 = BIT(color_prom[i+0x100], 3);
+ bit2 = BIT(color_prom[i+0x100], 4);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
// TODO: actually opaque flag
+ int b;
if((color_prom[i+0x100] >> 7) & 1)
b = 0xff;
else
{
- bit0 = 0; //(color_prom[i+0x100] >> 5) & 0x01;
- bit1 = (color_prom[i+0x100] >> 5) & 0x01;
- bit2 = (color_prom[i+0x100] >> 6) & 0x01;
+ bit0 = 0; //BIT(color_prom[i+0x100], 5);
+ bit1 = BIT(color_prom[i+0x100], 5);
+ bit2 = BIT(color_prom[i+0x100], 6);
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
}
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
-
}
static const gfx_layout esh_gfx_layout =
@@ -372,15 +371,13 @@ MACHINE_CONFIG_START(esh_state::esh)
MCFG_LASERDISC_LDV1000_ADD("laserdisc")
MCFG_LASERDISC_LDV1000_COMMAND_STROBE_CB(WRITELINE(*this, esh_state, ld_command_strobe_cb))
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, esh_state, screen_update_esh)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(esh_state, esh)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_esh)
+ PALETTE(config, m_palette, FUNC(esh_state::esh_palette), 256);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_esh);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/espial.cpp b/src/mame/drivers/espial.cpp
index 50f62bf3d74..47091a72620 100644
--- a/src/mame/drivers/espial.cpp
+++ b/src/mame/drivers/espial.cpp
@@ -340,11 +340,10 @@ MACHINE_CONFIG_START(espial_state::espial)
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(espial_state, screen_update_espial)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_espial)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(espial_state, espial)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_espial);
+ PALETTE(config, m_palette, FUNC(espial_state::espial_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/esprit.cpp b/src/mame/drivers/esprit.cpp
index bfa19cdfc04..6edd039ce38 100644
--- a/src/mame/drivers/esprit.cpp
+++ b/src/mame/drivers/esprit.cpp
@@ -152,8 +152,8 @@ void esprit_state::esprit(machine_config &config)
screen.set_raw(16.5888_MHz_XTAL, 900, 0, 720, 307, 0, 288);
screen.set_screen_update("crtc", FUNC(mc6845_device::screen_update));
- GFXDECODE(config, "gfxdecode", "palette", gfx_esprit);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_esprit);
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* Devices */
mc6845_device &crtc(MC6845(config, "crtc", 16.5888_MHz_XTAL / 9));
@@ -192,8 +192,8 @@ void esprit_state::esprit3(machine_config &config)
screen.set_raw(17.9712_MHz_XTAL, 936, 0, 720, 320, 0, 288);
screen.set_screen_update("crtc", FUNC(r6545_1_device::screen_update));
- GFXDECODE(config, "gfxdecode", "palette", gfx_esprit);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_esprit);
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
r6545_1_device &crtc(R6545_1(config, "crtc", 17.9712_MHz_XTAL / 9));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/ettrivia.cpp b/src/mame/drivers/ettrivia.cpp
index 6575021ede4..abcead4b5eb 100644
--- a/src/mame/drivers/ettrivia.cpp
+++ b/src/mame/drivers/ettrivia.cpp
@@ -51,6 +51,9 @@ public:
void ettrivia(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
int m_palreg;
int m_gfx_bank;
@@ -71,8 +74,7 @@ private:
DECLARE_WRITE8_MEMBER(b800_w);
TILE_GET_INFO_MEMBER(get_tile_info_bg);
TILE_GET_INFO_MEMBER(get_tile_info_fg);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(ettrivia);
+ void ettrivia_palette(palette_device &palette) const;
uint32_t screen_update_ettrivia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(ettrivia_interrupt);
inline void get_tile_info(tile_data &tileinfo, int tile_index, uint8_t *vidram, int gfx_code);
@@ -237,38 +239,36 @@ TILE_GET_INFO_MEMBER(ettrivia_state::get_tile_info_fg)
get_tile_info(tileinfo, tile_index, m_fg_videoram, 1);
}
-PALETTE_INIT_MEMBER(ettrivia_state, ettrivia)
+void ettrivia_state::ettrivia_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[2] = { 270, 130 };
- double weights[2];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[2] = { 270, 130 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights[2];
compute_resistor_weights(0, 255, -1.0,
2, resistances, weights, 0, 0,
2, resistances, weights, 0, 0,
0, nullptr, nullptr, 0, 0);
- for (i = 0;i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 0) & 0x01;
- r = combine_2_weights(weights, bit0, bit1);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i+0x100], 0);
+ int const r = combine_2_weights(weights, bit0, bit1);
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i+0x100] >> 2) & 0x01;
- g = combine_2_weights(weights, bit0, bit1);
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i+0x100], 2);
+ int const g = combine_2_weights(weights, bit0, bit1);
- /* blue component */
- bit0 = (color_prom[i] >> 1) & 0x01;
- bit1 = (color_prom[i+0x100] >> 1) & 0x01;
- b = combine_2_weights(weights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 1);
+ bit1 = BIT(color_prom[i+0x100], 1);
+ int const b = combine_2_weights(weights, bit0, bit1);
palette.set_pen_color(bitswap<8>(i,5,7,6,2,1,0,4,3), rgb_t(r, g, b));
}
@@ -314,9 +314,8 @@ MACHINE_CONFIG_START(ettrivia_state::ettrivia)
MCFG_SCREEN_UPDATE_DRIVER(ettrivia_state, screen_update_ettrivia)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ettrivia)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(ettrivia_state, ettrivia)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ettrivia);
+ PALETTE(config, "palette", FUNC(ettrivia_state::ettrivia_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/eurocom2.cpp b/src/mame/drivers/eurocom2.cpp
index fa7f8f09d75..cb14c154bfa 100644
--- a/src/mame/drivers/eurocom2.cpp
+++ b/src/mame/drivers/eurocom2.cpp
@@ -445,9 +445,9 @@ MACHINE_CONFIG_START(eurocom2_state::eurocom2)
MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green())
MCFG_SCREEN_RAW_PARAMS(10.7172_MHz_XTAL, VC_TOTAL_HORZ, 0, VC_DISP_HORZ, VC_TOTAL_VERT, 0, VC_DISP_VERT)
MCFG_SCREEN_UPDATE_DRIVER(eurocom2_state, screen_update)
-
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+
+ PALETTE(config, "palette", palette_device::MONOCHROME);
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(eurocom2_state::kbd_put));
diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp
index 52c2e2c553b..caf29423c86 100644
--- a/src/mame/drivers/excali64.cpp
+++ b/src/mame/drivers/excali64.cpp
@@ -76,7 +76,7 @@ public:
void excali64(machine_config &config);
private:
- DECLARE_PALETTE_INIT(excali64);
+ void excali64_palette(palette_device &palette);
DECLARE_WRITE8_MEMBER(ppib_w);
DECLARE_READ8_MEMBER(ppic_r);
DECLARE_WRITE8_MEMBER(ppic_w);
@@ -98,8 +98,6 @@ private:
DECLARE_WRITE_LINE_MEMBER(crtc_vs);
DECLARE_WRITE_LINE_MEMBER(motor_w);
DECLARE_MACHINE_RESET(excali64);
- required_device<palette_device> m_palette;
-
void io_map(address_map &map);
void mem_map(address_map &map);
@@ -111,6 +109,7 @@ private:
bool m_crtc_hs;
bool m_motor;
bool m_centronics_busy;
+ required_device<palette_device> m_palette;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_p_chargen;
required_device<cassette_image_device> m_cass;
@@ -457,7 +456,7 @@ GFXDECODE_END
// The prom, the schematic, and the manual all contradict each other,
// so the colours can only be described as wild guesses. Further, the 38
// colour-load resistors are missing labels and values.
-PALETTE_INIT_MEMBER( excali64_state, excali64 )
+void excali64_state::excali64_palette(palette_device &palette)
{
// do this here because driver_init hasn't run yet
m_p_videoram = memregion("videoram")->base();
@@ -490,13 +489,12 @@ PALETTE_INIT_MEMBER( excali64_state, excali64 )
membank("bankw4")->configure_entry(2, &m_p_hiresram[0x0000]);
// Set up foreground colours
- uint8_t r,g,b,i,code;
- for (i = 0; i < 32; i++)
+ for (uint8_t i = 0; i < 32; i++)
{
- code = m_p_chargen[0x1000+i];
- r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0);
- b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0);
- g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0);
+ uint8_t const code = m_p_chargen[0x1000+i];
+ uint8_t const r = (BIT(code, 0) ? 38 : 0) + (BIT(code, 1) ? 73 : 0) + (BIT(code, 2) ? 144 : 0);
+ uint8_t const b = (BIT(code, 3) ? 38 : 0) + (BIT(code, 4) ? 73 : 0) + (BIT(code, 5) ? 144 : 0);
+ uint8_t const g = (BIT(code, 6) ? 85 : 0) + (BIT(code, 7) ? 170 : 0);
palette.set_pen_color(i, r, g, b);
}
@@ -589,9 +587,10 @@ MACHINE_CONFIG_START(excali64_state::excali64)
MCFG_SCREEN_SIZE(80*8, 24*12)
MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD("palette", 40)
- MCFG_PALETTE_INIT_OWNER(excali64_state, excali64)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_excali64)
+
+ PALETTE(config, m_palette, FUNC(excali64_state::excali64_palette), 40);
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_excali64);
+
MC6845(config, m_crtc, 16_MHz_XTAL / 16); // 1MHz for lowres; 2MHz for highres
m_crtc->set_screen("screen");
m_crtc->set_show_border_area(false);
diff --git a/src/mame/drivers/exedexes.cpp b/src/mame/drivers/exedexes.cpp
index 8c7e124b9e0..d8214068174 100644
--- a/src/mame/drivers/exedexes.cpp
+++ b/src/mame/drivers/exedexes.cpp
@@ -245,9 +245,7 @@ MACHINE_CONFIG_START(exedexes_state::exedexes)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exedexes)
- MCFG_PALETTE_ADD("palette", 64*4+64*4+16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(exedexes_state, exedexes)
+ PALETTE(config, m_palette, FUNC(exedexes_state::exedexes_palette), 64*4+64*4+16*16+16*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/exelv.cpp b/src/mame/drivers/exelv.cpp
index 3df238daec6..6c0be4d51ca 100644
--- a/src/mame/drivers/exelv.cpp
+++ b/src/mame/drivers/exelv.cpp
@@ -519,7 +519,7 @@ void exelv_state::exl100(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_palette("palette");
- PALETTE(config, "palette", 8).set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, "palette", palette_device::RGB_3BIT);
// MCFG_DEVICE_ADD("vsm", SPEECHROM, 0)
@@ -573,7 +573,7 @@ void exelv_state::exeltel(machine_config &config)
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
screen.set_palette("palette");
- PALETTE(config, "palette", 8).set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, "palette", palette_device::RGB_3BIT);
SPEECHROM(config, "vsm", 0);
diff --git a/src/mame/drivers/exerion.cpp b/src/mame/drivers/exerion.cpp
index 94b0324c416..1bce76d1346 100644
--- a/src/mame/drivers/exerion.cpp
+++ b/src/mame/drivers/exerion.cpp
@@ -385,12 +385,10 @@ MACHINE_CONFIG_START(exerion_state::exerion)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(EXERION_PIXEL_CLOCK, EXERION_HTOTAL, EXERION_HBEND, EXERION_HBSTART, EXERION_VTOTAL, EXERION_VBEND, EXERION_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(exerion_state, screen_update_exerion)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exerion)
- MCFG_PALETTE_ADD("palette", 256*3)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(exerion_state, exerion)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_exerion);
+ PALETTE(config, m_palette, FUNC(exerion_state::exerion_palette), 256*3, 32);
/* audio hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp
index d1b2dc0e6b2..bc078757484 100644
--- a/src/mame/drivers/expro02.cpp
+++ b/src/mame/drivers/expro02.cpp
@@ -222,8 +222,8 @@ TODO:
class expro02_state : public driver_device
{
public:
- expro02_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ expro02_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
m_screen(*this, "screen"),
@@ -262,7 +262,7 @@ private:
DECLARE_WRITE8_MEMBER(expro02_6295_bankswitch_w);
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(expro02);
+ void expro02_palette(palette_device &palette) const;
uint32_t screen_update_backgrounds(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -291,33 +291,28 @@ void expro02_state::machine_start()
membank("okibank")->configure_entries(0, 16, memregion("oki")->base(), 0x10000);
}
-PALETTE_INIT_MEMBER(expro02_state, expro02)
+void expro02_state::expro02_palette(palette_device &palette) const
{
- int i;
+ // first 2048 colors are dynamic
- /* first 2048 colors are dynamic */
-
- /* initialize 555 RGB lookup */
- for (i = 0; i < 32768; i++)
- palette.set_pen_color(2048 + i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
+ // initialize 555 RGB lookup
+ for (int i = 0; i < 32768; i++)
+ palette.set_pen_color(2048 + i, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0));
}
uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
// kaneko16_fill_bitmap(machine(),bitmap,cliprect);
- int y,x;
int count;
-
count = 0;
- for (y=0;y<256;y++)
+ for (int y = 0; y < 256; y++)
{
- uint16_t *dest = &bitmap.pix16(y);
-
- for (x=0;x<256;x++)
+ uint16_t *const dest = &bitmap.pix16(y);
+ for (int x = 0; x < 256; x++)
{
uint16_t dat = (m_bg_rgb555_pixram[count] & 0xfffe)>>1;
- dat+=2048;
+ dat += 2048;
// never seen to test
//if (!(m_bg_rgb555_pixram[count] & 0x0001))
@@ -336,36 +331,29 @@ uint32_t expro02_state::screen_update_backgrounds(screen_device &screen, bitmap_
}
count = 0;
- for (y=0;y<256;y++)
+ for (int y = 0; y < 256; y++)
{
- uint16_t *dest = &bitmap.pix16(y);
-
- for (x=0;x<256;x++)
+ uint16_t *const dest = &bitmap.pix16(y);
+ for (int x = 0; x < 256; x++)
{
- uint16_t dat = (m_fg_ind8_pixram[count]);
- dat &=0x7ff;
- if (!(m_paletteram[(dat&0x7ff)] & 0x0001))
+ uint16_t const dat = m_fg_ind8_pixram[count] & 0x7ff;
+ if (!(m_paletteram[dat] & 0x0001))
dest[x] = dat;
count++;
}
}
-
-
- int i;
-
screen.priority().fill(0, cliprect);
if (m_view2_0)
{
m_view2_0->kaneko16_prepare(bitmap, cliprect);
- for (i = 0; i < 8; i++)
- {
+ for (int i = 0; i < 8; i++)
m_view2_0->render_tilemap_chip(screen, bitmap, cliprect, i);
- }
}
+
return 0;
}
@@ -927,12 +915,10 @@ MACHINE_CONFIG_START(expro02_state::expro02)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-32-1)
MCFG_SCREEN_UPDATE_DRIVER(expro02_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_expro02)
- MCFG_PALETTE_ADD("palette", 2048 + 32768)
- MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx)
- MCFG_PALETTE_INIT_OWNER(expro02_state, expro02)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_expro02);
+ PALETTE(config, m_palette, FUNC(expro02_state::expro02_palette)).set_format(palette_device::GRBx_555, 2048 + 32768);
KANEKO_TMAP(config, m_view2_0);
m_view2_0->set_gfx_region(1);
diff --git a/src/mame/drivers/exprraid.cpp b/src/mame/drivers/exprraid.cpp
index 6c4d5e8ea1f..afa6a43eb3f 100644
--- a/src/mame/drivers/exprraid.cpp
+++ b/src/mame/drivers/exprraid.cpp
@@ -511,10 +511,10 @@ MACHINE_CONFIG_START(exprraid_state::exprraid)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2, 384, 0, 256, 262, 8, 256-8) /* not accurate */
MCFG_SCREEN_UPDATE_DRIVER(exprraid_state, screen_update_exprraid)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exprraid)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/exterm.cpp b/src/mame/drivers/exterm.cpp
index 5b4e17cda4e..0ce68b6395a 100644
--- a/src/mame/drivers/exterm.cpp
+++ b/src/mame/drivers/exterm.cpp
@@ -406,9 +406,7 @@ MACHINE_CONFIG_START(exterm_state::exterm)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_PALETTE_ADD("palette", 2048+32768)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_INIT_OWNER(exterm_state, exterm)
+ PALETTE(config, "palette", FUNC(exterm_state::exterm_palette)).set_format(palette_device::xRGB_555, 2048+32768);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(40000000/8, 318, 0, 256, 264, 0, 240)
diff --git a/src/mame/drivers/extrema.cpp b/src/mame/drivers/extrema.cpp
index b1cd04802f9..0229b3510af 100644
--- a/src/mame/drivers/extrema.cpp
+++ b/src/mame/drivers/extrema.cpp
@@ -20,8 +20,9 @@ class extrema_state : public driver_device
{
public:
extrema_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ { }
void extrema(machine_config &config);
diff --git a/src/mame/drivers/exzisus.cpp b/src/mame/drivers/exzisus.cpp
index 814db23a991..af75f3addec 100644
--- a/src/mame/drivers/exzisus.cpp
+++ b/src/mame/drivers/exzisus.cpp
@@ -256,10 +256,10 @@ MACHINE_CONFIG_START(exzisus_state::exzisus)
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(exzisus_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_exzisus)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 1024)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/f-32.cpp b/src/mame/drivers/f-32.cpp
index df80fe1292a..ee1c14f0272 100644
--- a/src/mame/drivers/f-32.cpp
+++ b/src/mame/drivers/f-32.cpp
@@ -40,10 +40,11 @@ f5
class mosaicf2_state : public driver_device
{
public:
- mosaicf2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mosaicf2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu") ,
- m_videoram(*this, "videoram"){ }
+ m_videoram(*this, "videoram")
+ { }
void mosaicf2(machine_config &config);
void royalpk2(machine_config &config);
@@ -188,7 +189,7 @@ MACHINE_CONFIG_START(mosaicf2_state::mosaicf2)
MCFG_SCREEN_UPDATE_DRIVER(mosaicf2_state, screen_update_mosaicf2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -267,7 +268,7 @@ MACHINE_CONFIG_START(mosaicf2_state::royalpk2)
MCFG_SCREEN_UPDATE_DRIVER(mosaicf2_state, screen_update_mosaicf2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/f1gp.cpp b/src/mame/drivers/f1gp.cpp
index b1f717592bf..d7c4c18c57e 100644
--- a/src/mame/drivers/f1gp.cpp
+++ b/src/mame/drivers/f1gp.cpp
@@ -424,11 +424,10 @@ MACHINE_CONFIG_START(f1gp_state::f1gp)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(f1gp_state, screen_update_f1gp)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_f1gp)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_f1gp);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
@@ -493,11 +492,10 @@ MACHINE_CONFIG_START(f1gp_state::f1gpb)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(f1gp_state, screen_update_f1gpb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_f1gp)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_f1gp);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
//VSYSTEM_GGA(config, "gga", 0);
diff --git a/src/mame/drivers/fantland.cpp b/src/mame/drivers/fantland.cpp
index 09b0984416e..243ac5ca0ab 100644
--- a/src/mame/drivers/fantland.cpp
+++ b/src/mame/drivers/fantland.cpp
@@ -829,12 +829,11 @@ MACHINE_CONFIG_START(fantland_state::fantland)
MCFG_SCREEN_SIZE(352,256)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(fantland_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, fantland_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fantland)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fantland);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -872,12 +871,11 @@ MACHINE_CONFIG_START(fantland_state::galaxygn)
MCFG_SCREEN_SIZE(352,256)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(fantland_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, fantland_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fantland)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fantland);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -949,12 +947,11 @@ MACHINE_CONFIG_START(borntofi_state::borntofi)
MCFG_SCREEN_SIZE(352,256)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(borntofi_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, borntofi_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fantland)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fantland);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1001,12 +998,11 @@ MACHINE_CONFIG_START(fantland_state::wheelrun)
MCFG_SCREEN_SIZE(256,224)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(fantland_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, fantland_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fantland)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fantland);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/fastfred.cpp b/src/mame/drivers/fastfred.cpp
index 3658ea79234..5a0cd8f3aed 100644
--- a/src/mame/drivers/fastfred.cpp
+++ b/src/mame/drivers/fastfred.cpp
@@ -660,14 +660,12 @@ MACHINE_CONFIG_START(fastfred_state::fastfred)
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(fastfred_state, screen_update_fastfred)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, fastfred_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fastfred)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_fastfred);
- MCFG_PALETTE_ADD("palette", 32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(fastfred_state,fastfred)
+ PALETTE(config, m_palette, FUNC(fastfred_state::fastfred_palette), 32 * 8, 256);
MCFG_VIDEO_START_OVERRIDE(fastfred_state,fastfred)
/* sound hardware */
@@ -711,8 +709,7 @@ MACHINE_CONFIG_START(fastfred_state::imago)
MCFG_MACHINE_START_OVERRIDE(fastfred_state,imago)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(256+64+2) /* 256 for characters, 64 for the stars and 2 for the web */
+ m_palette->set_entries(256+64+2); // 256 for characters, 64 for the stars and 2 for the web
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_imago)
MCFG_VIDEO_START_OVERRIDE(fastfred_state,imago)
diff --git a/src/mame/drivers/fastinvaders.cpp b/src/mame/drivers/fastinvaders.cpp
index 2fe2640fef1..e196016da06 100644
--- a/src/mame/drivers/fastinvaders.cpp
+++ b/src/mame/drivers/fastinvaders.cpp
@@ -659,7 +659,7 @@ void fastinvaders_state::fastinvaders(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_fastinvaders);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
// TODO
diff --git a/src/mame/drivers/fastlane.cpp b/src/mame/drivers/fastlane.cpp
index b3626ab7b95..de480868d0d 100644
--- a/src/mame/drivers/fastlane.cpp
+++ b/src/mame/drivers/fastlane.cpp
@@ -218,10 +218,7 @@ void fastlane_state::fastlane(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fastlane);
- PALETTE(config, m_palette, 1024*16);
- m_palette->set_indirect_entries(0x400);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- m_palette->set_init(FUNC(fastlane_state::palette_init_fastlane));
+ PALETTE(config, m_palette, FUNC(fastlane_state::fastlane_palette)).set_format(palette_device::xBGR_555, 1024*16, 0x400);
K007121(config, m_k007121, 0);
m_k007121->set_palette_tag(m_palette);
diff --git a/src/mame/drivers/fb01.cpp b/src/mame/drivers/fb01.cpp
index 304e680085d..0cae2c6467a 100644
--- a/src/mame/drivers/fb01.cpp
+++ b/src/mame/drivers/fb01.cpp
@@ -39,6 +39,10 @@ public:
void fb01(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE_LINE_MEMBER(write_usart_clock);
DECLARE_WRITE_LINE_MEMBER(midi_in);
@@ -46,23 +50,20 @@ private:
DECLARE_WRITE_LINE_MEMBER(upd71051_txrdy_w);
DECLARE_WRITE_LINE_MEMBER(upd71051_rxrdy_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- DECLARE_PALETTE_INIT(fb01);
+ void fb01_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(fb01_pixel_update);
void fb01_io(address_map &map);
void fb01_mem(address_map &map);
+ void update_int();
+
required_device<z80_device> m_maincpu;
required_device<i8251_device> m_upd71051;
required_device<midi_port_device> m_midi_thru;
int m_ym2164_irq;
int m_upd71051_txrdy;
int m_upd71051_rxrdy;
-
- void update_int();
};
@@ -171,7 +172,7 @@ HD44780_PIXEL_UPDATE(fb01_state::fb01_pixel_update)
}
-PALETTE_INIT_MEMBER(fb01_state, fb01)
+void fb01_state::fb01_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(30, 0, 0));
palette.set_pen_color(1, rgb_t(150, 0, 0));
@@ -195,8 +196,7 @@ MACHINE_CONFIG_START(fb01_state::fb01)
config.set_default_layout(layout_fb01);
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(fb01_state, fb01)
+ PALETTE(config, "palette", FUNC(fb01_state::fb01_palette), 2);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 8) // 2x8 displayed as 1x16
diff --git a/src/mame/drivers/fc100.cpp b/src/mame/drivers/fc100.cpp
index a0bfc9e39ac..2f4ad646d3c 100644
--- a/src/mame/drivers/fc100.cpp
+++ b/src/mame/drivers/fc100.cpp
@@ -530,7 +530,7 @@ MACHINE_CONFIG_START(fc100_state::fc100)
MCFG_SCREEN_MC6847_NTSC_ADD("screen", "vdg")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "f4palette", gfx_fc100)
- MCFG_PALETTE_ADD_MONOCHROME("f4palette")
+ PALETTE(config, "f4palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fcombat.cpp b/src/mame/drivers/fcombat.cpp
index 8e22cfd35cf..7a0e8954007 100644
--- a/src/mame/drivers/fcombat.cpp
+++ b/src/mame/drivers/fcombat.cpp
@@ -297,17 +297,14 @@ MACHINE_CONFIG_START(fcombat_state::fcombat)
MCFG_DEVICE_ADD("audiocpu", Z80, 10000000/3)
MCFG_DEVICE_PROGRAM_MAP(audio_map)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(FCOMBAT_PIXEL_CLOCK, FCOMBAT_HTOTAL, FCOMBAT_HBEND, FCOMBAT_HBSTART, FCOMBAT_VTOTAL, FCOMBAT_VBEND, FCOMBAT_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(fcombat_state, screen_update_fcombat)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fcombat)
- MCFG_PALETTE_ADD("palette", 256*3)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(fcombat_state, fcombat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fcombat);
+ PALETTE(config, m_palette, FUNC(fcombat_state::fcombat_palette), 256*3, 32);
/* audio hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/feversoc.cpp b/src/mame/drivers/feversoc.cpp
index a5788263ca5..db22fe0ba17 100644
--- a/src/mame/drivers/feversoc.cpp
+++ b/src/mame/drivers/feversoc.cpp
@@ -81,8 +81,8 @@ U0564 LH28F800SU OBJ4-1
class feversoc_state : public driver_device
{
public:
- feversoc_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ feversoc_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_mainram1(*this, "workram1"),
m_mainram2(*this, "workram2"),
m_nvram(*this, "nvram"),
@@ -95,7 +95,8 @@ public:
m_rtc(*this, "rtc"),
m_hopper(*this, "hopper"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void init_feversoc();
void feversoc(machine_config &config);
@@ -298,13 +299,11 @@ MACHINE_CONFIG_START(feversoc_state::feversoc)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1) //dynamic resolution?
MCFG_SCREEN_UPDATE_DRIVER(feversoc_state, screen_update_feversoc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, feversoc_state, feversoc_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_feversoc)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_feversoc);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fgoal.cpp b/src/mame/drivers/fgoal.cpp
index 3c2d146469d..8aee26d04be 100644
--- a/src/mame/drivers/fgoal.cpp
+++ b/src/mame/drivers/fgoal.cpp
@@ -19,53 +19,47 @@ Differences between these sets include
***************************************************************************/
#include "emu.h"
-#include "cpu/m6800/m6800.h"
#include "includes/fgoal.h"
+#include "cpu/m6800/m6800.h"
int fgoal_state::intensity(int bits)
{
int v = 0;
- /* contrary to the schems pull-up resistors are 270 and not 390 */
+ // contrary to the schems pull-up resistors are 270 and not 390
if (1)
- {
- v += 0x2e; /* 100 + 270 */
- }
+ v += 0x2e; // 100 + 270
+
if (bits & 1)
- {
- v += 0x27; /* 100 + 330 */
- }
+ v += 0x27; // 100 + 330
+
if (bits & 2)
- {
- v += 0xaa; /* 100 */
- }
+ v += 0xaa; // 100
return v;
}
-PALETTE_INIT_MEMBER(fgoal_state, fgoal)
+void fgoal_state::fgoal_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- /* for B/W screens PCB can be jumpered to use lower half of PROM */
+ // for B/W screens PCB can be jumpered to use lower half of PROM
- for (i = 0; i < 128; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 128; i++)
{
- uint8_t color = color_prom[0x80 | i] & 63;
+ uint8_t const color = color_prom[0x80 | i] & 63;
palette.set_pen_color(i, intensity(color >> 4), intensity(color >> 2), intensity(color >> 0));
}
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
- palette.set_pen_color(128 + 0*8 + i, rgb_t(0x2e,0x80,0x2e));
- palette.set_pen_color(128 + 1*8 + i, rgb_t(0x2e,0x2e,0x2e));
+ palette.set_pen_color(128 + 0*8 + i, rgb_t(0x2e, 0x80, 0x2e));
+ palette.set_pen_color(128 + 1*8 + i, rgb_t(0x2e, 0x2e, 0x2e));
}
- /* ball is a fixed color */
+ // ball is a fixed color
palette.set_pen_color(128 + 16, intensity(0x38 >> 4), intensity(0x38 >> 2), intensity(0x38 >> 0));
}
@@ -371,7 +365,6 @@ MACHINE_CONFIG_START(fgoal_state::fgoal)
MCFG_DEVICE_ADD("maincpu", M6800, 10065000 / 10) /* ? */
MCFG_DEVICE_PROGRAM_MAP(cpu_map)
-
/* add shifter */
MB14241(config, "mb14241");
@@ -381,11 +374,10 @@ MACHINE_CONFIG_START(fgoal_state::fgoal)
MCFG_SCREEN_SIZE(256, 263)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 16, 255)
MCFG_SCREEN_UPDATE_DRIVER(fgoal_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fgoal)
- MCFG_PALETTE_ADD("palette", 128 + 16 + 1)
- MCFG_PALETTE_INIT_OWNER(fgoal_state, fgoal)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fgoal);
+ PALETTE(config, m_palette, FUNC(fgoal_state::fgoal_palette), 128 + 16 + 1);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/finalizr.cpp b/src/mame/drivers/finalizr.cpp
index d1a869d8acf..e4a2e9b6fbb 100644
--- a/src/mame/drivers/finalizr.cpp
+++ b/src/mame/drivers/finalizr.cpp
@@ -285,12 +285,10 @@ MACHINE_CONFIG_START(finalizr_state::finalizr)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 35*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(finalizr_state, screen_update_finalizr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_finalizr)
- MCFG_PALETTE_ADD("palette", 2*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(finalizr_state, finalizr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_finalizr);
+ PALETTE(config, m_palette, FUNC(finalizr_state::finalizr_palette), 2*16*16, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/firebeat.cpp b/src/mame/drivers/firebeat.cpp
index 2b73831a706..90b4a2aae13 100644
--- a/src/mame/drivers/firebeat.cpp
+++ b/src/mame/drivers/firebeat.cpp
@@ -177,8 +177,8 @@ struct IBUTTON
class firebeat_state : public driver_device
{
public:
- firebeat_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ firebeat_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_work_ram(*this, "work_ram"),
@@ -1196,7 +1196,7 @@ MACHINE_CONFIG_START(firebeat_state::firebeat)
m_ata->slot(1).set_option_machine_config("cdrom", cdrom_config);
/* video hardware */
- PALETTE(config, "palette", 32768).set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB));
+ PALETTE(config, "palette", palette_device::RGB_555);
K057714(config, m_gcu[0], 0);
m_gcu[0]->irq_callback().set(FUNC(firebeat_state::gcu0_interrupt));
@@ -1252,7 +1252,7 @@ void firebeat_state::firebeat2(machine_config &config)
m_ata->slot(1).set_option_machine_config("cdrom", cdrom_config);
/* video hardware */
- PALETTE(config, "palette", 32768).set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB));
+ PALETTE(config, "palette", palette_device::RGB_555);
K057714(config, m_gcu[0], 0);
m_gcu[0]->irq_callback().set(FUNC(firebeat_state::gcu0_interrupt));
diff --git a/src/mame/drivers/firetrap.cpp b/src/mame/drivers/firetrap.cpp
index 00561eca7e5..815564c257a 100644
--- a/src/mame/drivers/firetrap.cpp
+++ b/src/mame/drivers/firetrap.cpp
@@ -639,11 +639,10 @@ MACHINE_CONFIG_START(firetrap_state::firetrap)
// DECO video CRTC, unverified
MCFG_SCREEN_RAW_PARAMS(FIRETRAP_XTAL/2,384,0,256,272,8,248)
MCFG_SCREEN_UPDATE_DRIVER(firetrap_state, screen_update_firetrap)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_firetrap)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(firetrap_state, firetrap)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_firetrap)
+ PALETTE(config, m_palette, FUNC(firetrap_state::firetrap_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -684,11 +683,10 @@ MACHINE_CONFIG_START(firetrap_state::firetrapbl)
// DECO video CRTC, unverified
MCFG_SCREEN_RAW_PARAMS(FIRETRAP_XTAL/2,384,0,256,272,8,248)
MCFG_SCREEN_UPDATE_DRIVER(firetrap_state, screen_update_firetrap)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_firetrap)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(firetrap_state, firetrap)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_firetrap)
+ PALETTE(config, m_palette, FUNC(firetrap_state::firetrap_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/firetrk.cpp b/src/mame/drivers/firetrk.cpp
index e4e91872b03..1c3085dbbaf 100644
--- a/src/mame/drivers/firetrk.cpp
+++ b/src/mame/drivers/firetrk.cpp
@@ -8,6 +8,7 @@
#include "emu.h"
#include "includes/firetrk.h"
+
#include "cpu/m6800/m6800.h"
#include "sound/discrete.h"
#include "speaker.h"
@@ -867,12 +868,11 @@ MACHINE_CONFIG_START(firetrk_state::firetrk)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 384, 0, 320, 262, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(firetrk_state, screen_update_firetrk)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 28)
- MCFG_PALETTE_INIT_OWNER(firetrk_state, firetrk)
+ PALETTE(config, m_palette, FUNC(firetrk_state::firetrk_palette), 28);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_firetrk)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_firetrk)
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -896,10 +896,6 @@ MACHINE_CONFIG_START(firetrk_state::superbug)
MCFG_VIDEO_START_OVERRIDE(firetrk_state,superbug)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_superbug)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(28)
- MCFG_PALETTE_INIT_OWNER(firetrk_state, firetrk)
-
/* sound hardware */
MCFG_DEVICE_REPLACE("discrete", DISCRETE, superbug_discrete)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
@@ -920,9 +916,8 @@ MACHINE_CONFIG_START(firetrk_state::montecar)
MCFG_VIDEO_START_OVERRIDE(firetrk_state,montecar)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_montecar)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(46)
- MCFG_PALETTE_INIT_OWNER(firetrk_state,montecar)
+ m_palette->set_entries(46);
+ m_palette->set_init(FUNC(firetrk_state::montecar_palette));
/* sound hardware */
MCFG_DEVICE_REPLACE("discrete", DISCRETE, montecar_discrete)
diff --git a/src/mame/drivers/fitfight.cpp b/src/mame/drivers/fitfight.cpp
index c9700916550..6db1ba3f3ff 100644
--- a/src/mame/drivers/fitfight.cpp
+++ b/src/mame/drivers/fitfight.cpp
@@ -735,7 +735,7 @@ MACHINE_CONFIG_START(fitfight_state::fitfight)
audiocpu.pc_in_cb().set(FUNC(fitfight_state::snd_portc_r));
audiocpu.pc_out_cb().set(FUNC(fitfight_state::snd_portc_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fitfight)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fitfight);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
@@ -746,9 +746,7 @@ MACHINE_CONFIG_START(fitfight_state::fitfight)
screen.set_palette(m_palette);
screen.screen_vblank().set([this] (int state) { if (state) m_audiocpu->pulse_input_line(UPD7810_INTF2, m_audiocpu->minimum_quantum_time()); });
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x800);
SPEAKER(config, "mono").front_center();
@@ -762,8 +760,7 @@ MACHINE_CONFIG_START(fitfight_state::bbprot)
MCFG_DEVICE_PROGRAM_MAP(bbprot_main_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", fitfight_state, irq2_line_hold)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_prot)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_prot);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -773,9 +770,7 @@ MACHINE_CONFIG_START(fitfight_state::bbprot)
MCFG_SCREEN_UPDATE_DRIVER(fitfight_state, screen_update_fitfight)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x2000);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fk1.cpp b/src/mame/drivers/fk1.cpp
index e24b4e2a819..aa63afa7fac 100644
--- a/src/mame/drivers/fk1.cpp
+++ b/src/mame/drivers/fk1.cpp
@@ -22,8 +22,8 @@
class fk1_state : public driver_device
{
public:
- fk1_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ fk1_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)
{ }
@@ -428,7 +428,7 @@ MACHINE_CONFIG_START(fk1_state::fk1)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
pit8253_device &pit8253(PIT8253(config, "pit8253", 0));
pit8253.set_clk<0>(50);
diff --git a/src/mame/drivers/flipjack.cpp b/src/mame/drivers/flipjack.cpp
index 837adeb2fed..2a5445693e3 100644
--- a/src/mame/drivers/flipjack.cpp
+++ b/src/mame/drivers/flipjack.cpp
@@ -93,8 +93,8 @@ ________________________|___________________________
class flipjack_state : public driver_device
{
public:
- flipjack_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ flipjack_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_prgbank(*this, "prgbank"),
@@ -106,14 +106,15 @@ public:
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch")
{
- m_bank = 0;
- m_layer = 0;
}
void flipjack(machine_config &config);
DECLARE_WRITE_LINE_MEMBER(coin_nmi_w);
+protected:
+ virtual void machine_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -126,11 +127,10 @@ private:
required_region_ptr<uint8_t> m_playfield;
required_device<palette_device> m_palette;
-
required_device<generic_latch_8_device> m_soundlatch;
- uint8_t m_bank;
- uint8_t m_layer;
+ uint8_t m_bank = 0;
+ uint8_t m_layer = 0;
DECLARE_WRITE8_MEMBER(sound_nmi_ack_w);
DECLARE_WRITE8_MEMBER(soundlatch_w);
@@ -138,8 +138,7 @@ private:
DECLARE_WRITE8_MEMBER(layer_w);
DECLARE_READ8_MEMBER(soundlatch_r);
DECLARE_WRITE8_MEMBER(portc_w);
- virtual void machine_start() override;
- DECLARE_PALETTE_INIT(flipjack);
+ void flipjack_palette(palette_device &palette) const;
MC6845_UPDATE_ROW(update_row);
void main_io_map(address_map &map);
@@ -155,10 +154,10 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(flipjack_state, flipjack)
+void flipjack_state::flipjack_palette(palette_device &palette) const
{
- // from prom
- const uint8_t *color_prom = memregion("proms")->base();
+ // from PROM
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < 0x40; i++)
{
palette.set_pen_color(2*i+1, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
@@ -450,10 +449,8 @@ MACHINE_CONFIG_START(flipjack_state::flipjack)
crtc.out_vsync_callback().append_inputline("audiocpu", INPUT_LINE_NMI, ASSERT_LINE);
crtc.set_update_row_callback(FUNC(flipjack_state::update_row), this);
- GFXDECODE(config, "gfxdecode", "palette", gfx_flipjack);
-
- MCFG_PALETTE_ADD("palette", 128+8)
- MCFG_PALETTE_INIT_OWNER(flipjack_state, flipjack)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_flipjack);
+ PALETTE(config, m_palette, FUNC(flipjack_state::flipjack_palette), 128+8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/flkatck.cpp b/src/mame/drivers/flkatck.cpp
index ece781f3d7e..d58e65bda44 100644
--- a/src/mame/drivers/flkatck.cpp
+++ b/src/mame/drivers/flkatck.cpp
@@ -235,9 +235,7 @@ void flkatck_state::flkatck(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_flkatck);
- palette_device &palette(PALETTE(config, "palette", 512));
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- palette.set_endianness(ENDIANNESS_LITTLE);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 512).set_endianness(ENDIANNESS_LITTLE);
K007121(config, m_k007121, 0);
m_k007121->set_palette_tag("palette");
diff --git a/src/mame/drivers/flower.cpp b/src/mame/drivers/flower.cpp
index 89f4daff5bb..e6b0f672a05 100644
--- a/src/mame/drivers/flower.cpp
+++ b/src/mame/drivers/flower.cpp
@@ -91,8 +91,8 @@ CHIP # POSITION TYPE
class flower_state : public driver_device
{
public:
- flower_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ flower_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_mastercpu(*this, "mastercpu"),
m_slavecpu(*this, "slavecpu"),
m_audiocpu(*this, "audiocpu"),
@@ -512,10 +512,10 @@ MACHINE_CONFIG_START(flower_state::flower)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_UPDATE_DRIVER(flower_state, screen_update)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3,384,0,288,264,16,240) // derived from Galaxian HW, 60.606060
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_flower)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
GENERIC_LATCH_8(config, m_soundlatch);
diff --git a/src/mame/drivers/flstory.cpp b/src/mame/drivers/flstory.cpp
index 3f7662d7f06..e35a9756418 100644
--- a/src/mame/drivers/flstory.cpp
+++ b/src/mame/drivers/flstory.cpp
@@ -754,8 +754,7 @@ void flstory_state::common(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_flstory);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/flyball.cpp b/src/mame/drivers/flyball.cpp
index edfe2e44429..992fd3f8752 100644
--- a/src/mame/drivers/flyball.cpp
+++ b/src/mame/drivers/flyball.cpp
@@ -70,7 +70,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(flyball);
+ void flyball_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -405,11 +405,11 @@ static GFXDECODE_START( gfx_flyball )
GFXDECODE_END
-PALETTE_INIT_MEMBER(flyball_state, flyball)
+void flyball_state::flyball_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x3F, 0x3F, 0x3F)); /* tiles, ball */
- palette.set_pen_color(1, rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(2, rgb_t(0xFF ,0xFF, 0xFF)); /* sprites */
+ palette.set_pen_color(0, rgb_t(0x3f, 0x3f, 0x3f)); // tiles, ball
+ palette.set_pen_color(1, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(2, rgb_t(0xff ,0xff, 0xff)); // sprites
palette.set_pen_color(3, rgb_t(0x00, 0x00, 0x00));
}
@@ -479,12 +479,11 @@ MACHINE_CONFIG_START(flyball_state::flyball)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(flyball_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_flyball)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(flyball_state, flyball)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_flyball)
+ PALETTE(config, m_palette, FUNC(flyball_state::flyball_palette), 4);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/fm7.cpp b/src/mame/drivers/fm7.cpp
index f00fce78202..4ed9ba92b60 100644
--- a/src/mame/drivers/fm7.cpp
+++ b/src/mame/drivers/fm7.cpp
@@ -2057,7 +2057,7 @@ MACHINE_CONFIG_START(fm7_state::fm7)
MCFG_SCREEN_RAW_PARAMS(16.128_MHz_XTAL, 1024, 0, 640, 262, 0, 200) // H = 15.75 KHz, V = 60.1145 Hz
MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_CASSETTE_ADD("cassette")
MCFG_CASSETTE_FORMATS(fm7_cassette_formats)
@@ -2070,8 +2070,8 @@ MACHINE_CONFIG_START(fm7_state::fm7)
m_fdc->intrq_wr_callback().set(FUNC(fm7_state::fm7_fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(fm7_state::fm7_fdc_drq_w));
- MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
+ FLOPPY_CONNECTOR(config, m_floppy0, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
+ FLOPPY_CONNECTOR(config, m_floppy1, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
MCFG_SOFTWARE_LIST_ADD("flop_list","fm7_disk")
@@ -2098,7 +2098,7 @@ MACHINE_CONFIG_START(fm7_state::fm8)
MCFG_QUANTUM_PERFECT_CPU("sub")
SPEAKER(config, "mono").front_center();
- BEEP(config, "beeper", 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
+ BEEP(config, m_beeper, 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
MCFG_MACHINE_START_OVERRIDE(fm7_state,fm7)
@@ -2108,7 +2108,7 @@ MACHINE_CONFIG_START(fm7_state::fm8)
MCFG_SCREEN_RAW_PARAMS(16.128_MHz_XTAL, 1024, 0, 640, 262, 0, 200)
MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_CASSETTE_ADD("cassette")
MCFG_CASSETTE_FORMATS(fm7_cassette_formats)
@@ -2119,8 +2119,8 @@ MACHINE_CONFIG_START(fm7_state::fm8)
m_fdc->intrq_wr_callback().set(FUNC(fm7_state::fm7_fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(fm7_state::fm7_fdc_drq_w));
- MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
+ FLOPPY_CONNECTOR(config, m_floppy0, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
+ FLOPPY_CONNECTOR(config, m_floppy1, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
MCFG_DEVICE_ADD("centronics", CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, fm7_state, write_centronics_busy))
@@ -2164,7 +2164,7 @@ MACHINE_CONFIG_START(fm7_state::fm77av)
MCFG_SCREEN_RAW_PARAMS(16.128_MHz_XTAL, 1024, 0, 640, 262, 0, 200)
MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_PALETTE_ADD("av_palette", 4096)
MCFG_CASSETTE_ADD("cassette")
@@ -2178,8 +2178,8 @@ MACHINE_CONFIG_START(fm7_state::fm77av)
m_fdc->intrq_wr_callback().set(FUNC(fm7_state::fm7_fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(fm7_state::fm7_fdc_drq_w));
- MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
+ FLOPPY_CONNECTOR(config, m_floppy0, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
+ FLOPPY_CONNECTOR(config, m_floppy1, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
MCFG_SOFTWARE_LIST_ADD("av_flop_list", "fm77av")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("flop_list", "fm7_disk")
@@ -2210,7 +2210,7 @@ MACHINE_CONFIG_START(fm7_state::fm11)
MCFG_DEVICE_IO_MAP(fm11_x86_io)
SPEAKER(config, "mono").front_center();
- BEEP(config, "beeper", 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
+ BEEP(config, m_beeper, 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
MCFG_MACHINE_START_OVERRIDE(fm7_state,fm11)
@@ -2225,7 +2225,7 @@ MACHINE_CONFIG_START(fm7_state::fm11)
MCFG_SCREEN_RAW_PARAMS(16128000, 1024, 0, 640, 262, 0, 200)
MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_CASSETTE_ADD("cassette")
MCFG_CASSETTE_FORMATS(fm7_cassette_formats)
@@ -2236,8 +2236,8 @@ MACHINE_CONFIG_START(fm7_state::fm11)
m_fdc->intrq_wr_callback().set(FUNC(fm7_state::fm7_fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(fm7_state::fm7_fdc_drq_w));
- MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
+ FLOPPY_CONNECTOR(config, m_floppy0, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
+ FLOPPY_CONNECTOR(config, m_floppy1, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
MCFG_DEVICE_ADD("centronics", CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, fm7_state, write_centronics_busy))
@@ -2261,7 +2261,7 @@ MACHINE_CONFIG_START(fm7_state::fm16beta)
MCFG_QUANTUM_PERFECT_CPU("sub")
SPEAKER(config, "mono").front_center();
- BEEP(config, "beeper", 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
+ BEEP(config, m_beeper, 1200).add_route(ALL_OUTPUTS, "mono", 0.50);
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
MCFG_MACHINE_START_OVERRIDE(fm7_state,fm16)
@@ -2271,7 +2271,7 @@ MACHINE_CONFIG_START(fm7_state::fm16beta)
MCFG_SCREEN_RAW_PARAMS(16128000, 1024, 0, 640, 262, 0, 200)
MCFG_SCREEN_UPDATE_DRIVER(fm7_state, screen_update_fm7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_CASSETTE_ADD("cassette")
MCFG_CASSETTE_FORMATS(fm7_cassette_formats)
@@ -2282,8 +2282,8 @@ MACHINE_CONFIG_START(fm7_state::fm16beta)
m_fdc->intrq_wr_callback().set(FUNC(fm7_state::fm7_fdc_intrq_w));
m_fdc->drq_wr_callback().set(FUNC(fm7_state::fm7_fdc_drq_w));
- MCFG_FLOPPY_DRIVE_ADD("fdc:0", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
- MCFG_FLOPPY_DRIVE_ADD("fdc:1", fm7_floppies, "qd", floppy_image_device::default_floppy_formats)
+ FLOPPY_CONNECTOR(config, m_floppy0, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
+ FLOPPY_CONNECTOR(config, m_floppy1, fm7_floppies, "qd", floppy_image_device::default_floppy_formats);
MCFG_DEVICE_ADD("centronics", CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, fm7_state, write_centronics_busy))
diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp
index 14f749c0548..98f089e485c 100644
--- a/src/mame/drivers/fmtowns.cpp
+++ b/src/mame/drivers/fmtowns.cpp
@@ -2770,9 +2770,9 @@ void towns_state::towns_base(machine_config &config)
m_screen->set_screen_update(FUNC(towns_state::screen_update));
GFXDECODE(config, "gfxdecode", m_palette16[0], gfx_towns);
- PALETTE(config, m_palette, 256);
- PALETTE(config, m_palette16[0], 16);
- PALETTE(config, m_palette16[1], 16);
+ PALETTE(config, m_palette).set_entries(256);
+ PALETTE(config, m_palette16[0]).set_entries(16);
+ PALETTE(config, m_palette16[1]).set_entries(16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/foodf.cpp b/src/mame/drivers/foodf.cpp
index 98182ab15d1..245a9f8c002 100644
--- a/src/mame/drivers/foodf.cpp
+++ b/src/mame/drivers/foodf.cpp
@@ -357,7 +357,7 @@ void foodf_state::foodf(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_foodf);
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
TILEMAP(config, m_playfield_tilemap, "gfxdecode", 2, 8,8, TILEMAP_SCAN_COLS, 32,32, 0).set_info_callback(FUNC(foodf_state::get_playfield_tile_info));
diff --git a/src/mame/drivers/fortecar.cpp b/src/mame/drivers/fortecar.cpp
index f30288b871e..c6efb77ede0 100644
--- a/src/mame/drivers/fortecar.cpp
+++ b/src/mame/drivers/fortecar.cpp
@@ -334,15 +334,16 @@
class fortecar_state : public driver_device
{
public:
- fortecar_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ fortecar_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_watchdog(*this, "watchdog"),
m_vram(*this, "vram"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_lamps(*this, "lamp%u", 0U) { }
+ m_lamps(*this, "lamp%u", 0U)
+ { }
void fortecar(machine_config &config);
@@ -366,7 +367,7 @@ private:
DECLARE_WRITE8_MEMBER(ayporta_w);
DECLARE_WRITE8_MEMBER(ayportb_w);
- DECLARE_PALETTE_INIT(fortecar);
+ void fortecar_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void fortecar_map(address_map &map);
@@ -407,9 +408,8 @@ uint32_t fortecar_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
return 0;
}
-PALETTE_INIT_MEMBER(fortecar_state, fortecar)
+void fortecar_state::fortecar_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
/* Video resistors...
O1 (LS374) R1K RED
@@ -423,35 +423,36 @@ O8 (LS374) R220 BLUE
R = 82 Ohms Pull Down.
*/
- static const int resistances_rg[3] = { 1000, 510, 220 };
- static const int resistances_b [2] = { 510, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
+ static constexpr int resistances_rg[3] = { 1000, 510, 220 };
+ static constexpr int resistances_b [2] = { 510, 220 };
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 82, 0,
3, resistances_rg, weights_g, 82, 0,
2, resistances_b, weights_b, 82, 0);
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < 512; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -698,7 +699,7 @@ MACHINE_CONFIG_START(fortecar_state::fortecar)
MCFG_SCREEN_SIZE(640, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 600-1, 0, 240-1) /* driven by CRTC */
MCFG_SCREEN_UPDATE_DRIVER(fortecar_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
EEPROM_93C56_16BIT(config, "eeprom").default_value(0);
@@ -712,9 +713,8 @@ MACHINE_CONFIG_START(fortecar_state::fortecar)
V3021(config, "rtc");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fortecar)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(fortecar_state, fortecar)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fortecar);
+ PALETTE(config, m_palette, FUNC(fortecar_state::fortecar_palette), 0x200);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); /* 1.5 MHz, measured */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp
index 71a4dafe478..d42b396dcf6 100644
--- a/src/mame/drivers/fp200.cpp
+++ b/src/mame/drivers/fp200.cpp
@@ -32,8 +32,8 @@ class fp200_state : public driver_device
{
public:
fp200_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
void fp200(machine_config &config);
@@ -72,7 +72,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(sod_w);
DECLARE_READ_LINE_MEMBER(sid_r);
- DECLARE_PALETTE_INIT(fp200);
+ void fp200_palette(palette_device &palette) const;
void fp200_io(address_map &map);
void fp200_map(address_map &map);
@@ -572,7 +572,7 @@ void fp200_state::machine_reset()
}
-PALETTE_INIT_MEMBER(fp200_state, fp200)
+void fp200_state::fp200_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xa0, 0xa8, 0xa0);
palette.set_pen_color(1, 0x30, 0x38, 0x10);
@@ -608,7 +608,7 @@ void fp200_state::fp200(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx_fp200);
- PALETTE(config, "palette", 2).set_init(FUNC(fp200_state::palette_init_fp200));
+ PALETTE(config, "palette", FUNC(fp200_state::fp200_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/freekick.cpp b/src/mame/drivers/freekick.cpp
index 797d222c714..3d891327045 100644
--- a/src/mame/drivers/freekick.cpp
+++ b/src/mame/drivers/freekick.cpp
@@ -748,11 +748,11 @@ MACHINE_CONFIG_START(freekick_state::omega)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(18'432'000)/3, 768/2, 0, 512/2, 263, 0+16, 224+16) // unknown divisor
MCFG_SCREEN_UPDATE_DRIVER(freekick_state, screen_update_gigas)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, freekick_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_freekick)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x200)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x200);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -786,11 +786,11 @@ MACHINE_CONFIG_START(freekick_state::base)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2, 768/2, 0, 512/2, 263, 0+16, 224+16)
MCFG_SCREEN_UPDATE_DRIVER(freekick_state, screen_update_pbillrd)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, freekick_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_freekick)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x200)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fresh.cpp b/src/mame/drivers/fresh.cpp
index 469fad4bcc1..7201533c326 100644
--- a/src/mame/drivers/fresh.cpp
+++ b/src/mame/drivers/fresh.cpp
@@ -34,18 +34,22 @@ rom 5 and 6 are prg roms
class fresh_state : public driver_device
{
public:
- fresh_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ fresh_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_bg_videoram(*this, "bg_videoram"),
m_bg_2_videoram(*this, "bg_videoram_2"),
m_attr_videoram(*this, "attr_videoram"),
m_attr_2_videoram(*this, "attr_videoram_2"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void fresh(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
tilemap_t *m_bg_tilemap;
tilemap_t *m_bg_2_tilemap;
@@ -55,6 +59,10 @@ private:
required_shared_ptr<uint16_t> m_attr_videoram;
required_shared_ptr<uint16_t> m_attr_2_videoram;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
DECLARE_WRITE16_MEMBER(fresh_bg_videoram_w);
DECLARE_WRITE16_MEMBER(fresh_attr_videoram_w);
TILE_GET_INFO_MEMBER(get_fresh_bg_tile_info);
@@ -97,12 +105,7 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(fake_scanline);
-
- virtual void video_start() override;
uint32_t screen_update_fresh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void fresh_map(address_map &map);
};
@@ -608,12 +611,10 @@ MACHINE_CONFIG_START(fresh_state::fresh)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(fresh_state, screen_update_fresh)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x1000) // or 0xc00
- MCFG_PALETTE_FORMAT(XBGR)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fresh)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 0x1000); // or 0xc00
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fresh);
/* sound hw? */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fromanc2.cpp b/src/mame/drivers/fromanc2.cpp
index a030b6f59e5..0bde16dbcd9 100644
--- a/src/mame/drivers/fromanc2.cpp
+++ b/src/mame/drivers/fromanc2.cpp
@@ -521,12 +521,10 @@ MACHINE_CONFIG_START(fromanc2_state::fromanc2)
EEPROM_93C46_16BIT(config, "eeprom");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "lpalette", gfx_fromanc2)
+ GFXDECODE(config, m_gfxdecode, m_lpalette, gfx_fromanc2);
- MCFG_PALETTE_ADD("lpalette", 2048)
- MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx)
- MCFG_PALETTE_ADD("rpalette", 2048)
- MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx)
+ PALETTE(config, m_lpalette).set_format(palette_device::GRBx_555, 2048);
+ PALETTE(config, m_rpalette).set_format(palette_device::GRBx_555, 2048);
config.set_default_layout(layout_dualhsxs);
@@ -536,7 +534,7 @@ MACHINE_CONFIG_START(fromanc2_state::fromanc2)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(fromanc2_state, screen_update_left)
- MCFG_SCREEN_PALETTE("lpalette")
+ MCFG_SCREEN_PALETTE(m_lpalette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -544,7 +542,7 @@ MACHINE_CONFIG_START(fromanc2_state::fromanc2)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(fromanc2_state, screen_update_right)
- MCFG_SCREEN_PALETTE("rpalette")
+ MCFG_SCREEN_PALETTE(m_rpalette)
MCFG_VIDEO_START_OVERRIDE(fromanc2_state,fromanc2)
@@ -581,12 +579,10 @@ MACHINE_CONFIG_START(fromanc2_state::fromancr)
EEPROM_93C46_16BIT(config, "eeprom");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "lpalette", gfx_fromancr)
+ GFXDECODE(config, m_gfxdecode, m_lpalette, gfx_fromancr);
- MCFG_PALETTE_ADD("lpalette", 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
- MCFG_PALETTE_ADD("rpalette", 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ PALETTE(config, m_lpalette).set_format(palette_device::xGRB_555, 2048);
+ PALETTE(config, m_rpalette).set_format(palette_device::xGRB_555, 2048);
config.set_default_layout(layout_dualhsxs);
@@ -596,7 +592,7 @@ MACHINE_CONFIG_START(fromanc2_state::fromancr)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(fromanc2_state, screen_update_left)
- MCFG_SCREEN_PALETTE("lpalette")
+ MCFG_SCREEN_PALETTE(m_lpalette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -604,7 +600,7 @@ MACHINE_CONFIG_START(fromanc2_state::fromancr)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 352-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(fromanc2_state, screen_update_right)
- MCFG_SCREEN_PALETTE("rpalette")
+ MCFG_SCREEN_PALETTE(m_rpalette)
MCFG_VIDEO_START_OVERRIDE(fromanc2_state,fromancr)
@@ -642,12 +638,10 @@ MACHINE_CONFIG_START(fromanc2_state::fromanc4)
//m_uart->out_rts_callback().set("link", FUNC(rs232_port_device::write_rts));
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "lpalette", gfx_fromancr)
+ GFXDECODE(config, m_gfxdecode, m_lpalette, gfx_fromancr);
- MCFG_PALETTE_ADD("lpalette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ADD("rpalette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_lpalette).set_format(palette_device::xRGB_555, 2048);
+ PALETTE(config, m_rpalette).set_format(palette_device::xRGB_555, 2048);
config.set_default_layout(layout_dualhsxs);
diff --git a/src/mame/drivers/funkybee.cpp b/src/mame/drivers/funkybee.cpp
index 186fcdde25c..654adcbd71e 100644
--- a/src/mame/drivers/funkybee.cpp
+++ b/src/mame/drivers/funkybee.cpp
@@ -308,11 +308,10 @@ MACHINE_CONFIG_START(funkybee_state::funkybee)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12, 32*8-8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(funkybee_state, screen_update_funkybee)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_funkybee)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(funkybee_state, funkybee)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_funkybee);
+ PALETTE(config, m_palette, FUNC(funkybee_state::funkybee_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/funkyjet.cpp b/src/mame/drivers/funkyjet.cpp
index 56bbc897e97..4234d7a7ffe 100644
--- a/src/mame/drivers/funkyjet.cpp
+++ b/src/mame/drivers/funkyjet.cpp
@@ -350,8 +350,7 @@ MACHINE_CONFIG_START(funkyjet_state::funkyjet)
m_deco146->set_interface_scramble_interleave();
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_funkyjet)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 1024);
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
diff --git a/src/mame/drivers/funtech.cpp b/src/mame/drivers/funtech.cpp
index b763e80dcc6..32e8d9949e7 100644
--- a/src/mame/drivers/funtech.cpp
+++ b/src/mame/drivers/funtech.cpp
@@ -37,8 +37,8 @@ and an unpopulated position for a YM2413 or UM3567
class fun_tech_corp_state : public driver_device
{
public:
- fun_tech_corp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ fun_tech_corp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_fgram(*this, "fgram"),
m_reel1_ram(*this, "reel1ram"),
m_reel2_ram(*this, "reel2ram"),
@@ -50,7 +50,8 @@ public:
m_maincpu(*this, "maincpu"),
m_hopper(*this, "hopper"),
m_gfxdecode(*this, "gfxdecode"),
- m_lamps(*this, "lamp%u", 0U) { }
+ m_lamps(*this, "lamp%u", 0U)
+ { }
void funtech(machine_config &config);
@@ -503,9 +504,8 @@ MACHINE_CONFIG_START(fun_tech_corp_state::funtech)
MCFG_SCREEN_UPDATE_DRIVER(fun_tech_corp_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_funtech)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_funtech)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 0x200);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp
index 6b40db1802f..45e2e825ce8 100644
--- a/src/mame/drivers/funworld.cpp
+++ b/src/mame/drivers/funworld.cpp
@@ -1158,18 +1158,17 @@ void funworld_state::cuoreuno_map(address_map &map)
}
-READ8_MEMBER(funworld_state::chinatow_r_32f0)
+READ8_MEMBER(chinatow_state::chinatow_r_32f0)
{
- logerror("read from 0x32f0 at offset %02X\n",offset);
+ logerror("read from 0x32f0 at offset %02X\n", offset);
switch (offset)
{
case 0: return 0xfe;
-
}
return 0xff;
}
-void funworld_state::chinatow_map(address_map &map)
+void chinatow_state::chinatow_map(address_map &map)
{
map(0x0000, 0x07ff).ram().share("nvram");
map(0x0800, 0x0803).rw("pia0", FUNC(pia6821_device::read), FUNC(pia6821_device::write));
@@ -1178,15 +1177,15 @@ void funworld_state::chinatow_map(address_map &map)
map(0x0c00, 0x0c01).w("ay8910", FUNC(ay8910_device::address_data_w));
map(0x0e00, 0x0e00).w("crtc", FUNC(mc6845_device::address_w));
map(0x0e01, 0x0e01).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
- map(0x2000, 0x2000).nopr(); /* some unknown reads */
- map(0x32f0, 0x32ff).r(FUNC(funworld_state::chinatow_r_32f0));
- map(0x4000, 0x5fff).rom(); /* used by rcdino4 (dino4 hw ) */
- map(0x6000, 0x6fff).ram().w(FUNC(funworld_state::funworld_videoram_w)).share("videoram");
- map(0x7000, 0x7fff).ram().w(FUNC(funworld_state::funworld_colorram_w)).share("colorram");
+ map(0x2000, 0x2000).nopr(); // some unknown reads
+ map(0x32f0, 0x32ff).r(FUNC(chinatow_state::chinatow_r_32f0));
+ map(0x4000, 0x5fff).rom(); // used by rcdino4 (dino4 hw)
+ map(0x6000, 0x6fff).ram().w(FUNC(chinatow_state::funworld_videoram_w)).share("videoram");
+ map(0x7000, 0x7fff).ram().w(FUNC(chinatow_state::funworld_colorram_w)).share("colorram");
map(0x8000, 0xffff).rom();
}
-void funworld_state::lunapark_map(address_map &map)
+void lunapark_state::lunapark_map(address_map &map)
{ // mirrored video RAM 4000/5000 to 6000/7000
map(0x0000, 0x07ff).ram().share("nvram");
map(0x0800, 0x0803).rw("pia0", FUNC(pia6821_device::read), FUNC(pia6821_device::write));
@@ -1195,8 +1194,8 @@ void funworld_state::lunapark_map(address_map &map)
map(0x0c00, 0x0c01).w("ay8910", FUNC(ay8910_device::address_data_w));
map(0x0e00, 0x0e00).w("crtc", FUNC(mc6845_device::address_w));
map(0x0e01, 0x0e01).rw("crtc", FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
- map(0x4000, 0x4fff).ram().w(FUNC(funworld_state::funworld_videoram_w)).share("videoram").mirror(0x2000);
- map(0x5000, 0x5fff).ram().w(FUNC(funworld_state::funworld_colorram_w)).share("colorram").mirror(0x2000);
+ map(0x4000, 0x4fff).ram().w(FUNC(lunapark_state::funworld_videoram_w)).share("videoram").mirror(0x2000);
+ map(0x5000, 0x5fff).ram().w(FUNC(lunapark_state::funworld_colorram_w)).share("colorram").mirror(0x2000);
map(0x8000, 0xffff).bankr("bank1");
}
@@ -3096,9 +3095,7 @@ MACHINE_CONFIG_START(funworld_state::fw1stpal)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fw1stpal)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(funworld_state, funworld)
- MCFG_VIDEO_START_OVERRIDE(funworld_state, funworld)
+ PALETTE(config, "palette", FUNC(funworld_state::funworld_palette), 0x200);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); /* 2MHz, verified on jollycrd & royalcrd */
crtc.set_screen("screen");
@@ -3137,17 +3134,17 @@ MACHINE_CONFIG_START(funworld_state::funquiz)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(funworld_state::magicrd2)
+MACHINE_CONFIG_START(magicrd2_state::magicrd2)
fw1stpal(config);
+
MCFG_DEVICE_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */
MCFG_DEVICE_PROGRAM_MAP(magicrd2_map)
- MCFG_VIDEO_START_OVERRIDE(funworld_state, magicrd2)
subdevice<mc6845_device>("crtc")->set_visarea_adjust(0, -56, 0, 0);
ay8910_device &ay8910(AY8910(config.replace(), "ay8910", SND_CLOCK)); /* 2MHz */
- ay8910.port_a_write_callback().set(FUNC(funworld_state::funworld_lamp_a_w));
- ay8910.port_b_write_callback().set(FUNC(funworld_state::funworld_lamp_b_w));
+ ay8910.port_a_write_callback().set(FUNC(magicrd2_state::funworld_lamp_a_w));
+ ay8910.port_b_write_callback().set(FUNC(magicrd2_state::funworld_lamp_b_w));
ay8910.add_route(ALL_OUTPUTS, "mono", 1.5); /* analyzed to avoid clips */
MACHINE_CONFIG_END
@@ -3194,18 +3191,16 @@ MACHINE_CONFIG_START(lunapark_state::lunapark)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(funworld_state::chinatow)
+MACHINE_CONFIG_START(chinatow_state::chinatow)
fw2ndpal(config);
MCFG_DEVICE_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */
MCFG_DEVICE_PROGRAM_MAP(chinatow_map)
- MCFG_VIDEO_START_OVERRIDE(funworld_state, chinatow)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(funworld_state::rcdino4)
+MACHINE_CONFIG_START(chinatow_state::rcdino4)
fw1stpal(config);
MCFG_DEVICE_REPLACE("maincpu", R65C02, CPU_CLOCK) /* 2MHz */
MCFG_DEVICE_PROGRAM_MAP(chinatow_map)
- MCFG_VIDEO_START_OVERRIDE(funworld_state, chinatow)
MACHINE_CONFIG_END
@@ -6542,30 +6537,30 @@ void funworld_state::init_tabblue()
}
-void funworld_state::init_magicd2b()
-/*****************************************************************
+void magicrd2_state::init_magicd2b()
+{
+ /*****************************************************************
- For a serie of Mexican Rockwell's 65c02
- seems that opcode 0x91 is STA ($zp) instead of STA ($zp),y
- ...or is patched with the correct opcode (0x92) by PLDs...
+ For a serie of Mexican Rockwell's 65c02
+ seems that opcode 0x91 is STA ($zp) instead of STA ($zp),y
+ ...or is patched with the correct opcode (0x92) by PLDs...
- In offset $C1C4, the code is trying to initialize both PIAs
- putting value 0x34 in $0800-$0803 & $0A00-$0A03.
+ In offset $C1C4, the code is trying to initialize both PIAs
+ putting value 0x34 in $0800-$0803 & $0A00-$0A03.
- The code use STA ($zp),y (opcode 0x91). As soon as register 'y'
- increments, almost all writes go out of range.
+ The code use STA ($zp),y (opcode 0x91). As soon as register 'y'
+ increments, almost all writes go out of range.
-******************************************************************/
-{
+ ******************************************************************/
uint8_t *ROM = memregion("maincpu")->base();
ROM[0xc1c6] = 0x92;
}
-void funworld_state::init_magicd2c()
-/*** same as blue TAB PCB, with the magicd2a patch ***/
+void magicrd2_state::init_magicd2c()
{
+ /*** same as blue TAB PCB, with the magicd2a patch ***/
int x, na, nb, nad, nbd;
uint8_t *src = memregion( "gfx1" )->base();
uint8_t *ROM = memregion("maincpu")->base();
@@ -6587,12 +6582,12 @@ void funworld_state::init_magicd2c()
void funworld_state::init_mongolnw()
{
-/* temporary patch to avoid hardware errors for debug purposes */
+ /* temporary patch to avoid hardware errors for debug purposes */
uint8_t *ROM = memregion("maincpu")->base();
ROM[0x9115] = 0xa5;
-/* prevents one test from triggering hardware error */
+ /* prevents one test from triggering hardware error */
ROM[0xb8f3] = 0xff;
}
@@ -7030,18 +7025,18 @@ static uint8_t rcdino4_keys80[] =
0x06, 0x1e, 0x28, 0x5a, 0xcf, 0x79, 0x11
};
-void funworld_state::init_rcdino4()
-/*****************************************************
+void chinatow_state::init_rcdino4()
+{
+ /*****************************************************
- Dino4 hardware with CPU+PLCC daughterboard
+ Dino4 hardware with CPU+PLCC daughterboard
- Program ROM data & address lines are swapped.
- GFX ROMs address lines are swapped and data encrypted.
+ Program ROM data & address lines are swapped.
+ GFX ROMs address lines are swapped and data encrypted.
- Color PROM seems straight.
+ Color PROM seems straight.
-******************************************************/
-{
+ ******************************************************/
uint8_t *rom = memregion("maincpu")->base();
decrypt_rcdino4(rom, memregion("maincpu")->bytes(), memregion("gfx1")->base(), memregion("gfx1")->bytes(), memregion( "gfx1" )->base());
@@ -7156,15 +7151,15 @@ void funworld_state::init_rcdino4()
while (1);
}
-void funworld_state::init_rcdinch()
-/*****************************************************
+void chinatow_state::init_rcdinch()
+{
+ /*****************************************************
- Dino4 hardware with CPU+PLCC daughterboard
+ Dino4 hardware with CPU+PLCC daughterboard
- Less encryption than rc4dino
+ Less encryption than rc4dino
-******************************************************/
-{
+ ******************************************************/
decrypt_rcdino4(memregion("maincpu")->base(), memregion("maincpu")->bytes(), memregion("gfx1")->base(), memregion("gfx1")->bytes(), memregion( "gfx1" )->base());
}
@@ -7243,10 +7238,10 @@ GAMEL( 1991, lluck3x3, royalcrd, cuoreuno, royalcrd, funworld_state, empty_ini
GAMEL( 1991, lluck4x1, royalcrd, royalcd1, royalcrd, funworld_state, empty_init, ROT0, "TAB Austria", "Lucky Lady (4x1 aces)", 0, layout_jollycrd )
// Magic Card 2 based...
-GAMEL( 1996, magicrd2, 0, magicrd2, magicrd2, funworld_state, empty_init, ROT0, "Impera", "Magic Card II (Bulgarian)", 0, layout_jollycrd )
-GAMEL( 1996, magicrd2a, magicrd2, magicrd2, magicrd2, funworld_state, empty_init, ROT0, "Impera", "Magic Card II (Nov, Yugoslavian)", 0, layout_jollycrd )
-GAME( 1996, magicrd2b, magicrd2, magicrd2, magicrd2, funworld_state, init_magicd2b, ROT0, "Impera", "Magic Card II (green TAB or Impera board)", 0 )
-GAME( 1996, magicrd2c, magicrd2, magicrd2, magicrd2, funworld_state, init_magicd2c, ROT0, "Impera", "Magic Card II (blue TAB board, encrypted)", 0 )
+GAMEL( 1996, magicrd2, 0, magicrd2, magicrd2, magicrd2_state, empty_init, ROT0, "Impera", "Magic Card II (Bulgarian)", 0, layout_jollycrd )
+GAMEL( 1996, magicrd2a, magicrd2, magicrd2, magicrd2, magicrd2_state, empty_init, ROT0, "Impera", "Magic Card II (Nov, Yugoslavian)", 0, layout_jollycrd )
+GAME( 1996, magicrd2b, magicrd2, magicrd2, magicrd2, magicrd2_state, init_magicd2b, ROT0, "Impera", "Magic Card II (green TAB or Impera board)", 0 )
+GAME( 1996, magicrd2c, magicrd2, magicrd2, magicrd2, magicrd2_state, init_magicd2c, ROT0, "Impera", "Magic Card II (blue TAB board, encrypted)", 0 )
// Joker Card based...
GAMEL( 1993, vegasslw, 0, fw2ndpal, vegasslw, funworld_state, empty_init, ROT0, "Fun World", "Royal Vegas Joker Card (slow deal)", 0, layout_jollycrd )
@@ -7274,8 +7269,8 @@ GAMEL( 1993, jolycdic, jollycrd, cuoreuno, jolycdic, funworld_state, init_tabb
// Dino 4 encrypted hardware...
GAMEL( 1997, pool10e, pool10, cuoreuno, cuoreuno, funworld_state, init_dino4, ROT0, "C.M.C.", "Pool 10 (Italian, Dino 4 hardware, encrypted)", 0, layout_jollycrd )
-GAME( 1998, rcdino4, 0, rcdino4, rcdino4, funworld_state, init_rcdino4, ROT0, "<unknown>", "Royal Card (Italian, Dino 4 hardware, encrypted)",0 )
-GAMEL( 1998, chinatow, 0, chinatow, chinatow, funworld_state, init_rcdinch, ROT0, "<unknown>", "China Town (Ver 1B, Dino4 HW)", 0, layout_jollycrd )
+GAME( 1998, rcdino4, 0, rcdino4, rcdino4, chinatow_state, init_rcdino4, ROT0, "<unknown>", "Royal Card (Italian, Dino 4 hardware, encrypted)",0 )
+GAMEL( 1998, chinatow, 0, chinatow, chinatow, chinatow_state, init_rcdinch, ROT0, "<unknown>", "China Town (Ver 1B, Dino4 HW)", 0, layout_jollycrd )
// MCU based games...
GAME( 199?, mongolnw, 0, royalcd1, royalcrd, funworld_state, init_mongolnw, ROT0, "<unknown>", "Mongolfier New (Italian)", MACHINE_UNEMULATED_PROTECTION )
diff --git a/src/mame/drivers/funybubl.cpp b/src/mame/drivers/funybubl.cpp
index 407f1a8b88d..b244d949740 100644
--- a/src/mame/drivers/funybubl.cpp
+++ b/src/mame/drivers/funybubl.cpp
@@ -238,11 +238,10 @@ MACHINE_CONFIG_START(funybubl_state::funybubl)
MCFG_SCREEN_VISIBLE_AREA(12*8, 512-12*8-1, 16, 256-16-1)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(funybubl_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_funybubl)
- MCFG_PALETTE_ADD("palette", 0xc00/4)
- MCFG_PALETTE_FORMAT_CLASS(4, funybubl_state, funybubl_R6B6G6)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_funybubl);
+ PALETTE(config, m_palette).set_format(4, &funybubl_state::funybubl_R6B6G6, 0xc00/4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fuukifg2.cpp b/src/mame/drivers/fuukifg2.cpp
index b81dbadae13..809b7dc0356 100644
--- a/src/mame/drivers/fuukifg2.cpp
+++ b/src/mame/drivers/fuukifg2.cpp
@@ -461,14 +461,12 @@ MACHINE_CONFIG_START(fuuki16_state::fuuki16)
MCFG_SCREEN_SIZE(320, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(fuuki16_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fuuki16)
- MCFG_PALETTE_ADD("palette", 0x4000 / 2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_fuuki16)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x4000 / 2);
- FUUKI_VIDEO(config, m_fuukivid, 0);
- m_fuukivid->set_gfxdecode_tag(m_gfxdecode);
+ FUUKI_VIDEO(config, m_fuukivid, 0, m_gfxdecode);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/fuukifg3.cpp b/src/mame/drivers/fuukifg3.cpp
index 839113656fe..531b49c1a63 100644
--- a/src/mame/drivers/fuukifg3.cpp
+++ b/src/mame/drivers/fuukifg3.cpp
@@ -533,10 +533,9 @@ void fuuki32_state::fuuki32(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fuuki32);
- PALETTE(config, m_palette, 0x4000 / 2).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x4000 / 2);
- FUUKI_VIDEO(config, m_fuukivid, 0);
- m_fuukivid->set_gfxdecode_tag(m_gfxdecode);
+ FUUKI_VIDEO(config, m_fuukivid, 0, m_gfxdecode);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/gaelco.cpp b/src/mame/drivers/gaelco.cpp
index 9a9988de55d..e7a2407fd3c 100644
--- a/src/mame/drivers/gaelco.cpp
+++ b/src/mame/drivers/gaelco.cpp
@@ -669,11 +669,10 @@ MACHINE_CONFIG_START(gaelco_state::bigkarnk)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(gaelco_state, screen_update_bigkarnk)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaelco)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaelco);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(gaelco_state,bigkarnk)
@@ -704,11 +703,10 @@ MACHINE_CONFIG_START(gaelco_state::maniacsq)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(gaelco_state, screen_update_maniacsq)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaelco)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaelco);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq)
@@ -743,11 +741,10 @@ MACHINE_CONFIG_START(gaelco_state::squash)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(gaelco_state, screen_update_maniacsq)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaelco)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaelco);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq)
@@ -782,11 +779,10 @@ MACHINE_CONFIG_START(gaelco_state::thoop)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(gaelco_state, screen_update_maniacsq)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaelco)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaelco);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(gaelco_state,maniacsq)
diff --git a/src/mame/drivers/gaelco2.cpp b/src/mame/drivers/gaelco2.cpp
index eeca65e1fa1..8bd5a577435 100644
--- a/src/mame/drivers/gaelco2.cpp
+++ b/src/mame/drivers/gaelco2.cpp
@@ -198,7 +198,7 @@ void gaelco2_state::maniacsq(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0080000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -481,7 +481,7 @@ void gaelco2_state::saltcrdi(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0080000); /* gfx_0x0040000 */
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -743,7 +743,7 @@ void gaelco2_state::play2000(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0200000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -849,7 +849,7 @@ void bang_state::bang(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0200000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -1088,7 +1088,7 @@ void gaelco2_state::alighunt(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0400000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -1384,7 +1384,7 @@ void gaelco2_state::touchgo(machine_config &config)
/* video hardware */
BUFFERED_SPRITERAM16(config, m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0400000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
config.set_default_layout(layout_dualhsxs);
screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
@@ -1702,7 +1702,7 @@ void gaelco2_state::snowboar(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0400000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -1746,7 +1746,7 @@ void gaelco2_state::maniacsqs(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0080000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
MCFG_VIDEO_START_OVERRIDE(gaelco2_state,gaelco2)
@@ -1982,7 +1982,7 @@ void wrally2_state::wrally2(machine_config &config)
/* video hardware */
BUFFERED_SPRITERAM16(config, m_spriteram);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_0x0200000);
- PALETTE(config, m_palette, 4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
+ PALETTE(config, m_palette).set_entries(4096*16 - 16); /* game's palette is 4096 but we allocate 15 more for shadows & highlights */
config.set_default_layout(layout_dualhsxs);
screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/gaelco3d.cpp b/src/mame/drivers/gaelco3d.cpp
index 8e3c3b41aa5..50ec35f225a 100644
--- a/src/mame/drivers/gaelco3d.cpp
+++ b/src/mame/drivers/gaelco3d.cpp
@@ -977,15 +977,15 @@ void gaelco3d_state::gaelco3d(machine_config &config)
m_screen->set_screen_update(FUNC(gaelco3d_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", 32768).set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB));
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "mono", 1.0); /* speedup: front mono */
- DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "mono", 1.0); /* speedup: left rear */
- DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, "mono", 1.0); /* speedup: right rear */
- DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, "mono", 1.0); /* speedup: seat speaker */
+ DMADAC(config, m_dmadac[0]).add_route(ALL_OUTPUTS, "mono", 1.0); // speedup: front mono
+ DMADAC(config, m_dmadac[1]).add_route(ALL_OUTPUTS, "mono", 1.0); // speedup: left rear
+ DMADAC(config, m_dmadac[2]).add_route(ALL_OUTPUTS, "mono", 1.0); // speedup: right rear
+ DMADAC(config, m_dmadac[3]).add_route(ALL_OUTPUTS, "mono", 1.0); // speedup: seat speaker
}
diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp
index 7e15ae29114..b096ac577a7 100644
--- a/src/mame/drivers/gaiden.cpp
+++ b/src/mame/drivers/gaiden.cpp
@@ -773,9 +773,8 @@ MACHINE_CONFIG_START(gaiden_state::shadoww)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gaiden_state, screen_update_gaiden)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gaiden)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaiden);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 4096);
TECMO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
@@ -859,11 +858,10 @@ MACHINE_CONFIG_START(gaiden_state::drgnbowl)
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(gaiden_state, screen_update_drgnbowl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_drgnbowl)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_drgnbowl);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 4096);
/* NOT using Tecmo Sprite device - significant changes, maybe a clone of something else */
@@ -876,8 +874,7 @@ MACHINE_CONFIG_START(gaiden_state::drgnbowl)
YM2151(config, "ymsnd", 4000000).add_route(ALL_OUTPUTS, "mono", 0.40);
- MCFG_DEVICE_ADD("oki", OKIM6295, 1000000, okim6295_device::PIN7_HIGH)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ OKIM6295(config, "oki", 1000000, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
/*
@@ -1017,11 +1014,10 @@ MACHINE_CONFIG_START(gaiden_state::mastninj)
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(gaiden_state, screen_update_drgnbowl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mastninj)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mastninj);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 4096);
/* NOT using Tecmo Sprite device - significant changes, maybe a clone of something else */
diff --git a/src/mame/drivers/gal3.cpp b/src/mame/drivers/gal3.cpp
index 9d628cefe5e..5843b92e73f 100644
--- a/src/mame/drivers/gal3.cpp
+++ b/src/mame/drivers/gal3.cpp
@@ -157,6 +157,10 @@ public:
void gal3(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device_array<namco_c355spr_device, 2> m_c355spr;
required_device_array<palette_device, 2> m_palette;
@@ -165,12 +169,12 @@ private:
required_device<c140_device> m_c140_16a;
required_device<c140_device> m_c140_16g;
-
required_device_array<namcos21_3d_device, 2> m_namcos21_3d;
required_device_array<namcos21_dsp_c67_device, 2> m_namcos21_dsp_c67;
uint32_t m_led_mst;
uint32_t m_led_slv;
+
DECLARE_READ32_MEMBER(led_mst_r);
DECLARE_WRITE32_MEMBER(led_mst_w);
DECLARE_READ32_MEMBER(led_slv_r);
@@ -179,8 +183,6 @@ private:
template<int Screen> DECLARE_WRITE16_MEMBER(video_enable_w);
DECLARE_READ16_MEMBER(rso_r);
DECLARE_WRITE16_MEMBER(rso_w);
- virtual void machine_start() override;
- virtual void video_start() override;
// using ind16 for now because namco_c355spr_device::zdrawgfxzoom does not support rgb32, will probably need to be improved for LD use
uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -647,10 +649,9 @@ MACHINE_CONFIG_START(gal3_state::gal3)
MCFG_SCREEN_UPDATE_DRIVER(gal3_state, screen_update_left)
MCFG_SCREEN_PALETTE("palette_1")
- MCFG_DEVICE_ADD("gfxdecode_1", GFXDECODE, "palette_1", gfx_gal3_l)
- MCFG_PALETTE_ADD("palette_1", NAMCOS21_NUM_COLORS)
- MCFG_PALETTE_MEMBITS(16)
- MCFG_PALETTE_FORMAT(XBRG)
+ GFXDECODE(config, "gfxdecode_1", m_palette[0], gfx_gal3_l);
+ PALETTE(config, m_palette[0]).set_format(palette_device::xBRG_888, NAMCOS21_NUM_COLORS);
+ m_palette[0]->set_membits(16);
NAMCO_C355SPR(config, m_c355spr[0], 0);
m_c355spr[0]->set_screen("lscreen");
@@ -678,10 +679,9 @@ MACHINE_CONFIG_START(gal3_state::gal3)
MCFG_SCREEN_UPDATE_DRIVER(gal3_state, screen_update_right)
MCFG_SCREEN_PALETTE("palette_2")
- MCFG_DEVICE_ADD("gfxdecode_2", GFXDECODE, "palette_2", gfx_gal3_r)
- MCFG_PALETTE_ADD("palette_2", NAMCOS21_NUM_COLORS)
- MCFG_PALETTE_MEMBITS(16)
- MCFG_PALETTE_FORMAT(XBRG)
+ GFXDECODE(config, "gfxdecode_2", m_palette[1], gfx_gal3_r);
+ PALETTE(config, m_palette[1]).set_format(palette_device::xBRG_888, NAMCOS21_NUM_COLORS);
+ m_palette[1]->set_membits(16);
NAMCO_C355SPR(config, m_c355spr[1], 0);
m_c355spr[1]->set_screen("rscreen");
diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp
index 5461f784450..bcad96fa4c7 100644
--- a/src/mame/drivers/galaga.cpp
+++ b/src/mame/drivers/galaga.cpp
@@ -1659,12 +1659,10 @@ void bosco_state::bosco(machine_config &config)
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");
+ m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bosco);
- PALETTE(config, m_palette, 64*4+64*4+4+64);
- m_palette->set_indirect_entries(32+64);
- m_palette->set_init(FUNC(bosco_state::palette_init_bosco));
+ PALETTE(config, m_palette, FUNC(bosco_state::bosco_palette), 64*4 + 64*4 + 4 + 64, 32+64);
MCFG_VIDEO_START_OVERRIDE(bosco_state,bosco)
@@ -1734,9 +1732,7 @@ void galaga_state::galaga(machine_config &config)
m_screen->set_palette("palette");
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaga);
- PALETTE(config, m_palette, 64*4+64*4+64);
- m_palette->set_indirect_entries(32+64);
- m_palette->set_init(FUNC(galaga_state::palette_init_galaga));
+ PALETTE(config, m_palette, FUNC(galaga_state::galaga_palette), 64*4 + 64*4 + 4 + 64, 32+64);
MCFG_VIDEO_START_OVERRIDE(galaga_state,galaga)
@@ -1837,9 +1833,7 @@ void xevious_state::xevious(machine_config &config)
m_screen->screen_vblank().set(FUNC(galaga_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_xevious);
- PALETTE(config, m_palette, 128*4+64*8+64*2);
- m_palette->set_indirect_entries(128+1);
- m_palette->set_init(FUNC(xevious_state::palette_init_xevious));
+ PALETTE(config, m_palette, FUNC(xevious_state::xevious_palette), 128*4 + 64*8 + 64*2, 128+1);
MCFG_VIDEO_START_OVERRIDE(xevious_state,xevious)
@@ -1951,9 +1945,7 @@ void digdug_state::digdug(machine_config &config)
m_screen->screen_vblank().set(FUNC(galaga_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_digdug);
- PALETTE(config, m_palette, 16*2+64*4+64*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(digdug_state::palette_init_digdug));
+ PALETTE(config, m_palette, FUNC(digdug_state::digdug_palette), 16*2 + 64*4 + 64*4, 32);
MCFG_VIDEO_START_OVERRIDE(digdug_state,digdug)
diff --git a/src/mame/drivers/galastrm.cpp b/src/mame/drivers/galastrm.cpp
index 5798ae78775..f6c6357fae4 100644
--- a/src/mame/drivers/galastrm.cpp
+++ b/src/mame/drivers/galastrm.cpp
@@ -237,7 +237,7 @@ void galastrm_state::galastrm(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galastrm);
- PALETTE(config, m_palette, 4096);
+ PALETTE(config, m_palette).set_entries(4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(0);
diff --git a/src/mame/drivers/galaxi.cpp b/src/mame/drivers/galaxi.cpp
index 9f95aac0d50..805810875e4 100644
--- a/src/mame/drivers/galaxi.cpp
+++ b/src/mame/drivers/galaxi.cpp
@@ -49,8 +49,8 @@
class galaxi_state : public driver_device
{
public:
- galaxi_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ galaxi_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_bg1_ram(*this, "bg1_ram"),
m_bg2_ram(*this, "bg2_ram"),
m_bg3_ram(*this, "bg3_ram"),
@@ -124,7 +124,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void show_out( );
+ void show_out();
void galaxi_map(address_map &map);
void lastfour_map(address_map &map);
@@ -479,11 +479,10 @@ MACHINE_CONFIG_START(galaxi_state::galaxi)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(16*5, 512-16*2-1, 16*1, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(galaxi_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxi)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxi);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/galaxia.cpp b/src/mame/drivers/galaxia.cpp
index ce634e9bd65..d334e3d4a04 100644
--- a/src/mame/drivers/galaxia.cpp
+++ b/src/mame/drivers/galaxia.cpp
@@ -322,7 +322,7 @@ void galaxia_state::galaxia(machine_config &config)
m_screen->screen_vblank().set(FUNC(galaxia_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxia);
- PALETTE(config, m_palette, 0x18+2).set_init(FUNC(galaxia_state::palette_init_galaxia));
+ PALETTE(config, m_palette, FUNC(galaxia_state::galaxia_palette), 0x18+2);
MCFG_VIDEO_START_OVERRIDE(galaxia_state,galaxia)
@@ -364,7 +364,7 @@ void galaxia_state::astrowar(machine_config &config)
m_screen->screen_vblank().set(FUNC(galaxia_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_astrowar);
- PALETTE(config, m_palette, 0x18+2).set_init(FUNC(galaxia_state::palette_init_astrowar));
+ PALETTE(config, m_palette, FUNC(galaxia_state::astrowar_palette), 0x18+2);
MCFG_VIDEO_START_OVERRIDE(galaxia_state,astrowar)
diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp
index 423a816fac4..e942ef73940 100644
--- a/src/mame/drivers/galaxian.cpp
+++ b/src/mame/drivers/galaxian.cpp
@@ -5997,9 +5997,8 @@ MACHINE_CONFIG_START(galaxian_state::galaxian_base)
WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 8);
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxian)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(galaxian_state, galaxian)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxian);
+ PALETTE(config, m_palette, FUNC(galaxian_state::galaxian_palette), 32);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(GALAXIAN_PIXEL_CLOCK, GALAXIAN_HTOTAL, GALAXIAN_HBEND, GALAXIAN_HBSTART, GALAXIAN_VTOTAL, GALAXIAN_VBEND, GALAXIAN_VBSTART)
@@ -6195,9 +6194,8 @@ MACHINE_CONFIG_START(galaxian_state::gmgalax)
/* banked video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_gmgalax)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(64)
- MCFG_PALETTE_INIT_OWNER(galaxian_state, galaxian)
+ m_palette->set_entries(64);
+ m_palette->set_init(FUNC(galaxian_state::galaxian_palette));
MACHINE_CONFIG_END
@@ -6732,8 +6730,7 @@ MACHINE_CONFIG_START(galaxian_state::moonwar)
m_ppi8255[0]->out_pc_callback().set(FUNC(galaxian_state::moonwar_port_select_w));
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(galaxian_state,moonwar) // bullets are less yellow
+ m_palette->set_init(FUNC(galaxian_state::moonwar_palette)); // bullets are less yellow
MACHINE_CONFIG_END
MACHINE_CONFIG_START(galaxian_state::fourplay)
@@ -6744,8 +6741,7 @@ MACHINE_CONFIG_START(galaxian_state::fourplay)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_gmgalax)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(64)
+ m_palette->set_entries(64);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(galaxian_state::videight)
@@ -6757,8 +6753,7 @@ MACHINE_CONFIG_START(galaxian_state::videight)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_videight)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(8*32)
+ m_palette->set_entries(8 * 32);
MACHINE_CONFIG_END
@@ -6770,16 +6765,15 @@ MACHINE_CONFIG_END
void galaxian_state::decode_mooncrst(int length, uint8_t *dest)
{
- uint8_t *rom = memregion("maincpu")->base();
- int offs;
+ uint8_t const *const rom = memregion("maincpu")->base();
- for (offs = 0; offs < length; offs++)
+ for (int offs = 0; offs < length; offs++)
{
- uint8_t data = rom[offs];
+ uint8_t const data = rom[offs];
uint8_t res = data;
- if (BIT(data,1)) res ^= 0x40;
- if (BIT(data,5)) res ^= 0x04;
- if ((offs & 1) == 0) res = bitswap<8>(res,7,2,5,4,3,6,1,0);
+ if (BIT(data, 1)) res ^= 0x40;
+ if (BIT(data, 5)) res ^= 0x04;
+ if (!BIT(offs, 0)) res = bitswap<8>(res,7,2,5,4,3,6,1,0);
dest[offs] = res;
}
}
@@ -7247,7 +7241,7 @@ void galaxian_state::tenspot_set_game_bank(int bank, int from_game)
dstregion = memregion("proms")->base();
memcpy(dstregion, srcregion, 0x20);
- PALETTE_INIT_NAME(galaxian)(*m_palette);
+ galaxian_palette(*m_palette);
}
void galaxian_state::init_tenspot()
diff --git a/src/mame/drivers/galaxold.cpp b/src/mame/drivers/galaxold.cpp
index 6832ef17b2e..7679ae3cdbc 100644
--- a/src/mame/drivers/galaxold.cpp
+++ b/src/mame/drivers/galaxold.cpp
@@ -2272,14 +2272,13 @@ MACHINE_CONFIG_START(galaxold_state::galaxold_base)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxian)
- MCFG_PALETTE_ADD("palette", 32+2+64) /* 32 for the characters, 2 for the bullets, 64 for the stars */
- MCFG_PALETTE_INIT_OWNER(galaxold_state,galaxold)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxian);
+ PALETTE(config, m_palette, FUNC(galaxold_state::galaxold_palette), 32+2+64); // 32 for the characters, 2 for the bullets, 64 for the stars
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(galaxold_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,galaxold)
@@ -2363,10 +2362,9 @@ MACHINE_CONFIG_START(galaxold_state::scramblb)
MCFG_DEVICE_PROGRAM_MAP(scramblb_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+2+64+1) /* 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background */
+ m_palette->set_entries(32+2+64+1); // 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background
+ m_palette->set_init(FUNC(galaxold_state::scrambold_palette));
- MCFG_PALETTE_INIT_OWNER(galaxold_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,scrambold)
MACHINE_CONFIG_END
@@ -2379,10 +2377,9 @@ MACHINE_CONFIG_START(galaxold_state::scramb2)
MCFG_DEVICE_PROGRAM_MAP(scramb2_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+2+64+1) /* 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background */
+ m_palette->set_entries(32+2+64+1); // 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background
+ m_palette->set_init(FUNC(galaxold_state::scrambold_palette));
- MCFG_PALETTE_INIT_OWNER(galaxold_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,scrambold)
MACHINE_CONFIG_END
@@ -2402,10 +2399,9 @@ MACHINE_CONFIG_START(galaxold_state::scrambler)
MCFG_DEVICE_PROGRAM_MAP(scrambler_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+2+64+1) /* 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background */
+ m_palette->set_entries(32+2+64+1); // 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background
+ m_palette->set_init(FUNC(galaxold_state::scrambold_palette));
- MCFG_PALETTE_INIT_OWNER(galaxold_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,scrambold)
MACHINE_CONFIG_END
@@ -2418,11 +2414,10 @@ MACHINE_CONFIG_START(galaxold_state::guttang)
MCFG_DEVICE_PROGRAM_MAP(guttang_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+2+64+1) /* 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background */
+ m_palette->set_entries(32+2+64+1); // 32 for the characters, 2 for the bullets, 64 for the stars, 1 for background
+ m_palette->set_init(FUNC(galaxold_state::galaxold_palette));
+// m_palette->set_init(FUNC(galaxold_state::scrambold_palette));
- MCFG_PALETTE_INIT_OWNER(galaxold_state,galaxold)
-// MCFG_PALETTE_INIT_OWNER(galaxold_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,mooncrst)
MACHINE_CONFIG_END
@@ -2486,9 +2481,8 @@ MACHINE_CONFIG_START(galaxold_state::rockclim)
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(galaxold_state,rockclim)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(64+64+2) /* 64 colors only, but still uses bullets so we need to keep the palette big */
- MCFG_PALETTE_INIT_OWNER(galaxold_state,rockclim)
+ m_palette->set_entries(64+64+2); // 64 colors only, but still uses bullets so we need to keep the palette big
+ m_palette->set_init(FUNC(galaxold_state::rockclim_palette));
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_SIZE(64*8, 32*8)
@@ -2507,9 +2501,8 @@ MACHINE_CONFIG_START(galaxold_state::ozon1)
MCFG_MACHINE_RESET_REMOVE()
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(galaxold_state,rockclim)
+ m_palette->set_entries(32);
+ m_palette->set_init(FUNC(galaxold_state::rockclim_palette));
MCFG_VIDEO_START_OVERRIDE(galaxold_state,ozon1)
AY8910(config, "aysnd", PIXEL_CLOCK/4).add_route(ALL_OUTPUTS, "speaker", 0.5);
@@ -2532,12 +2525,11 @@ MACHINE_CONFIG_START(galaxold_state::drivfrcg)
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(galaxold_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(galaxold_state,rockclim)
+ PALETTE(config, m_palette, FUNC(galaxold_state::rockclim_palette), 64);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gmgalax)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gmgalax);
MCFG_VIDEO_START_OVERRIDE(galaxold_state,drivfrcg)
@@ -2616,14 +2608,13 @@ MACHINE_CONFIG_START(galaxold_state::racknrol)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", galaxold_state, hunchbks_vh_interrupt)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxian)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(galaxold_state,rockclim)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxian);
+ PALETTE(config, m_palette, FUNC(galaxold_state::rockclim_palette), 32);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(galaxold_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,racknrol)
@@ -2645,14 +2636,13 @@ MACHINE_CONFIG_START(galaxold_state::hexpoola)
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)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(galaxold_state,rockclim)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galaxian);
+ PALETTE(config, m_palette, FUNC(galaxold_state::rockclim_palette), 32);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(galaxold_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(galaxold_state,racknrol)
diff --git a/src/mame/drivers/galaxy.cpp b/src/mame/drivers/galaxy.cpp
index 6104a88ac9d..1c81aed7705 100644
--- a/src/mame/drivers/galaxy.cpp
+++ b/src/mame/drivers/galaxy.cpp
@@ -195,8 +195,7 @@ MACHINE_CONFIG_START(galaxy_state::galaxy)
MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galaxy)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
-
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* snapshot */
MCFG_SNAPSHOT_ADD("snapshot", galaxy_state, galaxy, "gal", 0)
@@ -234,7 +233,7 @@ MACHINE_CONFIG_START(galaxy_state::galaxyp)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 208-1)
MCFG_SCREEN_UPDATE_DRIVER(galaxy_state, screen_update_galaxy)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* snapshot */
diff --git a/src/mame/drivers/galeb.cpp b/src/mame/drivers/galeb.cpp
index 0880b7f94dc..cc7cd4cf938 100644
--- a/src/mame/drivers/galeb.cpp
+++ b/src/mame/drivers/galeb.cpp
@@ -176,11 +176,11 @@ MACHINE_CONFIG_START(galeb_state::galeb)
MCFG_SCREEN_SIZE(48*8, 16*8)
MCFG_SCREEN_VISIBLE_AREA(0, 48*8-1, 0, 16*8-1)
MCFG_SCREEN_UPDATE_DRIVER(galeb_state, screen_update_galeb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galeb )
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* audio hardware */
diff --git a/src/mame/drivers/galgame.cpp b/src/mame/drivers/galgame.cpp
index 049d9f83849..5c87b3d2d03 100644
--- a/src/mame/drivers/galgame.cpp
+++ b/src/mame/drivers/galgame.cpp
@@ -21,10 +21,11 @@
class galaxygame_state : public driver_device
{
public:
- galaxygame_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ galaxygame_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void galaxygame(machine_config &config);
@@ -342,7 +343,7 @@ void galaxygame_state::galaxygame(machine_config &config)
screen.set_screen_update(FUNC(galaxygame_state::screen_update_galaxygame));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
}
ROM_START(galgame)
diff --git a/src/mame/drivers/galgames.cpp b/src/mame/drivers/galgames.cpp
index ea0c871a86f..58b8c7f7aaf 100644
--- a/src/mame/drivers/galgames.cpp
+++ b/src/mame/drivers/galgames.cpp
@@ -729,8 +729,8 @@ WRITE_LINE_MEMBER(galgames_slot_device::eeprom_cs_write)
class galgames_state : public driver_device
{
public:
- galgames_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ galgames_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
@@ -997,15 +997,14 @@ MACHINE_CONFIG_START(galgames_state::galgames_base)
MCFG_SCREEN_SIZE(400, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(galgames_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_CESBLIT_ADD("blitter", "screen", XTAL(24'000'000))
MCFG_CESBLIT_MAP(blitter_map)
MCFG_CESBLIT_COMPUTE_ADDR(galgames_compute_addr)
MCFG_CESBLIT_IRQ_CB(WRITELINE(*this, galgames_state, blitter_irq_callback))
- MCFG_PALETTE_ADD("palette", 0x1000) // only 0x100 used
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000); // only 0x100 used
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/galivan.cpp b/src/mame/drivers/galivan.cpp
index 392d98d0bc9..75a20127ed5 100644
--- a/src/mame/drivers/galivan.cpp
+++ b/src/mame/drivers/galivan.cpp
@@ -455,12 +455,10 @@ MACHINE_CONFIG_START(galivan_state::galivan)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(galivan_state, screen_update_galivan)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galivan)
- MCFG_PALETTE_ADD("palette", 8*16+16*16+256*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(galivan_state, galivan)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galivan);
+ PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 8*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,galivan)
@@ -515,12 +513,10 @@ MACHINE_CONFIG_START(galivan_state::ninjemak)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(galivan_state, screen_update_ninjemak)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galivan)
- MCFG_PALETTE_ADD("palette", 8*16+16*16+256*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(galivan_state, galivan)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galivan);
+ PALETTE(config, m_palette, FUNC(galivan_state::galivan_palette), 8*16+16*16+256*16, 256);
MCFG_VIDEO_START_OVERRIDE(galivan_state,ninjemak)
diff --git a/src/mame/drivers/galpani2.cpp b/src/mame/drivers/galpani2.cpp
index e4c08a87042..dde79ee7b85 100644
--- a/src/mame/drivers/galpani2.cpp
+++ b/src/mame/drivers/galpani2.cpp
@@ -644,16 +644,10 @@ MACHINE_CONFIG_START(galpani2_state::galpani2)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 256-1-16)
MCFG_SCREEN_UPDATE_DRIVER(galpani2_state, screen_update_galpani2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galpani2)
- MCFG_PALETTE_ADD("palette", 0x4000) // sprites
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
-
- MCFG_PALETTE_ADD("bg8palette", 0x200/2) // bg8
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
-
- MCFG_PALETTE_ADD("bgpalette", 32768) /* 32768 static colors for the bg */
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
- MCFG_PALETTE_INIT_OWNER(galpani2_state,galpani2)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_galpani2);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x4000); // sprites
+ PALETTE(config, m_bg8palette).set_format(palette_device::xGRB_555, 0x200 / 2); // bg8
+ PALETTE(config, m_bg15palette, palette_device::GRB_555); // 32768 static colors for the bg
KANEKO_KC002_SPRITE(config, m_kaneko_spr);
m_kaneko_spr->set_offsets(0x10000 - 0x16c0 + 0xc00, 0);
diff --git a/src/mame/drivers/galpani3.cpp b/src/mame/drivers/galpani3.cpp
index e3ca63100a7..8e04a9e25f5 100644
--- a/src/mame/drivers/galpani3.cpp
+++ b/src/mame/drivers/galpani3.cpp
@@ -79,8 +79,8 @@ Dumped by Uki
class galpani3_state : public driver_device
{
public:
- galpani3_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ galpani3_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_grap2(*this,"grap2_%u", 0),
m_palette(*this, "palette"),
@@ -469,8 +469,7 @@ MACHINE_CONFIG_START(galpani3_state::galpani3)
MCFG_DEVICE_ADD("toybox", KANEKO_TOYBOX, "eeprom", "DSW1", "mcuram", "mcudata")
- MCFG_PALETTE_ADD("palette", 0x4000)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x4000);
MCFG_DEVICE_ADD("spritegen", SKNS_SPRITE, 0)
diff --git a/src/mame/drivers/galpanic.cpp b/src/mame/drivers/galpanic.cpp
index 7f679d0f761..382c04155dd 100644
--- a/src/mame/drivers/galpanic.cpp
+++ b/src/mame/drivers/galpanic.cpp
@@ -249,12 +249,11 @@ MACHINE_CONFIG_START(galpanic_state::galpanic)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(galpanic_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, galpanic_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galpanic)
- MCFG_PALETTE_ADD("palette", 1024 + 32768)
- MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx) // fg palette ram, bit 0 seems to be a transparency flag for the front bitmap
- MCFG_PALETTE_INIT_OWNER(galpanic_state, galpanic)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_galpanic);
+ // fg palette RAM, bit 0 seems to be a transparency flag for the front bitmap
+ PALETTE(config, m_palette, FUNC(galpanic_state::galpanic_palette)).set_format(palette_device::GRBx_555, 1024 + 32768);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_offsets(0, -16);
diff --git a/src/mame/drivers/galspnbl.cpp b/src/mame/drivers/galspnbl.cpp
index 3dc9a63e3de..09c494b5d90 100644
--- a/src/mame/drivers/galspnbl.cpp
+++ b/src/mame/drivers/galspnbl.cpp
@@ -233,15 +233,13 @@ MACHINE_CONFIG_START(galspnbl_state::galspnbl)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 16, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(galspnbl_state, screen_update_galspnbl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(galspnbl_state,galspnbl)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_galspnbl)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_galspnbl)
- MCFG_PALETTE_ADD("palette", 1024 + 32768)
- MCFG_PALETTE_INIT_OWNER(galspnbl_state, galspnbl)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette, FUNC(galspnbl_state::galspnbl_palette)).set_format(palette_device::xBGR_444, 1024 + 32768);
TECMO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(1);
diff --git a/src/mame/drivers/gamecom.cpp b/src/mame/drivers/gamecom.cpp
index eb23311e848..e0747c767d4 100644
--- a/src/mame/drivers/gamecom.cpp
+++ b/src/mame/drivers/gamecom.cpp
@@ -235,13 +235,13 @@ static INPUT_PORTS_START( gamecom )
PORT_BIT( 0x200, IP_ACTIVE_HIGH, IPT_OTHER)
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(gamecom_state, gamecom)
+void gamecom_state::gamecom_palette(palette_device &palette) const
{
- palette.set_pen_color(0, 0x00, 0x00, 0x00 ); // Black
- palette.set_pen_color(1, 0x0F, 0x4F, 0x2F ); // Gray 1
- palette.set_pen_color(2, 0x6F, 0x8F, 0x4F ); // Gray 2
- palette.set_pen_color(3, 0x8F, 0xCF, 0x8F ); // Grey 3
- palette.set_pen_color(4, 0xDF, 0xFF, 0x8F ); // White
+ palette.set_pen_color(0, 0x00, 0x00, 0x00); // Black
+ palette.set_pen_color(1, 0x0f, 0x4f, 0x2f); // Gray 1
+ palette.set_pen_color(2, 0x6f, 0x8f, 0x4f); // Gray 2
+ palette.set_pen_color(3, 0x8f, 0xcf, 0x8f); // Grey 3
+ palette.set_pen_color(4, 0xdf, 0xff, 0x8f); // White
}
uint32_t gamecom_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -277,8 +277,7 @@ MACHINE_CONFIG_START(gamecom_state::gamecom)
MCFG_SCREEN_PALETTE("palette")
config.set_default_layout(layout_gamecom);
- MCFG_PALETTE_ADD("palette", 5)
- MCFG_PALETTE_INIT_OWNER(gamecom_state, gamecom)
+ PALETTE(config, "palette", FUNC(gamecom_state::gamecom_palette), 5);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/gameking.cpp b/src/mame/drivers/gameking.cpp
index 3d171a834e9..5870b1130ff 100644
--- a/src/mame/drivers/gameking.cpp
+++ b/src/mame/drivers/gameking.cpp
@@ -38,13 +38,13 @@
class gameking_state : public driver_device
{
public:
- gameking_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ gameking_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_cart(*this, "cartslot"),
m_io_joy(*this, "JOY"),
m_palette(*this, "palette")
- { }
+ { }
void gameking(machine_config &config);
void gameking3(machine_config &config);
@@ -52,10 +52,12 @@ public:
void init_gameking();
-private:
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(gameking);
+
+private:
+ void gameking_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(io_r);
DECLARE_WRITE8_MEMBER(io_w);
DECLARE_READ8_MEMBER(lcd_r);
@@ -181,18 +183,17 @@ static INPUT_PORTS_START( gameking )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP)
INPUT_PORTS_END
-static const unsigned char gameking_palette[] =
+static constexpr rgb_t gameking_pens[] =
{
- 255, 255, 255,
- 127, 127, 127,
- 63, 63, 63,
- 0, 0, 0
+ { 255, 255, 255 },
+ { 127, 127, 127 },
+ { 63, 63, 63 },
+ { 0, 0, 0 }
};
-PALETTE_INIT_MEMBER(gameking_state, gameking)
+void gameking_state::gameking_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(gameking_palette) / 3; i++)
- palette.set_pen_color(i, gameking_palette[i*3], gameking_palette[i*3+1], gameking_palette[i*3+2]);
+ palette.set_pen_colors(0, gameking_pens);
}
@@ -297,10 +298,9 @@ MACHINE_CONFIG_START(gameking_state::gameking)
MCFG_SCREEN_SIZE(48, 32)
MCFG_SCREEN_VISIBLE_AREA(0, 48-1, 0, 32-1)
MCFG_SCREEN_UPDATE_DRIVER(gameking_state, screen_update_gameking)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gameking_palette) * 3)
- MCFG_PALETTE_INIT_OWNER(gameking_state, gameking )
+ PALETTE(config, m_palette, FUNC(gameking_state::gameking_palette), ARRAY_LENGTH(gameking_pens));
/* cartridge */
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "gameking_cart")
diff --git a/src/mame/drivers/gamepock.cpp b/src/mame/drivers/gamepock.cpp
index 33c4a697374..098b1bb1f98 100644
--- a/src/mame/drivers/gamepock.cpp
+++ b/src/mame/drivers/gamepock.cpp
@@ -58,7 +58,7 @@ MACHINE_CONFIG_START(gamepock_state::gamepock)
screen.set_screen_update(FUNC(gamepock_state::screen_update_gamepock));
screen.set_palette("palette");
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gaplus.cpp b/src/mame/drivers/gaplus.cpp
index 041f76c3f2d..b40f5b20252 100644
--- a/src/mame/drivers/gaplus.cpp
+++ b/src/mame/drivers/gaplus.cpp
@@ -550,9 +550,7 @@ void gaplus_base_state::gaplus_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gaplus);
- PALETTE(config, m_palette, 64 * 4 + 64 * 8);
- m_palette->set_indirect_entries(256);
- m_palette->set_init(FUNC(gaplus_base_state::palette_init_gaplus));
+ PALETTE(config, m_palette, FUNC(gaplus_base_state::gaplus_palette), 64 * 4 + 64 * 8, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gauntlet.cpp b/src/mame/drivers/gauntlet.cpp
index 59b0003fcb9..f4ef4cec567 100644
--- a/src/mame/drivers/gauntlet.cpp
+++ b/src/mame/drivers/gauntlet.cpp
@@ -502,10 +502,9 @@ MACHINE_CONFIG_START(gauntlet_state::gauntlet_base)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gauntlet)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_gauntlet);
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(IIIIRRRRGGGGBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_4444, 1024);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, gauntlet_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, gauntlet_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
diff --git a/src/mame/drivers/gb.cpp b/src/mame/drivers/gb.cpp
index 75986d121d3..b7219a8633b 100644
--- a/src/mame/drivers/gb.cpp
+++ b/src/mame/drivers/gb.cpp
@@ -536,70 +536,70 @@ static void megaduck_cart(device_slot_interface &device)
-static const unsigned char palette_gb[] =
+static constexpr rgb_t palette_gb[] =
{
- /* Simple black and white palette */
- /* 0xFF,0xFF,0xFF,
- 0xB0,0xB0,0xB0,
+ // Simple black and white palette
+ /* 0xff,0xff,0xff,
+ 0xb0,0xb0,0xb0,
0x60,0x60,0x60,
0x00,0x00,0x00 */
- /* Possibly needs a little more green in it */
- 0xFF,0xFB,0x87, /* Background */
- 0xB1,0xAE,0x4E, /* Light */
- 0x84,0x80,0x4E, /* Medium */
- 0x4E,0x4E,0x4E, /* Dark */
-
- /* Palette for Game Boy Pocket/Light */
- 0xC4,0xCF,0xA1, /* Background */
- 0x8B,0x95,0x6D, /* Light */
- 0x6B,0x73,0x53, /* Medium */
- 0x41,0x41,0x41, /* Dark */
+ // Possibly needs a little more green in it
+ { 0xff,0xfb,0x87 }, // Background
+ { 0xb1,0xae,0x4e }, // Light
+ { 0x84,0x80,0x4e }, // Medium
+ { 0x4e,0x4e,0x4e }, // Dark
+
+ // Palette for Game Boy Pocket/Light
+ { 0xc4,0xcf,0xa1 }, // Background
+ { 0x8b,0x95,0x6d }, // Light
+ { 0x6b,0x73,0x53 }, // Medium
+ { 0x41,0x41,0x41 }, // Dark
};
-static const unsigned char palette_megaduck[] = {
- 0x6B, 0xA6, 0x4A, 0x43, 0x7A, 0x63, 0x25, 0x59, 0x55, 0x12, 0x42, 0x4C
+static constexpr rgb_t palette_megaduck[] = {
+ { 0x6b, 0xa6, 0x4a }, { 0x43, 0x7a, 0x63 }, { 0x25, 0x59, 0x55 }, { 0x12, 0x42, 0x4c }
};
-/* Initialise the palettes */
-PALETTE_INIT_MEMBER(gb_state, gb)
+// Initialise the palettes
+void gb_state::gb_palette(palette_device &palette) const
{
for (int i = 0; i < 4; i++)
- palette.set_pen_color(i, palette_gb[i * 3 + 0], palette_gb[i * 3 + 1], palette_gb[i * 3 + 2]);
+ palette.set_pen_color(i, palette_gb[i]);
}
-PALETTE_INIT_MEMBER(gb_state, gbp)
+void gb_state::gbp_palette(palette_device &palette) const
{
for (int i = 0; i < 4; i++)
- palette.set_pen_color(i, palette_gb[(i + 4) * 3 + 0], palette_gb[(i + 4) * 3 + 1], palette_gb[(i + 4) * 3 + 2]);
+ palette.set_pen_color(i, palette_gb[i + 4]);
}
-PALETTE_INIT_MEMBER(gb_state, sgb)
+void gb_state::sgb_palette(palette_device &palette) const
{
for (int i = 0; i < 32768; i++)
{
- int r = (i & 0x1F) << 3;
- int g = ((i >> 5) & 0x1F) << 3;
- int b = ((i >> 10) & 0x1F) << 3;
- palette.set_pen_color(i, r, g, b);
+ int const r = i & 0x1f;
+ int const g = (i >> 5) & 0x1f;
+ int const b = (i >> 10) & 0x1f;
+ palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(gb_state, gbc)
+void gb_state::gbc_palette(palette_device &palette) const
{
for (int i = 0; i < 32768; i++)
{
- int r = (i & 0x1F) << 3;
- int g = ((i >> 5) & 0x1F) << 3;
- int b = ((i >> 10) & 0x1F) << 3;
- palette.set_pen_color(i, r, g, b);
+ int const r = i & 0x1f;
+ int const g = (i >> 5) & 0x1f;
+ int const b = (i >> 10) & 0x1f;
+ palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(megaduck_state, megaduck)
+void megaduck_state::megaduck_palette(palette_device &palette) const
{
for (int i = 0; i < 4; i++)
- palette.set_pen_color(i, palette_megaduck[i * 3 + 0], palette_megaduck[i * 3 + 1], palette_megaduck[i * 3 + 2]);
+ palette.set_pen_color(i, palette_megaduck[i]);
}
@@ -622,7 +622,7 @@ void gb_state::gameboy(machine_config &config)
screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1);
GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty);
- PALETTE(config, m_palette, 4).set_init(FUNC(gb_state::palette_init_gb));
+ PALETTE(config, m_palette, FUNC(gb_state::gb_palette), 4);
DMG_PPU(config, m_ppu, m_maincpu);
@@ -662,7 +662,7 @@ void gb_state::supergb(machine_config &config)
screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty);
- PALETTE(config, m_palette, 32768).set_init(FUNC(gb_state::palette_init_sgb));
+ PALETTE(config, m_palette, FUNC(gb_state::sgb_palette), 32768);
SGB_PPU(config, m_ppu, m_maincpu);
@@ -683,6 +683,7 @@ void gb_state::supergb(machine_config &config)
void gb_state::supergb2(machine_config &config)
{
gameboy(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &gb_state::sgb_map);
@@ -696,7 +697,7 @@ void gb_state::supergb2(machine_config &config)
screen.set_visarea(0*8, 32*8-1, 0*8, 28*8-1);
m_palette->set_entries(32768);
- m_palette->set_init(FUNC(gb_state::palette_init_sgb));
+ m_palette->set_init(FUNC(gb_state::sgb_palette));
SGB_PPU(config.replace(), m_ppu, m_maincpu);
}
@@ -706,7 +707,7 @@ void gb_state::gbpocket(machine_config &config)
gameboy(config);
/* video hardware */
- m_palette->set_init(FUNC(gb_state::palette_init_gbp));
+ m_palette->set_init(FUNC(gb_state::gbp_palette));
MGB_PPU(config.replace(), m_ppu, m_maincpu);
}
@@ -732,8 +733,7 @@ void gb_state::gbcolor(machine_config &config)
screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1);
GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty);
-
- PALETTE(config, m_palette, 32768).set_init(FUNC(gb_state::palette_init_gbc));
+ PALETTE(config, m_palette, FUNC(gb_state::gbc_palette), 32768);
CGB_PPU(config, m_ppu, m_maincpu);
@@ -772,8 +772,7 @@ void megaduck_state::megaduck(machine_config &config)
screen.set_visarea(0*8, 20*8-1, 0*8, 18*8-1);
GFXDECODE(config, "gfxdecode", m_palette, gfxdecode_device::empty);
-
- PALETTE(config, m_palette, 4).set_init(FUNC(megaduck_state::palette_init_megaduck));
+ PALETTE(config, m_palette, FUNC(megaduck_state::megaduck_palette), 4);
DMG_PPU(config, m_ppu, m_maincpu);
diff --git a/src/mame/drivers/gberet.cpp b/src/mame/drivers/gberet.cpp
index b0e931cac93..51f1e7048bb 100644
--- a/src/mame/drivers/gberet.cpp
+++ b/src/mame/drivers/gberet.cpp
@@ -426,12 +426,10 @@ MACHINE_CONFIG_START(gberet_state::gberet)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gberet_state, screen_update_gberet)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gberet)
- MCFG_PALETTE_ADD("palette", 2*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(gberet_state,gberet)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gberet);
+ PALETTE(config, m_palette, FUNC(gberet_state::gberet_palette), 2*16*16, 32);
MCFG_VIDEO_START_OVERRIDE(gberet_state,gberet)
/* sound hardware */
@@ -467,12 +465,10 @@ MACHINE_CONFIG_START(gberet_state::gberetb)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gberet_state, screen_update_gberetb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gberetb)
- MCFG_PALETTE_ADD("palette", 2*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(gberet_state,gberet)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gberetb);
+ PALETTE(config, m_palette, FUNC(gberet_state::gberet_palette), 2*16*16, 32);
MCFG_VIDEO_START_OVERRIDE(gberet_state,gberet)
/* sound hardware */
diff --git a/src/mame/drivers/gcpinbal.cpp b/src/mame/drivers/gcpinbal.cpp
index e69c4e532a5..9b02f4a3d76 100644
--- a/src/mame/drivers/gcpinbal.cpp
+++ b/src/mame/drivers/gcpinbal.cpp
@@ -371,13 +371,12 @@ MACHINE_CONFIG_START(gcpinbal_state::gcpinbal)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gcpinbal_state, screen_update_gcpinbal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gcpinbal)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gcpinbal);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
- MCFG_DEVICE_ADD("spritegen", EXCELLENT_SPRITE, 0)
+ EXCELLENT_SPRITE(config, m_sprgen, 0);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gei.cpp b/src/mame/drivers/gei.cpp
index 9af0823a872..f9642a81786 100644
--- a/src/mame/drivers/gei.cpp
+++ b/src/mame/drivers/gei.cpp
@@ -992,7 +992,7 @@ MACHINE_CONFIG_START(gei_state::getrivia)
MCFG_SCREEN_VISIBLE_AREA(48, 511-48, 16, 255-16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_GBR("palette")
+ PALETTE(config, "palette", palette_device::GBR_3BIT);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
@@ -1031,8 +1031,7 @@ MACHINE_CONFIG_START(gei_state::quizvid)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(quizvid_map)
- MCFG_DEVICE_REMOVE("palette")
- MCFG_PALETTE_ADD_3BIT_GRB("palette")
+ PALETTE(config.replace(), "palette", palette_device::GRB_3BIT);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(gei_state::gselect)
diff --git a/src/mame/drivers/geniusiq.cpp b/src/mame/drivers/geniusiq.cpp
index 9001e558c18..fc916f4daf7 100644
--- a/src/mame/drivers/geniusiq.cpp
+++ b/src/mame/drivers/geniusiq.cpp
@@ -167,8 +167,8 @@ PCB - German Version:
class geniusiq_state : public driver_device
{
public:
- geniusiq_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ geniusiq_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_cart(*this, "cartslot"),
m_rom(*this, "maincpu"),
@@ -183,6 +183,10 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(send_input);
DECLARE_INPUT_CHANGED_MEMBER(send_mouse_input);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
enum
{
@@ -198,9 +202,7 @@ private:
required_shared_ptr<uint16_t> m_vram;
required_shared_ptr<uint16_t> m_mouse_gfx;
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(geniusiq);
+ void geniusiq_palette(palette_device &palette) const;
virtual uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ16_MEMBER(input_r);
@@ -237,31 +239,30 @@ private:
};
-PALETTE_INIT_MEMBER(geniusiq_state, geniusiq)
+void geniusiq_state::geniusiq_palette(palette_device &palette) const
{
// shades need to be verified
- const uint8_t palette_val[] =
+ constexpr rgb_t palette_val[] =
{
- 0x00, 0x00, 0x00, // Black?? (used in the cursor for transparency)
- 0xff, 0xff, 0xff, // White
- 0xa0, 0xa0, 0xa0, // Light grey
- 0x7f, 0x7f, 0x7f, // Dark grey
- 0x00, 0x00, 0x00, // Black
- 0x00, 0x60, 0xff, // Sky blue
- 0x00, 0x00, 0xff, // Blue
- 0xff, 0x00, 0x00, // Red
- 0x00, 0xff, 0x00, // Green
- 0x00, 0x7f, 0x00, // Dark green
- 0xff, 0xff, 0x00, // Yellow
- 0xff, 0x7f, 0x00, // Orange
- 0x7f, 0x40, 0x00, // Brown
- 0x60, 0x40, 0x00, // Dark brown
- 0x60, 0x00, 0xff, // Mauve
- 0xff, 0x00, 0xff // Pink
+ { 0x00, 0x00, 0x00 }, // Black?? (used in the cursor for transparency)
+ { 0xff, 0xff, 0xff }, // White
+ { 0xa0, 0xa0, 0xa0 }, // Light grey
+ { 0x7f, 0x7f, 0x7f }, // Dark grey
+ { 0x00, 0x00, 0x00 }, // Black
+ { 0x00, 0x60, 0xff }, // Sky blue
+ { 0x00, 0x00, 0xff }, // Blue
+ { 0xff, 0x00, 0x00 }, // Red
+ { 0x00, 0xff, 0x00 }, // Green
+ { 0x00, 0x7f, 0x00 }, // Dark green
+ { 0xff, 0xff, 0x00 }, // Yellow
+ { 0xff, 0x7f, 0x00 }, // Orange
+ { 0x7f, 0x40, 0x00 }, // Brown
+ { 0x60, 0x40, 0x00 }, // Dark brown
+ { 0x60, 0x00, 0xff }, // Mauve
+ { 0xff, 0x00, 0xff } // Pink
};
- for (int i=0; i<ARRAY_LENGTH(palette_val)/3; i++)
- palette.set_pen_color(i, palette_val[i*3], palette_val[i*3+1], palette_val[i*3+2]);
+ palette.set_pen_colors(0, palette_val);
}
@@ -712,8 +713,7 @@ MACHINE_CONFIG_START(geniusiq_state::iq128)
MCFG_SCREEN_UPDATE_DRIVER( geniusiq_state, screen_update )
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(geniusiq_state, geniusiq)
+ PALETTE(config, "palette", FUNC(geniusiq_state::geniusiq_palette), 16);
/* internal flash */
AMD_29F010(config, "flash");
diff --git a/src/mame/drivers/ghosteo.cpp b/src/mame/drivers/ghosteo.cpp
index 8cdc8e2745c..f893214d78c 100644
--- a/src/mame/drivers/ghosteo.cpp
+++ b/src/mame/drivers/ghosteo.cpp
@@ -613,7 +613,7 @@ void ghosteo_state::ghosteo(machine_config &config)
screen.set_visarea(0, 320-1, 0, 256-1);
screen.set_screen_update("s3c2410", FUNC(s3c2410_device::screen_update));
- PALETTE(config, "palette", 256);
+ PALETTE(config, "palette").set_entries(256);
S3C2410(config, m_s3c2410, 12000000);
m_s3c2410->set_palette_tag("palette");
diff --git a/src/mame/drivers/giclassic.cpp b/src/mame/drivers/giclassic.cpp
index 98ae41bc320..0e06edbaa0b 100644
--- a/src/mame/drivers/giclassic.cpp
+++ b/src/mame/drivers/giclassic.cpp
@@ -57,8 +57,8 @@
class giclassic_state : public driver_device
{
public:
- giclassic_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ giclassic_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_k056832(*this, "k056832"),
m_palette(*this, "palette")
@@ -71,8 +71,6 @@ private:
required_device<k056832_device> m_k056832;
required_device<palette_device> m_palette;
- DECLARE_PALETTE_INIT(giclassic);
-
INTERRUPT_GEN_MEMBER(giclassic_interrupt);
virtual void machine_start() override;
@@ -311,11 +309,10 @@ MACHINE_CONFIG_START(giclassic_state::giclassic)
MCFG_SCREEN_SIZE(600, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 599, 0, 383)
MCFG_SCREEN_UPDATE_DRIVER(giclassic_state, screen_update_giclassic)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 256);
+ m_palette->enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(giclassic_state::tile_callback), this);
@@ -337,11 +334,10 @@ MACHINE_CONFIG_START(giclassicsvr_state::giclassvr)
MCFG_SCREEN_SIZE(600, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 599, 0, 383)
MCFG_SCREEN_UPDATE_DRIVER(giclassicsvr_state, screen_update_giclassicsvr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 16384)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 16384);
+ m_palette->enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(giclassicsvr_state::tile_callback), this);
diff --git a/src/mame/drivers/gijoe.cpp b/src/mame/drivers/gijoe.cpp
index 7a809a57e95..70ae9c16b9e 100644
--- a/src/mame/drivers/gijoe.cpp
+++ b/src/mame/drivers/gijoe.cpp
@@ -313,9 +313,7 @@ void gijoe_state::gijoe(machine_config &config)
screen.set_screen_update(FUNC(gijoe_state::screen_update_gijoe));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- palette.enable_shadows();
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(gijoe_state::tile_callback), this);
diff --git a/src/mame/drivers/ginganin.cpp b/src/mame/drivers/ginganin.cpp
index b0979fb5912..e8953a789e4 100644
--- a/src/mame/drivers/ginganin.cpp
+++ b/src/mame/drivers/ginganin.cpp
@@ -267,11 +267,10 @@ MACHINE_CONFIG_START(ginganin_state::ginganin)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0 + 16 , 255 - 16)
MCFG_SCREEN_UPDATE_DRIVER(ginganin_state, screen_update_ginganin)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ginganin)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_ginganin)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/glass.cpp b/src/mame/drivers/glass.cpp
index e6b01d1b103..89244939895 100644
--- a/src/mame/drivers/glass.cpp
+++ b/src/mame/drivers/glass.cpp
@@ -241,11 +241,10 @@ MACHINE_CONFIG_START(glass_state::glass)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 368-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(glass_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_glass)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_glass)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gluck2.cpp b/src/mame/drivers/gluck2.cpp
index cd370910195..66cec436edf 100644
--- a/src/mame/drivers/gluck2.cpp
+++ b/src/mame/drivers/gluck2.cpp
@@ -207,12 +207,13 @@
class gluck2_state : public driver_device
{
public:
- gluck2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
+ gluck2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_videoram(*this, "videoram"),
- m_colorram(*this, "colorram") { }
+ m_colorram(*this, "colorram")
+ { }
void gluck2(machine_config &config);
@@ -505,7 +506,7 @@ MACHINE_CONFIG_START(gluck2_state::gluck2)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gluck2)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 256);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/16)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/gmaster.cpp b/src/mame/drivers/gmaster.cpp
index 483beef069f..9c9104b9b8c 100644
--- a/src/mame/drivers/gmaster.cpp
+++ b/src/mame/drivers/gmaster.cpp
@@ -33,7 +33,7 @@ public:
void init_gmaster() { memset(&m_video, 0, sizeof(m_video)); memset(m_ram, 0, sizeof(m_ram)); }
private:
- DECLARE_PALETTE_INIT(gmaster);
+ void gmaster_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(gmaster_io_r);
DECLARE_WRITE8_MEMBER(gmaster_io_w);
DECLARE_READ8_MEMBER(gmaster_portb_r);
@@ -260,12 +260,11 @@ static INPUT_PORTS_START( gmaster )
INPUT_PORTS_END
-/* palette in red, green, blue tribles */
-static const unsigned char gmaster_palette[2][3] =
+static constexpr rgb_t gmaster_pens[2] =
{
#if 1
{ 130, 159, 166 },
- { 45,45,43 }
+ { 45, 45, 43 }
#else
{ 255,255,255 },
{ 0, 0, 0 }
@@ -273,14 +272,9 @@ static const unsigned char gmaster_palette[2][3] =
};
-PALETTE_INIT_MEMBER(gmaster_state, gmaster)
+void gmaster_state::gmaster_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 2; i++)
- {
- palette.set_pen_color(i, gmaster_palette[i][0], gmaster_palette[i][1], gmaster_palette[i][2]);
- }
+ palette.set_pen_colors(0, gmaster_pens);
}
@@ -354,8 +348,7 @@ MACHINE_CONFIG_START(gmaster_state::gmaster)
screen.set_screen_update(FUNC(gmaster_state::screen_update_gmaster));
screen.set_palette("palette");
- MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(gmaster_palette))
- MCFG_PALETTE_INIT_OWNER(gmaster_state, gmaster)
+ PALETTE(config, "palette", FUNC(gmaster_state::gmaster_palette), ARRAY_LENGTH(gmaster_pens));
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(0, "mono", 0.50);
diff --git a/src/mame/drivers/gng.cpp b/src/mame/drivers/gng.cpp
index bbd9b6e9ba2..11b6df45206 100644
--- a/src/mame/drivers/gng.cpp
+++ b/src/mame/drivers/gng.cpp
@@ -406,12 +406,11 @@ MACHINE_CONFIG_START(gng_state::gng)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gng_state, screen_update_gng)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gng)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/go2000.cpp b/src/mame/drivers/go2000.cpp
index de547825625..4d41829dfbd 100644
--- a/src/mame/drivers/go2000.cpp
+++ b/src/mame/drivers/go2000.cpp
@@ -45,8 +45,8 @@ Notes:
class go2000_state : public driver_device
{
public:
- go2000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ go2000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_videoram2(*this, "videoram2"),
m_maincpu(*this, "maincpu"),
@@ -54,7 +54,8 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void go2000(machine_config &config);
@@ -354,7 +355,7 @@ MACHINE_CONFIG_START(go2000_state::go2000)
MCFG_DEVICE_IO_MAP(go2000_sound_io)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_go2000)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_go2000);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -362,10 +363,9 @@ MACHINE_CONFIG_START(go2000_state::go2000)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(go2000_state, screen_update_go2000)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
GENERIC_LATCH_8(config, m_soundlatch);
diff --git a/src/mame/drivers/goal92.cpp b/src/mame/drivers/goal92.cpp
index 4762d55d954..e2d09b2b45f 100644
--- a/src/mame/drivers/goal92.cpp
+++ b/src/mame/drivers/goal92.cpp
@@ -316,11 +316,10 @@ MACHINE_CONFIG_START(goal92_state::goal92)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) // black border at bottom is a game bug...
MCFG_SCREEN_UPDATE_DRIVER(goal92_state, screen_update_goal92)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, goal92_state, screen_vblank_goal92))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_goal92)
- MCFG_PALETTE_ADD("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_goal92);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 128*16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/goindol.cpp b/src/mame/drivers/goindol.cpp
index 388b1976c03..80ad3052be6 100644
--- a/src/mame/drivers/goindol.cpp
+++ b/src/mame/drivers/goindol.cpp
@@ -254,10 +254,10 @@ MACHINE_CONFIG_START(goindol_state::goindol)
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(goindol_state, screen_update_goindol)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_goindol)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/goldngam.cpp b/src/mame/drivers/goldngam.cpp
index c5a74e76aa3..5ccc4a504a5 100644
--- a/src/mame/drivers/goldngam.cpp
+++ b/src/mame/drivers/goldngam.cpp
@@ -618,7 +618,7 @@ void goldngam_state::base(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx_goldngam);
- PALETTE(config, "palette", 512).set_init(DEVICE_SELF, FUNC(goldngam_state::palette_init));
+ PALETTE(config, "palette", FUNC(goldngam_state::palette_init), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp
index 19d876fe924..ea4c97d9cde 100644
--- a/src/mame/drivers/goldnpkr.cpp
+++ b/src/mame/drivers/goldnpkr.cpp
@@ -1301,16 +1301,15 @@ public:
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_pia(*this, "pia%u", 0U),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_discrete(*this, "discrete"),
m_ay8910(*this, "ay8910"),
- m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette"),
m_lamps(*this, "lamp%u", 0U)
{ }
- void goldnpkr_base(machine_config &config);
void wildcard(machine_config &config);
void wildcrdb(machine_config &config);
void witchcrd(machine_config &config);
@@ -1349,17 +1348,25 @@ public:
DECLARE_WRITE8_MEMBER(sound_w);
DECLARE_WRITE8_MEMBER(mux_w);
- DECLARE_PALETTE_INIT(witchcrd);
-
uint32_t screen_update_goldnpkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
- required_device<cpu_device> m_maincpu;
- required_device_array<pia6821_device, 2> m_pia;
+ virtual void machine_start() override { m_lamps.resolve(); }
+
+ virtual void video_start() override;
DECLARE_WRITE8_MEMBER(goldnpkr_videoram_w);
DECLARE_WRITE8_MEMBER(goldnpkr_colorram_w);
+ void witchcrd_palette(palette_device &palette) const;
+
+ void goldnpkr_base(machine_config &config);
+
+ required_device<cpu_device> m_maincpu;
+ required_device_array<pia6821_device, 2> m_pia;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
private:
DECLARE_READ8_MEMBER(goldnpkr_mux_port_r);
DECLARE_WRITE8_MEMBER(mux_port_w);
@@ -1375,10 +1382,9 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(wcrdxtnd_get_bg_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(goldnpkr);
+ void goldnpkr_palette(palette_device &palette) const;
DECLARE_VIDEO_START(wcrdxtnd);
- DECLARE_PALETTE_INIT(wcrdxtnd);
+ void wcrdxtnd_palette(palette_device &palette) const;
DECLARE_MACHINE_START(mondial);
DECLARE_MACHINE_RESET(mondial);
@@ -1395,14 +1401,10 @@ private:
void witchcrd_falcon_map(address_map &map);
void witchcrd_map(address_map &map);
- virtual void machine_start() override { m_lamps.resolve(); }
-
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
optional_device<discrete_device> m_discrete;
optional_device<ay8910_device> m_ay8910;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
output_finder<5> m_lamps;
tilemap_t *m_bg_tilemap;
@@ -1511,9 +1513,8 @@ uint32_t goldnpkr_state::screen_update_goldnpkr(screen_device &screen, bitmap_in
return 0;
}
-PALETTE_INIT_MEMBER(goldnpkr_state, goldnpkr)
+void goldnpkr_state::goldnpkr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
/* prom bits
7654 3210
---- ---x red component.
@@ -1522,42 +1523,36 @@ PALETTE_INIT_MEMBER(goldnpkr_state, goldnpkr)
---- x--- intensity.
xxxx ---- unused.
*/
- int i;
- /* 0000IBGR */
- if (color_prom == nullptr) return;
+ // 0000IBGR
+ uint8_t const *const color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b, inten, intenmin, intenmax;
+ constexpr int intenmin = 0xe0;
+// constexpr int intenmin = 0xc2; // 2.5 Volts (75.757575% of the whole range)
+ constexpr int intenmax = 0xff; // 3.3 Volts (the whole range)
- intenmin = 0xe0;
-// intenmin = 0xc2; /* 2.5 Volts (75.757575% of the whole range) */
- intenmax = 0xff; /* 3.3 Volts (the whole range) */
+ // intensity component
+ int const inten = BIT(color_prom[i], 3);
- /* intensity component */
- inten = (color_prom[i] >> 3) & 0x01;
+ // red component
+ int const r = BIT(color_prom[i], 0) * (inten ? intenmax : intenmin);
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- r = (bit0 * intenmin) + (inten * (bit0 * (intenmax - intenmin)));
-
- /* green component */
- bit1 = (color_prom[i] >> 1) & 0x01;
- g = (bit1 * intenmin) + (inten * (bit1 * (intenmax - intenmin)));
-
- /* blue component */
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = (bit2 * intenmin) + (inten * (bit2 * (intenmax - intenmin)));
+ // green component
+ int const g = BIT(color_prom[i], 1) * (inten ? intenmax : intenmin);
+ // blue component
+ int const b = BIT(color_prom[i], 2) * (inten ? intenmax : intenmin);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(goldnpkr_state,witchcrd)
+void goldnpkr_state::witchcrd_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
/*
This hardware has a feature called BLUE KILLER.
Using the original intensity line, the PCB has a bridge
@@ -1573,39 +1568,32 @@ PALETTE_INIT_MEMBER(goldnpkr_state,witchcrd)
---- x--- blue killer.
xxxx ---- unused.
*/
- int i;
- /* 0000KBGR */
+ // 0000KBGR
+ uint8_t const *const color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- if (color_prom == nullptr) return;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b, bk;
-
- /* blue killer (from schematics) */
- bit3 = (color_prom[i] >> 3) & 0x01;
- bk = bit3;
+ // blue killer (from schematics)
+ int const bk = BIT(color_prom[i], 3);
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- r = (bit0 * 0xff);
+ // red component
+ int const r = BIT(color_prom[i], 0) * 0xff;
- /* green component */
- bit1 = (color_prom[i] >> 1) & 0x01;
- g = (bit1 * 0xff);
+ // green component
+ int const g = BIT(color_prom[i], 1) * 0xff;
- /* blue component */
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = bk * (bit2 * 0xff);
+ // blue component
+ int const b = bk * BIT(color_prom[i], 2) * 0xff;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(goldnpkr_state,wcrdxtnd)
+void goldnpkr_state::wcrdxtnd_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
/*
Using the original intensity line, the PCB has a bridge
that allow (as default) turn the background dark blue.
@@ -1617,32 +1605,25 @@ PALETTE_INIT_MEMBER(goldnpkr_state,wcrdxtnd)
---- x--- intensity / blue killer.
xxxx ---- unused.
*/
- int i;
+ // 0000KBGR
+ uint8_t const *const color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- /* 0000KBGR */
-
- if (color_prom == nullptr) return;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b, bk;
+ // blue killer (from schematics)
+ int const bk = BIT(color_prom[i], 3);
- /* blue killer (from schematics) */
- bit3 = (color_prom[i] >> 3) & 0x01;
- bk = bit3;
+ // red component
+ int const r = BIT(color_prom[i], 0) * 0xff;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- r = (bit0 * 0xff);
+ // green component
+ int const g = BIT(color_prom[i], 1) * 0xff;
- /* green component */
- bit1 = (color_prom[i] >> 1) & 0x01;
- g = (bit1 * 0xff);
-
- /* blue component */
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = bk * (bit2 * 0xff);
- //if ((b == 0) & (bk = 1)) --> needs better implementation
+ // blue component
+ int b = bk * BIT(color_prom[i], 2) * 0xff;
+ //if (!b & bk) --> needs better implementation
// b = 0x3f;
palette.set_pen_color(i, rgb_t(r, g, b));
@@ -4348,7 +4329,7 @@ void goldnpkr_state::goldnpkr_base(machine_config &config)
crtc.out_vsync_callback().set_inputline(m_maincpu, INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_goldnpkr);
- PALETTE(config, m_palette, 256).set_init(FUNC(goldnpkr_state::palette_init_goldnpkr));
+ PALETTE(config, m_palette, FUNC(goldnpkr_state::goldnpkr_palette), 256);
}
void goldnpkr_state::goldnpkr(machine_config &config)
@@ -4386,7 +4367,7 @@ void goldnpkr_state::witchcrd(machine_config &config)
m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w));
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4404,7 +4385,7 @@ void goldnpkr_state::wcfalcon(machine_config &config)
m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::wcfalcon_snd_w)); /* port A out, custom handler due to address + data are muxed */
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4422,7 +4403,9 @@ void goldnpkr_state::wildcard(machine_config &config)
m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w));
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+// MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wildcard)
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
+// MCFG_VIDEO_START_OVERRIDE(goldnpkr_state,wildcard)
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4441,7 +4424,7 @@ void goldnpkr_state::wcrdxtnd(machine_config &config)
/* video hardware */
m_gfxdecode->set_info(gfx_wcrdxtnd);
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_wcrdxtnd));
+ m_palette->set_init(FUNC(goldnpkr_state::wcrdxtnd_palette));
MCFG_VIDEO_START_OVERRIDE(goldnpkr_state, wcrdxtnd)
/* sound hardware */
@@ -4464,7 +4447,9 @@ void goldnpkr_state::wildcrdb(machine_config &config)
m_pia[1]->writepa_handler().set(FUNC(goldnpkr_state::wcfalcon_snd_w));
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+// MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wildcard)
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
+// MCFG_VIDEO_START_OVERRIDE(goldnpkr_state,wildcard)
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4482,7 +4467,7 @@ void goldnpkr_state::genie(machine_config &config)
m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w));
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4500,7 +4485,7 @@ void goldnpkr_state::geniea(machine_config &config)
// m_pia[0]->writepa_handler().set(FUNC(goldnpkr_state::mux_port_w));
/* video hardware */
- m_palette->set_init(FUNC(goldnpkr_state::palette_init_witchcrd));
+ m_palette->set_init(FUNC(goldnpkr_state::witchcrd_palette));
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -4698,7 +4683,7 @@ MACHINE_CONFIG_START(blitz_state::megadpkr)
MCFG_SCREEN_SIZE((32)*8, (32)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldnpkr_state, screen_update_goldnpkr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", CPU_CLOCK));
crtc.set_screen("screen");
@@ -4706,9 +4691,8 @@ MACHINE_CONFIG_START(blitz_state::megadpkr)
crtc.set_char_width(8);
crtc.out_vsync_callback().set_inputline(m_maincpu, 0);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_goldnpkr)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldnpkr_state, witchcrd)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_goldnpkr);
+ PALETTE(config, m_palette, FUNC(blitz_state::witchcrd_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp
index 7a31ddf98f9..98efb939458 100644
--- a/src/mame/drivers/goldstar.cpp
+++ b/src/mame/drivers/goldstar.cpp
@@ -8457,12 +8457,11 @@ MACHINE_CONFIG_START(goldstar_state::goldstar)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_goldstar)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_goldstar);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -8494,12 +8493,11 @@ MACHINE_CONFIG_START(goldstar_state::goldstbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bl)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bl);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -8540,13 +8538,13 @@ MACHINE_CONFIG_START(sanghopm_state::star100)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sanghopm_state, screen_update_sangho)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_PALETTE_ADD("palette", 0x100)
+ PALETTE(config, m_palette).set_entries(0x100);
RAMDAC(config, "ramdac", 0, "palette").set_addrmap(0, &sanghopm_state::ramdac_map);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sangho)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sangho);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
@@ -8581,12 +8579,11 @@ MACHINE_CONFIG_START(goldstar_state::super9)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_super9)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_super9);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -8603,61 +8600,46 @@ MACHINE_CONFIG_START(goldstar_state::super9)
MACHINE_CONFIG_END
-PALETTE_INIT_MEMBER(goldstar_state, cm)
+void goldstar_state::cm_palette(palette_device &palette) const
{
- /* BBGGGRRR */
-
- int i;
-
- for (i = 0; i < 0x100; i++)
+ // BBGGGRRR
+ uint8_t const *const proms = memregion("proms")->base();
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t data;
- uint8_t*proms = memregion("proms")->base();
-
- data = proms[0x000 + i] | (proms[0x100 + i] << 4);
-
+ uint8_t const data = proms[0x000 + i] | (proms[0x100 + i] << 4);
palette.set_pen_color(i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
}
}
-PALETTE_INIT_MEMBER(goldstar_state, cmast91)
+void goldstar_state::cmast91_palette(palette_device &palette) const
{
- int i;
- for (i = 0; i < 0x100; i++)
+ uint8_t const *const proms = memregion("proms")->base();
+ for (int i = 0; i < 0x100; i++)
{
- int r,g,b;
-
- uint8_t*proms = memregion("proms")->base();
-
- b = proms[0x000 + i] << 4;
- g = proms[0x100 + i] << 4;
- r = proms[0x200 + i] << 4;
+ int const b = pal4bit(proms[0x000 + i]);
+ int const g = pal4bit(proms[0x100 + i]);
+ int const r = pal4bit(proms[0x200 + i]);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(goldstar_state, lucky8)
+void goldstar_state::lucky8_palette(palette_device &palette) const
{
- /* BBGGGRRR */
-
- int i;
- uint8_t data;
- uint8_t *proms;
+ // BBGGGRRR
+ uint8_t const *proms;
proms = memregion("proms")->base();
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- data = proms[0x000 + i] | (proms[0x100 + i] << 4);
-
+ uint8_t const data = proms[0x000 + i] | (proms[0x100 + i] << 4);
palette.set_pen_color(i, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
}
proms = memregion("proms2")->base();
- for (i=0; i < 0x20; i++)
+ for (int i = 0; i < 0x20; i++)
{
- data = proms[i];
-
+ uint8_t const data = proms[i];
palette.set_pen_color(i + 0x80, pal3bit(data >> 0), pal3bit(data >> 3), pal2bit(data >> 6));
}
}
@@ -8689,12 +8671,11 @@ MACHINE_CONFIG_START(cb3_state::ncb3)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
@@ -8764,12 +8745,11 @@ MACHINE_CONFIG_START(goldstar_state::wcherry)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cb3e)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cb3e);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -8811,12 +8791,11 @@ MACHINE_CONFIG_START(cmaster_state::cm)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cmbitmap)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state,cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cmbitmap);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, cherrym)
@@ -8859,12 +8838,11 @@ MACHINE_CONFIG_START(goldstar_state::cmast91)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_cmast91)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cmast91)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, cmast91)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cmast91);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cmast91_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, cherrym)
@@ -8915,13 +8893,11 @@ MACHINE_CONFIG_START(wingco_state::lucky8)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, wingco_state, masked_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette)).set_format(palette_device::BGR_233, 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -8970,12 +8946,11 @@ MACHINE_CONFIG_START(wingco_state::bingowng)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(wingco_state, screen_update_bingowng)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, wingco_state, masked_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(wingco_state, bingowng)
@@ -9051,14 +9026,14 @@ MACHINE_CONFIG_END
-PALETTE_INIT_MEMBER(wingco_state, magodds)
+void wingco_state::magodds_palette(palette_device &palette) const
{
+ uint8_t const *const proms = memregion("proms")->base();
for (int i = 0; i < 0x100; i++)
{
- uint8_t *proms = memregion("proms")->base();
- uint8_t b = proms[0x000 + i] << 4;
- uint8_t g = proms[0x100 + i] << 4;
- uint8_t r = proms[0x200 + i] << 4;
+ uint8_t const b = pal4bit(proms[0x000 + i]);
+ uint8_t const g = pal4bit(proms[0x100 + i]);
+ uint8_t const r = pal4bit(proms[0x200 + i]);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -9094,12 +9069,11 @@ MACHINE_CONFIG_START(wingco_state::magodds)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(wingco_state, screen_update_magical)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, wingco_state, masked_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_magodds)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(wingco_state, magodds)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_magodds);
+ PALETTE(config, m_palette, FUNC(wingco_state::magodds_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(wingco_state, magical)
@@ -9145,12 +9119,11 @@ MACHINE_CONFIG_START(goldstar_state::kkotnoli)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -9185,12 +9158,11 @@ MACHINE_CONFIG_START(goldstar_state::ladylinr)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -9235,12 +9207,11 @@ MACHINE_CONFIG_START(wingco_state::wcat3)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -9286,12 +9257,11 @@ MACHINE_CONFIG_START(cmaster_state::amcoe1)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cm)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state,cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cm);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, cherrym)
@@ -9343,12 +9313,11 @@ MACHINE_CONFIG_START(cmaster_state::amcoe2)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cm)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state,cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cm);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, cherrym)
@@ -9394,12 +9363,11 @@ MACHINE_CONFIG_START(unkch_state::unkch)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(unkch_state, screen_update_unkch)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, unkch_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unkch)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_unkch);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 512);
MCFG_VIDEO_START_OVERRIDE(unkch_state, unkch)
@@ -9431,12 +9399,11 @@ MACHINE_CONFIG_START(goldstar_state::pkrmast)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(HOLDLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pkrmast)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, cm)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pkrmast);
+ PALETTE(config, m_palette, FUNC(goldstar_state::cm_palette), 256);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, cherrym)
@@ -9468,12 +9435,11 @@ MACHINE_CONFIG_START(unkch_state::megaline)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_megaline)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_megaline);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
// NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_VIDEO_START_OVERRIDE(goldstar_state,goldstar)
@@ -9516,12 +9482,11 @@ MACHINE_CONFIG_START(unkch_state::bonusch)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(goldstar_state, screen_update_goldstar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_megaline)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_megaline);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette), 256);
MCFG_VIDEO_START_OVERRIDE(goldstar_state, goldstar)
@@ -9568,13 +9533,11 @@ MACHINE_CONFIG_START(unkch_state::feverch)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(unkch_state, screen_update_unkch)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ncb3)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
- MCFG_PALETTE_INIT_OWNER(goldstar_state, lucky8)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ncb3);
+ PALETTE(config, m_palette, FUNC(goldstar_state::lucky8_palette)).set_format(palette_device::BGR_233, 256);
MCFG_VIDEO_START_OVERRIDE(unkch_state, unkch)
diff --git a/src/mame/drivers/gomoku.cpp b/src/mame/drivers/gomoku.cpp
index 47c09d9fec8..43ef834bdfc 100644
--- a/src/mame/drivers/gomoku.cpp
+++ b/src/mame/drivers/gomoku.cpp
@@ -142,9 +142,8 @@ MACHINE_CONFIG_START(gomoku_state::gomoku)
MCFG_SCREEN_UPDATE_DRIVER(gomoku_state, screen_update_gomoku)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gomoku)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(gomoku_state, gomoku)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_gomoku);
+ PALETTE(config, "palette", FUNC(gomoku_state::gomoku_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/good.cpp b/src/mame/drivers/good.cpp
index 44daeb366eb..0c34bc2de21 100644
--- a/src/mame/drivers/good.cpp
+++ b/src/mame/drivers/good.cpp
@@ -43,8 +43,8 @@ voice.rom - VOICE ROM
class good_state : public driver_device
{
public:
- good_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ good_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_fg_tilemapram(*this, "fg_tilemapram"),
m_bg_tilemapram(*this, "bg_tilemapram"),
m_maincpu(*this, "maincpu"),
@@ -54,6 +54,9 @@ public:
void good(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
/* memory pointers */
required_shared_ptr<uint16_t> m_fg_tilemapram;
@@ -66,7 +69,6 @@ private:
DECLARE_WRITE16_MEMBER(bg_tilemapram_w);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void video_start() override;
uint32_t screen_update_good(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -295,7 +297,7 @@ MACHINE_CONFIG_START(good_state::good)
MCFG_DEVICE_PROGRAM_MAP(good_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", good_state, irq2_line_hold)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_good)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_good);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -305,9 +307,7 @@ MACHINE_CONFIG_START(good_state::good)
MCFG_SCREEN_UPDATE_DRIVER(good_state, screen_update_good)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x400);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/goodejan.cpp b/src/mame/drivers/goodejan.cpp
index 693c009b0ac..f9e8576cb28 100644
--- a/src/mame/drivers/goodejan.cpp
+++ b/src/mame/drivers/goodejan.cpp
@@ -85,8 +85,8 @@ Secret menu hack [totmejan only] (I couldn't find official way to enter, so it's
class goodejan_state : public driver_device, protected seibu_sound_common
{
public:
- goodejan_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ goodejan_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
@@ -95,7 +95,8 @@ public:
m_sc1_vram(*this, "sc1_vram"),
m_sc2_vram(*this, "sc2_vram"),
m_sc3_vram(*this, "sc3_vram"),
- m_spriteram16(*this, "sprite_ram") { }
+ m_spriteram16(*this, "sprite_ram")
+ { }
void totmejan(machine_config &config);
void goodejan(machine_config &config);
@@ -670,16 +671,15 @@ MACHINE_CONFIG_START(goodejan_state::goodejan)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) //TODO: dynamic resolution
MCFG_SCREEN_UPDATE_DRIVER(goodejan_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, goodejan_state, vblank_irq))
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(goodejan_state::layer_en_w));
m_crtc->layer_scroll_callback().set(FUNC(goodejan_state::layer_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_goodejan)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_goodejan);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x1000);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gotcha.cpp b/src/mame/drivers/gotcha.cpp
index 66494cdbfad..d910eb2fff4 100644
--- a/src/mame/drivers/gotcha.cpp
+++ b/src/mame/drivers/gotcha.cpp
@@ -280,9 +280,8 @@ MACHINE_CONFIG_START(gotcha_state::gotcha)
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)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_gotcha);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 768);
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(1);
diff --git a/src/mame/drivers/gottlieb.cpp b/src/mame/drivers/gottlieb.cpp
index 3add7405656..624e1756c34 100644
--- a/src/mame/drivers/gottlieb.cpp
+++ b/src/mame/drivers/gottlieb.cpp
@@ -1775,7 +1775,7 @@ void gottlieb_state::gottlieb_core(machine_config &config)
m_screen->set_screen_update(FUNC(gottlieb_state::screen_update));
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
// basic speaker configuration
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/gotya.cpp b/src/mame/drivers/gotya.cpp
index c1106e010a0..cae7818c430 100644
--- a/src/mame/drivers/gotya.cpp
+++ b/src/mame/drivers/gotya.cpp
@@ -228,9 +228,7 @@ void gotya_state::gotya(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gotya);
- PALETTE(config, m_palette, 16*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(gotya_state::palette_init_gotya));
+ PALETTE(config, m_palette, FUNC(gotya_state::gotya_palette), 16*4, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/goupil.cpp b/src/mame/drivers/goupil.cpp
index 43bfa1650a3..13a1c103dfd 100644
--- a/src/mame/drivers/goupil.cpp
+++ b/src/mame/drivers/goupil.cpp
@@ -134,7 +134,6 @@ private:
class goupil_g2_state : public goupil_base_state
{
public:
-
goupil_g2_state(const machine_config &mconfig, device_type type, const char *tag)
: goupil_base_state(mconfig, type, tag)
, m_visu24x80_ram(*this, RAM_TAG)
@@ -574,7 +573,7 @@ void goupil_g1_state::goupil_g1(machine_config &config)
m_screen->set_size(64*8, 16*(8+4));
m_screen->set_visarea(0, 64*8-1, 0, 16*(8+4)-1);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
EF9364(config, m_ef9364, VIDEO_CLOCK);
m_ef9364->set_palette_tag("palette");
@@ -598,8 +597,7 @@ void goupil_g2_state::goupil_g2(machine_config &config)
m_screen->set_size((80*8), (24*(8+4)));
m_screen->set_visarea(0, (80*8)-1, 0, (24*(8+4))-1);
- PALETTE(config, m_palette, 3);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
mc6845_device &crtc(MC6845(config, "crtc", 14.318181_MHz_XTAL / 8));
crtc.set_show_border_area(false);
diff --git a/src/mame/drivers/gradius3.cpp b/src/mame/drivers/gradius3.cpp
index 19184345d82..1b793f364bb 100644
--- a/src/mame/drivers/gradius3.cpp
+++ b/src/mame/drivers/gradius3.cpp
@@ -307,9 +307,7 @@ void gradius3_state::gradius3(machine_config &config)
screen.set_screen_update(FUNC(gradius3_state::screen_update_gradius3));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
- palette.enable_shadows();
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 2048).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/grchamp.cpp b/src/mame/drivers/grchamp.cpp
index 924f30b56ba..76df4032055 100644
--- a/src/mame/drivers/grchamp.cpp
+++ b/src/mame/drivers/grchamp.cpp
@@ -759,9 +759,8 @@ MACHINE_CONFIG_START(grchamp_state::grchamp)
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_grchamp)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(grchamp_state, grchamp)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_grchamp);
+ PALETTE(config, m_palette, FUNC(grchamp_state::grchamp_palette), 32);
MCFG_SCREEN_ADD(m_screen, RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
@@ -772,8 +771,7 @@ MACHINE_CONFIG_START(grchamp_state::grchamp)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ay8910_device &ay1(AY8910(config, "ay1", SOUND_CLOCK/4)); /* 3B */
ay1.port_a_write_callback().set(FUNC(grchamp_state::portA_0_w));
diff --git a/src/mame/drivers/grfd2301.cpp b/src/mame/drivers/grfd2301.cpp
index 967a1a1161a..2e0dc245288 100644
--- a/src/mame/drivers/grfd2301.cpp
+++ b/src/mame/drivers/grfd2301.cpp
@@ -44,7 +44,7 @@ public:
, m_p_videoram(*this, "videoram")
, m_maincpu(*this, "maincpu")
, m_p_chargen(*this, "chargen")
- { }
+ { }
void grfd2301(machine_config &config);
@@ -131,7 +131,7 @@ MACHINE_CONFIG_START(grfd2301_state::grfd2301)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
ROM_START( grfd2301 )
diff --git a/src/mame/drivers/gridcomp.cpp b/src/mame/drivers/gridcomp.cpp
index 2c5d357fa3f..6b3c59c609e 100644
--- a/src/mame/drivers/gridcomp.cpp
+++ b/src/mame/drivers/gridcomp.cpp
@@ -387,9 +387,9 @@ MACHINE_CONFIG_START(gridcomp_state::grid1101)
MCFG_SCREEN_UPDATE_DRIVER(gridcomp_state, screen_update_110x)
MCFG_SCREEN_RAW_PARAMS(XTAL(15'000'000)/2, 424, 0, 320, 262, 0, 240) // XXX 66 Hz refresh
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(I80130_TAG, i80130_device, ir3_w))
-
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+
+ PALETTE(config, "palette", palette_device::MONOCHROME);
grid_keyboard_device &keyboard(GRID_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(gridcomp_state::kbd_put));
diff --git a/src/mame/drivers/gridlee.cpp b/src/mame/drivers/gridlee.cpp
index 4bd8b56548e..b1ccf5555c1 100644
--- a/src/mame/drivers/gridlee.cpp
+++ b/src/mame/drivers/gridlee.cpp
@@ -419,8 +419,7 @@ void gridlee_state::gridlee(machine_config &config)
m_screen->set_screen_update(FUNC(gridlee_state::screen_update_gridlee));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_init(FUNC(gridlee_state::palette_init_gridlee));
+ PALETTE(config, m_palette, FUNC(gridlee_state::gridlee_palette), 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/groundfx.cpp b/src/mame/drivers/groundfx.cpp
index 9bae2e20283..145378de015 100644
--- a/src/mame/drivers/groundfx.cpp
+++ b/src/mame/drivers/groundfx.cpp
@@ -268,11 +268,10 @@ MACHINE_CONFIG_START(groundfx_state::groundfx)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 3*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(groundfx_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_groundfx)
- MCFG_PALETTE_ADD("palette", 16384)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_groundfx);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 16384);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(2);
diff --git a/src/mame/drivers/gstream.cpp b/src/mame/drivers/gstream.cpp
index 7fd776c0629..e24cc45e37b 100644
--- a/src/mame/drivers/gstream.cpp
+++ b/src/mame/drivers/gstream.cpp
@@ -836,7 +836,6 @@ MACHINE_CONFIG_START(gstream_state::gstream)
MCFG_DEVICE_IO_MAP(gstream_io)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", gstream_state, irq0_line_hold)
-
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
/* video hardware */
@@ -847,10 +846,9 @@ MACHINE_CONFIG_START(gstream_state::gstream)
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update)
- MCFG_PALETTE_ADD("palette", 0x1000 + 0x400 + 0x400 + 0x400) // sprites + 3 bg layers
- MCFG_PALETTE_FORMAT(BBBBBGGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_565, 0x1000 + 0x400 + 0x400 + 0x400); // sprites + 3 bg layers
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gstream)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gstream);
SPEAKER(config, "mono").front_center();
@@ -879,9 +877,9 @@ MACHINE_CONFIG_START(gstream_state::x2222)
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(gstream_state, screen_update)
- MCFG_PALETTE_ADD_BBBBBGGGGGGRRRRR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_565);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_x2222)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_x2222);
// unknown sound hw (no sound roms dumped)
diff --git a/src/mame/drivers/gstriker.cpp b/src/mame/drivers/gstriker.cpp
index 72f3743d6d2..8735eaf9f7d 100644
--- a/src/mame/drivers/gstriker.cpp
+++ b/src/mame/drivers/gstriker.cpp
@@ -517,11 +517,10 @@ MACHINE_CONFIG_START(gstriker_state::base)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gstriker_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, gstriker_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gstriker)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gstriker);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x800);
MB60553(config, m_bg, 0);
diff --git a/src/mame/drivers/gsword.cpp b/src/mame/drivers/gsword.cpp
index b00a0829919..5db256d5e0e 100644
--- a/src/mame/drivers/gsword.cpp
+++ b/src/mame/drivers/gsword.cpp
@@ -942,19 +942,17 @@ MACHINE_CONFIG_START(gsword_state::gsword)
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(gsword_state, screen_update_gsword)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gsword)
- MCFG_PALETTE_ADD("palette", 64*4+64*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(gsword_state,gsword)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gsword);
+ PALETTE(config, m_palette, FUNC(gsword_state::gsword_palette), 64*4 + 64*4, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
- AY8910(config, m_ay0, XTAL(18'000'000)/12).add_route(ALL_OUTPUTS, "mono", 0.30); /* verified on pcb */
+ AY8910(config, m_ay0, XTAL(18'000'000)/12).add_route(ALL_OUTPUTS, "mono", 0.30); // Clock verified on PCB
AY8910(config, m_ay1, 1500000);
m_ay1->port_a_write_callback().set(FUNC(gsword_state::nmi_set_w));
@@ -1009,12 +1007,10 @@ MACHINE_CONFIG_START(josvolly_state::josvolly)
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(josvolly_state, screen_update_gsword)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gsword)
- MCFG_PALETTE_ADD("palette", 64*4+64*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(josvolly_state, josvolly)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gsword);
+ PALETTE(config, m_palette, FUNC(josvolly_state::josvolly_palette), 64*4 + 64*4, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp
index 7e47f5acf4d..52cd205bf3c 100644
--- a/src/mame/drivers/gticlub.cpp
+++ b/src/mame/drivers/gticlub.cpp
@@ -988,7 +988,7 @@ void gticlub_state::gticlub(machine_config &config)
screen.set_visarea(0, 511, 0, 383);
screen.set_screen_update(FUNC(gticlub_state::screen_update_gticlub));
- PALETTE(config, m_palette, 65536);
+ PALETTE(config, m_palette).set_entries(65536);
MCFG_VIDEO_START_OVERRIDE(gticlub_state,gticlub)
@@ -1100,7 +1100,7 @@ void gticlub_state::hangplt(machine_config &config)
K033906(config, "k033906_2", 0, "voodoo1");
/* video hardware */
- PALETTE(config, m_palette, 65536);
+ PALETTE(config, m_palette).set_entries(65536);
screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
lscreen.set_refresh_hz(60);
diff --git a/src/mame/drivers/gts3a.cpp b/src/mame/drivers/gts3a.cpp
index b85c79cd08e..78b69325723 100644
--- a/src/mame/drivers/gts3a.cpp
+++ b/src/mame/drivers/gts3a.cpp
@@ -361,8 +361,7 @@ void gts3a_state::gts3a(machine_config &config)
screen.set_size(128, 32);
screen.set_visarea(0, 127, 0, 31);
- PALETTE(config, m_palette, 2);
- m_palette->set_init(DEVICE_SELF, FUNC(gts3a_state::palette_init));
+ PALETTE(config, m_palette, FUNC(gts3a_state::palette_init), 2);
mc6845_device &crtc(MC6845(config, "crtc", XTAL(3'579'545) / 2));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/guab.cpp b/src/mame/drivers/guab.cpp
index 43a99a5577f..abda91a6d4b 100644
--- a/src/mame/drivers/guab.cpp
+++ b/src/mame/drivers/guab.cpp
@@ -488,7 +488,7 @@ void guab_state::guab(machine_config &config)
screen.set_screen_update(FUNC(guab_state::screen_update_guab));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, ef9369_device::NUMCOLORS);
+ PALETTE(config, m_palette).set_entries(ef9369_device::NUMCOLORS);
EF9369(config, "ef9369").set_color_update_callback(FUNC(guab_state::ef9369_color_update));
diff --git a/src/mame/drivers/gumbo.cpp b/src/mame/drivers/gumbo.cpp
index 74c5f8eb029..6810d612ef8 100644
--- a/src/mame/drivers/gumbo.cpp
+++ b/src/mame/drivers/gumbo.cpp
@@ -243,7 +243,7 @@ MACHINE_CONFIG_START(gumbo_state::gumbo)
MCFG_DEVICE_PROGRAM_MAP(gumbo_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", gumbo_state, irq1_line_hold) // all the same
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gumbo)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_gumbo);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -253,8 +253,7 @@ MACHINE_CONFIG_START(gumbo_state::gumbo)
MCFG_SCREEN_UPDATE_DRIVER(gumbo_state, screen_update_gumbo)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/gunbustr.cpp b/src/mame/drivers/gunbustr.cpp
index 84000dbb49b..99efa095775 100644
--- a/src/mame/drivers/gunbustr.cpp
+++ b/src/mame/drivers/gunbustr.cpp
@@ -44,13 +44,15 @@
***************************************************************************/
#include "emu.h"
+#include "includes/gunbustr.h"
+
#include "audio/taito_en.h"
#include "machine/taitoio.h"
-#include "includes/gunbustr.h"
#include "cpu/m68000/m68000.h"
#include "machine/eepromser.h"
#include "sound/es5506.h"
+
#include "screen.h"
@@ -254,11 +256,10 @@ MACHINE_CONFIG_START(gunbustr_state::gunbustr)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(gunbustr_state, screen_update_gunbustr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gunbustr)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gunbustr);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 4096);
TC0480SCP(config, m_tc0480scp, 0);
m_tc0480scp->set_gfx_region(1);
diff --git a/src/mame/drivers/gunpey.cpp b/src/mame/drivers/gunpey.cpp
index 0a9c36ff275..edeb8d227db 100644
--- a/src/mame/drivers/gunpey.cpp
+++ b/src/mame/drivers/gunpey.cpp
@@ -1229,9 +1229,9 @@ MACHINE_CONFIG_START(gunpey_state::gunpey)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(57242400/8, 442, 0, 320, 264, 0, 240) /* just to get ~60 Hz */
MCFG_SCREEN_UPDATE_DRIVER(gunpey_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_555);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/gunsmoke.cpp b/src/mame/drivers/gunsmoke.cpp
index 6e3e86be024..0c9f31fb998 100644
--- a/src/mame/drivers/gunsmoke.cpp
+++ b/src/mame/drivers/gunsmoke.cpp
@@ -321,13 +321,11 @@ MACHINE_CONFIG_START(gunsmoke_state::gunsmoke)
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(gunsmoke_state, screen_update_gunsmoke)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gunsmoke)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_gunsmoke)
- MCFG_PALETTE_ADD("palette", 32*4+16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(gunsmoke_state, gunsmoke)
+ PALETTE(config, m_palette, FUNC(gunsmoke_state::gunsmoke_palette), 32*4 + 16*16 + 16*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/gyruss.cpp b/src/mame/drivers/gyruss.cpp
index 246527d9c54..e597b5ae677 100644
--- a/src/mame/drivers/gyruss.cpp
+++ b/src/mame/drivers/gyruss.cpp
@@ -504,13 +504,11 @@ MACHINE_CONFIG_START(gyruss_state::gyruss)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(gyruss_state, screen_update_gyruss)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, gyruss_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_gyruss)
- MCFG_PALETTE_ADD("palette", 16*4+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(gyruss_state, gyruss)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_gyruss);
+ PALETTE(config, m_palette, FUNC(gyruss_state::gyruss_palette), 16*4+16*16, 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/h19.cpp b/src/mame/drivers/h19.cpp
index 64804b8c463..35ad51af112 100644
--- a/src/mame/drivers/h19.cpp
+++ b/src/mame/drivers/h19.cpp
@@ -536,7 +536,7 @@ MACHINE_CONFIG_START(h19_state::h19)
MCFG_SCREEN_SIZE(640, 250)
MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 250 - 1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_h19)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MC6845(config, m_crtc, MC6845_CLOCK);
m_crtc->set_screen("screen");
diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp
index 9078e189656..f000894af47 100644
--- a/src/mame/drivers/halleys.cpp
+++ b/src/mame/drivers/halleys.cpp
@@ -216,14 +216,15 @@ Video sync 6 F Video sync Post 6 F Post
class halleys_state : public driver_device
{
public:
- halleys_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ halleys_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_blitter_ram(*this, "blitter_ram"),
m_io_ram(*this, "io_ram"),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void benberob(machine_config &config);
void halleys(machine_config &config);
@@ -233,6 +234,10 @@ public:
void init_halleys();
void init_halleysp();
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
uint16_t *m_render_layer[MAX_LAYERS];
uint8_t *m_gfx_plane02;
@@ -277,9 +282,7 @@ private:
DECLARE_READ8_MEMBER(io_mirror_r);
void blit(int offset);
DECLARE_WRITE8_MEMBER(sndnmi_msk_w);
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(halleys);
+ void halleys_palette(palette_device &palette);
uint32_t screen_update_halleys(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_benberob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(blitter_reset);
@@ -1129,14 +1132,13 @@ READ8_MEMBER(halleys_state::collision_id_r)
//**************************************************************************
// Video Initializations and Updates
-PALETTE_INIT_MEMBER(halleys_state, halleys)
+void halleys_state::halleys_palette(palette_device &palette)
{
- uint32_t d, r, g, b, i, j, count;
// allocate memory for internal palette
m_internal_palette = std::make_unique<uint32_t[]>(PALETTE_SIZE);
- uint32_t *pal_ptr = m_internal_palette.get();
+ uint32_t *const pal_ptr = m_internal_palette.get();
- for (count=0; count<1024; count++)
+ for (uint32_t count = 0; count < 1024; count++)
{
pal_ptr[count] = 0;
palette.set_pen_color(count, rgb_t(0, 0, 0));
@@ -1151,13 +1153,13 @@ PALETTE_INIT_MEMBER(halleys_state, halleys)
// 256-1023: palette mirrors
// 1024-1279: gray shades
- for (i=0; i<16; i++)
+ for (uint32_t i = 0; i < 16; i++)
{
- d = (i<<6&0xc0) | (i<<2&0x30) | (i&0x0c) | (i>>2&0x03) | BG_RGB;
- for (count=0; count<16; count++)
+ uint32_t const d = (i << 6 & 0xc0) | (i << 2 & 0x30) | (i & 0x0c) | (i >> 2 & 0x03) | BG_RGB;
+ for (uint32_t count = 0; count < 16; count++)
{
- r = i << 4;
- g = r + count + BG_MONO;
+ uint32_t r = i << 4;
+ uint32_t const g = r + count + BG_MONO;
r += i;
pal_ptr[g] = d;
palette.set_pen_color(g, rgb_t(r, r, r));
@@ -1165,15 +1167,15 @@ PALETTE_INIT_MEMBER(halleys_state, halleys)
}
// 1280-1535: RGB
- for (d=0; d<256; d++)
+ for (uint32_t d = 0; d < 256; d++)
{
- j = d + BG_RGB;
+ uint32_t const j = d + BG_RGB;
pal_ptr[j] = j;
- i = d>>6 & 0x03;
- r = d>>2 & 0x0c; r |= i;
- g = d & 0x0c; g |= i;
- b = d<<2 & 0x0c; b |= i;
+ uint32_t const i = (d>>6 & 0x03);
+ uint32_t const r = (d>>2 & 0x0c) | i;
+ uint32_t const g = (d & 0x0c) | i;
+ uint32_t const b = (d<<2 & 0x0c) | i;
palette.set_pen_color(j, pal4bit(r), pal4bit(g), pal4bit(b));
}
@@ -1231,27 +1233,26 @@ READ8_MEMBER(halleys_state::paletteram_r)
WRITE8_MEMBER(halleys_state::paletteram_w)
{
- uint32_t d, r, g, b, i, j;
- uint32_t *pal_ptr = m_internal_palette.get();
+ uint32_t *const pal_ptr = m_internal_palette.get();
m_paletteram[offset] = data;
- d = (uint32_t)data;
- j = d | BG_RGB;
+ uint32_t const d = uint32_t(data);
+ uint32_t const j = d | BG_RGB;
pal_ptr[offset] = j;
- pal_ptr[offset+SP_2BACK] = j;
- pal_ptr[offset+SP_ALPHA] = j;
- pal_ptr[offset+SP_COLLD] = j;
+ pal_ptr[offset + SP_2BACK] = j;
+ pal_ptr[offset + SP_ALPHA] = j;
+ pal_ptr[offset + SP_COLLD] = j;
// 8-bit RGB format: IIRRGGBB
- i = d>>6 & 0x03;
- r = d>>2 & 0x0c; r |= i; r = r<<4 | r;
- g = d & 0x0c; g |= i; g = g<<4 | g;
- b = d<<2 & 0x0c; b |= i; b = b<<4 | b;
+ uint32_t i = (d>>6 & 0x03);
+ uint32_t r = (d>>2 & 0x0c) | i; r = r<<4 | r;
+ uint32_t g = (d & 0x0c) | i; g = g<<4 | g;
+ uint32_t b = (d<<2 & 0x0c) | i; b = b<<4 | b;
m_palette->set_pen_color(offset, rgb_t(r, g, b));
- m_palette->set_pen_color(offset+SP_2BACK, rgb_t(r, g, b));
- m_palette->set_pen_color(offset+SP_ALPHA, rgb_t(r, g, b));
- m_palette->set_pen_color(offset+SP_COLLD, rgb_t(r, g, b));
+ m_palette->set_pen_color(offset + SP_2BACK, rgb_t(r, g, b));
+ m_palette->set_pen_color(offset + SP_ALPHA, rgb_t(r, g, b));
+ m_palette->set_pen_color(offset + SP_COLLD, rgb_t(r, g, b));
halleys_decode_rgb(&r, &g, &b, offset, 0);
m_palette->set_pen_color(offset+0x20, rgb_t(r, g, b));
@@ -1947,10 +1948,9 @@ MACHINE_CONFIG_START(halleys_state::halleys)
MCFG_SCREEN_SIZE(SCREEN_WIDTH, SCREEN_HEIGHT)
MCFG_SCREEN_VISIBLE_AREA(VIS_MINX, VIS_MAXX, VIS_MINY, VIS_MAXY)
MCFG_SCREEN_UPDATE_DRIVER(halleys_state, screen_update_halleys)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", PALETTE_SIZE)
- MCFG_PALETTE_INIT_OWNER(halleys_state, halleys)
+ PALETTE(config, m_palette, FUNC(halleys_state::halleys_palette), PALETTE_SIZE);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hanaawas.cpp b/src/mame/drivers/hanaawas.cpp
index 1eb7a808fdb..1b015188f85 100644
--- a/src/mame/drivers/hanaawas.cpp
+++ b/src/mame/drivers/hanaawas.cpp
@@ -233,10 +233,8 @@ MACHINE_CONFIG_START(hanaawas_state::hanaawas)
MCFG_SCREEN_UPDATE_DRIVER(hanaawas_state, screen_update_hanaawas)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hanaawas)
- MCFG_PALETTE_ADD("palette", 32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(hanaawas_state, hanaawas)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_hanaawas);
+ PALETTE(config, "palette", FUNC(hanaawas_state::hanaawas_palette), 32 * 8, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/harddriv.cpp b/src/mame/drivers/harddriv.cpp
index 6e3406f6ed9..15fcf4bb041 100644
--- a/src/mame/drivers/harddriv.cpp
+++ b/src/mame/drivers/harddriv.cpp
@@ -1500,7 +1500,7 @@ void harddriv_state::driver_nomsp(machine_config &config)
rs232.rxd_handler().set("duartn68681", FUNC(mc68681_device::rx_a_w));
/* video hardware */
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_entries(1024);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(HARDDRIV_GSP_CLOCK/12*4, 160*4, 0, 127*4, 417, 0, 384);
diff --git a/src/mame/drivers/hazeltin.cpp b/src/mame/drivers/hazeltin.cpp
index f916fb95e23..5fc7cf60776 100644
--- a/src/mame/drivers/hazeltin.cpp
+++ b/src/mame/drivers/hazeltin.cpp
@@ -713,7 +713,7 @@ MACHINE_CONFIG_START(hazl1500_state::hazl1500)
SCREEN_HTOTAL, 0, SCREEN_HTOTAL,
SCREEN_VTOTAL, 0, SCREEN_VTOTAL);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hazl1500)
com8116_device &baudgen(COM8116(config, BAUDGEN_TAG, XTAL(5'068'800)));
diff --git a/src/mame/drivers/hcastle.cpp b/src/mame/drivers/hcastle.cpp
index 7598f7753a1..65097d75925 100644
--- a/src/mame/drivers/hcastle.cpp
+++ b/src/mame/drivers/hcastle.cpp
@@ -211,10 +211,7 @@ void hcastle_state::hcastle(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hcastle);
- PALETTE(config, m_palette, 2*8*16*16);
- m_palette->set_indirect_entries(128);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- m_palette->set_init(FUNC(hcastle_state::palette_init_hcastle));
+ PALETTE(config, m_palette, FUNC(hcastle_state::hcastle_palette)).set_format(palette_device::xBGR_555, 2*8*16*16, 128);
K007121(config, m_k007121_1, 0);
m_k007121_1->set_palette_tag(m_palette);
diff --git a/src/mame/drivers/headonb.cpp b/src/mame/drivers/headonb.cpp
index 6c894201925..c63694bf47b 100644
--- a/src/mame/drivers/headonb.cpp
+++ b/src/mame/drivers/headonb.cpp
@@ -37,11 +37,12 @@ Other outs:
class headonb_state : public driver_device
{
public:
- headonb_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ headonb_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_video_ram(*this, "video_ram") { }
+ m_video_ram(*this, "video_ram")
+ { }
void headonb(machine_config &config);
@@ -183,7 +184,7 @@ MACHINE_CONFIG_START(headonb_state::headonb)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_headonb)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
// TODO
diff --git a/src/mame/drivers/hexion.cpp b/src/mame/drivers/hexion.cpp
index 41fac719417..fa5c8bc14cf 100644
--- a/src/mame/drivers/hexion.cpp
+++ b/src/mame/drivers/hexion.cpp
@@ -274,9 +274,7 @@ void hexion_state::hexion(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hexion);
- PALETTE(config, m_palette, 256);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hideseek.cpp b/src/mame/drivers/hideseek.cpp
index 22d229de991..0f5280a1e14 100644
--- a/src/mame/drivers/hideseek.cpp
+++ b/src/mame/drivers/hideseek.cpp
@@ -46,9 +46,11 @@ public:
void init_hideseek();
-private:
+protected:
virtual void video_start() override;
- DECLARE_PALETTE_INIT(hideseek);
+
+private:
+ void hideseek_palette(palette_device &palette) const;
uint32_t screen_update_hideseek(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mem_map(address_map &map);
@@ -93,12 +95,10 @@ static GFXDECODE_START( gfx_hideseek )
GFXDECODE_END
-PALETTE_INIT_MEMBER(hideseek_state, hideseek)
+void hideseek_state::hideseek_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 0x8000; i++)
- palette.set_pen_color(i, rgb_t( pal5bit((i >> 10)&0x1f), pal5bit(((i >> 5))&0x1f), pal5bit((i >> 0)&0x1f)));
+ for (int i = 0; i < 0x8000; i++)
+ palette.set_pen_color(i, rgb_t(pal5bit((i >> 10)&0x1f), pal5bit((i >> 5)&0x1f), pal5bit((i >> 0)&0x1f)));
}
@@ -119,9 +119,8 @@ MACHINE_CONFIG_START(hideseek_state::hideseek)
MCFG_SCREEN_UPDATE_DRIVER(hideseek_state, screen_update_hideseek)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_INIT_OWNER(hideseek_state, hideseek)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hideseek)
+ PALETTE(config, "palette", FUNC(hideseek_state::hideseek_palette), 0x10000);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_hideseek);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
@@ -164,4 +163,4 @@ void hideseek_state::init_hideseek()
}
-GAME( 200?, hideseek, 0, hideseek, hideseek, hideseek_state, init_hideseek, ROT0, "<unknown>", "Hide & Seek",MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
+GAME( 200?, hideseek, 0, hideseek, hideseek, hideseek_state, init_hideseek, ROT0, "<unknown>", "Hide & Seek", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
diff --git a/src/mame/drivers/higemaru.cpp b/src/mame/drivers/higemaru.cpp
index f1dc7cf67b5..22d52ab9337 100644
--- a/src/mame/drivers/higemaru.cpp
+++ b/src/mame/drivers/higemaru.cpp
@@ -177,13 +177,11 @@ MACHINE_CONFIG_START(higemaru_state::higemaru)
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(higemaru_state, screen_update_higemaru)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_higemaru)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_higemaru)
- MCFG_PALETTE_ADD("palette", 32*4+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(higemaru_state, higemaru)
+ PALETTE(config, m_palette, FUNC(higemaru_state::higemaru_palette), 32*4+16*16, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/highvdeo.cpp b/src/mame/drivers/highvdeo.cpp
index 2f691cd2e0d..45dc366f227 100644
--- a/src/mame/drivers/highvdeo.cpp
+++ b/src/mame/drivers/highvdeo.cpp
@@ -137,6 +137,9 @@ public:
void tv_tcf(machine_config &config);
void tv_vcf(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
required_shared_ptr<uint16_t> m_blit_ram;
optional_memory_bank m_mainbank;
@@ -171,7 +174,6 @@ private:
DECLARE_WRITE16_MEMBER(tv_ncf_oki6376_st_w);
DECLARE_READ8_MEMBER(nmi_clear_r);
DECLARE_WRITE8_MEMBER(nmi_clear_w);
- virtual void machine_start() override;
uint32_t screen_update_tourvisn(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_brasil(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
@@ -1242,7 +1244,7 @@ MACHINE_CONFIG_START(highvdeo_state::tv_vcf)
MCFG_SCREEN_UPDATE_DRIVER(highvdeo_state, screen_update_tourvisn)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
+ PALETTE(config, m_palette).set_entries(0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette));
ramdac.set_addrmap(0, &highvdeo_state::ramdac_map);
@@ -1280,8 +1282,7 @@ MACHINE_CONFIG_START(highvdeo_state::tv_tcf)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 300-1)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRRGGGGGGBBBBB)
+ m_palette->set_format(palette_device::RGB_565, 0x100);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(highvdeo_state::newmcard)
@@ -1327,7 +1328,7 @@ MACHINE_CONFIG_START(highvdeo_state::brasil)
MCFG_SCREEN_UPDATE_DRIVER(highvdeo_state, screen_update_brasil)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_565);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1357,7 +1358,7 @@ MACHINE_CONFIG_START(highvdeo_state::grancapi)
MCFG_SCREEN_UPDATE_DRIVER(highvdeo_state, screen_update_brasil)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_565);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1381,7 +1382,7 @@ MACHINE_CONFIG_START(highvdeo_state::magicbom)
MCFG_SCREEN_UPDATE_DRIVER(highvdeo_state, screen_update_brasil)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_565);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hikaru.cpp b/src/mame/drivers/hikaru.cpp
index 22aebe99321..41a1c286352 100644
--- a/src/mame/drivers/hikaru.cpp
+++ b/src/mame/drivers/hikaru.cpp
@@ -529,7 +529,7 @@ void hikaru_state::hikaru(machine_config &config)
screen.set_visarea(0, 640-1, 0, 480-1);
screen.set_screen_update(FUNC(hikaru_state::screen_update_hikaru));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
// SPEAKER(config, "lspeaker").front_left();
// SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/himesiki.cpp b/src/mame/drivers/himesiki.cpp
index 9f358699ba2..a89a22b5091 100644
--- a/src/mame/drivers/himesiki.cpp
+++ b/src/mame/drivers/himesiki.cpp
@@ -455,12 +455,10 @@ MACHINE_CONFIG_START(himesiki_state::himesiki)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 24*8-1)
MCFG_SCREEN_UPDATE_DRIVER(himesiki_state, screen_update_himesiki)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_himesiki)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_himesiki);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xRGB_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hitme.cpp b/src/mame/drivers/hitme.cpp
index ecc1d19a63c..e80ee193270 100644
--- a/src/mame/drivers/hitme.cpp
+++ b/src/mame/drivers/hitme.cpp
@@ -333,12 +333,11 @@ MACHINE_CONFIG_START(hitme_state::hitme)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hitme)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("discrete", DISCRETE, hitme_discrete)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ DISCRETE(config, m_discrete, hitme_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/hitpoker.cpp b/src/mame/drivers/hitpoker.cpp
index 6d0a110629f..cdba067704c 100644
--- a/src/mame/drivers/hitpoker.cpp
+++ b/src/mame/drivers/hitpoker.cpp
@@ -486,7 +486,7 @@ MACHINE_CONFIG_START(hitpoker_state::hitpoker)
crtc.out_vsync_callback().set(FUNC(hitpoker_state::hitpoker_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hitpoker);
- PALETTE(config, m_palette, 0x800);
+ PALETTE(config, m_palette).set_entries(0x800);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hnayayoi.cpp b/src/mame/drivers/hnayayoi.cpp
index da106bd0796..e00cde62f19 100644
--- a/src/mame/drivers/hnayayoi.cpp
+++ b/src/mame/drivers/hnayayoi.cpp
@@ -565,7 +565,7 @@ MACHINE_CONFIG_START(hnayayoi_state::hnayayoi)
MCFG_SCREEN_RAW_PARAMS(20_MHz_XTAL / 2, 632, 0, 512, 263, 0, 243)
MCFG_SCREEN_UPDATE_DEVICE("crtc", hd6845_device, screen_update)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
hd6845_device &crtc(HD6845(config, "crtc", 20_MHz_XTAL / 8));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/hng64.cpp b/src/mame/drivers/hng64.cpp
index f4bc58d3e25..89688fe9561 100644
--- a/src/mame/drivers/hng64.cpp
+++ b/src/mame/drivers/hng64.cpp
@@ -2126,7 +2126,7 @@ MACHINE_CONFIG_START(hng64_state::hng64)
m_screen->set_screen_update(FUNC(hng64_state::screen_update_hng64));
m_screen->screen_vblank().set(FUNC(hng64_state::screen_vblank_hng64));
- PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x1000);
hng64_audio(config);
hng64_network(config);
diff --git a/src/mame/drivers/holeland.cpp b/src/mame/drivers/holeland.cpp
index 581df2d5d00..36a44ff3566 100644
--- a/src/mame/drivers/holeland.cpp
+++ b/src/mame/drivers/holeland.cpp
@@ -297,10 +297,10 @@ MACHINE_CONFIG_START(holeland_state::holeland)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 2*16, 30*16-1)
MCFG_SCREEN_UPDATE_DRIVER(holeland_state, screen_update_holeland)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_holeland)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(holeland_state,holeland)
/* sound hardware */
@@ -378,10 +378,10 @@ MACHINE_CONFIG_START(holeland_state::crzrally)
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(holeland_state, screen_update_crzrally)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_crzrally)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(holeland_state,crzrally)
/* sound hardware */
diff --git a/src/mame/drivers/homedata.cpp b/src/mame/drivers/homedata.cpp
index c355807717d..de844e42ee8 100644
--- a/src/mame/drivers/homedata.cpp
+++ b/src/mame/drivers/homedata.cpp
@@ -1236,12 +1236,11 @@ MACHINE_CONFIG_START(homedata_state::mrokumei)
MCFG_SCREEN_VISIBLE_AREA(0*8, 54*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(homedata_state, screen_update_mrokumei)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, homedata_state, screen_vblank_homedata))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mrokumei)
- MCFG_PALETTE_ADD("palette", 0x8000)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrokumei);
+ PALETTE(config, m_palette, FUNC(homedata_state::mrokumei_palette), 0x8000);
- MCFG_PALETTE_INIT_OWNER(homedata_state,mrokumei)
MCFG_VIDEO_START_OVERRIDE(homedata_state,mrokumei)
/* sound hardware */
@@ -1291,10 +1290,9 @@ MACHINE_CONFIG_START(homedata_state::reikaids)
screen.screen_vblank().append([this] (int state) { if (state) m_audiocpu->pulse_input_line(UPD7810_INTF1, m_audiocpu->minimum_quantum_time()); });
screen.set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_reikaids)
- MCFG_PALETTE_ADD("palette", 0x8000)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_reikaids);
+ PALETTE(config, m_palette, FUNC(homedata_state::reikaids_palette), 0x8000);
- MCFG_PALETTE_INIT_OWNER(homedata_state,reikaids)
MCFG_VIDEO_START_OVERRIDE(homedata_state,reikaids)
/* sound hardware */
@@ -1349,10 +1347,9 @@ MACHINE_CONFIG_START(homedata_state::pteacher)
screen.screen_vblank().append([this] (int state) { if (state) m_audiocpu->pulse_input_line(UPD7810_INTF1, m_audiocpu->minimum_quantum_time()); });
screen.set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pteacher)
- MCFG_PALETTE_ADD("palette", 0x8000)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pteacher);
+ PALETTE(config, m_palette, FUNC(homedata_state::pteacher_palette), 0x8000);
- MCFG_PALETTE_INIT_OWNER(homedata_state,pteacher)
MCFG_VIDEO_START_OVERRIDE(homedata_state,pteacher)
/* sound hardware */
@@ -1516,12 +1513,11 @@ MACHINE_CONFIG_START(homedata_state::mirderby)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 54*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(homedata_state, screen_update_mirderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mirderby)
- MCFG_PALETTE_ADD("palette", 0x8000)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mirderby);
+ PALETTE(config, m_palette, FUNC(homedata_state::mirderby_palette), 0x8000);
- MCFG_PALETTE_INIT_OWNER(homedata_state,mirderby)
MCFG_VIDEO_START_OVERRIDE(homedata_state,mirderby)
/* sound hardware */
diff --git a/src/mame/drivers/homelab.cpp b/src/mame/drivers/homelab.cpp
index e69f8b57199..04ff0e7ac75 100644
--- a/src/mame/drivers/homelab.cpp
+++ b/src/mame/drivers/homelab.cpp
@@ -55,7 +55,7 @@ public:
, m_p_chargen(*this, "chargen")
, m_dac(*this, "dac")
, m_cass(*this, "cassette")
- { }
+ { }
void homelab3(machine_config &config);
void brailab4(machine_config &config);
@@ -767,7 +767,7 @@ MACHINE_CONFIG_START(homelab_state::homelab)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_homelab)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -799,7 +799,7 @@ MACHINE_CONFIG_START(homelab_state::homelab3)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_homelab)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -831,7 +831,7 @@ MACHINE_CONFIG_START(homelab_state::brailab4)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_homelab)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/homerun.cpp b/src/mame/drivers/homerun.cpp
index 3dc40648493..83128368eaa 100644
--- a/src/mame/drivers/homerun.cpp
+++ b/src/mame/drivers/homerun.cpp
@@ -370,7 +370,7 @@ void homerun_state::dynashot(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_homerun);
- PALETTE(config, m_palette, 16*4);
+ PALETTE(config, m_palette).set_entries(16*4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/homez80.cpp b/src/mame/drivers/homez80.cpp
index ec42b3107fa..b5dfb30b1dd 100644
--- a/src/mame/drivers/homez80.cpp
+++ b/src/mame/drivers/homez80.cpp
@@ -34,7 +34,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_p_videoram(*this, "videoram")
, m_p_chargen(*this, "chargen")
- { }
+ { }
void homez80(machine_config &config);
@@ -303,7 +303,7 @@ MACHINE_CONFIG_START(homez80_state::homez80)
MCFG_SCREEN_VISIBLE_AREA(0, 344-1, 0, 32*8-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_homez80)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp
index ea88a965432..115a1b4a689 100644
--- a/src/mame/drivers/hornet.cpp
+++ b/src/mame/drivers/hornet.cpp
@@ -1101,7 +1101,7 @@ MACHINE_CONFIG_START(hornet_state::hornet)
screen.set_visarea(0, 64 * 8 - 1, 0, 48 * 8 - 1);
screen.set_screen_update(FUNC(hornet_state::screen_update));
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
K037122(config, m_k037122_1, 0);
m_k037122_1->set_screen("screen");
@@ -1181,6 +1181,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(hornet_state::hornet_2board_v2)
hornet_2board(config);
+
VOODOO_2(config.replace(), m_voodoo[0], STD_VOODOO_2_CLOCK);
m_voodoo[0]->set_fbmem(2);
m_voodoo[0]->set_tmumem(4, 0);
diff --git a/src/mame/drivers/hotblock.cpp b/src/mame/drivers/hotblock.cpp
index 332e36140e6..7c63d22dc6b 100644
--- a/src/mame/drivers/hotblock.cpp
+++ b/src/mame/drivers/hotblock.cpp
@@ -223,7 +223,7 @@ MACHINE_CONFIG_START(hotblock_state::hotblock)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI)) // right?
- PALETTE(config, m_palette, 0x200/2).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x200/2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/hp2640.cpp b/src/mame/drivers/hp2640.cpp
index de334235867..adf45587cff 100644
--- a/src/mame/drivers/hp2640.cpp
+++ b/src/mame/drivers/hp2640.cpp
@@ -983,7 +983,7 @@ MACHINE_CONFIG_START(hp2645_state::hp2645)
VIDEO_TOT_ROWS * VIDEO_CHAR_HEIGHT , 0 , VIDEO_VIS_ROWS * VIDEO_CHAR_HEIGHT)
MCFG_SCREEN_UPDATE_DRIVER(hp2645_state , screen_update)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", hp2645_state, scanline_timer, "screen", 0, 1)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
config.set_default_layout(layout_hp2640);
// RS232
@@ -998,8 +998,7 @@ MACHINE_CONFIG_START(hp2645_state::hp2645)
// Beep
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beep" , BEEP , BEEP_FREQUENCY)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS , "mono" , 1.00)
+ BEEP(config, m_beep, BEEP_FREQUENCY).add_route(ALL_OUTPUTS, "mono", 1.00);
MCFG_TIMER_DRIVER_ADD("timer_beep" , hp2645_state , timer_beep_exp)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/hp48.cpp b/src/mame/drivers/hp48.cpp
index a199517ede4..5288b93b638 100644
--- a/src/mame/drivers/hp48.cpp
+++ b/src/mame/drivers/hp48.cpp
@@ -1165,7 +1165,7 @@ void hp48_state::hp48_common(machine_config &config)
m_screen->set_palette(m_palette);
/* monochrome, but with varying contrast and grayscale */
- PALETTE(config, m_palette, 256).set_init(FUNC(hp48_state::palette_init_hp48));
+ PALETTE(config, m_palette, FUNC(hp48_state::hp48_palette), 256);
/* sound */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/hp64k.cpp b/src/mame/drivers/hp64k.cpp
index b24336b4301..f7ea1209530 100644
--- a/src/mame/drivers/hp64k.cpp
+++ b/src/mame/drivers/hp64k.cpp
@@ -370,8 +370,8 @@ void hp64k_state::cpu_io_map(address_map &map)
map(HP_MAKE_IOADDR(12, 0), HP_MAKE_IOADDR(12, 3)).w(FUNC(hp64k_state::hp64k_irl_mask_w));
}
-hp64k_state::hp64k_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig , type , tag),
+hp64k_state::hp64k_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig , type , tag),
m_cpu(*this , "cpu"),
m_crtc(*this , "crtc"),
m_palette(*this , "palette"),
@@ -1402,7 +1402,7 @@ MACHINE_CONFIG_START(hp64k_state::hp64k)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(720, 390)
MCFG_SCREEN_VISIBLE_AREA(0, 720-1, 0, 390-1)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
FD1791(config, m_fdc, 4_MHz_XTAL / 4);
m_fdc->set_force_ready(true); // should be able to get rid of this when fdc issue is fixed
diff --git a/src/mame/drivers/hp80.cpp b/src/mame/drivers/hp80.cpp
index 65a88d1e044..7f7dfb6ab54 100644
--- a/src/mame/drivers/hp80.cpp
+++ b/src/mame/drivers/hp80.cpp
@@ -1342,7 +1342,7 @@ MACHINE_CONFIG_START(hp85_state::hp85)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK / 2 , 312 , 0 , 256 , 256 , 0 , 192)
MCFG_SCREEN_UPDATE_DRIVER(hp85_state , screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, hp85_state, vblank_w))
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_TIMER_DRIVER_ADD("vm_timer", hp85_state, vm_timer)
// No idea at all about the actual keyboard scan frequency
diff --git a/src/mame/drivers/hp95lx.cpp b/src/mame/drivers/hp95lx.cpp
index 4437a120790..ce39999461c 100644
--- a/src/mame/drivers/hp95lx.cpp
+++ b/src/mame/drivers/hp95lx.cpp
@@ -115,12 +115,7 @@ public:
DECLARE_WRITE8_MEMBER(f300_w);
DECLARE_READ8_MEMBER(f300_r);
- DECLARE_PALETTE_INIT(hp95lx);
void hp95lx(machine_config &config);
- void hp95lx_io(address_map &map);
- void hp95lx_map(address_map &map);
- void hp95lx_romdos(address_map &map);
-
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -141,6 +136,8 @@ protected:
required_device<screen_device> m_screen;
private:
+ void hp95lx_palette(palette_device &palette) const;
+
DECLARE_WRITE_LINE_MEMBER(keyboard_clock_w);
DECLARE_WRITE_LINE_MEMBER(keyboard_data_w);
DECLARE_READ8_MEMBER(keyboard_r);
@@ -152,6 +149,10 @@ private:
DECLARE_WRITE8_MEMBER(video_register_w);
DECLARE_WRITE8_MEMBER(debug_w);
+ void hp95lx_io(address_map &map);
+ void hp95lx_map(address_map &map);
+ void hp95lx_romdos(address_map &map);
+
required_shared_ptr<u8> m_p_videoram;
required_region_ptr<u8> m_p_chargen;
@@ -174,7 +175,7 @@ private:
};
-PALETTE_INIT_MEMBER(hp95lx_state, hp95lx)
+void hp95lx_state::hp95lx_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xa0, 0xa8, 0xa0);
palette.set_pen_color(1, 0x30, 0x38, 0x10);
@@ -748,10 +749,9 @@ MACHINE_CONFIG_START(hp95lx_state::hp95lx)
MCFG_SCREEN_ADD_MONOCHROME("screen", LCD, rgb_t::white())
MCFG_SCREEN_UPDATE_DRIVER(hp95lx_state, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(5'370'000) / 2, 300, 0, 240, 180, 0, 128)
-
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(hp95lx_state, hp95lx)
+
+ PALETTE(config, "palette", FUNC(hp95lx_state::hp95lx_palette), 2);
RAM(config, RAM_TAG).set_default_size("512K");
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/hp9k.cpp b/src/mame/drivers/hp9k.cpp
index 64c5068e35e..aaa24e2c14b 100644
--- a/src/mame/drivers/hp9k.cpp
+++ b/src/mame/drivers/hp9k.cpp
@@ -112,11 +112,11 @@ static uint8_t prom16a[256] = {
class hp9k_state : public driver_device
{
public:
- hp9k_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_6845(*this, "mc6845"),
- m_gfxdecode(*this, "gfxdecode")
+ hp9k_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_6845(*this, "mc6845"),
+ m_gfxdecode(*this, "gfxdecode")
{
kbdBit=0;
crtc_curreg=0;
@@ -410,7 +410,7 @@ MACHINE_CONFIG_START(hp9k_state::hp9k)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hp9k)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MC6845(config, m_6845, XTAL(16'000'000) / 16);
m_6845->set_screen("screen");
diff --git a/src/mame/drivers/hp_ipc.cpp b/src/mame/drivers/hp_ipc.cpp
index 3a5cf6aa450..d040abb82ef 100644
--- a/src/mame/drivers/hp_ipc.cpp
+++ b/src/mame/drivers/hp_ipc.cpp
@@ -806,7 +806,7 @@ MACHINE_CONFIG_START(hp_ipc_state::hp_ipc)
m_screen->screen_vblank().set("mlc", FUNC(hp_hil_mlc_device::ap_w)); // XXX actually it's driven by 555 (U59)
m_screen->set_palette("palette");
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(hp_ipc_state::hp9808a)
@@ -824,7 +824,7 @@ MACHINE_CONFIG_START(hp_ipc_state::hp9808a)
m_screen->screen_vblank().set("mlc", FUNC(hp_hil_mlc_device::ap_w)); // XXX actually it's driven by 555 (U59)
m_screen->set_palette("palette");
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp
index 24d756c9b18..1e3891954a6 100644
--- a/src/mame/drivers/hprot1.cpp
+++ b/src/mame/drivers/hprot1.cpp
@@ -78,16 +78,18 @@ public:
void init_hprot1();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE8_MEMBER(henry_p1_w);
DECLARE_WRITE8_MEMBER(henry_p3_w);
- DECLARE_PALETTE_INIT(hprot1);
+ void hprot1_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(hprot1_pixel_update);
void i80c31_io(address_map &map);
void i80c31_prg(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<i80c31_device> m_maincpu;
required_device<hd44780_device> m_lcdc;
};
@@ -209,7 +211,7 @@ WRITE8_MEMBER(hprot1_state::henry_p3_w)
logerror("Write to P3: %02X\n", data);
}
-PALETTE_INIT_MEMBER(hprot1_state, hprot1)
+void hprot1_state::hprot1_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -261,9 +263,8 @@ MACHINE_CONFIG_START(hprot1_state::hprot1)
MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(hprot1_state, hprot1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hprot1)
+ PALETTE(config, "palette", FUNC(hprot1_state::hprot1_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_hprot1);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
@@ -276,6 +277,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(hprot1_state::hprotr8a)
hprot1(config);
+
MCFG_DEVICE_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB
MCFG_DEVICE_PROGRAM_MAP(i80c31_prg)
MCFG_DEVICE_IO_MAP(i80c31_io)
@@ -293,6 +295,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(hprot1_state::hprot2r6)
hprot1(config);
+
MCFG_DEVICE_REPLACE("maincpu", I80C31, 11059200) // value of X1 cristal on the PCB
MCFG_DEVICE_PROGRAM_MAP(i80c31_prg)
MCFG_DEVICE_IO_MAP(i80c31_io)
diff --git a/src/mame/drivers/huebler.cpp b/src/mame/drivers/huebler.cpp
index a6bae8e6903..ff273669060 100644
--- a/src/mame/drivers/huebler.cpp
+++ b/src/mame/drivers/huebler.cpp
@@ -326,7 +326,7 @@ MACHINE_CONFIG_START(amu880_state::amu880)
MCFG_SCREEN_RAW_PARAMS(9000000, 576, 0*6, 64*6, 320, 0*10, 24*10)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_amu880)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* devices */
z80ctc_device& ctc(Z80CTC(config, Z80CTC_TAG, XTAL(10'000'000)/4));
diff --git a/src/mame/drivers/hunter2.cpp b/src/mame/drivers/hunter2.cpp
index 192b51a0344..713f03d4914 100644
--- a/src/mame/drivers/hunter2.cpp
+++ b/src/mame/drivers/hunter2.cpp
@@ -54,6 +54,9 @@ public:
void init_hunter2();
+protected:
+ virtual void machine_reset() override;
+
private:
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_READ8_MEMBER(serial_dsr_r);
@@ -67,7 +70,7 @@ private:
DECLARE_WRITE8_MEMBER(speaker_w);
DECLARE_WRITE8_MEMBER(irqctrl_w);
DECLARE_WRITE8_MEMBER(memmap_w);
- DECLARE_PALETTE_INIT(hunter2);
+ void hunter2_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(timer0_out);
DECLARE_WRITE_LINE_MEMBER(timer1_out);
@@ -80,7 +83,6 @@ private:
uint8_t m_keydata;
uint8_t m_irq_mask;
- virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
required_device<rs232_port_device> m_rs232;
@@ -343,7 +345,7 @@ void hunter2_state::init_hunter2()
m_nvram->set_base(ram,m_ram->bytes());
}
-PALETTE_INIT_MEMBER(hunter2_state, hunter2)
+void hunter2_state::hunter2_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -390,8 +392,7 @@ MACHINE_CONFIG_START(hunter2_state::hunter2)
MCFG_SCREEN_VISIBLE_AREA(0, 239, 0, 63)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(hunter2_state, hunter2)
+ PALETTE(config, "palette", FUNC(hunter2_state::hunter2_palette), 2);
MCFG_DEVICE_ADD("lcdc", HD61830, XTAL(4'915'200)/2/2) // unknown clock
MCFG_VIDEO_SET_SCREEN("screen")
diff --git a/src/mame/drivers/hvyunit.cpp b/src/mame/drivers/hvyunit.cpp
index ed5a01ffbe2..1f4b11a2dc7 100644
--- a/src/mame/drivers/hvyunit.cpp
+++ b/src/mame/drivers/hvyunit.cpp
@@ -659,11 +659,10 @@ MACHINE_CONFIG_START(hvyunit_state::hvyunit)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(hvyunit_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, hvyunit_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hvyunit)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_hvyunit);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x800);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_gfxdecode_tag(m_gfxdecode);
diff --git a/src/mame/drivers/hx20.cpp b/src/mame/drivers/hx20.cpp
index 684b34d9301..d54e917b70d 100644
--- a/src/mame/drivers/hx20.cpp
+++ b/src/mame/drivers/hx20.cpp
@@ -75,15 +75,9 @@ WRITE8_MEMBER( hx20_state::ksc_w )
READ8_MEMBER( hx20_state::krtn07_r )
{
uint8_t data = 0xff;
-
- if (!BIT(m_ksc, 0)) data &= m_ksc0->read();
- if (!BIT(m_ksc, 1)) data &= m_ksc1->read();
- if (!BIT(m_ksc, 2)) data &= m_ksc2->read();
- if (!BIT(m_ksc, 3)) data &= m_ksc3->read();
- if (!BIT(m_ksc, 4)) data &= m_ksc4->read();
- if (!BIT(m_ksc, 5)) data &= m_ksc5->read();
- if (!BIT(m_ksc, 6)) data &= m_ksc6->read();
- if (!BIT(m_ksc, 7)) data &= m_ksc7->read();
+ for (int b = 0; 8 > b; ++b)
+ if (!BIT(m_ksc, b))
+ data &= m_ksc_io[b]->read();
return data;
}
@@ -111,15 +105,9 @@ READ8_MEMBER( hx20_state::krtn89_r )
*/
uint8_t data = 0xff;
-
- if (!BIT(m_ksc, 0)) data &= m_ksc0->read() >> 8;
- if (!BIT(m_ksc, 1)) data &= m_ksc1->read() >> 8;
- if (!BIT(m_ksc, 2)) data &= m_ksc2->read() >> 8;
- if (!BIT(m_ksc, 3)) data &= m_ksc3->read() >> 8;
- if (!BIT(m_ksc, 4)) data &= m_ksc4->read() >> 8;
- if (!BIT(m_ksc, 5)) data &= m_ksc5->read() >> 8;
- if (!BIT(m_ksc, 6)) data &= m_ksc6->read() >> 8;
- if (!BIT(m_ksc, 7)) data &= m_ksc7->read() >> 8;
+ for (int b = 0; 8 > b; ++b)
+ if (!BIT(m_ksc, b))
+ data &= m_ksc_io[b]->read() >> 8;
return data;
}
@@ -149,31 +137,15 @@ WRITE8_MEMBER( hx20_state::lcd_cs_w )
logerror("LCD CS %02x\n", data);
// LCD
- m_lcdc0->cs_w(1);
- m_lcdc1->cs_w(1);
- m_lcdc2->cs_w(1);
- m_lcdc3->cs_w(1);
- m_lcdc4->cs_w(1);
- m_lcdc5->cs_w(1);
-
- switch (data & 0x07)
- {
- case 1: m_lcdc0->cs_w(0); break;
- case 2: m_lcdc1->cs_w(0); break;
- case 3: m_lcdc2->cs_w(0); break;
- case 4: m_lcdc3->cs_w(0); break;
- case 5: m_lcdc4->cs_w(0); break;
- case 6: m_lcdc5->cs_w(0); break;
- }
+ for (auto &lcdc : m_lcdc)
+ lcdc->cs_w(1);
- int cd = BIT(data, 3);
+ if (data & 0x07)
+ m_lcdc[(data & 0x07) - 1]->cs_w(0);
- m_lcdc0->cd_w(cd);
- m_lcdc1->cd_w(cd);
- m_lcdc2->cd_w(cd);
- m_lcdc3->cd_w(cd);
- m_lcdc4->cd_w(cd);
- m_lcdc5->cd_w(cd);
+ int const cd = BIT(data, 3);
+ for (auto &lcdc : m_lcdc)
+ lcdc->cd_w(cd);
// serial
m_sio->pout_w(BIT(data, 5));
@@ -786,7 +758,7 @@ WRITE_LINE_MEMBER( hx20_state::rtc_irq_w )
// VIDEO
//**************************************************************************
-PALETTE_INIT_MEMBER(hx20_state, hx20)
+void hx20_state::hx20_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xa5, 0xad, 0xa5);
palette.set_pen_color(1, 0x31, 0x39, 0x10);
@@ -799,12 +771,8 @@ PALETTE_INIT_MEMBER(hx20_state, hx20)
uint32_t hx20_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- m_lcdc0->screen_update(screen, bitmap, cliprect);
- m_lcdc1->screen_update(screen, bitmap, cliprect);
- m_lcdc2->screen_update(screen, bitmap, cliprect);
- m_lcdc3->screen_update(screen, bitmap, cliprect);
- m_lcdc4->screen_update(screen, bitmap, cliprect);
- m_lcdc5->screen_update(screen, bitmap, cliprect);
+ for (auto &lcdc : m_lcdc)
+ lcdc->screen_update(screen, bitmap, cliprect);
return 0;
}
@@ -899,20 +867,15 @@ MACHINE_CONFIG_START(hx20_state::hx20)
MCFG_SCREEN_UPDATE_DRIVER(hx20_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(hx20_state, hx20)
+ PALETTE(config, "palette", FUNC(hx20_state::hx20_palette), 2);
- MCFG_UPD7227_ADD(UPD7227_0_TAG, 0, 0)
- MCFG_UPD7227_ADD(UPD7227_1_TAG, 40, 0)
- MCFG_UPD7227_ADD(UPD7227_2_TAG, 80, 0)
- MCFG_UPD7227_ADD(UPD7227_3_TAG, 0, 16)
- MCFG_UPD7227_ADD(UPD7227_4_TAG, 40, 16)
- MCFG_UPD7227_ADD(UPD7227_5_TAG, 80, 16)
+ for (int y = 0, i = 0; 2 > y; ++y)
+ for (int x = 0; 3 > x; ++x)
+ UPD7227(config, m_lcdc[i++], x * 40, y * 16);
// sound hardware
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD(SPEAKER_TAG, SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
// devices
MC146818(config, m_rtc, 4.194304_MHz_XTAL);
diff --git a/src/mame/drivers/hyperspt.cpp b/src/mame/drivers/hyperspt.cpp
index 422e0a8aec9..6fcec542d85 100644
--- a/src/mame/drivers/hyperspt.cpp
+++ b/src/mame/drivers/hyperspt.cpp
@@ -324,10 +324,8 @@ MACHINE_CONFIG_START(hyperspt_state::hyperspt)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, hyperspt_state, vblank_irq))
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_hyperspt)
- MCFG_PALETTE_ADD(m_palette, 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(hyperspt_state, hyperspt)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_hyperspt);
+ PALETTE(config, m_palette, FUNC(hyperspt_state::hyperspt_palette), 16*16+16*16, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/i7000.cpp b/src/mame/drivers/i7000.cpp
index 561f738f3c7..916505868d4 100644
--- a/src/mame/drivers/i7000.cpp
+++ b/src/mame/drivers/i7000.cpp
@@ -71,10 +71,11 @@ public:
void init_i7000();
-private:
+protected:
void video_start() override;
void machine_start() override;
+private:
required_device<cpu_device> m_maincpu;
required_device<generic_slot_device> m_card;
required_device<gfxdecode_device> m_gfxdecode;
@@ -85,7 +86,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
- DECLARE_PALETTE_INIT(i7000);
+ void i7000_palette(palette_device &palette) const;
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( i7000_card );
DECLARE_READ8_MEMBER(i7000_kbd_r);
@@ -240,7 +241,7 @@ void i7000_state::machine_start()
}
}
-PALETTE_INIT_MEMBER(i7000_state, i7000)
+void i7000_state::i7000_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x33, 0x33, 0x33));
palette.set_pen_color(1, rgb_t(0xBB, 0xBB, 0xBB));
@@ -356,9 +357,8 @@ MACHINE_CONFIG_START(i7000_state::i7000)
MCFG_SCREEN_UPDATE_DRIVER(i7000_state, screen_update_i7000)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_i7000)
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(i7000_state, i7000)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_i7000);
+ PALETTE(config, "palette", FUNC(i7000_state::i7000_palette), 2);
r6545_1_device &crtc(R6545_1(config, "crtc", XTAL(20'000'000))); /* (?) */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/ibm3153.cpp b/src/mame/drivers/ibm3153.cpp
index 991e7879b00..5312285d329 100644
--- a/src/mame/drivers/ibm3153.cpp
+++ b/src/mame/drivers/ibm3153.cpp
@@ -54,14 +54,16 @@ public:
void ibm3153(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+
private:
- DECLARE_PALETTE_INIT(ibm3153);
+ void ibm3153_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void io_map(address_map &map);
void mem_map(address_map &map);
- virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_p_chargen;
};
@@ -90,11 +92,11 @@ uint32_t ibm3153_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
-PALETTE_INIT_MEMBER( ibm3153_state, ibm3153 )
+void ibm3153_state::ibm3153_palette(palette_device &palette) const
{
- palette.set_pen_color(0, 0, 0, 0 ); /* Black */
- palette.set_pen_color(1, 0, 255, 0 ); /* Full */
- palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */
+ palette.set_pen_color(0, 0, 0, 0); // Black
+ palette.set_pen_color(1, 0, 255, 0); // Full
+ palette.set_pen_color(2, 0, 128, 0); // Dimmed
}
void ibm3153_state::machine_reset()
@@ -116,8 +118,7 @@ MACHINE_CONFIG_START(ibm3153_state::ibm3153)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(ibm3153_state, ibm3153)
+ PALETTE(config, "palette", FUNC(ibm3153_state::ibm3153_palette), 3);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/ibm6580.cpp b/src/mame/drivers/ibm6580.cpp
index cf62f4b26c5..f83be36c8d2 100644
--- a/src/mame/drivers/ibm6580.cpp
+++ b/src/mame/drivers/ibm6580.cpp
@@ -153,7 +153,7 @@ public:
void ibm6580(machine_config &config);
private:
- DECLARE_PALETTE_INIT(ibm6580);
+ void ibm6580_palette(palette_device &palette) const;
DECLARE_WRITE16_MEMBER(pic_latch_w);
DECLARE_WRITE16_MEMBER(unk_latch_w);
@@ -834,11 +834,11 @@ uint32_t ibm6580_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
-PALETTE_INIT_MEMBER( ibm6580_state, ibm6580 )
+void ibm6580_state::ibm6580_palette(palette_device &palette) const
{
- palette.set_pen_color(0, 0, 0, 0 ); /* Black */
- palette.set_pen_color(1, 0, 192, 0 ); /* Normal */
- palette.set_pen_color(2, 0, 255, 0 ); /* Bright */
+ palette.set_pen_color(0, 0, 0, 0 ); // Black
+ palette.set_pen_color(1, 0, 192, 0 ); // Normal
+ palette.set_pen_color(2, 0, 255, 0 ); // Bright
}
void ibm6580_state::machine_start()
@@ -896,8 +896,7 @@ MACHINE_CONFIG_START(ibm6580_state::ibm6580)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ibm6580_state, vblank_w))
config.set_default_layout(layout_ibm6580);
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(ibm6580_state, ibm6580)
+ PALETTE(config, "palette", FUNC(ibm6580_state::ibm6580_palette), 3);
PIC8259(config, m_pic8259, 0);
m_pic8259->out_int_callback().set_inputline(m_maincpu, 0);
diff --git a/src/mame/drivers/ibmpcjr.cpp b/src/mame/drivers/ibmpcjr.cpp
index a21042d8a76..fbb9e3aa502 100644
--- a/src/mame/drivers/ibmpcjr.cpp
+++ b/src/mame/drivers/ibmpcjr.cpp
@@ -33,8 +33,8 @@
class pcjr_state : public driver_device
{
public:
- pcjr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pcjr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_pic8259(*this, "pic8259"),
m_pit8253(*this, "pit8253"),
diff --git a/src/mame/drivers/icatel.cpp b/src/mame/drivers/icatel.cpp
index 5d670832121..2c46896b84d 100644
--- a/src/mame/drivers/icatel.cpp
+++ b/src/mame/drivers/icatel.cpp
@@ -41,6 +41,10 @@ public:
void init_icatel();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_READ8_MEMBER(magic_string);
@@ -64,7 +68,7 @@ private:
DECLARE_READ8_MEMBER(ci16_r);
DECLARE_WRITE8_MEMBER(ci16_w);
- DECLARE_PALETTE_INIT(icatel);
+ void icatel_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(icatel_pixel_update);
@@ -72,8 +76,6 @@ private:
void i80c31_io(address_map &map);
void i80c31_prg(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<i80c31_device> m_maincpu;
required_device<hd44780_device> m_lcdc;
};
@@ -218,7 +220,7 @@ WRITE8_MEMBER(icatel_state::ci16_w)
//----------------------------------------
-PALETTE_INIT_MEMBER(icatel_state, icatel)
+void icatel_state::icatel_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -272,9 +274,8 @@ MACHINE_CONFIG_START(icatel_state::icatel)
MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(icatel_state, icatel)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_icatel)
+ PALETTE(config, "palette", FUNC(icatel_state::icatel_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_icatel);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
diff --git a/src/mame/drivers/ichiban.cpp b/src/mame/drivers/ichiban.cpp
index 0f8f27a8d62..5b2229756a1 100644
--- a/src/mame/drivers/ichiban.cpp
+++ b/src/mame/drivers/ichiban.cpp
@@ -141,7 +141,7 @@ MACHINE_CONFIG_START(ichibanjyan_state::ichibanjyan)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ichibanjyan)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 512)
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/igs009.cpp b/src/mame/drivers/igs009.cpp
index d8d3767caa1..18fb6bc90c2 100644
--- a/src/mame/drivers/igs009.cpp
+++ b/src/mame/drivers/igs009.cpp
@@ -853,12 +853,11 @@ MACHINE_CONFIG_START(igs009_state::jingbell)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(igs009_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, igs009_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jingbell)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_jingbell)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp
index d4596193eeb..b19a09763c8 100644
--- a/src/mame/drivers/igs011.cpp
+++ b/src/mame/drivers/igs011.cpp
@@ -4175,8 +4175,7 @@ void igs011_state::igs011_base(machine_config &config)
m_screen->set_screen_update(FUNC(igs011_state::screen_update_igs011));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 0x2000/4);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x2000/4);
m_palette->set_membits(8);
// GFXDECODE(config, "gfxdecode", m_palette, gfx_igs011);
diff --git a/src/mame/drivers/igs017.cpp b/src/mame/drivers/igs017.cpp
index 2224ce4d93d..94d3949100b 100644
--- a/src/mame/drivers/igs017.cpp
+++ b/src/mame/drivers/igs017.cpp
@@ -453,8 +453,8 @@ void igs_incdec_device::device_reset()
class igs017_state : public driver_device
{
public:
- igs017_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ igs017_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_remap_addr(-1),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
@@ -540,10 +540,10 @@ private:
DECLARE_WRITE16_MEMBER(mgcs_magic_w);
DECLARE_READ16_MEMBER(mgcs_magic_r);
- uint16_t mgcs_palette_bitswap(uint16_t bgr);
- uint16_t lhzb2a_palette_bitswap(uint16_t bgr);
- uint16_t tjsb_palette_bitswap(uint16_t bgr);
- uint16_t slqz2_palette_bitswap(uint16_t bgr);
+ uint16_t mgcs_palette_bitswap(uint16_t bgr) const;
+ uint16_t lhzb2a_palette_bitswap(uint16_t bgr) const;
+ uint16_t tjsb_palette_bitswap(uint16_t bgr) const;
+ uint16_t slqz2_palette_bitswap(uint16_t bgr) const;
DECLARE_READ8_MEMBER(sdmg2_keys_r);
DECLARE_WRITE16_MEMBER(sdmg2_magic_w);
@@ -629,26 +629,26 @@ uint32_t igs017_state::screen_update_igs017(screen_device &screen, bitmap_ind16
}
// palette bitswap callbacks
-uint16_t igs017_state::mgcs_palette_bitswap(uint16_t bgr)
+uint16_t igs017_state::mgcs_palette_bitswap(uint16_t bgr) const
{
bgr = ((bgr & 0xff00) >> 8) | ((bgr & 0x00ff) << 8);
return bitswap<16>(bgr, 7, 8, 9, 2, 14, 3, 13, 15, 12, 11, 10, 0, 1, 4, 5, 6);
}
-uint16_t igs017_state::lhzb2a_palette_bitswap(uint16_t bgr)
+uint16_t igs017_state::lhzb2a_palette_bitswap(uint16_t bgr) const
{
// bgr = ((bgr & 0xff00) >> 8) | ((bgr & 0x00ff) << 8);
return bitswap<16>(bgr, 15,9,13,12,11,5,4,8,7,6,0,14,3,2,1,10);
}
-uint16_t igs017_state::tjsb_palette_bitswap(uint16_t bgr)
+uint16_t igs017_state::tjsb_palette_bitswap(uint16_t bgr) const
{
// bitswap
return bitswap<16>(bgr, 15,12,3,6,10,5,4,2,9,13,8,7,11,1,0,14);
}
-uint16_t igs017_state::slqz2_palette_bitswap(uint16_t bgr)
+uint16_t igs017_state::slqz2_palette_bitswap(uint16_t bgr) const
{
return bitswap<16>(bgr, 15,14,9,4,11,10,12,3,7,6,5,8,13,2,1,0);
}
@@ -3552,10 +3552,9 @@ MACHINE_CONFIG_START(igs017_state::iqblocka)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette("palette");
@@ -3637,10 +3636,9 @@ MACHINE_CONFIG_START(igs017_state::mgcs)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette_scramble_cb(FUNC(igs017_state::mgcs_palette_bitswap), this);
@@ -3681,10 +3679,9 @@ MACHINE_CONFIG_START(igs017_state::lhzb2)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette_scramble_cb(FUNC(igs017_state::lhzb2a_palette_bitswap), this);
@@ -3733,10 +3730,9 @@ MACHINE_CONFIG_START(igs017_state::lhzb2a)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette_scramble_cb(FUNC(igs017_state::lhzb2a_palette_bitswap), this);
@@ -3777,10 +3773,9 @@ MACHINE_CONFIG_START(igs017_state::slqz2)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette_scramble_cb(FUNC(igs017_state::slqz2_palette_bitswap), this);
@@ -3814,10 +3809,9 @@ MACHINE_CONFIG_START(igs017_state::sdmg2)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette("palette");
@@ -3860,10 +3854,9 @@ MACHINE_CONFIG_START(igs017_state::mgdha)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette("palette");
@@ -3898,10 +3891,9 @@ MACHINE_CONFIG_START(igs017_state::tjsb)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette_scramble_cb(FUNC(igs017_state::tjsb_palette_bitswap), this);
@@ -3940,10 +3932,9 @@ MACHINE_CONFIG_START(igs017_state::spkrform)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(igs017_state, screen_update_igs017)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100*2)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x100*2);
IGS017_IGS031(config, m_igs017_igs031, 0);
m_igs017_igs031->set_palette("palette");
diff --git a/src/mame/drivers/igs_fear.cpp b/src/mame/drivers/igs_fear.cpp
index f8d8ab0ee2c..9e288680e2c 100644
--- a/src/mame/drivers/igs_fear.cpp
+++ b/src/mame/drivers/igs_fear.cpp
@@ -96,8 +96,7 @@ void igs_fear_state::igs_fear(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(igs_fear_state, igs_fear)
- PALETTE(config, m_palette, 0x200);
-
+ PALETTE(config, m_palette).set_entries(0x200);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_igs_fear);
/* sound hardware */
diff --git a/src/mame/drivers/igspoker.cpp b/src/mame/drivers/igspoker.cpp
index e29eb7cd45c..2e8ff33ac9a 100644
--- a/src/mame/drivers/igspoker.cpp
+++ b/src/mame/drivers/igspoker.cpp
@@ -1941,11 +1941,10 @@ MACHINE_CONFIG_START(igspoker_state::igspoker)
MCFG_SCREEN_SIZE(64*8, 32*8) // TODO: wrong screen size!
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(igspoker_state, screen_update_igs_video)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_igspoker)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_igspoker)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ikki.cpp b/src/mame/drivers/ikki.cpp
index 0611ae7a29e..8e160984c03 100644
--- a/src/mame/drivers/ikki.cpp
+++ b/src/mame/drivers/ikki.cpp
@@ -271,12 +271,10 @@ MACHINE_CONFIG_START(ikki_state::ikki)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(ikki_state, screen_update_ikki)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ikki)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+1)
- MCFG_PALETTE_INIT_OWNER(ikki_state, ikki)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ikki);
+ PALETTE(config, m_palette, FUNC(ikki_state::ikki_palette), 1024, 256 + 1);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/imolagp.cpp b/src/mame/drivers/imolagp.cpp
index a76239b068f..082886e45a5 100644
--- a/src/mame/drivers/imolagp.cpp
+++ b/src/mame/drivers/imolagp.cpp
@@ -107,6 +107,11 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(imolagp_steerlatch_r);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_slavecpu;
@@ -134,10 +139,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
TIMER_DEVICE_CALLBACK_MEMBER(imolagp_pot_callback);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(imolagp);
+ void imolagp_palette(palette_device &palette) const;
uint32_t screen_update_imolagp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void imolagp_master_io(address_map &map);
void imolagp_master_map(address_map &map);
@@ -152,16 +154,16 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(imolagp_state, imolagp)
+void imolagp_state::imolagp_palette(palette_device &palette) const
{
// palette seems like 3bpp + intensity
// this still needs to be verified
for (int i = 0; i < 8; i++)
{
- palette.set_pen_color(i*4+0, 0, 0, 0);
- palette.set_pen_color(i*4+1, pal1bit(i >> 2)/2, pal1bit(i >> 1)/2, pal1bit(i >> 0)/2);
- palette.set_pen_color(i*4+2, 0, 0, 0);
- palette.set_pen_color(i*4+3, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
+ palette.set_pen_color(i*4 + 0, 0, 0, 0);
+ palette.set_pen_color(i*4 + 1, pal1bit(i >> 2) / 2, pal1bit(i >> 1) / 2, pal1bit(i >> 0) / 2);
+ palette.set_pen_color(i*4 + 2, 0, 0, 0);
+ palette.set_pen_color(i*4 + 3, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
}
@@ -179,19 +181,19 @@ uint32_t imolagp_state::screen_update_imolagp(screen_device &screen, bitmap_ind1
{
for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- const uint8_t *source = &m_videoram[layer][(y & 0xff) * 0x40];
- uint16_t *dest = &bitmap.pix16(y & 0xff);
+ uint8_t const *const source = &m_videoram[layer][(y & 0xff) * 0x40];
+ uint16_t *const dest = &bitmap.pix16(y & 0xff);
for (int i = 0; i < 0x40; i++)
{
- uint8_t data = source[i];
- if (data || layer == 0)
+ uint8_t const data = source[i];
+ if (data || !layer)
{
// one color per each 4 pixels
- uint8_t color = (data & 0xf0) >> 3;
- uint8_t x = (i << 2) - (m_scroll ^ 3);
+ uint8_t const color = (data & 0xf0) >> 3;
+ uint8_t const x = (i << 2) - (m_scroll ^ 3);
for (int x2 = 0; x2 < 4; x2++)
{
- uint8_t offset = x + x2;
+ uint8_t const offset = x + x2;
if (offset >= cliprect.min_x && offset <= cliprect.max_x)
dest[offset] = color | (data >> x2 & 1);
}
@@ -542,8 +544,7 @@ MACHINE_CONFIG_START(imolagp_state::imolagp)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, imolagp_state, vblank_irq))
- MCFG_PALETTE_ADD("palette", 0x20)
- MCFG_PALETTE_INIT_OWNER(imolagp_state, imolagp)
+ PALETTE(config, "palette", FUNC(imolagp_state::imolagp_palette), 0x20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/indigo.cpp b/src/mame/drivers/indigo.cpp
index 159600cd27e..e58056fce37 100644
--- a/src/mame/drivers/indigo.cpp
+++ b/src/mame/drivers/indigo.cpp
@@ -567,7 +567,7 @@ void indigo_state::indigo_base(machine_config &config)
screen.set_visarea(0, 1024-1, 0, 768-1);
screen.set_screen_update(FUNC(indigo_state::screen_update));
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
EEPROM_93C56_16BIT(config, m_eeprom);
}
diff --git a/src/mame/drivers/indy_indigo2.cpp b/src/mame/drivers/indy_indigo2.cpp
index 65b9517b87f..1c19fa6777e 100644
--- a/src/mame/drivers/indy_indigo2.cpp
+++ b/src/mame/drivers/indy_indigo2.cpp
@@ -198,7 +198,7 @@ void ip22_state::ip22_base(machine_config &config)
screen.set_screen_update("newport", FUNC(newport_video_device::screen_update));
screen.screen_vblank().set(m_newport, FUNC(newport_video_device::vblank_w));
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
NEWPORT_VIDEO(config, m_newport, m_maincpu, m_hpc3);
diff --git a/src/mame/drivers/inteladv.cpp b/src/mame/drivers/inteladv.cpp
index 40088572920..57254101554 100644
--- a/src/mame/drivers/inteladv.cpp
+++ b/src/mame/drivers/inteladv.cpp
@@ -27,24 +27,25 @@
class inteladv_state : public driver_device
{
public:
- inteladv_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ inteladv_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette")
{ }
void inteladv(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
uint32_t screen_update_inteladv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void inteladv_main(address_map &map);
void inteladv(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
};
@@ -94,9 +95,7 @@ MACHINE_CONFIG_START(inteladv_state::inteladv)
MCFG_SCREEN_UPDATE_DRIVER(inteladv_state, screen_update_inteladv)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_888, 256).enable_shadows();
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/intv.cpp b/src/mame/drivers/intv.cpp
index 299fea36a8f..c878215b485 100644
--- a/src/mame/drivers/intv.cpp
+++ b/src/mame/drivers/intv.cpp
@@ -69,39 +69,35 @@ RO-3-9506 = 8KiB (4Kiw) self decoding address mask rom with external address dec
#endif
#endif
-static const unsigned char intv_colors[] =
+static constexpr rgb_t intv_colors[] =
{
- 0x00, 0x00, 0x00, /* BLACK */
- 0x00, 0x2D, 0xFF, /* BLUE */
- 0xFF, 0x3D, 0x10, /* RED */
- 0xC9, 0xCF, 0xAB, /* TAN */
- 0x38, 0x6B, 0x3F, /* DARK GREEN */
- 0x00, 0xA7, 0x56, /* GREEN */
- 0xFA, 0xEA, 0x50, /* YELLOW */
- 0xFF, 0xFC, 0xFF, /* WHITE */
- 0xBD, 0xAC, 0xC8, /* GRAY */
- 0x24, 0xB8, 0xFF, /* CYAN */
- 0xFF, 0xB4, 0x1F, /* ORANGE */
- 0x54, 0x6E, 0x00, /* BROWN */
- 0xFF, 0x4E, 0x57, /* PINK */
- 0xA4, 0x96, 0xFF, /* LIGHT BLUE */
- 0x75, 0xCC, 0x80, /* YELLOW GREEN */
- 0xB5, 0x1A, 0x58 /* PURPLE */
+ { 0x00, 0x00, 0x00 }, // BLACK
+ { 0x00, 0x2d, 0xff }, // BLUE
+ { 0xff, 0x3d, 0x10 }, // RED
+ { 0xc9, 0xcf, 0xab }, // TAN
+ { 0x38, 0x6b, 0x3f }, // DARK GREEN
+ { 0x00, 0xa7, 0x56 }, // GREEN
+ { 0xfa, 0xea, 0x50 }, // YELLOW
+ { 0xff, 0xfc, 0xff }, // WHITE
+ { 0xbd, 0xac, 0xc8 }, // GRAY
+ { 0x24, 0xb8, 0xff }, // CYAN
+ { 0xff, 0xb4, 0x1f }, // ORANGE
+ { 0x54, 0x6e, 0x00 }, // BROWN
+ { 0xff, 0x4e, 0x57 }, // PINK
+ { 0xa4, 0x96, 0xff }, // LIGHT BLUE
+ { 0x75, 0xcc, 0x80 }, // YELLOW GREEN
+ { 0xb5, 0x1a, 0x58 } // PURPLE
};
-PALETTE_INIT_MEMBER(intv_state, intv)
+void intv_state::intv_palette(palette_device &palette) const
{
int k = 0;
- uint8_t r, g, b;
- /* Two copies of everything (why?) */
+ // Two copies of everything (why?)
for (int i = 0; i < 16; i++)
{
- r = intv_colors[i * 3 + 0];
- g = intv_colors[i * 3 + 1];
- b = intv_colors[i * 3 + 2];
- palette.set_indirect_color(i, rgb_t(r, g, b));
- palette.set_indirect_color(i + 16, rgb_t(r, g, b));
+ palette.set_indirect_color(i, intv_colors[i]);
+ palette.set_indirect_color(i + 16, intv_colors[i]);
}
for (int i = 0; i < 16; i++)
@@ -478,11 +474,9 @@ MACHINE_CONFIG_START(intv_state::intv)
MCFG_SCREEN_UPDATE_DRIVER(intv_state, screen_update_intv)
MCFG_SCREEN_SIZE(stic_device::SCREEN_WIDTH*INTV_X_SCALE, stic_device::SCREEN_HEIGHT*INTV_Y_SCALE)
MCFG_SCREEN_VISIBLE_AREA(0, stic_device::SCREEN_WIDTH*INTV_X_SCALE-1, 0, stic_device::SCREEN_HEIGHT*INTV_Y_SCALE-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(intv_state, intv)
+ PALETTE(config, m_palette, FUNC(intv_state::intv_palette), 0x400, 32);
MCFG_INTV_CONTROL_PORT_ADD("iopt_right_ctrl", intv_control_port_devices, "handctrl")
MCFG_INTV_CONTROL_PORT_ADD("iopt_left_ctrl", intv_control_port_devices, "handctrl")
@@ -551,9 +545,7 @@ MACHINE_CONFIG_START(intv_state::intvkbd)
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_intvkbd)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(intv_state, intv)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_intvkbd)
/* crt controller */
TMS9927(config, m_crtc, XTAL(7'159'090)/8);
diff --git a/src/mame/drivers/inufuku.cpp b/src/mame/drivers/inufuku.cpp
index d1791d09830..80a9271c733 100644
--- a/src/mame/drivers/inufuku.cpp
+++ b/src/mame/drivers/inufuku.cpp
@@ -356,7 +356,7 @@ MACHINE_CONFIG_START(inufuku_state::inufuku)
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 223)
MCFG_SCREEN_UPDATE_DRIVER(inufuku_state, screen_update_inufuku)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, inufuku_state, screen_vblank_inufuku))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_offsets(0, 1); // reference videos confirm at least the +1 against tilemaps in 3on3dunk (the highscore header text and black box are meant to be 1 pixel misaligned, although there is currently a priority bug there too)
@@ -365,9 +365,8 @@ MACHINE_CONFIG_START(inufuku_state::inufuku)
m_spr->set_gfx_region(2);
m_spr->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_inufuku)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xGGGGGBBBBBRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_inufuku);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 4096);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ipds.cpp b/src/mame/drivers/ipds.cpp
index 96bd4f3e176..87c39b19d87 100644
--- a/src/mame/drivers/ipds.cpp
+++ b/src/mame/drivers/ipds.cpp
@@ -19,8 +19,8 @@
class ipds_state : public driver_device
{
public:
- ipds_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ipds_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_crtc(*this, "i8275"),
m_palette(*this, "palette")
@@ -148,7 +148,7 @@ MACHINE_CONFIG_START(ipds_state::ipds)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ipds)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("i8275", I8275, XTAL(19'660'800) / 4)
MCFG_I8275_CHARACTER_WIDTH(6)
diff --git a/src/mame/drivers/iq151.cpp b/src/mame/drivers/iq151.cpp
index 72277e40d77..7574b6fb4ec 100644
--- a/src/mame/drivers/iq151.cpp
+++ b/src/mame/drivers/iq151.cpp
@@ -405,7 +405,7 @@ MACHINE_CONFIG_START(iq151_state::iq151)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 32*8-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/iqblock.cpp b/src/mame/drivers/iqblock.cpp
index 526b25f5b89..a8f5fa8192a 100644
--- a/src/mame/drivers/iqblock.cpp
+++ b/src/mame/drivers/iqblock.cpp
@@ -364,14 +364,12 @@ MACHINE_CONFIG_START(iqblock_state::iqblock)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_iqblock)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("ymsnd", YM2413, 3579545)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ YM2413(config, "ymsnd", 3'579'545).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/irisha.cpp b/src/mame/drivers/irisha.cpp
index 545be9f4d6f..44527d8f855 100644
--- a/src/mame/drivers/irisha.cpp
+++ b/src/mame/drivers/irisha.cpp
@@ -380,7 +380,7 @@ MACHINE_CONFIG_START(irisha_state::irisha)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_irisha)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/irobot.cpp b/src/mame/drivers/irobot.cpp
index 4ca24af4c99..99481b24fab 100644
--- a/src/mame/drivers/irobot.cpp
+++ b/src/mame/drivers/irobot.cpp
@@ -304,8 +304,7 @@ void irobot_state::irobot(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_irobot);
- PALETTE(config, m_palette, 64 + 32); /* 64 for polygons, 32 for text */
- m_palette->set_init(FUNC(irobot_state::palette_init_irobot));
+ PALETTE(config, m_palette, FUNC(irobot_state::irobot_palette), 64 + 32); // 64 for polygons, 32 for text
TIMER(config, "irvg_timer").configure_generic(FUNC(irobot_state::irobot_irvg_done_callback));
TIMER(config, "irmb_timer").configure_generic(FUNC(irobot_state::irobot_irmb_done_callback));
diff --git a/src/mame/drivers/ironhors.cpp b/src/mame/drivers/ironhors.cpp
index 288af65e523..3ff1379258e 100644
--- a/src/mame/drivers/ironhors.cpp
+++ b/src/mame/drivers/ironhors.cpp
@@ -399,12 +399,10 @@ MACHINE_CONFIG_START(ironhors_state::ironhors)
MCFG_SCREEN_RAW_PARAMS(18432000/4,296,8,256-8,255,16,240) // pixel clock is a guesswork
MCFG_SCREEN_UPDATE_DRIVER(ironhors_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ironhors)
- MCFG_PALETTE_ADD("palette", 16*8*16+16*8*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(ironhors_state, ironhors)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ironhors);
+ PALETTE(config, m_palette, FUNC(ironhors_state::ironhors_palette), 16*8*16+16*8*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/istellar.cpp b/src/mame/drivers/istellar.cpp
index 766d8a7e9b1..9b64b5a6777 100644
--- a/src/mame/drivers/istellar.cpp
+++ b/src/mame/drivers/istellar.cpp
@@ -297,14 +297,14 @@ MACHINE_CONFIG_START(istellar_state::istellar)
MCFG_LASERDISC_LDV1000_ADD("laserdisc")
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, istellar_state, screen_update_istellar)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, istellar_state, vblank_irq))
// Daphne says "TODO: get the real interstellar resistor values"
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_istellar)
diff --git a/src/mame/drivers/istrebiteli.cpp b/src/mame/drivers/istrebiteli.cpp
index 95f9cba8ed7..2c047cdb21e 100644
--- a/src/mame/drivers/istrebiteli.cpp
+++ b/src/mame/drivers/istrebiteli.cpp
@@ -32,19 +32,20 @@
/////////////////////////////////////////////////////////////
-class istrebiteli_sound_device : public device_t,
- public device_sound_interface
+class istrebiteli_sound_device : public device_t, public device_sound_interface
{
public:
istrebiteli_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void sound_w(uint8_t data);
+
protected:
- // device-level overrides
+ // device_t overrides
virtual void device_start() override;
- // sound stream update overrides
+ // device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
+
private:
// internal state
sound_stream *m_channel;
@@ -136,8 +137,25 @@ public:
{
}
- DECLARE_PALETTE_INIT(istrebiteli);
- DECLARE_PALETTE_INIT(motogonki);
+ void init_istreb();
+ void init_moto();
+
+ void istreb(machine_config &config);
+ void motogonki(machine_config &config);
+
+ DECLARE_CUSTOM_INPUT_MEMBER(collision_r);
+ DECLARE_CUSTOM_INPUT_MEMBER(coin_r);
+
+ DECLARE_INPUT_CHANGED_MEMBER(coin_inc);
+
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
+private:
+ void istrebiteli_palette(palette_device &palette) const;
+ void motogonki_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(ppi0_r);
DECLARE_WRITE8_MEMBER(ppi0_w);
DECLARE_READ8_MEMBER(ppi1_r);
@@ -150,24 +168,14 @@ public:
DECLARE_WRITE8_MEMBER(tileram_w);
DECLARE_WRITE8_MEMBER(moto_tileram_w);
DECLARE_WRITE8_MEMBER(road_ctrl_w);
- DECLARE_CUSTOM_INPUT_MEMBER(collision_r);
- DECLARE_CUSTOM_INPUT_MEMBER(coin_r);
- DECLARE_INPUT_CHANGED_MEMBER(coin_inc);
DECLARE_VIDEO_START(moto);
- void init_istreb();
- void init_moto();
-
required_device<cpu_device> m_maincpu;
required_device<i8255_device> m_ppi0;
required_device<i8255_device> m_ppi1;
required_device<gfxdecode_device> m_gfxdecode;
required_device<istrebiteli_sound_device> m_sound_dev;
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
TILE_GET_INFO_MEMBER(get_tile_info);
tilemap_t *m_tilemap;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -179,10 +187,9 @@ public:
uint8_t m_spr_xy[8];
uint8_t m_tileram[16];
uint8_t m_road_scroll;
- void istreb(machine_config &config);
+
void io_map(address_map &map);
void mem_map(address_map &map);
- void motogonki(machine_config &config);
void moto_io_map(address_map &map);
void moto_mem_map(address_map &map);
};
@@ -206,27 +213,25 @@ void istrebiteli_state::machine_reset()
}
static const rgb_t istreb_palette[4] = {
- rgb_t(0x00, 0x00, 0x00),
- rgb_t(0x00, 0x00, 0xff),
- rgb_t(0xff, 0xff, 0xff),
- rgb_t(0x00, 0x00, 0xff)
-};
+ rgb_t(0x00, 0x00, 0x00),
+ rgb_t(0x00, 0x00, 0xff),
+ rgb_t(0xff, 0xff, 0xff),
+ rgb_t(0x00, 0x00, 0xff) };
-PALETTE_INIT_MEMBER(istrebiteli_state,istrebiteli)
+void istrebiteli_state::istrebiteli_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, istreb_palette, ARRAY_LENGTH(istreb_palette));
+ palette.set_pen_colors(0, istreb_palette);
}
static const rgb_t moto_palette[4] = {
- rgb_t(0x00, 0x00, 0x00),
- rgb_t(0x00, 0x00, 0xff),
- rgb_t(0xff, 0xff, 0xff),
- rgb_t(0x00, 0x00, 0x00)
-};
+ rgb_t(0x00, 0x00, 0x00),
+ rgb_t(0x00, 0x00, 0xff),
+ rgb_t(0xff, 0xff, 0xff),
+ rgb_t(0x00, 0x00, 0x00) };
-PALETTE_INIT_MEMBER(istrebiteli_state, motogonki)
+void istrebiteli_state::motogonki_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, moto_palette, ARRAY_LENGTH(moto_palette));
+ palette.set_pen_colors(0, moto_palette);
}
TILE_GET_INFO_MEMBER(istrebiteli_state::get_tile_info)
@@ -581,7 +586,7 @@ GFXDECODE_END
MACHINE_CONFIG_START(istrebiteli_state::istreb)
/* basic machine hardware */
- MCFG_DEVICE_ADD(I8080_TAG, I8080, XTAL(8'000'000) / 4) // KR580VM80A
+ MCFG_DEVICE_ADD(m_maincpu, I8080, XTAL(8'000'000) / 4) // KR580VM80A
MCFG_DEVICE_PROGRAM_MAP(mem_map)
MCFG_DEVICE_IO_MAP(io_map)
@@ -601,19 +606,17 @@ MACHINE_CONFIG_START(istrebiteli_state::istreb)
MCFG_SCREEN_UPDATE_DRIVER(istrebiteli_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_istrebiteli)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(istrebiteli_state, istrebiteli)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_istrebiteli);
+ PALETTE(config, "palette", FUNC(istrebiteli_state::istrebiteli_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("custom", ISTREBITELI_SOUND, XTAL(8'000'000) / 2 / 256)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ ISTREBITELI_SOUND(config, m_sound_dev, XTAL(8'000'000) / 2 / 256).add_route(ALL_OUTPUTS, "mono", 1.00);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(istrebiteli_state::motogonki)
/* basic machine hardware */
- MCFG_DEVICE_ADD(I8080_TAG, I8080, XTAL(15'700'000) / 9) // KR580VM80A
+ MCFG_DEVICE_ADD(m_maincpu, I8080, XTAL(15'700'000) / 9) // KR580VM80A
MCFG_DEVICE_PROGRAM_MAP(moto_mem_map)
MCFG_DEVICE_IO_MAP(moto_io_map)
@@ -632,15 +635,13 @@ MACHINE_CONFIG_START(istrebiteli_state::motogonki)
MCFG_SCREEN_UPDATE_DRIVER(istrebiteli_state, moto_screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_motogonki)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(istrebiteli_state, motogonki)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_motogonki);
+ PALETTE(config, "palette", FUNC(istrebiteli_state::motogonki_palette), 4);
MCFG_VIDEO_START_OVERRIDE(istrebiteli_state, moto)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("custom", ISTREBITELI_SOUND, XTAL(8'000'000) / 2 / 256)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ ISTREBITELI_SOUND(config, m_sound_dev, XTAL(8'000'000) / 2 / 256).add_route(ALL_OUTPUTS, "mono", 1.00);
MACHINE_CONFIG_END
ROM_START( istreb )
diff --git a/src/mame/drivers/itech32.cpp b/src/mame/drivers/itech32.cpp
index 70ca451f8b5..c560827d403 100644
--- a/src/mame/drivers/itech32.cpp
+++ b/src/mame/drivers/itech32.cpp
@@ -1678,8 +1678,7 @@ void itech32_state::base_devices(machine_config &config)
WATCHDOG_TIMER(config, "watchdog");
- PALETTE(config, m_palette, 8192);
- m_palette->set_format(PALETTE_FORMAT_GRBX);
+ PALETTE(config, m_palette).set_format(palette_device::GRBx_888, 8192);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
@@ -1725,8 +1724,7 @@ void itech32_state::bloodstm(machine_config &config)
base_devices(config);
- m_palette->set_entries(32768);
- m_palette->set_format(PALETTE_FORMAT_XBGR);
+ m_palette->set_format(palette_device::xBGR_888, 32768);
m_palette->set_endianness(ENDIANNESS_LITTLE);
via(config);
@@ -1746,8 +1744,7 @@ void drivedge_state::drivedge(machine_config &config)
TMS32031(config, m_dsp2, TMS_CLOCK);
m_dsp2->set_addrmap(AS_PROGRAM, &drivedge_state::tms2_map);
- m_palette->set_entries(32768);
- m_palette->set_format(PALETTE_FORMAT_XBGR);
+ m_palette->set_format(palette_device::xBGR_888, 32768);
via(config);
m_via->writepb_handler().set(FUNC(drivedge_state::portb_out));
@@ -1777,8 +1774,7 @@ void itech32_state::sftm(machine_config &config)
m_soundcpu->set_addrmap(AS_PROGRAM, &itech32_state::sound_020_map);
m_soundcpu->set_periodic_int(FUNC(itech32_state::irq1_line_assert), attotime::from_hz(4*60));
- m_palette->set_entries(32768);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
+ m_palette->set_format(palette_device::xRGB_888, 32768);
}
void itech32_state::tourny(machine_config &config)
diff --git a/src/mame/drivers/itgambl2.cpp b/src/mame/drivers/itgambl2.cpp
index 34d4d99e331..14d69f83254 100644
--- a/src/mame/drivers/itgambl2.cpp
+++ b/src/mame/drivers/itgambl2.cpp
@@ -67,23 +67,27 @@
class itgambl2_state : public driver_device
{
public:
- itgambl2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ itgambl2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void itgambl2(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
+ required_device<cpu_device> m_maincpu;
+ required_device<palette_device> m_palette;
int m_test_x;
int m_test_y;
int m_start_offs;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(itgambl2);
+
+ void itgambl2_palette(palette_device &palette) const;
uint32_t screen_update_itgambl2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<palette_device> m_palette;
void itgambl2_map(address_map &map);
};
@@ -102,7 +106,6 @@ void itgambl2_state::video_start()
/* (dirty) debug code for looking 8bpps blitter-based gfxs */
uint32_t itgambl2_state::screen_update_itgambl2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- int x,y,count;
const uint8_t *blit_ram = memregion("gfx1")->base();
if(machine().input().code_pressed(KEYCODE_Z))
@@ -133,15 +136,13 @@ uint32_t itgambl2_state::screen_update_itgambl2(screen_device &screen, bitmap_rg
bitmap.fill(m_palette->black_pen(), cliprect);
- count = (m_start_offs);
+ int count = m_start_offs;
- for(y = 0; y < m_test_y; y++)
+ for(int y = 0; y < m_test_y; y++)
{
- for(x = 0; x < m_test_x; x++)
+ for(int x = 0; x < m_test_x; x++)
{
- uint32_t color;
-
- color = (blit_ram[count] & 0xff) >> 0;
+ uint32_t const color = (blit_ram[count] & 0xff) >> 0;
if(cliprect.contains(x, y))
bitmap.pix32(y, x) = m_palette->pen(color);
@@ -259,15 +260,13 @@ void itgambl2_state::machine_reset()
}
/* default 444 palette for debug purpose*/
-PALETTE_INIT_MEMBER(itgambl2_state, itgambl2)
+void itgambl2_state::itgambl2_palette(palette_device &palette) const
{
- int x, r, g, b;
-
- for(x = 0; x < 0x100; x++)
+ for(int x = 0; x < 0x100; x++)
{
- r = (x & 0xf) * 0x10;
- g = ((x & 0x3c) >> 2) * 0x10;
- b = ((x & 0xf0) >> 4) * 0x10;
+ int const r = (x & 0xf) * 0x10;
+ int const g = ((x & 0x3c) >> 2) * 0x10;
+ int const b = ((x & 0xf0) >> 4) * 0x10;
palette.set_pen_color(x, rgb_t(r, g, b));
}
}
@@ -278,11 +277,11 @@ PALETTE_INIT_MEMBER(itgambl2_state, itgambl2)
MACHINE_CONFIG_START(itgambl2_state::itgambl2)
- /* basic machine hardware */
+ // basic machine hardware
MCFG_DEVICE_ADD("maincpu", H83337, MAIN_CLOCK)
MCFG_DEVICE_PROGRAM_MAP(itgambl2_map)
- /* video hardware */
+ // video hardware
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@@ -290,15 +289,12 @@ MACHINE_CONFIG_START(itgambl2_state::itgambl2)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(itgambl2_state, screen_update_itgambl2)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_itgambl2);
+ PALETTE(config, m_palette, FUNC(itgambl2_state::itgambl2_palette), 0x200);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_itgambl2)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(itgambl2_state, itgambl2)
-
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("upd", UPD7759)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ UPD7759(config, "upd").add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/itgambl3.cpp b/src/mame/drivers/itgambl3.cpp
index 3ce8f76c871..3f6f25b4cde 100644
--- a/src/mame/drivers/itgambl3.cpp
+++ b/src/mame/drivers/itgambl3.cpp
@@ -53,23 +53,27 @@
class itgambl3_state : public driver_device
{
public:
- itgambl3_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ itgambl3_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void itgambl3(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
int m_test_x;
int m_test_y;
int m_start_offs;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(itgambl3);
- uint32_t screen_update_itgambl3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
+
+ void itgambl3_palette(palette_device &palette) const;
+ uint32_t screen_update_itgambl3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void itgambl3_map(address_map &map);
};
@@ -246,16 +250,14 @@ void itgambl3_state::machine_reset()
}
/* default 444 palette for debug purpose*/
-PALETTE_INIT_MEMBER(itgambl3_state, itgambl3)
+void itgambl3_state::itgambl3_palette(palette_device &palette) const
{
- int x,r,g,b;
-
- for(x=0;x<0x100;x++)
+ for (int x = 0; x < 0x100; x++)
{
- r = (x & 0xf)*0x11;
- g = ((x & 0x3c)>>2)*0x11;
- b = ((x & 0xf0)>>4)*0x11;
- palette.set_pen_color(x,rgb_t(r,g,b));
+ int const r = (x & 0xf) * 0x11;
+ int const g = ((x & 0x3c) >> 2) * 0x11;
+ int const b = ((x & 0xf0) >> 4) * 0x11;
+ palette.set_pen_color(x, rgb_t(r, g, b));
}
}
@@ -266,11 +268,11 @@ PALETTE_INIT_MEMBER(itgambl3_state, itgambl3)
MACHINE_CONFIG_START(itgambl3_state::itgambl3)
- /* basic machine hardware */
- MCFG_DEVICE_ADD("maincpu", H83044, MAIN_CLOCK) /* wrong CPU, but we have not a M16C core ATM */
+ // basic machine hardware
+ MCFG_DEVICE_ADD("maincpu", H83044, MAIN_CLOCK) // wrong CPU, but we have not a M16C core ATM
MCFG_DEVICE_PROGRAM_MAP(itgambl3_map)
- /* video hardware */
+ // video hardware
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
@@ -278,14 +280,12 @@ MACHINE_CONFIG_START(itgambl3_state::itgambl3)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(itgambl3_state, screen_update_itgambl3)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_itgambl3);
+ PALETTE(config, m_palette, FUNC(itgambl3_state::itgambl3_palette), 0x200);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_itgambl3)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(itgambl3_state, itgambl3)
-
- /* sound hardware */
+ // sound hardware
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("oki", OKIM6295, MAIN_CLOCK/16, okim6295_device::PIN7_HIGH) /* 1MHz */
+ MCFG_DEVICE_ADD("oki", OKIM6295, MAIN_CLOCK/16, okim6295_device::PIN7_HIGH) // 1MHz
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/itgamble.cpp b/src/mame/drivers/itgamble.cpp
index 869dab951b5..c3701df621e 100644
--- a/src/mame/drivers/itgamble.cpp
+++ b/src/mame/drivers/itgamble.cpp
@@ -289,7 +289,7 @@ void itgamble_state::itgamble(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, "gfxdecode", m_palette, gfx_itgamble);
- PALETTE(config, m_palette, 0x200);
+ PALETTE(config, m_palette).set_entries(0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/itt3030.cpp b/src/mame/drivers/itt3030.cpp
index 9d64b13dd9c..39cb7bb5e89 100644
--- a/src/mame/drivers/itt3030.cpp
+++ b/src/mame/drivers/itt3030.cpp
@@ -232,6 +232,11 @@ public:
void itt3030(machine_config &config);
+protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -252,16 +257,12 @@ private:
DECLARE_WRITE_LINE_MEMBER(fdcirq_w);
DECLARE_WRITE_LINE_MEMBER(fdcdrq_w);
DECLARE_WRITE_LINE_MEMBER(fdchld_w);
- DECLARE_PALETTE_INIT(itt3030);
+ void itt3030_palette(palette_device &palette) const;
void itt3030_io(address_map &map);
void itt3030_map(address_map &map);
void lower48_map(address_map &map);
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
// devices
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
@@ -278,7 +279,6 @@ private:
// shared pointers
required_shared_ptr<uint8_t> m_vram;
-private:
uint8_t m_kbdclk, m_kbdread, m_kbdport2;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
@@ -532,7 +532,7 @@ static GFXDECODE_START( gfx_itt3030 )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(itt3030_state, itt3030)
+void itt3030_state::itt3030_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(215, 229, 82));
@@ -720,7 +720,7 @@ MACHINE_CONFIG_START(itt3030_state::itt3030)
MCFG_SCREEN_UPDATE_DRIVER(itt3030_state, screen_update)
MCFG_SCREEN_SIZE(80*8, 24*12)
MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 24*12-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* devices */
ADDRESS_MAP_BANK(config, "lowerbank").set_map(&itt3030_state::lower48_map).set_options(ENDIANNESS_LITTLE, 8, 20, 0xc000);
@@ -735,18 +735,16 @@ MACHINE_CONFIG_START(itt3030_state::itt3030)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", itt3030_floppies, "525qd", itt3030_state::itt3030_floppy_formats)
MCFG_FLOPPY_DRIVE_ADD("fdc:2", itt3030_floppies, "525qd", itt3030_state::itt3030_floppy_formats)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_itt3030)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_itt3030);
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(itt3030_state, itt3030)
+ PALETTE(config, m_palette, FUNC(itt3030_state::itt3030_palette), 3);
/* internal ram */
RAM(config, "mainram").set_default_size("256K");
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD( "beeper", BEEP, 3250 )
- MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 1.00);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/jack.cpp b/src/mame/drivers/jack.cpp
index 51aee2349fc..5aaa0d113ad 100644
--- a/src/mame/drivers/jack.cpp
+++ b/src/mame/drivers/jack.cpp
@@ -929,12 +929,11 @@ MACHINE_CONFIG_START(jack_state::jack)
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(jack_state, screen_update_jack)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jack)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_jack)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -997,9 +996,7 @@ MACHINE_CONFIG_START(jack_state::joinem)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_joinem)
- MCFG_DEVICE_REMOVE("palette")
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(jack_state, joinem)
+ PALETTE(config.replace(), m_palette, FUNC(jack_state::joinem_palette), 64);
MCFG_VIDEO_START_OVERRIDE(jack_state,joinem)
MACHINE_CONFIG_END
@@ -1016,8 +1013,7 @@ MACHINE_CONFIG_START(jack_state::unclepoo)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(256)
+ m_palette->set_entries(256);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/jackal.cpp b/src/mame/drivers/jackal.cpp
index 4debcc73ef4..0e8b8480cbc 100644
--- a/src/mame/drivers/jackal.cpp
+++ b/src/mame/drivers/jackal.cpp
@@ -380,12 +380,10 @@ MACHINE_CONFIG_START(jackal_state::jackal)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, jackal_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jackal)
- MCFG_PALETTE_ADD("palette", 0x300)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x200)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_LITTLE)
- MCFG_PALETTE_INIT_OWNER(jackal_state, jackal)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_jackal);
+ PALETTE(config, m_palette, FUNC(jackal_state::jackal_palette));
+ m_palette->set_format(palette_device::xBGR_555, 0x300, 0x200);
+ m_palette->set_endianness(ENDIANNESS_LITTLE);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/jackie.cpp b/src/mame/drivers/jackie.cpp
index 0b99f5480f5..91e90c19351 100644
--- a/src/mame/drivers/jackie.cpp
+++ b/src/mame/drivers/jackie.cpp
@@ -577,7 +577,7 @@ void jackie_state::jackie(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jackie);
- PALETTE(config, m_palette, 2048).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jackpool.cpp b/src/mame/drivers/jackpool.cpp
index 6a745594303..4b8800b9a16 100644
--- a/src/mame/drivers/jackpool.cpp
+++ b/src/mame/drivers/jackpool.cpp
@@ -31,24 +31,28 @@ TODO:
class jackpool_state : public driver_device
{
public:
- jackpool_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jackpool_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void jackpool(machine_config &config);
void init_jackpool();
+protected:
+ virtual void video_start() override;
+
private:
DECLARE_READ8_MEMBER(jackpool_io_r);
DECLARE_WRITE_LINE_MEMBER(map_vreg_w);
- virtual void video_start() override;
uint32_t screen_update_jackpool(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(jackpool_interrupt);
+ void jackpool_mem(address_map &map);
required_shared_ptr<uint16_t> m_vram;
uint8_t m_map_vreg;
@@ -56,7 +60,6 @@ private:
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
- void jackpool_mem(address_map &map);
};
@@ -235,7 +238,7 @@ MACHINE_CONFIG_START(jackpool_state::jackpool)
MCFG_DEVICE_PROGRAM_MAP(jackpool_mem)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", jackpool_state, jackpool_interrupt) // ?
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jackpool)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_jackpool);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -268,10 +271,9 @@ MACHINE_CONFIG_START(jackpool_state::jackpool)
EEPROM_93C46_16BIT(config, "eeprom");
- MCFG_DEVICE_ADD("uart", NS16550, 1843200) // exact type and clock unknown
+ NS16550(config, "uart", 1843200); // exact type and clock unknown
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x200);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jailbrek.cpp b/src/mame/drivers/jailbrek.cpp
index 38d93ac6bce..d4529239329 100644
--- a/src/mame/drivers/jailbrek.cpp
+++ b/src/mame/drivers/jailbrek.cpp
@@ -271,15 +271,13 @@ MACHINE_CONFIG_START(jailbrek_state::jailbrek)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jailbrek)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(jailbrek_state, jailbrek)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_jailbrek);
+ PALETTE(config, m_palette, FUNC(jailbrek_state::jailbrek_palette), 512, 32);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 396, 8, 248, 256, 16, 240)
MCFG_SCREEN_UPDATE_DRIVER(jailbrek_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, jailbrek_state, vblank_irq))
/* sound hardware */
diff --git a/src/mame/drivers/jalmah.cpp b/src/mame/drivers/jalmah.cpp
index 0f3fa0372e6..64d63283345 100644
--- a/src/mame/drivers/jalmah.cpp
+++ b/src/mame/drivers/jalmah.cpp
@@ -121,8 +121,8 @@ OSC: 12.000MHz
class jalmah_state : public driver_device
{
public:
- jalmah_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jalmah_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_palette(*this, "palette"),
m_tmap(*this, "scroll%u", 0),
m_sharedram(*this, "sharedram"),
@@ -133,7 +133,7 @@ public:
m_okibank(*this, "okibank"),
m_system_io(*this, "SYSTEM"),
m_dsw_io(*this, "DSW")
- { }
+ { }
DECLARE_WRITE8_MEMBER(tilebank_w);
DECLARE_WRITE8_MEMBER(okirom_w);
@@ -1101,10 +1101,9 @@ MACHINE_CONFIG_START(jalmah_state::jalmah)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(12000000/2,406,0,256,263,16,240) // assume same as nmk16 & mega system 1
MCFG_SCREEN_UPDATE_DRIVER(jalmah_state, screen_update_jalmah)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x400);
MCFG_TIMER_DRIVER_ADD_PERIODIC("mcusim", jalmah_state, mcu_sim, attotime::from_hz(10000))
diff --git a/src/mame/drivers/jangou.cpp b/src/mame/drivers/jangou.cpp
index 7d6f47ac171..1bc6fb59389 100644
--- a/src/mame/drivers/jangou.cpp
+++ b/src/mame/drivers/jangou.cpp
@@ -112,7 +112,7 @@ private:
DECLARE_READ8_MEMBER(input_mux_r);
DECLARE_READ8_MEMBER(input_system_r);
- DECLARE_PALETTE_INIT(jangou);
+ void jangou_palette(palette_device &palette) const;
DECLARE_MACHINE_START(jngolady);
DECLARE_MACHINE_RESET(jngolady);
DECLARE_MACHINE_START(common);
@@ -142,42 +142,40 @@ private:
*
*************************************/
-/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
-PALETTE_INIT_MEMBER(jangou_state, jangou)
+// guess: use the same resistor values as Crazy Climber (needs checking on the real hardware)
+void jangou_state::jangou_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_rg[3], weights_b[2];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
- for (i = 0;i < palette.entries(); i++)
+ for (int i = 0;i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -190,16 +188,14 @@ void jangou_state::video_start()
uint32_t jangou_state::screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y;
-
- for (y = cliprect.min_y; y <= cliprect.max_y; ++y)
+ for (int y = cliprect.min_y; y <= cliprect.max_y; ++y)
{
const uint8_t *src = &m_blitter->blit_buffer(y, cliprect.min_x);
uint16_t *dst = &m_tmp_bitmap->pix16(y, cliprect.min_x);
- for (x = cliprect.min_x; x <= cliprect.max_x; x += 2)
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x += 2)
{
- uint32_t srcpix = *src++;
+ uint32_t const srcpix = *src++;
*dst++ = m_palette->pen(srcpix & 0xf);
*dst++ = m_palette->pen((srcpix >> 4) & 0xf);
}
@@ -892,10 +888,9 @@ MACHINE_CONFIG_START(jangou_state::jangou)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240) // assume same as nightgal.cpp
MCFG_SCREEN_UPDATE_DRIVER(jangou_state, screen_update_jangou)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(jangou_state, jangou)
+ PALETTE(config, m_palette, FUNC(jangou_state::jangou_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jantotsu.cpp b/src/mame/drivers/jantotsu.cpp
index 77c08eaa652..95ab9ddb4f9 100644
--- a/src/mame/drivers/jantotsu.cpp
+++ b/src/mame/drivers/jantotsu.cpp
@@ -108,11 +108,12 @@ dumped by sayu
class jantotsu_state : public driver_device
{
public:
- jantotsu_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jantotsu_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_adpcm(*this, "adpcm") ,
- m_palette(*this, "palette"){ }
+ m_palette(*this, "palette")
+ { }
void jantotsu(machine_config &config);
@@ -141,7 +142,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(jantotsu);
+ void jantotsu_palette(palette_device &palette) const;
uint32_t screen_update_jantotsu(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(jan_adpcm_int);
required_device<cpu_device> m_maincpu;
@@ -218,26 +219,26 @@ WRITE8_MEMBER(jantotsu_state::bankaddr_w)
logerror("I/O port $07 write trips %02x\n",data);
}
-PALETTE_INIT_MEMBER(jantotsu_state, jantotsu)
+void jantotsu_state::jantotsu_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2, r, g, b;
- int i;
- for (i = 0; i < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[0] >> 4) & 0x01;
- bit2 = (color_prom[0] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[0], 3);
+ bit1 = BIT(color_prom[0], 4);
+ bit2 = BIT(color_prom[0], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[0], 6);
+ bit2 = BIT(color_prom[0], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
@@ -518,8 +519,7 @@ MACHINE_CONFIG_START(jantotsu_state::jantotsu)
MCFG_SCREEN_UPDATE_DRIVER(jantotsu_state, screen_update_jantotsu)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x20)
- MCFG_PALETTE_INIT_OWNER(jantotsu_state, jantotsu)
+ PALETTE(config, m_palette, FUNC(jantotsu_state::jantotsu_palette), 0x20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jchan.cpp b/src/mame/drivers/jchan.cpp
index 9de1278308f..25d45bfa545 100644
--- a/src/mame/drivers/jchan.cpp
+++ b/src/mame/drivers/jchan.cpp
@@ -614,7 +614,7 @@ MACHINE_CONFIG_START(jchan_state::jchan)
WATCHDOG_TIMER(config, "watchdog");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jchan)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_jchan);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -622,18 +622,17 @@ MACHINE_CONFIG_START(jchan_state::jchan)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(jchan_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x10000);
KANEKO_TMAP(config, m_view2);
m_view2->set_gfx_region(0);
m_view2->set_offset(33, 11, 320, 240);
m_view2->set_gfxdecode_tag("gfxdecode");
- MCFG_DEVICE_ADD("spritegen1", SKNS_SPRITE, 0)
- MCFG_DEVICE_ADD("spritegen2", SKNS_SPRITE, 0)
+ for (auto &spritegen : m_spritegen)
+ SKNS_SPRITE(config, spritegen, 0);
MCFG_DEVICE_ADD("toybox", KANEKO_TOYBOX, "eeprom", "DSW1", "mcuram", "mcudata")
diff --git a/src/mame/drivers/jclub2.cpp b/src/mame/drivers/jclub2.cpp
index a1caa4b7656..57dc4d26b5d 100644
--- a/src/mame/drivers/jclub2.cpp
+++ b/src/mame/drivers/jclub2.cpp
@@ -1155,10 +1155,9 @@ MACHINE_CONFIG_START(jclub2o_state::jclub2o)
MCFG_SCREEN_SIZE(0x190, 0x100+16)
MCFG_SCREEN_VISIBLE_AREA(0, 0x190-1, 0x10, 0x100-1)
MCFG_SCREEN_UPDATE_DRIVER(jclub2_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
ST0020_SPRITES(config, m_st0020, 0);
m_st0020->set_is_jclub2(1);
@@ -1189,10 +1188,9 @@ MACHINE_CONFIG_START(jclub2_state::jclub2)
MCFG_SCREEN_SIZE(0x190, 0x100+16)
MCFG_SCREEN_VISIBLE_AREA(0, 0x190-1, 8, 0x100-8-1)
MCFG_SCREEN_UPDATE_DRIVER(jclub2_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
// NOT an ST0020 but instead ST0032, ram format isn't compatible at least
ST0020_SPRITES(config, m_st0020, 0);
@@ -1224,12 +1222,11 @@ MACHINE_CONFIG_START(darkhors_state::darkhors)
MCFG_SCREEN_SIZE(0x190, 0x100+16)
MCFG_SCREEN_VISIBLE_AREA(0, 0x190-1, 8, 0x100-8-1)
MCFG_SCREEN_UPDATE_DRIVER(darkhors_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_darkhors)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_darkhors);
MCFG_VIDEO_START_OVERRIDE(darkhors_state, darkhors)
// layout
diff --git a/src/mame/drivers/jokrwild.cpp b/src/mame/drivers/jokrwild.cpp
index 63610e2cc4f..38c53c9fbe6 100644
--- a/src/mame/drivers/jokrwild.cpp
+++ b/src/mame/drivers/jokrwild.cpp
@@ -85,32 +85,36 @@
class jokrwild_state : public driver_device
{
public:
- jokrwild_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jokrwild_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void jokrwild(machine_config &config);
void init_jokrwild();
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(jokrwild_videoram_w);
DECLARE_WRITE8_MEMBER(jokrwild_colorram_w);
DECLARE_READ8_MEMBER(rng_r);
DECLARE_WRITE8_MEMBER(testa_w);
DECLARE_WRITE8_MEMBER(testb_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(jokrwild);
+ void jokrwild_palette(palette_device &palette) const;
uint32_t screen_update_jokrwild(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
void jokrwild_map(address_map &map);
};
@@ -156,7 +160,7 @@ uint32_t jokrwild_state::screen_update_jokrwild(screen_device &screen, bitmap_in
return 0;
}
-PALETTE_INIT_MEMBER(jokrwild_state, jokrwild)
+void jokrwild_state::jokrwild_palette(palette_device &palette) const
{
//missing proms
}
@@ -436,9 +440,8 @@ MACHINE_CONFIG_START(jokrwild_state::jokrwild)
MCFG_SCREEN_UPDATE_DRIVER(jokrwild_state, screen_update_jokrwild)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jokrwild)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(jokrwild_state, jokrwild)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_jokrwild);
+ PALETTE(config, "palette", FUNC(jokrwild_state::jokrwild_palette), 512);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/16)); /* guess */
crtc.set_screen("screen");
@@ -484,22 +487,22 @@ ROM_END
**************************/
void jokrwild_state::init_jokrwild()
-/*****************************************************************************
+{
+ /*****************************************************************************
- Encryption was made by pages of 256 bytes.
+ Encryption was made by pages of 256 bytes.
- For each page, the value is XORed with a fixed value (0xCC),
- then XORed again with the offset of the original value inside its own page.
+ For each page, the value is XORed with a fixed value (0xCC),
+ then XORed again with the offset of the original value inside its own page.
- Example:
+ Example:
- For encrypted value at offset 0x123A (0x89)...
+ For encrypted value at offset 0x123A (0x89)...
- 0x89 XOR 0xCC XOR 0x3A = 0x7F
+ 0x89 XOR 0xCC XOR 0x3A = 0x7F
-*****************************************************************************/
-{
- uint8_t *srcp = memregion( "maincpu" )->base();
+ *****************************************************************************/
+ uint8_t *const srcp = memregion( "maincpu" )->base();
for (int i = 0x8000; i < 0x10000; i++)
{
int offs = i & 0xff;
diff --git a/src/mame/drivers/jollyjgr.cpp b/src/mame/drivers/jollyjgr.cpp
index 7c025e3845d..7fddc2e98e5 100644
--- a/src/mame/drivers/jollyjgr.cpp
+++ b/src/mame/drivers/jollyjgr.cpp
@@ -128,8 +128,8 @@ Notes:
class jollyjgr_state : public driver_device
{
public:
- jollyjgr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jollyjgr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
@@ -170,7 +170,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(jollyjgr);
+ void jollyjgr_palette(palette_device &palette) const;
uint32_t screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_fspider(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
@@ -450,28 +450,30 @@ INPUT_PORTS_END
*************************************/
/* tilemap / sprites palette */
-PALETTE_INIT_MEMBER(jollyjgr_state, jollyjgr)
+void jollyjgr_state::jollyjgr_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = BIT(*color_prom, 0);
bit1 = BIT(*color_prom, 1);
bit2 = BIT(*color_prom, 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
bit0 = BIT(*color_prom, 3);
bit1 = BIT(*color_prom, 4);
bit2 = BIT(*color_prom, 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
bit0 = BIT(*color_prom, 6);
bit1 = BIT(*color_prom, 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r,g,b));
color_prom++;
@@ -494,31 +496,27 @@ void jollyjgr_state::video_start()
m_bg_tilemap->set_scroll_cols(32);
}
-void jollyjgr_state::draw_bitmap( bitmap_rgb32 &bitmap )
+void jollyjgr_state::draw_bitmap(bitmap_rgb32 &bitmap)
{
- int x, y, count;
- int i, bit0, bit1, bit2;
- int color;
-
- count = 0;
- for (y = 0; y < 256; y++)
+ int count = 0;
+ for (int y = 0; y < 256; y++)
{
- for (x = 0; x < 256 / 8; x++)
+ for (int x = 0; x < 256 / 8; x++)
{
- for(i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
- bit0 = (m_bitmap[count] >> i) & 1;
- bit1 = (m_bitmap[count + 0x2000] >> i) & 1;
- bit2 = (m_bitmap[count + 0x4000] >> i) & 1;
- color = bit0 | (bit1 << 1) | (bit2 << 2);
+ int const bit0 = BIT(m_bitmap[count], i);
+ int const bit1 = BIT(m_bitmap[count + 0x2000], i);
+ int const bit2 = BIT(m_bitmap[count + 0x4000], i);
+ int const color = bit0 | (bit1 << 1) | (bit2 << 2);
- if(color)
+ if (color)
{
- if(m_flip_x && m_flip_y)
+ if (m_flip_x && m_flip_y)
bitmap.pix32(y, x * 8 + i) = m_bm_palette->pen_color(color);
- else if(m_flip_x && !m_flip_y)
+ else if (m_flip_x && !m_flip_y)
bitmap.pix32(255 - y, x * 8 + i) = m_bm_palette->pen_color(color);
- else if(!m_flip_x && m_flip_y)
+ else if (!m_flip_x && m_flip_y)
bitmap.pix32(y, 255 - x * 8 - i) = m_bm_palette->pen_color(color);
else
bitmap.pix32(255 - y, 255 - x * 8 - i) = m_bm_palette->pen_color(color);
@@ -532,14 +530,11 @@ void jollyjgr_state::draw_bitmap( bitmap_rgb32 &bitmap )
uint32_t jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- uint8_t *spriteram = m_spriteram;
- int offs;
-
bitmap.fill(m_bm_palette->pen_color(0), cliprect);
- if(m_pri) //used in Frog & Spiders level 3
+ if (m_pri) //used in Frog & Spiders level 3
{
- if(!(m_bitmap_disable))
+ if (!(m_bitmap_disable))
draw_bitmap(bitmap);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
@@ -552,15 +547,15 @@ uint32_t jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rg
draw_bitmap(bitmap);
}
- /* Sprites are the same as in Galaxian */
- for (offs = 0; offs < 0x40; offs += 4)
+ // Sprites are the same as in Galaxian
+ for (int offs = 0; offs < 0x40; offs += 4)
{
- int sx = spriteram[offs + 3] + 1;
- int sy = spriteram[offs];
- int flipx = spriteram[offs + 1] & 0x40;
- int flipy = spriteram[offs + 1] & 0x80;
- int code = spriteram[offs + 1] & 0x3f;
- int color = spriteram[offs + 2] & 7;
+ int sx = m_spriteram[offs + 3] + 1;
+ int sy = m_spriteram[offs];
+ int flipx = m_spriteram[offs + 1] & 0x40;
+ int flipy = m_spriteram[offs + 1] & 0x80;
+ int code = m_spriteram[offs + 1] & 0x3f;
+ int color = m_spriteram[offs + 2] & 7;
if (m_flip_x)
{
@@ -580,7 +575,6 @@ uint32_t jollyjgr_state::screen_update_jollyjgr(screen_device &screen, bitmap_rg
code,color,
flipx,flipy,
sx,sy,0);
-
}
return 0;
}
@@ -696,10 +690,9 @@ MACHINE_CONFIG_START(jollyjgr_state::jollyjgr)
MCFG_SCREEN_UPDATE_DRIVER(jollyjgr_state, screen_update_jollyjgr)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, jollyjgr_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jollyjgr)
- MCFG_PALETTE_ADD("palette", 32) // tilemap and sprites
- MCFG_PALETTE_INIT_OWNER(jollyjgr_state, jollyjgr)
- MCFG_PALETTE_ADD_3BIT_RGB("bm_palette") // bitmap
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_jollyjgr);
+ PALETTE(config, m_palette, FUNC(jollyjgr_state::jollyjgr_palette), 32); // tilemap and sprites
+ PALETTE(config, m_bm_palette, palette_device::RGB_3BIT); // bitmap
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp
index 1fafaa3a7f1..e8286ef38c3 100644
--- a/src/mame/drivers/jongkyo.cpp
+++ b/src/mame/drivers/jongkyo.cpp
@@ -40,8 +40,8 @@
class jongkyo_state : public driver_device
{
public:
- jongkyo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jongkyo_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_bank1(*this, "bank1"),
m_bank1d(*this, "bank1d"),
@@ -78,7 +78,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(jongkyo);
+ void jongkyo_palette(palette_device &palette) const;
uint32_t screen_update_jongkyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void decrypted_opcodes_map(address_map &map);
void jongkyo_memmap(address_map &map);
@@ -471,20 +471,18 @@ INPUT_PORTS_END
*
*************************************/
-PALETTE_INIT_MEMBER(jongkyo_state, jongkyo)
+void jongkyo_state::jongkyo_palette(palette_device &palette) const
{
- int i;
- uint8_t* proms = memregion("proms")->base();
- for (i = 0; i < 0x40; i++)
+ uint8_t const *const proms = memregion("proms")->base();
+ for (int i = 0; i < 0x40; i++)
{
- int data = proms[i];
+ int const data = proms[i];
- int r = (data >> 0) & 0x07;
- int g = (data >> 3) & 0x07;
- int b = (data >> 6) & 0x03;
-
- palette.set_pen_color(i, r << 5, g << 5, b << 6 );
+ int const r = pal3bit((data >> 0) & 0x07);
+ int const g = pal3bit((data >> 3) & 0x07);
+ int const b = pal2bit((data >> 6) & 0x03);
+ palette.set_pen_color(i, r, g, b);
}
}
@@ -532,8 +530,7 @@ MACHINE_CONFIG_START(jongkyo_state::jongkyo)
MCFG_SCREEN_UPDATE_DRIVER(jongkyo_state, screen_update_jongkyo)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(jongkyo_state, jongkyo)
+ PALETTE(config, "palette", FUNC(jongkyo_state::jongkyo_palette), 0x100);
SPEAKER(config, "mono").front_center();
ay8910_device &aysnd(AY8910(config, "aysnd", JONGKYO_CLOCK/8));
diff --git a/src/mame/drivers/jonos.cpp b/src/mame/drivers/jonos.cpp
index b7e74808269..f48a6981af2 100644
--- a/src/mame/drivers/jonos.cpp
+++ b/src/mame/drivers/jonos.cpp
@@ -31,7 +31,7 @@ public:
, m_maincpu(*this, "maincpu")
, m_p_videoram(*this, "videoram")
, m_p_chargen(*this, "chargen")
- { }
+ { }
void jonos(machine_config &config);
@@ -190,7 +190,7 @@ MACHINE_CONFIG_START(jonos_state::jonos)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jonos)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
keyboard.set_keyboard_callback(FUNC(jonos_state::kbd_put));
diff --git a/src/mame/drivers/joystand.cpp b/src/mame/drivers/joystand.cpp
index 74011f91287..900f3ccb810 100644
--- a/src/mame/drivers/joystand.cpp
+++ b/src/mame/drivers/joystand.cpp
@@ -103,8 +103,8 @@ Notes:
class joystand_state : public driver_device
{
public:
- joystand_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ joystand_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_tmp68301(*this, "tmp68301"),
m_palette(*this, "palette"),
@@ -135,6 +135,11 @@ public:
void joystand(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
// devices
required_device<cpu_device> m_maincpu;
@@ -201,11 +206,8 @@ private:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- virtual void video_start() override;
// machine
- virtual void machine_start() override;
- virtual void machine_reset() override;
INTERRUPT_GEN_MEMBER(joystand_interrupt);
void joystand_map(address_map &map);
};
@@ -605,11 +607,10 @@ MACHINE_CONFIG_START(joystand_state::joystand)
MCFG_SCREEN_SIZE(0x200, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0x40, 0x40+0x178-1, 0x10, 0x100-1)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_joystand)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_joystand);
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("bg15_palette")
+ PALETTE(config, m_bg15_palette, palette_device::RGB_555);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jr100.cpp b/src/mame/drivers/jr100.cpp
index 7cb360c5680..3235e60ceb6 100644
--- a/src/mame/drivers/jr100.cpp
+++ b/src/mame/drivers/jr100.cpp
@@ -30,8 +30,8 @@
class jr100_state : public driver_device
{
public:
- jr100_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jr100_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_ram(*this, "ram"),
m_pcg(*this, "pcg"),
m_vram(*this, "vram"),
@@ -49,7 +49,8 @@ public:
m_line6(*this, "LINE6"),
m_line7(*this, "LINE7"),
m_line8(*this, "LINE8") ,
- m_maincpu(*this, "maincpu") { }
+ m_maincpu(*this, "maincpu")
+ { }
void jr100(machine_config &config);
@@ -391,7 +392,7 @@ void jr100_state::jr100(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_jr100);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
VIA6522(config, m_via, XTAL(14'318'181) / 16);
m_via->readpb_handler().set(FUNC(jr100_state::jr100_via_read_b));
diff --git a/src/mame/drivers/jr200.cpp b/src/mame/drivers/jr200.cpp
index 4da347d71ef..364b76c4111 100644
--- a/src/mame/drivers/jr200.cpp
+++ b/src/mame/drivers/jr200.cpp
@@ -28,8 +28,8 @@
class jr200_state : public driver_device
{
public:
- jr200_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ jr200_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
m_cram(*this, "cram"),
m_mn1271_ram(*this, "mn1271_ram"),
@@ -49,7 +49,8 @@ public:
m_row8(*this, "ROW8"),
m_row9(*this, "ROW9"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void jr200(machine_config &config);
@@ -552,10 +553,10 @@ MACHINE_CONFIG_START(jr200_state::jr200)
MCFG_SCREEN_SIZE(16 + 256 + 16, 16 + 192 + 16) /* border size not accurate */
MCFG_SCREEN_VISIBLE_AREA(0, 16 + 256 + 16 - 1, 0, 16 + 192 + 16 - 1)
MCFG_SCREEN_UPDATE_DRIVER(jr200_state, screen_update_jr200)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jr200)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/jrpacman.cpp b/src/mame/drivers/jrpacman.cpp
index edda1c297a9..aa0836e0aa0 100644
--- a/src/mame/drivers/jrpacman.cpp
+++ b/src/mame/drivers/jrpacman.cpp
@@ -312,9 +312,7 @@ void jrpacman_state::jrpacman(machine_config &config)
screen.screen_vblank().set(FUNC(jrpacman_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jrpacman);
- PALETTE(config, m_palette, 128*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(jrpacman_state::palette_init_pacman));
+ PALETTE(config, m_palette, FUNC(jrpacman_state::pacman_palette), 128 * 4, 32);
MCFG_VIDEO_START_OVERRIDE(jrpacman_state,jrpacman)
diff --git a/src/mame/drivers/jtc.cpp b/src/mame/drivers/jtc.cpp
index 37043871214..588a49ca077 100644
--- a/src/mame/drivers/jtc.cpp
+++ b/src/mame/drivers/jtc.cpp
@@ -55,7 +55,7 @@ public:
DECLARE_WRITE8_MEMBER( p2_w );
DECLARE_READ8_MEMBER( p3_r );
DECLARE_WRITE8_MEMBER( p3_w );
- DECLARE_PALETTE_INIT(jtc_es40);
+ void es40_palette(palette_device &palette) const;
DECLARE_QUICKLOAD_LOAD_MEMBER( jtc );
int m_centronics_busy;
@@ -716,7 +716,7 @@ uint32_t jtces23_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
-PALETTE_INIT_MEMBER(jtc_state,jtc_es40)
+void jtc_state::es40_palette(palette_device &palette) const
{
for (u8 i = 8; i < 16; i++)
palette.set_pen_color(i, rgb_t(BIT(i, 0) ? 0xc0 : 0, BIT(i, 1) ? 0xc0 : 0, BIT(i, 2) ? 0xc0 : 0));
@@ -741,21 +741,20 @@ void jtces40_state::video_start()
uint32_t jtces40_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- u8 i, y, z, x;
u16 ma = 0;
- for (y = 0; y < 64; y++)
+ for (int y = 0; y < 64; y++)
{
- for (z = 0; z < 3; z++)
+ for (int z = 0; z < 3; z++)
{
- for (x = 0; x < 40; x++)
+ for (int x = 0; x < 40; x++)
{
- u8 data = m_video_ram[ma + x];
- u8 r = ~m_color_ram_r[ma + x];
- u8 g = ~m_color_ram_g[ma + x];
- u8 b = ~m_color_ram_b[ma + x];
+ u8 const data = m_video_ram[ma + x];
+ u8 const r = ~m_color_ram_r[ma + x];
+ u8 const g = ~m_color_ram_g[ma + x];
+ u8 const b = ~m_color_ram_b[ma + x];
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
bitmap.pix16(y*3+z, (x * 8) + 7 - i) = (BIT(r, i) << 0) | (BIT(g, i) << 1) | (BIT(b, i) << 2) | (BIT(data, i) << 3);
}
ma+=40;
@@ -846,7 +845,7 @@ MACHINE_CONFIG_START(jtc_state::jtc)
MCFG_SCREEN_VISIBLE_AREA(0, 64-1, 0, 64-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* internal ram */
RAM(config, m_ram).set_default_size("2K");
@@ -874,7 +873,7 @@ MACHINE_CONFIG_START(jtces23_state::jtces23)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jtces23)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("4K");
@@ -895,8 +894,7 @@ MACHINE_CONFIG_START(jtces40_state::jtces40)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jtces40)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(jtc_state,jtc_es40)
+ PALETTE(config, "palette", FUNC(jtc_state::es40_palette), 16);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("8K").set_extra_options("16K,32K");
diff --git a/src/mame/drivers/jungleyo.cpp b/src/mame/drivers/jungleyo.cpp
index de732f955e8..b42416e14b7 100644
--- a/src/mame/drivers/jungleyo.cpp
+++ b/src/mame/drivers/jungleyo.cpp
@@ -56,9 +56,11 @@ public:
void jungleyo(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
/* video-related */
- virtual void video_start() override;
uint32_t screen_update_jungleyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void jungleyo_map(address_map &map);
@@ -124,7 +126,7 @@ MACHINE_CONFIG_START(jungleyo_state::jungleyo)
MCFG_DEVICE_PROGRAM_MAP(jungleyo_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", jungleyo_state, irq1_line_hold)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jungleyo)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_jungleyo);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -134,8 +136,7 @@ MACHINE_CONFIG_START(jungleyo_state::jungleyo)
MCFG_SCREEN_UPDATE_DRIVER(jungleyo_state, screen_update_jungleyo)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/junofrst.cpp b/src/mame/drivers/junofrst.cpp
index 3d45aa8ff59..a86811791c8 100644
--- a/src/mame/drivers/junofrst.cpp
+++ b/src/mame/drivers/junofrst.cpp
@@ -428,7 +428,7 @@ MACHINE_CONFIG_START(junofrst_state::junofrst)
WATCHDOG_TIMER(config, "watchdog");
- PALETTE(config, m_palette, 16).set_format(PALETTE_FORMAT_BBGGGRRR);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 16);
/* video hardware */
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/jupace.cpp b/src/mame/drivers/jupace.cpp
index 9fd23d91b72..8b551db5d1f 100644
--- a/src/mame/drivers/jupace.cpp
+++ b/src/mame/drivers/jupace.cpp
@@ -770,7 +770,7 @@ MACHINE_CONFIG_START(ace_state::ace)
MCFG_TIMER_DRIVER_ADD_SCANLINE("set_irq", ace_state, set_irq, SCREEN_TAG, 31*8, 264)
MCFG_TIMER_DRIVER_ADD_SCANLINE("clear_irq", ace_state, clear_irq, SCREEN_TAG, 32*8, 264)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ace)
diff --git a/src/mame/drivers/jupiter.cpp b/src/mame/drivers/jupiter.cpp
index 2f0f38d0b53..5366da61ac8 100644
--- a/src/mame/drivers/jupiter.cpp
+++ b/src/mame/drivers/jupiter.cpp
@@ -334,7 +334,7 @@ MACHINE_CONFIG_START(jupiter3_state::jupiter3)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 320-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// devices
FD1771(config, INS1771N1_TAG, 1000000);
diff --git a/src/mame/drivers/k8915.cpp b/src/mame/drivers/k8915.cpp
index ef7d7912edf..e316bd9ccc9 100644
--- a/src/mame/drivers/k8915.cpp
+++ b/src/mame/drivers/k8915.cpp
@@ -149,7 +149,7 @@ MACHINE_CONFIG_START(k8915_state::k8915)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
z80ctc_device& ctc(Z80CTC(config, "ctc", XTAL(4'915'200) / 2));
ctc.set_clk<2>(XTAL(4'915'200) / 2);
diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp
index 6cf40c43fef..9e166ea1560 100644
--- a/src/mame/drivers/kaneko16.cpp
+++ b/src/mame/drivers/kaneko16.cpp
@@ -1786,13 +1786,10 @@ MACHINE_CONFIG_START(kaneko16_berlwall_state::berlwall)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 240-1)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_berlwall_state, screen_update_berlwall)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_1x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_1x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
- MCFG_PALETTE_ADD(m_bgpalette, 32768) /* 32768 static colors for the bg */
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
- MCFG_PALETTE_INIT_OWNER(kaneko16_berlwall_state,berlwall)
+ PALETTE(config, m_bgpalette, palette_device::GRB_555); // 32768 static colors for the bg
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
@@ -1855,9 +1852,8 @@ MACHINE_CONFIG_START(kaneko16_state::bakubrkr)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_state, screen_update_kaneko16)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_2x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_2x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
@@ -1927,9 +1923,8 @@ MACHINE_CONFIG_START(kaneko16_state::blazeon)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_state, screen_update_kaneko16)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_1x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_1x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2[0], 0);
m_view2[0]->set_gfx_region(1);
@@ -1983,9 +1978,8 @@ MACHINE_CONFIG_START(kaneko16_state::wingforc)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_state, screen_update_kaneko16)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_1x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_1x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
@@ -2064,9 +2058,8 @@ MACHINE_CONFIG_START(kaneko16_gtmr_state::gtmr)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_state, screen_update_kaneko16)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x8bit_2x4bit)
- MCFG_PALETTE_ADD(m_palette, 32768)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x8bit_2x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 32768);
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
@@ -2173,9 +2166,8 @@ MACHINE_CONFIG_START(kaneko16_state::mgcrystl)
MCFG_SCREEN_UPDATE_DRIVER(kaneko16_state, screen_update_kaneko16)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_2x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_2x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
@@ -2292,9 +2284,8 @@ MACHINE_CONFIG_START(kaneko16_shogwarr_state::shogwarr)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_1x4bit_1x4bit)
- MCFG_PALETTE_ADD(m_palette, 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1x4bit_1x4bit);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2[0]);
m_view2[0]->set_gfx_region(1);
diff --git a/src/mame/drivers/kangaroo.cpp b/src/mame/drivers/kangaroo.cpp
index fc1ad219066..62fff7f69c5 100644
--- a/src/mame/drivers/kangaroo.cpp
+++ b/src/mame/drivers/kangaroo.cpp
@@ -437,7 +437,7 @@ MACHINE_CONFIG_START(kangaroo_state::nomcu)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK, 320*2, 0*2, 256*2, 260, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(kangaroo_state, screen_update_kangaroo)
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/kaypro.cpp b/src/mame/drivers/kaypro.cpp
index ee6b73a63f3..407c985cfa4 100644
--- a/src/mame/drivers/kaypro.cpp
+++ b/src/mame/drivers/kaypro.cpp
@@ -213,10 +213,10 @@ MACHINE_CONFIG_START(kaypro_state::kayproii)
MCFG_SCREEN_VISIBLE_AREA(0,80*7-1,0,24*10-1)
MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro )
MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kayproii)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kayproii)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -302,17 +302,15 @@ MACHINE_CONFIG_START(kaypro_state::kaypro484)
MCFG_VIDEO_START_OVERRIDE(kaypro_state, kaypro )
MCFG_SCREEN_UPDATE_DRIVER(kaypro_state, screen_update_kaypro484)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kaypro484)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(kaypro_state, kaypro)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_kaypro484);
+ PALETTE(config, m_palette, FUNC(kaypro_state::kaypro_palette), 3);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 950) /* piezo-device needs to be measured */
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ BEEP(config, m_beep, 950).add_route(ALL_OUTPUTS, "mono", 1.00); // piezo-device needs to be measured
/* devices */
- MC6845(config, m_crtc, 2000000); /* comes out of ULA - needs to be measured */
+ MC6845(config, m_crtc, 2000000); // comes out of ULA - needs to be measured
m_crtc->set_screen(m_screen);
m_crtc->set_show_border_area(false);
m_crtc->set_char_width(7);
diff --git a/src/mame/drivers/kc.cpp b/src/mame/drivers/kc.cpp
index 77e47af8938..7fbf8fed1ec 100644
--- a/src/mame/drivers/kc.cpp
+++ b/src/mame/drivers/kc.cpp
@@ -127,8 +127,7 @@ MACHINE_CONFIG_START(kc_state::kc85_3)
MCFG_SCREEN_PALETTE("palette")
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc_state, kc_scanline, "screen", 0, 1)
- MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE)
- MCFG_PALETTE_INIT_OWNER(kc_state, kc85 )
+ PALETTE(config, "palette", FUNC(kc_state::kc85_palette), KC85_PALETTE_SIZE);
kc_keyboard_device &keyboard(KC_KEYBOARD(config, "keyboard", XTAL(4'000'000)));
keyboard.out_wr_callback().set(FUNC(kc_state::keyboard_cb));
@@ -208,8 +207,7 @@ MACHINE_CONFIG_START(kc85_4_state::kc85_4)
MCFG_SCREEN_PALETTE("palette")
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", kc85_4_state, kc_scanline, "screen", 0, 1)
- MCFG_PALETTE_ADD("palette", KC85_PALETTE_SIZE)
- MCFG_PALETTE_INIT_OWNER(kc85_4_state, kc85 )
+ PALETTE(config, "palette", FUNC(kc85_4_state::kc85_palette), KC85_PALETTE_SIZE);
kc_keyboard_device &keyboard(KC_KEYBOARD(config, "keyboard", XTAL(4'000'000)));
keyboard.out_wr_callback().set(FUNC(kc_state::keyboard_cb));
diff --git a/src/mame/drivers/kchamp.cpp b/src/mame/drivers/kchamp.cpp
index ef01ebc9eb5..b60421bca77 100644
--- a/src/mame/drivers/kchamp.cpp
+++ b/src/mame/drivers/kchamp.cpp
@@ -431,13 +431,11 @@ MACHINE_CONFIG_START(kchamp_state::kchampvs)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kchamp_state, screen_update_kchampvs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, kchamp_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kchamp)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(kchamp_state, kchamp)
-
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_kchamp)
+ PALETTE(config, m_palette, FUNC(kchamp_state::kchamp_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -489,13 +487,11 @@ MACHINE_CONFIG_START(kchamp_state::kchamp)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kchamp_state, screen_update_kchamp)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, kchamp_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kchamp)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(kchamp_state, kchamp)
-
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_kchamp)
+ PALETTE(config, m_palette, FUNC(kchamp_state::kchamp_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/kdt6.cpp b/src/mame/drivers/kdt6.cpp
index 0b0c6eb6eca..9ca94a8bb09 100644
--- a/src/mame/drivers/kdt6.cpp
+++ b/src/mame/drivers/kdt6.cpp
@@ -628,7 +628,7 @@ MACHINE_CONFIG_START(kdt6_state::psi98)
MCFG_SCREEN_RAW_PARAMS(XTAL(13'516'800), 824, 48, 688, 274, 0, 250)
MCFG_SCREEN_UPDATE_DRIVER(kdt6_state, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
config.set_default_layout(layout_kdt6);
MC6845(config, m_crtc, XTAL(13'516'800) / 8);
diff --git a/src/mame/drivers/kickgoal.cpp b/src/mame/drivers/kickgoal.cpp
index b7a05b1aea6..7628eb9026b 100644
--- a/src/mame/drivers/kickgoal.cpp
+++ b/src/mame/drivers/kickgoal.cpp
@@ -443,11 +443,10 @@ MACHINE_CONFIG_START(kickgoal_state::kickgoal)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(9*8, 55*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kickgoal_state, screen_update_kickgoal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kickgoal)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_kickgoal);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(kickgoal_state,kickgoal)
@@ -481,11 +480,10 @@ MACHINE_CONFIG_START(kickgoal_state::actionhw)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(10*8+2, 54*8-1+2, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kickgoal_state, screen_update_kickgoal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_actionhw)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_actionhw);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(kickgoal_state,actionhw)
diff --git a/src/mame/drivers/kingdrby.cpp b/src/mame/drivers/kingdrby.cpp
index 4ac76456db2..84246640d98 100644
--- a/src/mame/drivers/kingdrby.cpp
+++ b/src/mame/drivers/kingdrby.cpp
@@ -107,6 +107,9 @@ public:
void cowrace(machine_config &config);
void kingdrby(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(sc0_vram_w);
DECLARE_WRITE8_MEMBER(sc0_attr_w);
@@ -122,9 +125,8 @@ private:
DECLARE_WRITE8_MEMBER(outportb_w);
TILE_GET_INFO_MEMBER(get_sc0_tile_info);
TILE_GET_INFO_MEMBER(get_sc1_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(kingdrby);
- DECLARE_PALETTE_INIT(kingdrbb);
+ void kingdrby_palette(palette_device &palette) const;
+ void kingdrbb_palette(palette_device &palette) const;
uint32_t screen_update_kingdrby(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -902,59 +904,61 @@ GFXDECODE_END
*
*************************************/
-PALETTE_INIT_MEMBER(kingdrby_state,kingdrby)
+void kingdrby_state::kingdrby_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
-
- for (i = 0; i < 0x200; ++i)
+ for (int i = 0; i < 0x200; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 0) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 7) & 0x01;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 5) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 0);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 3);
+ bit2 = BIT(color_prom[0], 2);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[0], 7);
+ bit1 = BIT(color_prom[0], 6);
+ bit2 = BIT(color_prom[0], 5);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
-PALETTE_INIT_MEMBER(kingdrby_state,kingdrbb)
+void kingdrby_state::kingdrbb_palette(palette_device &palette) const
{
- uint8_t *raw_prom = memregion("raw_prom")->base();
+ uint8_t *const raw_prom = memregion("raw_prom")->base();
uint8_t *prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
-
- for(i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
{
- /* this set has an extra address line shuffle applied on the prom */
+ // this set has an extra address line shuffle applied on the PROM
prom[i] = raw_prom[bitswap<16>(i, 15,14,13,12,11,10,9,8,7,6,5,0,1,2,3,4)+0x1000];
}
- for(i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (prom[i] >> 1) & 0x01;
- bit2 = (prom[i] >> 0) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (prom[i] >> 4) & 0x01;
- bit1 = (prom[i] >> 3) & 0x01;
- bit2 = (prom[i] >> 2) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (prom[i] >> 7) & 0x01;
- bit1 = (prom[i] >> 6) & 0x01;
- bit2 = (prom[i] >> 5) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(prom[i], 1);
+ bit2 = BIT(prom[i], 0);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(prom[i], 4);
+ bit1 = BIT(prom[i], 3);
+ bit2 = BIT(prom[i], 2);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(prom[i], 7);
+ bit1 = BIT(prom[i], 6);
+ bit2 = BIT(prom[i], 5);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -994,16 +998,15 @@ MACHINE_CONFIG_START(kingdrby_state::kingdrby)
m_ppi[1]->in_pc_callback().set(FUNC(kingdrby_state::input_mux_r));
m_ppi[1]->out_pc_callback().set(FUNC(kingdrby_state::outport2_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kingdrby)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(kingdrby_state,kingdrby)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_kingdrby);
+ PALETTE(config, m_palette, FUNC(kingdrby_state::kingdrby_palette), 0x200);
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, 256-1, 0, 224-1) /* controlled by CRTC */
MCFG_SCREEN_UPDATE_DRIVER(kingdrby_state, screen_update_kingdrby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
mc6845_device &crtc(MC6845(config, "crtc", CLK_1/32)); /* 53.333 Hz. guess */
crtc.set_screen("screen");
@@ -1023,8 +1026,7 @@ MACHINE_CONFIG_START(kingdrby_state::kingdrbb)
MCFG_DEVICE_MODIFY("slave")
MCFG_DEVICE_PROGRAM_MAP(slave_1986_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(kingdrby_state,kingdrbb)
+ m_palette->set_init(FUNC(kingdrby_state::kingdrbb_palette));
/* C as input, (all) as output */
m_ppi[0]->out_pa_callback().set(FUNC(kingdrby_state::sound_cmd_w));
@@ -1052,8 +1054,7 @@ MACHINE_CONFIG_START(kingdrby_state::cowrace)
MCFG_DEVICE_IO_MAP(cowrace_sound_io)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_cowrace)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(kingdrby_state,kingdrby)
+ m_palette->set_init(FUNC(kingdrby_state::kingdrby_palette));
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) // clock frequency & pin 7 not verified
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.80)
diff --git a/src/mame/drivers/kingobox.cpp b/src/mame/drivers/kingobox.cpp
index 399135a8875..cb3f3d8d78a 100644
--- a/src/mame/drivers/kingobox.cpp
+++ b/src/mame/drivers/kingobox.cpp
@@ -495,13 +495,11 @@ MACHINE_CONFIG_START(kingofb_state::kingofb)
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(kingofb_state, screen_update_kingofb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("nmigate", input_merger_device, in_w<0>))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kingobox)
- MCFG_PALETTE_ADD("palette", 256+8*2)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+8)
- MCFG_PALETTE_INIT_OWNER(kingofb_state,kingofb)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_kingobox)
+ PALETTE(config, m_palette, FUNC(kingofb_state::kingofb_palette), 256+8*2, 256+8);
MCFG_VIDEO_START_OVERRIDE(kingofb_state,kingofb)
/* sound hardware */
@@ -553,13 +551,11 @@ MACHINE_CONFIG_START(kingofb_state::ringking)
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(kingofb_state, screen_update_ringking)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("nmigate", input_merger_device, in_w<0>))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rk)
- MCFG_PALETTE_ADD("palette", 256+8*2)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+8)
- MCFG_PALETTE_INIT_OWNER(kingofb_state,ringking)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_rk)
+ PALETTE(config, m_palette, FUNC(kingofb_state::ringking_palette), 256+8*2, 256+8);
MCFG_VIDEO_START_OVERRIDE(kingofb_state,ringking)
/* sound hardware */
diff --git a/src/mame/drivers/kinst.cpp b/src/mame/drivers/kinst.cpp
index 72bfea15efd..aaa86789fed 100644
--- a/src/mame/drivers/kinst.cpp
+++ b/src/mame/drivers/kinst.cpp
@@ -740,7 +740,7 @@ void kinst_state::kinst(machine_config &config)
screen.set_screen_update(FUNC(kinst_state::screen_update));
screen.set_palette("palette");
- PALETTE(config, "palette", 32768).set_init("palette", FUNC(palette_device::palette_init_BBBBBGGGGGRRRRR));
+ PALETTE(config, "palette", palette_device::BGR_555);
/* sound hardware */
DCS_AUDIO_2K(config, m_dcs, 0);
diff --git a/src/mame/drivers/klax.cpp b/src/mame/drivers/klax.cpp
index 94f8a88b242..fe67297a324 100644
--- a/src/mame/drivers/klax.cpp
+++ b/src/mame/drivers/klax.cpp
@@ -206,9 +206,7 @@ MACHINE_CONFIG_START(klax_state::klax)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_klax)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 512).set_membits(8);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, klax_state, get_playfield_tile_info, 8,8, SCAN_COLS, 64,32)
diff --git a/src/mame/drivers/kncljoe.cpp b/src/mame/drivers/kncljoe.cpp
index f03e8eaeee3..cdd8d80de2c 100644
--- a/src/mame/drivers/kncljoe.cpp
+++ b/src/mame/drivers/kncljoe.cpp
@@ -272,12 +272,10 @@ MACHINE_CONFIG_START(kncljoe_state::kncljoe)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kncljoe_state, screen_update_kncljoe)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kncljoe)
- MCFG_PALETTE_ADD("palette", 16*8+16*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(128+16)
- MCFG_PALETTE_INIT_OWNER(kncljoe_state, kncljoe)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_kncljoe);
+ PALETTE(config, m_palette, FUNC(kncljoe_state::kncljoe_palette), 16*8+16*8, 128+16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/koikoi.cpp b/src/mame/drivers/koikoi.cpp
index 23bf222b0a0..51eb86d950f 100644
--- a/src/mame/drivers/koikoi.cpp
+++ b/src/mame/drivers/koikoi.cpp
@@ -48,16 +48,17 @@ to prevent disabling inputs.
#define KOIKOI_CRYSTAL 15468000
-static const int input_tab[]= { 0x22, 0x64, 0x44, 0x68, 0x30, 0x50, 0x70, 0x48, 0x28, 0x21, 0x41, 0x82, 0x81, 0x42 };
+static constexpr int input_tab[] = { 0x22, 0x64, 0x44, 0x68, 0x30, 0x50, 0x70, 0x48, 0x28, 0x21, 0x41, 0x82, 0x81, 0x42 };
class koikoi_state : public driver_device
{
public:
- koikoi_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ koikoi_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void koikoi(machine_config &config);
@@ -82,7 +83,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(koikoi);
+ void koikoi_palette(palette_device &palette) const;
uint32_t screen_update_koikoi(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -106,45 +107,43 @@ TILE_GET_INFO_MEMBER(koikoi_state::get_tile_info)
SET_TILE_INFO_MEMBER(0, code, color, flip);
}
-PALETTE_INIT_MEMBER(koikoi_state, koikoi)
+void koikoi_state::koikoi_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters/sprites */
- for (i = 0; i < 0x100; i++)
+ // characters/sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
@@ -373,10 +372,8 @@ MACHINE_CONFIG_START(koikoi_state::koikoi)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_koikoi)
- MCFG_PALETTE_ADD("palette", 8*32)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(koikoi_state, koikoi)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_koikoi);
+ PALETTE(config, "palette", FUNC(koikoi_state::koikoi_palette), 8 * 32, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/konamigx.cpp b/src/mame/drivers/konamigx.cpp
index 7e70a4eaf2e..50e33254c5c 100644
--- a/src/mame/drivers/konamigx.cpp
+++ b/src/mame/drivers/konamigx.cpp
@@ -1651,8 +1651,7 @@ void konamigx_state::konamigx(machine_config &config)
m_screen->set_visarea(24, 24+288-1, 16, 16+224-1);
m_screen->set_screen_update(FUNC(konamigx_state::screen_update_konamigx));
- PALETTE(config, m_palette, 8192);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 8192);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -1838,7 +1837,7 @@ void konamigx_state::gxtype3(machine_config &config)
m_k055673->set_config("gfx2", K055673_LAYOUT_GX6, -132, -23);
- PALETTE(config.replace(), m_palette, 16384);
+ PALETTE(config.replace(), m_palette).set_entries(16384);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -1876,7 +1875,7 @@ void konamigx_state::gxtype4(machine_config &config)
screen2.set_visarea(0, 384-1, 16, 32*8-1-16);
screen2.set_screen_update(FUNC(konamigx_state::screen_update_konamigx_right));
- PALETTE(config.replace(), m_palette, 8192);
+ PALETTE(config.replace(), m_palette).set_entries(8192);
m_palette->enable_shadows();
m_palette->enable_hilights();
diff --git a/src/mame/drivers/konamim2.cpp b/src/mame/drivers/konamim2.cpp
index bca70e30788..fee5bee182f 100644
--- a/src/mame/drivers/konamim2.cpp
+++ b/src/mame/drivers/konamim2.cpp
@@ -247,8 +247,8 @@ Notes:
class konamim2_state : public driver_device
{
public:
- konamim2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ konamim2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_ppc1(*this, "ppc1"),
m_ppc2(*this, "ppc2"),
m_bda(*this, "bda"),
diff --git a/src/mame/drivers/konblands.cpp b/src/mame/drivers/konblands.cpp
index 1f3dc2c8fac..a50f23ca37e 100644
--- a/src/mame/drivers/konblands.cpp
+++ b/src/mame/drivers/konblands.cpp
@@ -46,7 +46,7 @@ public:
private:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(konblands);
+ void konblands_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(ldp_r);
DECLARE_WRITE8_MEMBER(ldp_w);
DECLARE_WRITE8_MEMBER(nmi_enable_w);
@@ -74,26 +74,25 @@ private:
bool m_nmi_enable, m_irq_enable, m_firq_enable;
};
-PALETTE_INIT_MEMBER(konblands_state, konblands)
+void konblands_state::konblands_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
-
- for (i = 0; i < 0x20; ++i)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x20; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -295,10 +294,9 @@ MACHINE_CONFIG_START(konblands_state::konblands)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_konblands)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_konblands);
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(konblands_state, konblands)
+ PALETTE(config, "palette", FUNC(konblands_state::konblands_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/konendev.cpp b/src/mame/drivers/konendev.cpp
index d7af812563c..2708b198fe7 100644
--- a/src/mame/drivers/konendev.cpp
+++ b/src/mame/drivers/konendev.cpp
@@ -311,7 +311,7 @@ MACHINE_CONFIG_START(konendev_state::konendev)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", konendev_state, vbl_interrupt)
/* video hardware */
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/drivers/konmedal.cpp b/src/mame/drivers/konmedal.cpp
index 0fa5969f100..bb24bc21f71 100644
--- a/src/mame/drivers/konmedal.cpp
+++ b/src/mame/drivers/konmedal.cpp
@@ -62,7 +62,7 @@ public:
void tsukande(machine_config &config);
private:
- DECLARE_PALETTE_INIT(konmedal);
+ void konmedal_palette(palette_device &palette) const;
DECLARE_MACHINE_START(shuriboy);
DECLARE_READ8_MEMBER(vram_r);
@@ -199,18 +199,17 @@ uint32_t konmedal_state::screen_update_shuriboy(screen_device &screen, bitmap_in
return 0;
}
-PALETTE_INIT_MEMBER(konmedal_state, konmedal)
+void konmedal_state::konmedal_palette(palette_device &palette) const
{
- int i;
- uint8_t *PROM = memregion("proms")->base();
+ uint8_t const *const PROM = memregion("proms")->base();
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
// this is extremely wrong, see the color test screen
palette.set_pen_color(i,
- PROM[i]<<4,
- PROM[0x100+i]<<4,
- PROM[0x200+i]<<4);
+ PROM[i] << 4,
+ PROM[0x100 + i] << 4,
+ PROM[0x200 + i] << 4);
}
}
@@ -397,10 +396,8 @@ void konmedal_state::tsukande(machine_config &config)
screen.set_screen_update(FUNC(konmedal_state::screen_update_konmedal));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8192);
+ PALETTE(config, m_palette, FUNC(konmedal_state::konmedal_palette)).set_format(palette_device::xBGR_555, 8192);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- m_palette->set_init(FUNC(konmedal_state::palette_init_konmedal));
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(konmedal_state::tile_callback), this);
@@ -432,10 +429,8 @@ void konmedal_state::ddboy(machine_config &config)
screen.set_screen_update(FUNC(konmedal_state::screen_update_konmedal));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8192);
+ PALETTE(config, m_palette, FUNC(konmedal_state::konmedal_palette)).set_format(palette_device::xBGR_555, 8192);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- m_palette->set_init(FUNC(konmedal_state::palette_init_konmedal));
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(konmedal_state::tile_callback), this);
@@ -559,8 +554,7 @@ void konmedal_state::shuriboy(machine_config &config)
screen.set_screen_update(FUNC(konmedal_state::screen_update_shuriboy));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8192); // not verified
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette, FUNC(konmedal_state::konmedal_palette)).set_format(palette_device::xBGR_555, 8192); // not verified
m_palette->enable_shadows();
m_palette->enable_hilights();
diff --git a/src/mame/drivers/konmedal68k.cpp b/src/mame/drivers/konmedal68k.cpp
index 0eca3bda494..4bc346fc4c2 100644
--- a/src/mame/drivers/konmedal68k.cpp
+++ b/src/mame/drivers/konmedal68k.cpp
@@ -36,8 +36,8 @@
class konmedal68k_state : public driver_device
{
public:
- konmedal68k_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ konmedal68k_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_k056832(*this, "k056832"),
m_k055555(*this, "k055555"),
@@ -309,9 +309,7 @@ MACHINE_CONFIG_START(konmedal68k_state::kzaurus)
MCFG_SCREEN_UPDATE_DRIVER(konmedal68k_state, screen_update_konmedal68k)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_888, 8192).enable_shadows();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(konmedal68k_state::tile_callback), this);
diff --git a/src/mame/drivers/kontest.cpp b/src/mame/drivers/kontest.cpp
index 5b23ce7827e..bc01ab4fe74 100644
--- a/src/mame/drivers/kontest.cpp
+++ b/src/mame/drivers/kontest.cpp
@@ -32,11 +32,11 @@
class kontest_state : public driver_device
{
public:
- kontest_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_ram(*this, "ram"),
- m_palette(*this, "palette")
+ kontest_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_ram(*this, "ram"),
+ m_palette(*this, "palette")
{ }
void kontest(machine_config &config);
@@ -65,7 +65,7 @@ private:
virtual void video_start() override;
- DECLARE_PALETTE_INIT(kontest);
+ void kontest_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(kontest_interrupt);
};
@@ -76,26 +76,25 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(kontest_state, kontest)
+void kontest_state::kontest_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
-
- for (i = 0; i < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
+ int bit0, bit1, bit2;
+
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -271,8 +270,7 @@ MACHINE_CONFIG_START(kontest_state::kontest)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(kontest_state, kontest)
+ PALETTE(config, m_palette, FUNC(kontest_state::kontest_palette), 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/kopunch.cpp b/src/mame/drivers/kopunch.cpp
index 860b7c0ddbc..7de29871fa1 100644
--- a/src/mame/drivers/kopunch.cpp
+++ b/src/mame/drivers/kopunch.cpp
@@ -275,9 +275,8 @@ MACHINE_CONFIG_START(kopunch_state::kopunch)
MCFG_SCREEN_UPDATE_DRIVER(kopunch_state, screen_update_kopunch)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kopunch)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(kopunch_state, kopunch)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_kopunch);
+ PALETTE(config, "palette", FUNC(kopunch_state::kopunch_palette), 8);
/* sound hardware */
// ...
diff --git a/src/mame/drivers/kramermc.cpp b/src/mame/drivers/kramermc.cpp
index 143c453aa6f..5924c4a9ba5 100644
--- a/src/mame/drivers/kramermc.cpp
+++ b/src/mame/drivers/kramermc.cpp
@@ -129,11 +129,11 @@ MACHINE_CONFIG_START(kramermc_state::kramermc)
MCFG_SCREEN_SIZE(64*8, 16*8)
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kramermc_state, screen_update_kramermc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kramermc)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/kron.cpp b/src/mame/drivers/kron.cpp
index 611e681bd2d..7fa942dfdec 100644
--- a/src/mame/drivers/kron.cpp
+++ b/src/mame/drivers/kron.cpp
@@ -128,8 +128,8 @@
class kron180_state : public driver_device
{
public:
- kron180_state(const machine_config &mconfig, device_type type, const char *tag) :
- driver_device(mconfig, type, tag)
+ kron180_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
, m_videoram(*this, "videoram")
, m_keyboard(*this, "pc_keyboard")
@@ -315,7 +315,7 @@ MACHINE_CONFIG_START(kron180_state::kron180)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 199) // TODO: This need to be fixed once the real char table is used...
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* keyboard TODO: fix it, doesn't work yet */
MCFG_PC_KEYB_ADD("pc_keyboard", WRITELINE(*this, kron180_state, keyb_interrupt))
diff --git a/src/mame/drivers/ksayakyu.cpp b/src/mame/drivers/ksayakyu.cpp
index b3490ea0d4a..c4c1ced6ec8 100644
--- a/src/mame/drivers/ksayakyu.cpp
+++ b/src/mame/drivers/ksayakyu.cpp
@@ -278,12 +278,11 @@ MACHINE_CONFIG_START(ksayakyu_state::ksayakyu)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(ksayakyu_state, screen_update_ksayakyu)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", 0))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ksayakyu)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(ksayakyu_state, ksayakyu)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ksayakyu);
+ PALETTE(config, m_palette, FUNC(ksayakyu_state::ksayakyu_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/kyugo.cpp b/src/mame/drivers/kyugo.cpp
index 19bf850a073..f7f0de665d5 100644
--- a/src/mame/drivers/kyugo.cpp
+++ b/src/mame/drivers/kyugo.cpp
@@ -546,10 +546,10 @@ MACHINE_CONFIG_START(kyugo_state::kyugo_base)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(kyugo_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_kyugo)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/labyrunr.cpp b/src/mame/drivers/labyrunr.cpp
index 67b38e0df9c..41101cb84ec 100644
--- a/src/mame/drivers/labyrunr.cpp
+++ b/src/mame/drivers/labyrunr.cpp
@@ -183,11 +183,9 @@ MACHINE_CONFIG_START(labyrunr_state::labyrunr)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, labyrunr_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_labyrunr)
- MCFG_PALETTE_ADD("palette", 2*8*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(128)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_INIT_OWNER(labyrunr_state, labyrunr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_labyrunr);
+ PALETTE(config, m_palette, FUNC(labyrunr_state::labyrunr_palette));
+ m_palette->set_format(palette_device::xBGR_555, 2*8*16*16, 128);
K007121(config, m_k007121, 0);
m_k007121->set_palette_tag(m_palette);
diff --git a/src/mame/drivers/ladybug.cpp b/src/mame/drivers/ladybug.cpp
index 9f1757a1a80..f97996b3580 100644
--- a/src/mame/drivers/ladybug.cpp
+++ b/src/mame/drivers/ladybug.cpp
@@ -736,13 +736,10 @@ MACHINE_CONFIG_START(ladybug_state::ladybug)
MCFG_SCREEN_UPDATE_DRIVER(ladybug_state, screen_update_ladybug)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ladybug)
- MCFG_PALETTE_ADD("palette", 4*8+4*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(ladybug_state,ladybug)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_ladybug);
+ PALETTE(config, "palette", FUNC(ladybug_state::ladybug_palette), 4*8 + 4*16, 32);
- LADYBUG_VIDEO(config, m_video, 4000000);
- m_video->set_gfxdecode_tag("gfxdecode");
+ LADYBUG_VIDEO(config, m_video, 4000000).set_gfxdecode_tag("gfxdecode");
ls259_device &videolatch(LS259(config, "videolatch")); // L5 on video board or H3 on single board
videolatch.q_out_cb<0>().set(FUNC(ladybug_state::flipscreen_w)); // no other outputs used
@@ -750,11 +747,8 @@ MACHINE_CONFIG_START(ladybug_state::ladybug)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("sn1", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn2", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ SN76489(config, "sn1", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn2", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(dorodon_state::dorodon)
@@ -784,35 +778,22 @@ MACHINE_CONFIG_START(sraider_state::sraider)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sraider_state, screen_update_sraider)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sraider_state, screen_vblank_sraider))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sraider)
- MCFG_PALETTE_ADD("palette", 4*8+4*16+32+2)
- MCFG_PALETTE_INDIRECT_ENTRIES(32+32+1)
- MCFG_PALETTE_INIT_OWNER(sraider_state,sraider)
-
- LADYBUG_VIDEO(config, m_video, 4000000);
- m_video->set_gfxdecode_tag(m_gfxdecode);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sraider);
+ PALETTE(config, m_palette, FUNC(sraider_state::sraider_palette), 4*8 + 4*16 + 32 + 2, 32 + 32 + 1);
+ LADYBUG_VIDEO(config, m_video, 4000000).set_gfxdecode_tag(m_gfxdecode);
ZEROHOUR_STARS(config, m_stars, 0);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("sn1", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn2", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn3", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn4", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn5", SN76489, 4000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ SN76489(config, "sn1", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn2", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn3", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn4", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn5", 4000000).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ladyfrog.cpp b/src/mame/drivers/ladyfrog.cpp
index 81e0a854697..be3263d3bf5 100644
--- a/src/mame/drivers/ladyfrog.cpp
+++ b/src/mame/drivers/ladyfrog.cpp
@@ -312,8 +312,7 @@ void ladyfrog_state::ladyfrog(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ladyfrog);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/laser3k.cpp b/src/mame/drivers/laser3k.cpp
index fdc27124c5f..e2d3d28bd7c 100644
--- a/src/mame/drivers/laser3k.cpp
+++ b/src/mame/drivers/laser3k.cpp
@@ -86,28 +86,18 @@ public:
void laser3k(machine_config &config);
-private:
- required_device<m6502_device> m_maincpu;
- required_device<screen_device> m_screen;
- required_device<ram_device> m_ram;
- required_device<address_map_bank_device> m_bank0;
- required_device<address_map_bank_device> m_bank1;
- required_device<address_map_bank_device> m_bank2;
- required_device<address_map_bank_device> m_bank3;
- required_device<ay3600_device> m_ay3600;
- required_device<speaker_sound_device> m_speaker;
- required_device<sn76489_device> m_sn;
- required_ioport m_kbspecial;
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+private:
READ8_MEMBER( ram_r );
WRITE8_MEMBER( ram_w );
READ8_MEMBER( io_r );
WRITE8_MEMBER( io_w );
READ8_MEMBER( io2_r );
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(laser3k);
+ void laser3k_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void text_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void hgr_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
@@ -120,6 +110,21 @@ private:
void banks_map(address_map &map);
void laser3k_map(address_map &map);
+ void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen);
+ void do_io(int offset);
+
+ required_device<m6502_device> m_maincpu;
+ required_device<screen_device> m_screen;
+ required_device<ram_device> m_ram;
+ required_device<address_map_bank_device> m_bank0;
+ required_device<address_map_bank_device> m_bank1;
+ required_device<address_map_bank_device> m_bank2;
+ required_device<address_map_bank_device> m_bank3;
+ required_device<ay3600_device> m_ay3600;
+ required_device<speaker_sound_device> m_speaker;
+ required_device<sn76489_device> m_sn;
+ required_ioport m_kbspecial;
+
uint8_t m_bank0val, m_bank1val, m_bank2val, m_bank3val;
int m_flash;
int m_speaker_state;
@@ -132,9 +137,6 @@ private:
int m_gfxmode;
std::unique_ptr<uint16_t[]> m_hires_artifact_map;
std::unique_ptr<uint16_t[]> m_dhires_artifact_map;
-
- void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen);
- void do_io(int offset);
};
/***************************************************************************
@@ -944,30 +946,30 @@ INPUT_PORTS_END
// this is an apple II palette; it seems more likely the
// actual laser3000 has a digital RGB palette...
-static const rgb_t laser3k_palette[] =
+static constexpr rgb_t laser3k_pens[] =
{
- rgb_t::black(),
- rgb_t(0xE3, 0x1E, 0x60), /* Dark Red */
- rgb_t(0x60, 0x4E, 0xBD), /* Dark Blue */
- rgb_t(0xFF, 0x44, 0xFD), /* Purple */
- rgb_t(0x00, 0xA3, 0x60), /* Dark Green */
- rgb_t(0x9C, 0x9C, 0x9C), /* Dark Gray */
- rgb_t(0x14, 0xCF, 0xFD), /* Medium Blue */
- rgb_t(0xD0, 0xC3, 0xFF), /* Light Blue */
- rgb_t(0x60, 0x72, 0x03), /* Brown */
- rgb_t(0xFF, 0x6A, 0x3C), /* Orange */
- rgb_t(0x9C, 0x9C, 0x9C), /* Light Grey */
- rgb_t(0xFF, 0xA0, 0xD0), /* Pink */
- rgb_t(0x14, 0xF5, 0x3C), /* Light Green */
- rgb_t(0xD0, 0xDD, 0x8D), /* Yellow */
- rgb_t(0x72, 0xFF, 0xD0), /* Aquamarine */
- rgb_t(0xFF, 0xFF, 0xFF) /* White */
+ { 0x00, 0x00, 0x00 }, // Black
+ { 0xe3, 0x1e, 0x60 }, // Dark Red
+ { 0x60, 0x4e, 0xbd }, // Dark Blue
+ { 0xff, 0x44, 0xfd }, // Purple
+ { 0x00, 0xa3, 0x60 }, // Dark Green
+ { 0x9c, 0x9c, 0x9c }, // Dark Gray
+ { 0x14, 0xcf, 0xfd }, // Medium Blue
+ { 0xd0, 0xc3, 0xff }, // Light Blue
+ { 0x60, 0x72, 0x03 }, // Brown
+ { 0xff, 0x6a, 0x3c }, // Orange
+ { 0x9c, 0x9c, 0x9c }, // Light Grey
+ { 0xff, 0xa0, 0xd0 }, // Pink
+ { 0x14, 0xf5, 0x3c }, // Light Green
+ { 0xd0, 0xdd, 0x8d }, // Yellow
+ { 0x72, 0xff, 0xd0 }, // Aquamarine
+ { 0xff, 0xff, 0xff } // White
};
/* Initialize the palette */
-PALETTE_INIT_MEMBER(laser3k_state, laser3k)
+void laser3k_state::laser3k_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, laser3k_palette, ARRAY_LENGTH(laser3k_palette));
+ palette.set_pen_colors(0, laser3k_pens);
}
MACHINE_CONFIG_START(laser3k_state::laser3k)
@@ -983,8 +985,7 @@ MACHINE_CONFIG_START(laser3k_state::laser3k)
MCFG_SCREEN_UPDATE_DRIVER(laser3k_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(laser3k_palette))
- MCFG_PALETTE_INIT_OWNER(laser3k_state, laser3k)
+ PALETTE(config, "palette", FUNC(laser3k_state::laser3k_palette), ARRAY_LENGTH(laser3k_pens));
/* memory banking */
ADDRESS_MAP_BANK(config, "bank0").set_map(&laser3k_state::banks_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x4000);
diff --git a/src/mame/drivers/laserbas.cpp b/src/mame/drivers/laserbas.cpp
index ca5b814099d..0df02156860 100644
--- a/src/mame/drivers/laserbas.cpp
+++ b/src/mame/drivers/laserbas.cpp
@@ -73,8 +73,8 @@ expected: 43 FB CC 9A D4 23 6C 01 3E <- From ROM 4
class laserbas_state : public driver_device
{
public:
- laserbas_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ laserbas_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
m_dac(*this, "dac%u", 1U)
@@ -82,6 +82,10 @@ public:
void laserbas(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
/* misc */
int m_dac_data;
@@ -96,6 +100,11 @@ private:
int m_scl;
bool m_flipscreen;
uint64_t m_z1data;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<palette_device> m_palette;
+ required_device_array<dac_byte_interface, 6> m_dac;
+
DECLARE_READ8_MEMBER(vram_r);
DECLARE_WRITE8_MEMBER(vram_w);
DECLARE_WRITE8_MEMBER(videoctrl_w);
@@ -107,12 +116,6 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(laserbas_scanline);
MC6845_UPDATE_ROW(crtc_update_row);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- required_device<cpu_device> m_maincpu;
- required_device<palette_device> m_palette;
- required_device_array<dac_byte_interface, 6> m_dac;
void laserbas_io(address_map &map);
void laserbas_memory(address_map &map);
};
@@ -184,7 +187,7 @@ WRITE8_MEMBER(laserbas_state::vram_w)
WRITE8_MEMBER(laserbas_state::videoctrl_w)
{
- if(!(offset&1))
+ if (!(offset&1))
{
m_vrambank = data & 0x40; // layer select
m_flipscreen = !(data & 0x80);
@@ -399,8 +402,7 @@ MACHINE_CONFIG_START(laserbas_state::laserbas)
crtc.set_char_width(8);
crtc.set_update_row_callback(FUNC(laserbas_state::crtc_update_row), this);
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_FORMAT(RRRGGGBB)
+ PALETTE(config, m_palette).set_format(palette_device::RGB_332, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/laserbat.cpp b/src/mame/drivers/laserbat.cpp
index 82457e60712..b358a978197 100644
--- a/src/mame/drivers/laserbat.cpp
+++ b/src/mame/drivers/laserbat.cpp
@@ -499,7 +499,7 @@ void laserbat_state::laserbat(machine_config &config)
laserbat_base(config);
// video hardware
- PALETTE(config, m_palette, 256).set_init(FUNC(laserbat_state::palette_init_laserbat));
+ PALETTE(config, m_palette, FUNC(laserbat_state::laserbat_palette), 256);
// sound board devices
SPEAKER(config, "speaker").front_center();
@@ -531,7 +531,7 @@ void catnmous_state::catnmous(machine_config &config)
laserbat_base(config);
// video hardware
- PALETTE(config, m_palette, 256).set_init(FUNC(catnmous_state::palette_init_catnmous));
+ PALETTE(config, m_palette, FUNC(catnmous_state::catnmous_palette), 256);
// sound board devices
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/lasso.cpp b/src/mame/drivers/lasso.cpp
index 82992ea8cd6..cf307aab66f 100644
--- a/src/mame/drivers/lasso.cpp
+++ b/src/mame/drivers/lasso.cpp
@@ -510,20 +510,17 @@ MACHINE_CONFIG_START(lasso_state::base)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lasso_state, screen_update_lasso)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lasso)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lasso);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
- MCFG_DEVICE_ADD("sn76489.1", SN76489, 2000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
-
- MCFG_DEVICE_ADD("sn76489.2", SN76489, 2000000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
+ SN76489(config, m_sn_1, 2000000).add_route(ALL_OUTPUTS, "speaker", 1.0);
+ SN76489(config, m_sn_2, 2000000).add_route(ALL_OUTPUTS, "speaker", 1.0);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(lasso_state::lasso)
@@ -533,8 +530,7 @@ MACHINE_CONFIG_START(lasso_state::lasso)
MCFG_DEVICE_ADD("blitter", M6502, 11289000/16) /* guess */
MCFG_DEVICE_PROGRAM_MAP(lasso_coprocessor_map)
- MCFG_PALETTE_ADD("palette", 0x40)
- MCFG_PALETTE_INIT_OWNER(lasso_state, lasso)
+ PALETTE(config, m_palette, FUNC(lasso_state::lasso_palette), 0x40);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(lasso_state::chameleo)
@@ -548,8 +544,7 @@ MACHINE_CONFIG_START(lasso_state::chameleo)
MCFG_DEVICE_PROGRAM_MAP(chameleo_audio_map)
/* video hardware */
- MCFG_PALETTE_ADD("palette", 0x40)
- MCFG_PALETTE_INIT_OWNER(lasso_state, lasso)
+ PALETTE(config, m_palette, FUNC(lasso_state::lasso_palette), 0x40);
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(lasso_state, screen_update_chameleo)
@@ -574,9 +569,7 @@ MACHINE_CONFIG_START(lasso_state::wwjgtin)
MCFG_SCREEN_UPDATE_DRIVER(lasso_state, screen_update_wwjgtin)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_wwjgtin) // Has 1 additional layer
- MCFG_PALETTE_ADD("palette", 0x40 + 16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(64)
- MCFG_PALETTE_INIT_OWNER(lasso_state,wwjgtin)
+ PALETTE(config, m_palette, FUNC(lasso_state::wwjgtin_palette), 0x40 + 16*16, 64);
MCFG_VIDEO_START_OVERRIDE(lasso_state,wwjgtin)
/* sound hardware */
@@ -600,7 +593,7 @@ MACHINE_CONFIG_START(lasso_state::pinbo)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_pinbo)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(lasso_state,pinbo)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(lasso_state, screen_update_chameleo)
@@ -610,7 +603,6 @@ MACHINE_CONFIG_START(lasso_state::pinbo)
MCFG_DEVICE_REMOVE("sn76489.2")
AY8910(config, "ay1", XTAL(18'000'000)/12).add_route(ALL_OUTPUTS, "speaker", 0.55);
-
AY8910(config, "ay2", XTAL(18'000'000)/12).add_route(ALL_OUTPUTS, "speaker", 0.55);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/lastduel.cpp b/src/mame/drivers/lastduel.cpp
index 65ff04e1854..175f33b37d6 100644
--- a/src/mame/drivers/lastduel.cpp
+++ b/src/mame/drivers/lastduel.cpp
@@ -536,13 +536,12 @@ MACHINE_CONFIG_START(lastduel_state::lastduel)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(lastduel_state, screen_update_lastduel)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lastduel)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT_CLASS(2, lastduel_state, lastduel_RRRRGGGGBBBBIIII)
+ PALETTE(config, m_palette).set_format(2, &lastduel_state::lastduel_RRRRGGGGBBBBIIII, 1024);
MCFG_VIDEO_START_OVERRIDE(lastduel_state,lastduel)
@@ -582,13 +581,12 @@ MACHINE_CONFIG_START(lastduel_state::madgear)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(lastduel_state, screen_update_madgear)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lastduel)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT_CLASS(2, lastduel_state, lastduel_RRRRGGGGBBBBIIII)
+ PALETTE(config, m_palette).set_format(2, &lastduel_state::lastduel_RRRRGGGGBBBBIIII, 1024);
MCFG_VIDEO_START_OVERRIDE(lastduel_state,madgear)
diff --git a/src/mame/drivers/lazercmd.cpp b/src/mame/drivers/lazercmd.cpp
index 0eae3a0df13..376cc587bd0 100644
--- a/src/mame/drivers/lazercmd.cpp
+++ b/src/mame/drivers/lazercmd.cpp
@@ -595,15 +595,15 @@ static GFXDECODE_START( gfx_lazercmd )
GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0, 2 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(lazercmd_state, lazercmd)
+void lazercmd_state::lazercmd_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0xb0, 0xb0, 0xb0)); /* white */
- palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); /* black */
+ palette.set_pen_color(0, rgb_t(0xb0, 0xb0, 0xb0)); // white
+ palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); // black
- palette.set_pen_color(2, rgb_t(0x00, 0x00, 0x00)); /* black */
- palette.set_pen_color(3, rgb_t(0xb0, 0xb0, 0xb0)); /* white */
+ palette.set_pen_color(2, rgb_t(0x00, 0x00, 0x00)); // black
+ palette.set_pen_color(3, rgb_t(0xb0, 0xb0, 0xb0)); // white
- palette.set_pen_color(4, rgb_t(0xff, 0xff, 0xff)); /* bright white */
+ palette.set_pen_color(4, rgb_t(0xff, 0xff, 0xff)); // bright white
}
@@ -645,11 +645,10 @@ MACHINE_CONFIG_START(lazercmd_state::lazercmd)
MCFG_SCREEN_SIZE(HORZ_RES * HORZ_CHR, VERT_RES * VERT_CHR + 16)
MCFG_SCREEN_VISIBLE_AREA(0 * HORZ_CHR, HORZ_RES * HORZ_CHR - 1, 0 * VERT_CHR, (VERT_RES - 1) * VERT_CHR - 1)
MCFG_SCREEN_UPDATE_DRIVER(lazercmd_state, screen_update_lazercmd)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lazercmd)
- MCFG_PALETTE_ADD("palette", 5)
- MCFG_PALETTE_INIT_OWNER(lazercmd_state, lazercmd)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lazercmd);
+ PALETTE(config, m_palette, FUNC(lazercmd_state::lazercmd_palette), 5);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -686,9 +685,8 @@ MACHINE_CONFIG_START(lazercmd_state::medlanes)
MCFG_SCREEN_UPDATE_DRIVER(lazercmd_state, screen_update_lazercmd)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lazercmd)
- MCFG_PALETTE_ADD("palette", 5)
- MCFG_PALETTE_INIT_OWNER(lazercmd_state, lazercmd)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lazercmd);
+ PALETTE(config, m_palette, FUNC(lazercmd_state::lazercmd_palette), 5);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -721,9 +719,8 @@ MACHINE_CONFIG_START(lazercmd_state::bbonk)
MCFG_SCREEN_UPDATE_DRIVER(lazercmd_state, screen_update_lazercmd)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lazercmd)
- MCFG_PALETTE_ADD("palette", 5)
- MCFG_PALETTE_INIT_OWNER(lazercmd_state, lazercmd)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lazercmd);
+ PALETTE(config, m_palette, FUNC(lazercmd_state::lazercmd_palette), 5);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/lbeach.cpp b/src/mame/drivers/lbeach.cpp
index 309e63687d2..726d7ede5d7 100644
--- a/src/mame/drivers/lbeach.cpp
+++ b/src/mame/drivers/lbeach.cpp
@@ -35,8 +35,8 @@ TODO:
class lbeach_state : public driver_device
{
public:
- lbeach_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ lbeach_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_bg_vram(*this, "bg_vram"),
m_fg_vram(*this, "fg_vram"),
@@ -52,6 +52,11 @@ public:
void lbeach(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
/* devices / memory pointers */
required_device<cpu_device> m_maincpu;
@@ -70,6 +75,7 @@ private:
bitmap_ind16 m_colmap_car;
tilemap_t* m_bg_tilemap;
tilemap_t* m_fg_tilemap;
+
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
@@ -78,10 +84,7 @@ private:
DECLARE_READ8_MEMBER(lbeach_in1_r);
DECLARE_READ8_MEMBER(lbeach_in2_r);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(lbeach);
+ void lbeach_palette(palette_device &palette) const;
uint32_t screen_update_lbeach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void lbeach_map(address_map &map);
};
@@ -94,7 +97,7 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(lbeach_state, lbeach)
+void lbeach_state::lbeach_palette(palette_device &palette) const
{
// tiles
palette.set_pen_color(0, 0x00, 0x00, 0x00);
@@ -345,12 +348,11 @@ MACHINE_CONFIG_START(lbeach_state::lbeach)
MCFG_SCREEN_VISIBLE_AREA(0, 511-32, 0, 255-24)
MCFG_SCREEN_UPDATE_DRIVER(lbeach_state, screen_update_lbeach)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) // needed for collision detection
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lbeach)
- MCFG_PALETTE_ADD("palette", 2+8+2)
- MCFG_PALETTE_INIT_OWNER(lbeach_state, lbeach)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lbeach);
+ PALETTE(config, m_palette, FUNC(lbeach_state::lbeach_palette), 2 + 8 + 2);
/* sound hardware */
// ...
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/lcmate2.cpp b/src/mame/drivers/lcmate2.cpp
index c856593071e..f390aefa0d2 100644
--- a/src/mame/drivers/lcmate2.cpp
+++ b/src/mame/drivers/lcmate2.cpp
@@ -43,28 +43,31 @@
class lcmate2_state : public driver_device
{
public:
- lcmate2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_lcdc(*this, "hd44780"),
- m_rtc(*this, "rtc"),
- m_speaker(*this, "speaker")
+ lcmate2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_lcdc(*this, "hd44780"),
+ m_rtc(*this, "rtc"),
+ m_speaker(*this, "speaker"),
+ m_kbdlines(*this, "LINE%u", 0U)
{ }
void lcmate2(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<hd44780_device> m_lcdc;
required_device<rp5c15_device> m_rtc;
required_device<speaker_sound_device> m_speaker;
-
- virtual void machine_start() override;
+ required_ioport_array<8> m_kbdlines;
DECLARE_READ8_MEMBER( key_r );
DECLARE_WRITE8_MEMBER( speaker_w );
DECLARE_WRITE8_MEMBER( bankswitch_w );
- DECLARE_PALETTE_INIT(lcmate2);
+ void lcmate2_palette(palette_device &palette) const;
void lcmate2_io(address_map &map);
void lcmate2_mem(address_map &map);
};
@@ -77,16 +80,12 @@ WRITE8_MEMBER( lcmate2_state::speaker_w )
// offsets are FE,FD,FB,F7,EF,DF,BF,7F to scan a particular row, or 00 to check if any key pressed
READ8_MEMBER( lcmate2_state::key_r )
{
- uint8_t i,data = 0xff;
- char kbdrow[8];
+ uint8_t data = 0xff;
- for (i=0; i<8; i++)
+ for (int i = 0; i < 8; i++)
{
- if (BIT(offset, i)==0)
- {
- sprintf(kbdrow,"LINE%d", i);
- data &= ioport(kbdrow)->read();
- }
+ if (!BIT(offset, i))
+ data &= m_kbdlines[i]->read();
}
return data;
@@ -203,7 +202,7 @@ static INPUT_PORTS_START( lcmate2 )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(lcmate2_state, lcmate2)
+void lcmate2_state::lcmate2_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -245,9 +244,8 @@ MACHINE_CONFIG_START(lcmate2_state::lcmate2)
MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 18-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(lcmate2_state, lcmate2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lcmate2)
+ PALETTE(config, "palette", FUNC(lcmate2_state::lcmate2_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_lcmate2);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 20)
@@ -256,8 +254,7 @@ MACHINE_CONFIG_START(lcmate2_state::lcmate2)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
/* Devices */
RP5C15(config, m_rtc, XTAL(32'768));
diff --git a/src/mame/drivers/ldplayer.cpp b/src/mame/drivers/ldplayer.cpp
index ae3dc419493..7b3aef786df 100644
--- a/src/mame/drivers/ldplayer.cpp
+++ b/src/mame/drivers/ldplayer.cpp
@@ -38,9 +38,6 @@ public:
, m_last_controls(0)
, m_playing(false) { }
- // callback hook
- static chd_file *get_disc_static(device_t *dummy, laserdisc_device &device) { return device.machine().driver_data<ldplayer_state>()->get_disc(); }
-
void ldplayer_ntsc(machine_config &config);
protected:
@@ -49,8 +46,10 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+ // callback hook
+ chd_file *get_disc(laserdisc_device &device);
+
// internal helpers
- chd_file *get_disc();
void process_commands();
// derived classes
@@ -165,7 +164,7 @@ protected:
*
*************************************/
-chd_file *ldplayer_state::get_disc()
+chd_file *ldplayer_state::get_disc(laserdisc_device &device)
{
bool found = false;
// open a path to the ROMs and find the first CHD file
@@ -635,7 +634,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(ldv1000_state::ldv1000)
ldplayer_ntsc(config);
MCFG_LASERDISC_LDV1000_ADD("laserdisc")
- MCFG_LASERDISC_GET_DISC(laserdisc_device::get_disc_delegate(&ldplayer_state::get_disc_static, device))
+ MCFG_LASERDISC_GET_DISC(laserdisc_device::get_disc_delegate(&ldv1000_state::get_disc, this))
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
SPEAKER(config, "lspeaker").front_left();
@@ -649,7 +648,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(pr8210_state::pr8210)
ldplayer_ntsc(config);
MCFG_LASERDISC_PR8210_ADD("laserdisc")
- MCFG_LASERDISC_GET_DISC(laserdisc_device::get_disc_delegate(&ldplayer_state::get_disc_static, device))
+ MCFG_LASERDISC_GET_DISC(laserdisc_device::get_disc_delegate(&pr8210_state::get_disc, this))
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/legionna.cpp b/src/mame/drivers/legionna.cpp
index 571e9aee9aa..ef88973077e 100644
--- a/src/mame/drivers/legionna.cpp
+++ b/src/mame/drivers/legionna.cpp
@@ -1220,16 +1220,15 @@ MACHINE_CONFIG_START(legionna_state::legionna)
MCFG_SCREEN_SIZE(36*8, 36*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_legionna)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
m_crtc->layer_scroll_callback().set(FUNC(legionna_state::tile_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_legionna)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_legionna);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,legionna)
@@ -1275,17 +1274,15 @@ MACHINE_CONFIG_START(legionna_state::heatbrl)
MCFG_SCREEN_SIZE(36*8, 36*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_heatbrl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
m_crtc->layer_scroll_callback().set(FUNC(legionna_state::tile_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_heatbrl)
-
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_heatbrl);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,heatbrl)
@@ -1332,7 +1329,7 @@ MACHINE_CONFIG_START(legionna_state::godzilla)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_RAW_PARAMS(14318180/2,455,0,320,258,0,224) // ~61 Hz, 15.734 kHz
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_godzilla)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
@@ -1340,10 +1337,8 @@ MACHINE_CONFIG_START(legionna_state::godzilla)
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
m_crtc->layer_scroll_base_callback().set(FUNC(legionna_state::tile_scroll_base_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_heatbrl)
-
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_heatbrl);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,godzilla)
@@ -1389,17 +1384,15 @@ MACHINE_CONFIG_START(legionna_state::denjinmk)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_godzilla)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_heatbrl)
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
m_crtc->layer_scroll_callback().set(FUNC(legionna_state::tile_scroll_w));
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_heatbrl);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,denjinmk)
@@ -1445,17 +1438,15 @@ MACHINE_CONFIG_START(legionna_state::grainbow)
MCFG_SCREEN_SIZE(64*8, 36*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 42*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_grainbow)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
m_crtc->layer_scroll_callback().set(FUNC(legionna_state::tile_scroll_w));
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_grainbow)
-
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_grainbow);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,grainbow)
@@ -1502,17 +1493,15 @@ MACHINE_CONFIG_START(legionna_state::cupsoc)
MCFG_SCREEN_SIZE(42*8, 36*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(legionna_state, screen_update_grainbow)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
SEIBU_CRTC(config, m_crtc, 0);
m_crtc->layer_en_callback().set(FUNC(legionna_state::tilemap_enable_w));
m_crtc->layer_scroll_callback().set(FUNC(legionna_state::tile_scroll_w));
m_crtc->reg_1a_callback().set(FUNC(legionna_state::tile_vreg_1a_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cupsoc)
-
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cupsoc);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
MCFG_VIDEO_START_OVERRIDE(legionna_state,cupsoc)
diff --git a/src/mame/drivers/lemmings.cpp b/src/mame/drivers/lemmings.cpp
index 2979ab43514..b7d1dac1c17 100644
--- a/src/mame/drivers/lemmings.cpp
+++ b/src/mame/drivers/lemmings.cpp
@@ -236,8 +236,7 @@ MACHINE_CONFIG_START(lemmings_state::lemmings)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, lemmings_state, screen_vblank_lemmings))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lemmings)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 1024);
DECO_SPRITE(config, m_sprgen[0], 0);
m_sprgen[0]->set_gfx_region(1);
diff --git a/src/mame/drivers/lethal.cpp b/src/mame/drivers/lethal.cpp
index b05d14dfcef..1d6ae81ea8c 100644
--- a/src/mame/drivers/lethal.cpp
+++ b/src/mame/drivers/lethal.cpp
@@ -512,9 +512,8 @@ void lethal_state::lethalen(machine_config &config)
screen.set_screen_update(FUNC(lethal_state::screen_update_lethalen));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8192);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 8192);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(lethal_state::tile_callback), this);
diff --git a/src/mame/drivers/lethalj.cpp b/src/mame/drivers/lethalj.cpp
index 3eb6a12e966..d21465b8ddc 100644
--- a/src/mame/drivers/lethalj.cpp
+++ b/src/mame/drivers/lethalj.cpp
@@ -649,7 +649,7 @@ MACHINE_CONFIG_START(lethalj_state::gameroom)
MCFG_SCREEN_UPDATE_DEVICE("maincpu", tms34010_device, tms340x0_ind16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lgp.cpp b/src/mame/drivers/lgp.cpp
index 0c275ad37d2..2598595ba1d 100644
--- a/src/mame/drivers/lgp.cpp
+++ b/src/mame/drivers/lgp.cpp
@@ -76,37 +76,43 @@ Dumping Notes:
class lgp_state : public driver_device
{
public:
- lgp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_laserdisc(*this, "laserdisc") ,
+ lgp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_laserdisc(*this, "laserdisc"),
m_tile_ram(*this, "tile_ram"),
m_tile_control_ram(*this, "tile_ctrl_ram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void lgp(machine_config &config);
void init_lgp();
+protected:
+ virtual void machine_start() override;
+
private:
- required_device<pioneer_ldv1000_device> m_laserdisc;
- required_shared_ptr<uint8_t> m_tile_ram;
- required_shared_ptr<uint8_t> m_tile_control_ram;
DECLARE_READ8_MEMBER(ldp_read);
DECLARE_WRITE8_MEMBER(ldp_write);
- virtual void machine_start() override;
uint32_t screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_callback_lgp);
DECLARE_WRITE_LINE_MEMBER(ld_command_strobe_cb);
- DECLARE_PALETTE_INIT(lgp);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
+ void lgp_palette(palette_device &palette) const;
+
void main_io_map(address_map &map);
void main_program_map(address_map &map);
void sound_io_map(address_map &map);
void sound_program_map(address_map &map);
+
+ required_device<pioneer_ldv1000_device> m_laserdisc;
+ required_shared_ptr<uint8_t> m_tile_ram;
+ required_shared_ptr<uint8_t> m_tile_control_ram;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
};
@@ -374,39 +380,33 @@ WRITE_LINE_MEMBER(lgp_state::ld_command_strobe_cb)
//m_maincpu->set_input_line(INPUT_LINE_NMI, state ? ASSERT_LINE : CLEAR_LINE);
}
-PALETTE_INIT_MEMBER(lgp_state, lgp)
+void lgp_state::lgp_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
-// for (i = 0; i < palette.entries(); i++)
- for (i = 0; i < 0x20; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x20; i++)
{
- int r,g,b;
- int bit0,bit1,bit2;
-
- /* red component */
- bit0 = 0; //(color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 0) & 0x01;
- bit2 = (color_prom[i] >> 1) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = 0; //(color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 2) & 0x01;
- bit2 = (color_prom[i] >> 3) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = 0; //(color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = 0; //BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 0);
+ bit2 = BIT(color_prom[i], 1);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = 0; //BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 2);
+ bit2 = BIT(color_prom[i], 3);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = 0; //BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i,rgb_t(r,g,b));
}
-
}
/* DRIVER */
@@ -431,10 +431,9 @@ MACHINE_CONFIG_START(lgp_state::lgp)
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(lgp_state,lgp)
+ PALETTE(config, m_palette, FUNC(lgp_state::lgp_palette), 256);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lgp)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lgp);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/liberate.cpp b/src/mame/drivers/liberate.cpp
index 834a0b67cd5..e2c31f14e29 100644
--- a/src/mame/drivers/liberate.cpp
+++ b/src/mame/drivers/liberate.cpp
@@ -764,12 +764,11 @@ MACHINE_CONFIG_START(liberate_state::liberate_base)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(liberate_state, screen_update_liberate)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, liberate_state, deco16_interrupt))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_liberate)
- MCFG_PALETTE_ADD("palette", 33)
- MCFG_PALETTE_INIT_OWNER(liberate_state,liberate)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_liberate)
+ PALETTE(config, m_palette, FUNC(liberate_state::liberate_palette), 33);
MCFG_VIDEO_START_OVERRIDE(liberate_state,liberate)
@@ -852,12 +851,11 @@ MACHINE_CONFIG_START(liberate_state::prosport)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(liberate_state, screen_update_prosport)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, liberate_state, deco16_interrupt))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_prosport)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(BBGGGRRR_inverted)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233_inverted, 256);
MCFG_VIDEO_START_OVERRIDE(liberate_state,prosport)
diff --git a/src/mame/drivers/limenko.cpp b/src/mame/drivers/limenko.cpp
index 446ab848b66..05f0496496b 100644
--- a/src/mame/drivers/limenko.cpp
+++ b/src/mame/drivers/limenko.cpp
@@ -66,6 +66,9 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
+protected:
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
optional_device<okim6295_device> m_oki;
@@ -111,7 +114,6 @@ private:
TILE_GET_INFO_MEMBER(get_md_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- virtual void video_start() override;
uint32_t screen_update_limenko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,uint32_t code,uint32_t color,int flipx,int flipy,int sx,int sy,int priority);
void draw_sprites(const rectangle &cliprect);
@@ -723,8 +725,7 @@ void limenko_state::limenko(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_limenko);
- PALETTE(config, m_palette, 0x1000);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -769,8 +770,7 @@ void limenko_state::spotty(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_limenko);
- PALETTE(config, m_palette, 0x1000);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lisa.cpp b/src/mame/drivers/lisa.cpp
index 62e4f28530a..c09aebd3eab 100644
--- a/src/mame/drivers/lisa.cpp
+++ b/src/mame/drivers/lisa.cpp
@@ -135,8 +135,7 @@ void lisa_state::lisa(machine_config &config)
m_screen->set_screen_update(FUNC(lisa_state::screen_update_lisa));
m_screen->set_palette("palette");
- PALETTE(config, m_palette, 2);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lkage.cpp b/src/mame/drivers/lkage.cpp
index 93f24ec5fc8..224e9b69ee5 100644
--- a/src/mame/drivers/lkage.cpp
+++ b/src/mame/drivers/lkage.cpp
@@ -86,11 +86,12 @@ TODO:
***************************************************************************/
#include "emu.h"
-
#include "includes/lkage.h"
+
#include "cpu/m6805/m6805.h"
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
+
#include "screen.h"
#include "speaker.h"
@@ -509,21 +510,18 @@ MACHINE_CONFIG_START(lkage_state::lkage)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lkage_state, screen_update_lkage)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lkage)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lkage);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
MCFG_DEVICE_ADD("ym1", YM2203, AUDIO_CLOCK )
MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
@@ -560,21 +558,18 @@ MACHINE_CONFIG_START(lkage_state::lkageb)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lkage_state, screen_update_lkage)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lkage)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lkage);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
MCFG_DEVICE_ADD("ym1", YM2203, AUDIO_CLOCK)
MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
diff --git a/src/mame/drivers/llc.cpp b/src/mame/drivers/llc.cpp
index 99baf74c5cb..44f7e645886 100644
--- a/src/mame/drivers/llc.cpp
+++ b/src/mame/drivers/llc.cpp
@@ -220,7 +220,7 @@ MACHINE_CONFIG_START(llc_state::llc1)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_llc1)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
config.set_default_layout(layout_llc1);
z80pio_device& pio1(Z80PIO(config, "z80pio1", XTAL(3'000'000)));
@@ -263,7 +263,7 @@ MACHINE_CONFIG_START(llc_state::llc2)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_llc2)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lockon.cpp b/src/mame/drivers/lockon.cpp
index 5422982ab72..9648e829649 100644
--- a/src/mame/drivers/lockon.cpp
+++ b/src/mame/drivers/lockon.cpp
@@ -499,11 +499,10 @@ MACHINE_CONFIG_START(lockon_state::lockon)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(lockon_state, screen_update_lockon)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, lockon_state, screen_vblank_lockon))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lockon)
- MCFG_PALETTE_ADD("palette", 1024 + 2048)
- MCFG_PALETTE_INIT_OWNER(lockon_state, lockon)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lockon);
+ PALETTE(config, m_palette, FUNC(lockon_state::lockon_palette), 1024 + 2048);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/lola8a.cpp b/src/mame/drivers/lola8a.cpp
index 10c97171fad..0d07d1daff7 100644
--- a/src/mame/drivers/lola8a.cpp
+++ b/src/mame/drivers/lola8a.cpp
@@ -295,7 +295,7 @@ void lola8a_state::lola8a(machine_config &config)
crtc.set_update_row_callback(FUNC(lola8a_state::crtc_update_row), this);
crtc.out_vsync_callback().set(FUNC(lola8a_state::crtc_vsync));
- PALETTE(config, m_palette, 8).set_init("palette", FUNC(palette_device::palette_init_3bit_brg));
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
/* Cassette */
CASSETTE(config, m_cass);
diff --git a/src/mame/drivers/looping.cpp b/src/mame/drivers/looping.cpp
index 3e9066dcf68..ff23f1f710b 100644
--- a/src/mame/drivers/looping.cpp
+++ b/src/mame/drivers/looping.cpp
@@ -127,6 +127,11 @@ public:
void init_looping();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
@@ -152,14 +157,11 @@ private:
DECLARE_WRITE_LINE_MEMBER(ay_enable_w);
DECLARE_WRITE_LINE_MEMBER(speech_enable_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(looping);
+ void looping_palette(palette_device &palette) const;
uint32_t screen_update_looping(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(looping_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
void looping_io_map(address_map &map);
void looping_map(address_map &map);
void looping_sound_io_map(address_map &map);
@@ -193,40 +195,39 @@ private:
*
*************************************/
-PALETTE_INIT_MEMBER(looping_state, looping)
+void looping_state::looping_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 470, 0,
3, &resistances[0], gweights, 470, 0,
2, &resistances[1], bweights, 470, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < 32; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 1;
- bit1 = (color_prom[i] >> 1) & 1;
- bit2 = (color_prom[i] >> 2) & 1;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 1;
- bit1 = (color_prom[i] >> 4) & 1;
- bit2 = (color_prom[i] >> 5) & 1;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 1;
- bit1 = (color_prom[i] >> 7) & 1;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -661,8 +662,7 @@ void looping_state::looping(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_looping);
-
- PALETTE(config, m_palette, 32).set_init(FUNC(looping_state::palette_init_looping));
+ PALETTE(config, m_palette, FUNC(looping_state::looping_palette), 32);
ls259_device &videolatch(LS259(config, "videolatch")); // E2 on video board
videolatch.q_out_cb<1>().set(FUNC(looping_state::level2_irq_set));
diff --git a/src/mame/drivers/lordgun.cpp b/src/mame/drivers/lordgun.cpp
index e075d78f36a..575d80e3a3c 100644
--- a/src/mame/drivers/lordgun.cpp
+++ b/src/mame/drivers/lordgun.cpp
@@ -667,7 +667,7 @@ void lordgun_state::lordgun(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_lordgun);
// 0x800 real colors, repeated per priority level
- PALETTE(config, m_palette, 0x800 * 8).set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x800 * 8);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -721,7 +721,7 @@ void lordgun_state::aliencha(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_lordgun);
// 0x800 real colors, repeated per priority level
- PALETTE(config, m_palette, 0x800 * 8).set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x800 * 8);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lsasquad.cpp b/src/mame/drivers/lsasquad.cpp
index d1ed476bdfe..b75ad9fb27e 100644
--- a/src/mame/drivers/lsasquad.cpp
+++ b/src/mame/drivers/lsasquad.cpp
@@ -590,10 +590,10 @@ MACHINE_CONFIG_START(lsasquad_state::lsasquad)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lsasquad_state, screen_update_lsasquad)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lsasquad)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 512)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -654,10 +654,10 @@ MACHINE_CONFIG_START(lsasquad_state::daikaiju)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lsasquad_state, screen_update_daikaiju)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lsasquad)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 512)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ltcasino.cpp b/src/mame/drivers/ltcasino.cpp
index 15f5ef264bb..cbad9040b9f 100644
--- a/src/mame/drivers/ltcasino.cpp
+++ b/src/mame/drivers/ltcasino.cpp
@@ -66,12 +66,13 @@ Other: Hitachi HD46821P 1MHz NMOS Peripheral Interface Adapter (PIA) x 2
class ltcasino_state : public driver_device
{
public:
- ltcasino_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ltcasino_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_tile_num_ram(*this, "tile_nuram"),
m_tile_atr_ram(*this, "tile_atr_ram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void init_mv4in1();
void ltcasino(machine_config &config);
@@ -91,7 +92,7 @@ private:
DECLARE_WRITE8_MEMBER(tile_atr_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(ltcasino);
+ void ltcasino_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
@@ -100,7 +101,7 @@ private:
/* Video */
-PALETTE_INIT_MEMBER(ltcasino_state, ltcasino)
+void ltcasino_state::ltcasino_palette(palette_device &palette) const
{
for (int i = 0; i < 64; i++)
{
@@ -756,10 +757,8 @@ MACHINE_CONFIG_START(ltcasino_state::ltcasino)
MCFG_SCREEN_UPDATE_DRIVER(ltcasino_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_ltcasino)
- MCFG_PALETTE_ADD("palette", 2*64)
- MCFG_PALETTE_INIT_OWNER(ltcasino_state, ltcasino)
-
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ltcasino);
+ PALETTE(config, "palette", FUNC(ltcasino_state::ltcasino_palette), 2*64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lucky74.cpp b/src/mame/drivers/lucky74.cpp
index 374802eeea2..cc000621cf2 100644
--- a/src/mame/drivers/lucky74.cpp
+++ b/src/mame/drivers/lucky74.cpp
@@ -1503,10 +1503,8 @@ MACHINE_CONFIG_START(lucky74_state::lucky74)
MCFG_SCREEN_UPDATE_DRIVER(lucky74_state, screen_update_lucky74)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lucky74)
-
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(lucky74_state, lucky74)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_lucky74);
+ PALETTE(config, "palette", FUNC(lucky74_state::lucky74_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lvcards.cpp b/src/mame/drivers/lvcards.cpp
index 4b35471febf..cbc54fd9b48 100644
--- a/src/mame/drivers/lvcards.cpp
+++ b/src/mame/drivers/lvcards.cpp
@@ -475,9 +475,8 @@ MACHINE_CONFIG_START(lvcards_state::lvcards)
MCFG_SCREEN_UPDATE_DRIVER(lvcards_state, screen_update_lvcards)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lvcards)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(lvcards_state, lvcards)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_lvcards);
+ PALETTE(config, "palette", FUNC(lvcards_state::lvcards_palette), 256);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -506,8 +505,7 @@ MACHINE_CONFIG_START(lvpoker_state::ponttehk)
MCFG_DEVICE_PROGRAM_MAP(ponttehk_map)
// video hardware
- MCFG_DEVICE_REMOVE("palette")
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config.replace(), "palette", palette_device::RGB_444_PROMS, "proms", 256);
MACHINE_CONFIG_END
ROM_START( lvpoker )
diff --git a/src/mame/drivers/lviv.cpp b/src/mame/drivers/lviv.cpp
index 52b599fba97..3af2fe67ae6 100644
--- a/src/mame/drivers/lviv.cpp
+++ b/src/mame/drivers/lviv.cpp
@@ -454,8 +454,7 @@ MACHINE_CONFIG_START(lviv_state::lviv)
MCFG_SCREEN_UPDATE_DRIVER(lviv_state, screen_update)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD(m_palette, sizeof (s_palette) / 3)
- MCFG_PALETTE_INIT_OWNER(lviv_state, lviv)
+ PALETTE(config, m_palette, FUNC(lviv_state::lviv_palette), ARRAY_LENGTH(s_palette));
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/lwings.cpp b/src/mame/drivers/lwings.cpp
index 68b61a7cd9e..251394647bb 100644
--- a/src/mame/drivers/lwings.cpp
+++ b/src/mame/drivers/lwings.cpp
@@ -954,12 +954,11 @@ MACHINE_CONFIG_START(lwings_state::lwings)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(lwings_state, screen_update_lwings)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lwings)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1004,12 +1003,11 @@ MACHINE_CONFIG_START(lwings_state::fball)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1) // the 16-pixel black border on left edge is correct, test mode actually uses that area
MCFG_SCREEN_UPDATE_DRIVER(lwings_state, screen_update_lwings)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lwings)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/m10.cpp b/src/mame/drivers/m10.cpp
index 6d12beace7c..1ad63866911 100644
--- a/src/mame/drivers/m10.cpp
+++ b/src/mame/drivers/m10.cpp
@@ -151,19 +151,11 @@ WRITE_LINE_MEMBER(m10_state::ic8j2_output_changed)
*
*************************************/
-PALETTE_INIT_MEMBER(m10_state,m10)
+void m10_state::m10_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 0x10; i++)
+ for (int i = 0; i < 0x10; i++)
{
- rgb_t color;
-
- if (i & 0x01)
- color = rgb_t(pal1bit(~i >> 3), pal1bit(~i >> 2), pal1bit(~i >> 1));
- else
- color = rgb_t::black();
-
+ rgb_t const color = BIT(i, 0) ? rgb_t(pal1bit(~i >> 3), pal1bit(~i >> 2), pal1bit(~i >> 1)) : rgb_t::black();
palette.set_pen_color(i, color);
}
}
@@ -828,9 +820,7 @@ void m10_state::m10(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m10);
-
- PALETTE(config, m_palette, 2*8);
- m_palette->set_init(FUNC(m10_state::palette_init_m10));
+ PALETTE(config, m_palette, FUNC(m10_state::m10_palette), 2 * 8);
MCFG_VIDEO_START_OVERRIDE(m10_state,m10)
@@ -889,11 +879,9 @@ void m10_state::m15(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
+ PALETTE(config, m_palette, FUNC(m10_state::m10_palette), 2 * 8);
- PALETTE(config, m_palette, 2*8);
- m_palette->set_init(FUNC(m10_state::palette_init_m10));
-
- MCFG_VIDEO_START_OVERRIDE(m10_state, m15 )
+ MCFG_VIDEO_START_OVERRIDE(m10_state, m15)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/m107.cpp b/src/mame/drivers/m107.cpp
index 799358af841..468d72483cb 100644
--- a/src/mame/drivers/m107.cpp
+++ b/src/mame/drivers/m107.cpp
@@ -758,7 +758,7 @@ void m107_state::firebarr(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_firebarr);
- PALETTE(config, m_palette, 2048).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/m14.cpp b/src/mame/drivers/m14.cpp
index 1f25cdd1f3f..a7f37c66748 100644
--- a/src/mame/drivers/m14.cpp
+++ b/src/mame/drivers/m14.cpp
@@ -59,16 +59,16 @@ Dumped by Chackn
class m14_state : public driver_device
{
public:
- m14_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ m14_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_video_ram(*this, "video_ram"),
m_color_ram(*this, "color_ram"),
- m_samples(*this,"samples")
- { }
+ m_samples(*this, "samples")
+ { }
void m14(machine_config &config);
@@ -99,7 +99,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(m14);
+ void m14_palette(palette_device &palette) const;
uint32_t screen_update_m14(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(m14_irq);
@@ -122,15 +122,13 @@ private:
*
*************************************/
-PALETTE_INIT_MEMBER(m14_state, m14)
+void m14_state::m14_palette(palette_device &palette) const
{
- int i;
const rgb_t green_pen = rgb_t(pal1bit(0), pal1bit(1), pal1bit(0));
- for (i = 0; i < 0x20; i++)
+ for (int i = 0; i < 0x20; i++)
{
rgb_t color;
-
if (i & 0x01)
color = rgb_t(pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 3));
else
@@ -450,8 +448,7 @@ void m14_state::m14(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m14);
- PALETTE(config, m_palette, 0x20);
- m_palette->set_init(FUNC(m14_state::palette_init_m14));
+ PALETTE(config, m_palette, FUNC(m14_state::m14_palette), 0x20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/m20.cpp b/src/mame/drivers/m20.cpp
index a16c42bc3b2..a1d07ace980 100644
--- a/src/mame/drivers/m20.cpp
+++ b/src/mame/drivers/m20.cpp
@@ -63,8 +63,8 @@ E I1 Vectored interrupt error
class m20_state : public driver_device
{
public:
- m20_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ m20_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_kbdi8251(*this, "i8251_1"),
@@ -807,7 +807,7 @@ MACHINE_CONFIG_START(m20_state::m20)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* Devices */
FD1797(config, m_fd1797, 1000000);
diff --git a/src/mame/drivers/m3.cpp b/src/mame/drivers/m3.cpp
index d9b15770076..265b6c67f07 100644
--- a/src/mame/drivers/m3.cpp
+++ b/src/mame/drivers/m3.cpp
@@ -128,7 +128,7 @@ MACHINE_CONFIG_START(m3_state::m3)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_f4disp)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* Devices */
mc6845_device &crtc(MC6845(config, "crtc", 2'000'000)); // clk unknown
diff --git a/src/mame/drivers/m52.cpp b/src/mame/drivers/m52.cpp
index 0fc60b08365..999b58f8210 100644
--- a/src/mame/drivers/m52.cpp
+++ b/src/mame/drivers/m52.cpp
@@ -407,16 +407,14 @@ MACHINE_CONFIG_START(m52_state::m52)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", m52_state, irq0_line_hold)
/* video hardware */
- MCFG_PALETTE_ADD("sp_palette", 256)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_DEVICE_ADD("sp_gfxdecode", GFXDECODE, "sp_palette", gfx_m52_sp)
+ PALETTE(config, m_sp_palette).set_entries(256, 32);
+ GFXDECODE(config, m_sp_gfxdecode, m_sp_palette, gfx_m52_sp);
- MCFG_PALETTE_ADD("tx_palette", 512)
- MCFG_DEVICE_ADD("tx_gfxdecode", GFXDECODE, "tx_palette", gfx_m52_tx)
+ PALETTE(config, m_tx_palette).set_entries(512);
+ GFXDECODE(config, m_tx_gfxdecode, m_tx_palette, gfx_m52_tx);
- MCFG_PALETTE_ADD("bg_palette", 3 * 4)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_DEVICE_ADD("bg_gfxdecode", GFXDECODE, "bg_palette", gfx_m52_bg)
+ PALETTE(config, m_bg_palette).set_entries(3 * 4, 32);
+ GFXDECODE(config, m_bg_gfxdecode, m_bg_palette, gfx_m52_bg);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK / 3, 384, 136, 376, 282, 22, 274)
diff --git a/src/mame/drivers/m57.cpp b/src/mame/drivers/m57.cpp
index c841efe11bd..d35f8a8eb30 100644
--- a/src/mame/drivers/m57.cpp
+++ b/src/mame/drivers/m57.cpp
@@ -245,12 +245,10 @@ MACHINE_CONFIG_START(m57_state::m57)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(m57_state, screen_update_m57)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_m57)
- MCFG_PALETTE_ADD("palette", 32*8+32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+16)
- MCFG_PALETTE_INIT_OWNER(m57_state, m57)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_m57)
+ PALETTE(config, m_palette, FUNC(m57_state::m57_palette), 32*8+32*8, 256+16);
/* sound hardware */
//m52_sound_c_audio(config);
diff --git a/src/mame/drivers/m58.cpp b/src/mame/drivers/m58.cpp
index 9fbe9d9df3a..991ecff9372 100644
--- a/src/mame/drivers/m58.cpp
+++ b/src/mame/drivers/m58.cpp
@@ -200,15 +200,13 @@ MACHINE_CONFIG_START(m58_state::yard)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", m58_state, irq0_line_hold)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yard)
- MCFG_PALETTE_ADD("palette", 256+256+256)
- MCFG_PALETTE_INDIRECT_ENTRIES(256+256+16)
- MCFG_PALETTE_INIT_OWNER(m58_state, m58)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_yard)
+ PALETTE(config, m_palette, FUNC(m58_state::m58_palette), 256+256+256, 256+256+16);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 256, 282, 42, 266)
MCFG_SCREEN_UPDATE_DRIVER(m58_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* sound hardware */
MCFG_DEVICE_ADD("irem_audio", IREM_M52_LARGE_AUDIO, 0)
diff --git a/src/mame/drivers/m62.cpp b/src/mame/drivers/m62.cpp
index c941a272088..9c12b6e6ae1 100644
--- a/src/mame/drivers/m62.cpp
+++ b/src/mame/drivers/m62.cpp
@@ -982,14 +982,11 @@ MACHINE_CONFIG_START(m62_state::ldrun)
MCFG_SCREEN_VISIBLE_AREA((64*8-384)/2, 64*8-(64*8-384)/2-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(m62_state, screen_update_ldrun)
- MCFG_DEVICE_ADD("spr_decode", GFXDECODE, "spr_palette", gfx_m62_sprites)
- MCFG_DEVICE_ADD("chr_decode", GFXDECODE, "chr_palette", gfx_m62_tiles)
+ MCFG_DEVICE_ADD(m_spr_decode, GFXDECODE, m_spr_palette, gfx_m62_sprites)
+ MCFG_DEVICE_ADD(m_chr_decode, GFXDECODE, m_chr_palette, gfx_m62_tiles)
- MCFG_PALETTE_ADD("chr_palette", 256)
- MCFG_PALETTE_INIT_OWNER(m62_state,m62_chr)
-
- MCFG_PALETTE_ADD("spr_palette", 256)
- MCFG_PALETTE_INIT_OWNER(m62_state,m62_spr)
+ PALETTE(config, m_chr_palette, FUNC(m62_state::m62_chr), 256);
+ PALETTE(config, m_spr_palette, FUNC(m62_state::m62_spr), 256);
/* sound hardware */
//m62_audio(config);
@@ -1032,10 +1029,9 @@ MACHINE_CONFIG_START(m62_state::battroad)
MCFG_SCREEN_VISIBLE_AREA((64*8-256)/2, 64*8-(64*8-256)/2-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(m62_state, screen_update_battroad)
- MCFG_DEVICE_ADD("fg_decode", GFXDECODE, "fg_palette", gfx_m62_fg_battroad)
+ MCFG_DEVICE_ADD(m_fg_decode, GFXDECODE, m_fg_palette, gfx_m62_fg_battroad)
- MCFG_PALETTE_ADD("fg_palette", 32)
- MCFG_PALETTE_INIT_OWNER(m62_state,m62_battroad_fg)
+ PALETTE(config, m_fg_palette, FUNC(m62_state::m62_battroad_fg), 32);
MCFG_VIDEO_START_OVERRIDE(m62_state,battroad)
MACHINE_CONFIG_END
@@ -1094,11 +1090,10 @@ MACHINE_CONFIG_START(m62_state::lotlot)
/* video hardware */
- MCFG_DEVICE_ADD("fg_decode", GFXDECODE, "fg_palette", gfx_m62_fg_lotlot)
+ MCFG_DEVICE_ADD(m_fg_decode, GFXDECODE, m_fg_palette, gfx_m62_fg_lotlot)
MCFG_GFXDECODE_MODIFY("chr_decode", gfx_m62_tiles_lotlot)
- MCFG_PALETTE_ADD("fg_palette", 256)
- MCFG_PALETTE_INIT_OWNER(m62_state,m62_lotlot_fg)
+ PALETTE(config, m_fg_palette, FUNC(m62_state::m62_lotlot_fg), 256);
MCFG_VIDEO_START_OVERRIDE(m62_state,lotlot)
@@ -1147,14 +1142,12 @@ MACHINE_CONFIG_START(m62_state::spelunk2)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(spelunk2_map)
-
/* video hardware */
MCFG_GFXDECODE_MODIFY("chr_decode", gfx_m62_tiles_spelunk2)
- MCFG_DEVICE_ADD("fg_decode", GFXDECODE, "chr_palette", gfx_m62_fg_spelunk2)
+ MCFG_DEVICE_ADD(m_fg_decode, GFXDECODE, m_chr_palette, gfx_m62_fg_spelunk2)
- MCFG_PALETTE_MODIFY("chr_palette")
- MCFG_PALETTE_ENTRIES(512)
- MCFG_PALETTE_INIT_OWNER(m62_state,spelunk2)
+ m_chr_palette->set_entries(512);
+ m_chr_palette->set_init(FUNC(m62_state::spelunk2_palette));
MCFG_VIDEO_START_OVERRIDE(m62_state,spelunk2)
MCFG_SCREEN_MODIFY("screen")
diff --git a/src/mame/drivers/m63.cpp b/src/mame/drivers/m63.cpp
index 6da1e777bd0..6c2016619e8 100644
--- a/src/mame/drivers/m63.cpp
+++ b/src/mame/drivers/m63.cpp
@@ -131,8 +131,8 @@ Dip locations verified for:
class m63_state : public driver_device
{
public:
- m63_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ m63_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_spriteram(*this, "spriteram"),
m_scrollram(*this, "scrollram"),
m_videoram2(*this, "videoram2"),
@@ -212,7 +212,7 @@ private:
DECLARE_MACHINE_START(m63);
DECLARE_MACHINE_RESET(m63);
DECLARE_VIDEO_START(m63);
- DECLARE_PALETTE_INIT(m63);
+ void m63_palette(palette_device &palette) const;
uint32_t screen_update_m63(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(snd_irq);
INTERRUPT_GEN_MEMBER(vblank_irq);
@@ -224,59 +224,58 @@ private:
};
-PALETTE_INIT_MEMBER(m63_state,m63)
+void m63_state::m63_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
- bit0 = (color_prom[i + 256] >> 0) & 0x01;
- bit1 = (color_prom[i + 256] >> 1) & 0x01;
- bit2 = (color_prom[i + 256] >> 2) & 0x01;
- bit3 = (color_prom[i + 256] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
- bit0 = (color_prom[i + 2*256] >> 0) & 0x01;
- bit1 = (color_prom[i + 2*256] >> 1) & 0x01;
- bit2 = (color_prom[i + 2*256] >> 2) & 0x01;
- bit3 = (color_prom[i + 2*256] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // green component
+ bit0 = BIT(color_prom[i + 256], 0);
+ bit1 = BIT(color_prom[i + 256], 1);
+ bit2 = BIT(color_prom[i + 256], 2);
+ bit3 = BIT(color_prom[i + 256], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
+ bit0 = BIT(color_prom[i + 2*256], 0);
+ bit1 = BIT(color_prom[i + 2*256], 1);
+ bit2 = BIT(color_prom[i + 2*256], 2);
+ bit3 = BIT(color_prom[i + 2*256], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
color_prom += 3 * 256;
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i+256,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i + 256, rgb_t(r, g, b));
}
}
@@ -791,8 +790,7 @@ MACHINE_CONFIG_START(m63_state::m63)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m63);
- PALETTE(config, m_palette, 256+4);
- m_palette->set_init(FUNC(m63_state::palette_init_m63));
+ PALETTE(config, m_palette, FUNC(m63_state::m63_palette), 256+4);
MCFG_VIDEO_START_OVERRIDE(m63_state,m63)
@@ -841,9 +839,7 @@ void m63_state::fghtbskt(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fghtbskt);
- PALETTE(config, m_palette, 256);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(m63_state,m63)
diff --git a/src/mame/drivers/m72.cpp b/src/mame/drivers/m72.cpp
index 331d1d8d339..0ce6cad4fc5 100644
--- a/src/mame/drivers/m72.cpp
+++ b/src/mame/drivers/m72.cpp
@@ -1844,7 +1844,7 @@ MACHINE_CONFIG_START(m72_state::m72_base)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m72);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MASTER_CLOCK/4, 512, 64, 448, 284, 0, 256);
diff --git a/src/mame/drivers/m79152pc.cpp b/src/mame/drivers/m79152pc.cpp
index 627d15a7337..bc0317a1896 100644
--- a/src/mame/drivers/m79152pc.cpp
+++ b/src/mame/drivers/m79152pc.cpp
@@ -288,7 +288,7 @@ MACHINE_CONFIG_START(m79152pc_state::m79152pc)
m_screen->set_palette("palette");
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_m79152pc)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
pit8253_device &pit(PIT8253(config, "pit", 0)); // КР580ВИ53
pit.set_clk<1>(921600);
diff --git a/src/mame/drivers/m90.cpp b/src/mame/drivers/m90.cpp
index 39b3747a95a..ceff4b12215 100644
--- a/src/mame/drivers/m90.cpp
+++ b/src/mame/drivers/m90.cpp
@@ -754,7 +754,7 @@ void m90_state::m90(machine_config &config)
m_screen->screen_vblank().set_inputline("maincpu", NEC_INPUT_LINE_INTP0);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m90);
- PALETTE(config, m_palette, 512).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 512);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/m92.cpp b/src/mame/drivers/m92.cpp
index a3d6806bde1..23cf49cb831 100644
--- a/src/mame/drivers/m92.cpp
+++ b/src/mame/drivers/m92.cpp
@@ -943,7 +943,7 @@ void m92_state::m92(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_m92);
- PALETTE(config, m_palette, 2048).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_VIDEO_START_OVERRIDE(m92_state,m92)
diff --git a/src/mame/drivers/mac.cpp b/src/mame/drivers/mac.cpp
index 52bdcea57b0..e998b013cfb 100644
--- a/src/mame/drivers/mac.cpp
+++ b/src/mame/drivers/mac.cpp
@@ -1047,8 +1047,7 @@ void mac_state::mac512ke_base(machine_config &config)
m_screen->set_screen_update(FUNC(mac_state::screen_update_mac));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 2);
- m_palette->set_init(DEVICE_SELF, FUNC(mac_state::palette_init_mac));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
MCFG_VIDEO_START_OVERRIDE(mac_state,mac)
@@ -1181,8 +1180,7 @@ void mac_state::macprtb(machine_config &config)
add_pb1xx_screen(config);
m_screen->set_screen_update(FUNC(mac_state::screen_update_macprtb));
- PALETTE(config, m_palette, 2);
- m_palette->set_init(DEVICE_SELF, FUNC(mac_state::palette_init_mac));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb)
@@ -1213,7 +1211,7 @@ void mac_state::macii(machine_config &config, bool cpu, asc_device::asc_type asc
m_maincpu->set_dasm_override(FUNC(mac_state::mac_dasm_override));
}
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
add_asc(config, asc_type);
add_base_devices(config);
@@ -1407,8 +1405,7 @@ void mac_state::macse30(machine_config &config)
m_screen->set_screen_update(FUNC(mac_state::screen_update_macse30));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 2);
- m_palette->set_init(DEVICE_SELF, FUNC(mac_state::palette_init_mac));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
MCFG_VIDEO_START_OVERRIDE(mac_state,mac)
@@ -1437,8 +1434,7 @@ void mac_state::macpb140(machine_config &config)
add_pb1xx_screen(config);
m_screen->set_screen_update(FUNC(mac_state::screen_update_macpb140));
- PALETTE(config, m_palette, 2);
- m_palette->set_init(DEVICE_SELF, FUNC(mac_state::palette_init_mac));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_INVERTED);
MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb)
@@ -1483,8 +1479,7 @@ void mac_state::macpb160(machine_config &config)
add_pb1xx_screen(config);
m_screen->set_screen_update(FUNC(mac_state::screen_update_macpb160));
- PALETTE(config, m_palette, 16);
- m_palette->set_init(DEVICE_SELF, FUNC(mac_state::palette_init_macgsc));
+ PALETTE(config, m_palette, FUNC(mac_state::macgsc_palette), 16);
MCFG_VIDEO_START_OVERRIDE(mac_state,macprtb)
@@ -1613,7 +1608,7 @@ void mac_state::pwrmac(machine_config &config)
m_screen->set_visarea(0, 640-1, 0, 480-1);
m_screen->set_screen_update(FUNC(mac_state::screen_update_macrbv));
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
MCFG_VIDEO_START_OVERRIDE(mac_state,macsonora)
MCFG_VIDEO_RESET_OVERRIDE(mac_state,macrbv)
@@ -1656,7 +1651,7 @@ void mac_state::macqd700(machine_config &config)
MCFG_VIDEO_START_OVERRIDE(mac_state,macdafb)
MCFG_VIDEO_RESET_OVERRIDE(mac_state,macdafb)
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
add_asc(config, asc_device::asc_type::EASC);
add_base_devices(config, true, false);
diff --git a/src/mame/drivers/mac128.cpp b/src/mame/drivers/mac128.cpp
index ce9148dd1c9..78c4bf9a395 100644
--- a/src/mame/drivers/mac128.cpp
+++ b/src/mame/drivers/mac128.cpp
@@ -247,7 +247,6 @@ private:
TIMER_CALLBACK_MEMBER(mac_scanline);
DECLARE_VIDEO_START(mac);
- void palette_init(palette_device &palette);
uint32_t screen_update_mac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
#ifndef MAC_USE_EMULATED_KBD
TIMER_CALLBACK_MEMBER(kbd_clock);
@@ -1231,12 +1230,6 @@ void mac128_state::mac128_state_load()
{
}
-void mac128_state::palette_init(palette_device &palette)
-{
- palette.set_pen_color(0, 0xff, 0xff, 0xff);
- palette.set_pen_color(1, 0x00, 0x00, 0x00);
-}
-
VIDEO_START_MEMBER(mac128_state,mac)
{
}
@@ -1347,8 +1340,7 @@ void mac128_state::mac512ke(machine_config &config)
m_screen->set_screen_update(FUNC(mac128_state::screen_update_mac));
m_screen->set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2));
- palette.set_init(DEVICE_SELF, FUNC(mac128_state::palette_init));
+ PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
MCFG_VIDEO_START_OVERRIDE(mac128_state,mac)
diff --git a/src/mame/drivers/macpci.cpp b/src/mame/drivers/macpci.cpp
index 4b1c519523e..19b8e213538 100644
--- a/src/mame/drivers/macpci.cpp
+++ b/src/mame/drivers/macpci.cpp
@@ -106,8 +106,7 @@ void macpci_state::pippin(machine_config &config)
screen.set_screen_update(FUNC(macpci_state::screen_update_pippin));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2));
- palette.set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/macrossp.cpp b/src/mame/drivers/macrossp.cpp
index 22a37781df7..62ae2e8c7f5 100644
--- a/src/mame/drivers/macrossp.cpp
+++ b/src/mame/drivers/macrossp.cpp
@@ -561,8 +561,7 @@ void macrossp_state::macrossp(machine_config &config)
m_screen->screen_vblank().set(FUNC(macrossp_state::screen_vblank_macrossp));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macrossp);
-
- PALETTE(config, m_palette, 4096).set_format(PALETTE_FORMAT_RGBX);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_888, 4096);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/madmotor.cpp b/src/mame/drivers/madmotor.cpp
index c1688518903..c46dd579df0 100644
--- a/src/mame/drivers/madmotor.cpp
+++ b/src/mame/drivers/madmotor.cpp
@@ -280,8 +280,7 @@ MACHINE_CONFIG_START(madmotor_state::madmotor)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_madmotor)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 1024);
DECO_BAC06(config, m_tilegen[0], 0);
m_tilegen[0]->set_gfx_region_wide(0, 0, 0);
diff --git a/src/mame/drivers/magic10.cpp b/src/mame/drivers/magic10.cpp
index 9660f1dd4eb..9195fff8044 100644
--- a/src/mame/drivers/magic10.cpp
+++ b/src/mame/drivers/magic10.cpp
@@ -166,6 +166,10 @@ public:
void init_hotslot();
void init_altaten();
+protected:
+ virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void video_start() override;
+
private:
DECLARE_WRITE16_MEMBER(layer0_videoram_w);
DECLARE_WRITE16_MEMBER(layer1_videoram_w);
@@ -184,9 +188,6 @@ private:
void magic10a_map(address_map &map);
void sgsafari_map(address_map &map);
- virtual void machine_start() override { m_lamps.resolve(); }
- virtual void video_start() override;
-
tilemap_t *m_layer0_tilemap;
tilemap_t *m_layer1_tilemap;
tilemap_t *m_layer2_tilemap;
@@ -750,12 +751,11 @@ MACHINE_CONFIG_START(magic10_state::magic10)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(magic10_state, screen_update_magic10)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 256);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_magic10)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_magic10);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/magicfly.cpp b/src/mame/drivers/magicfly.cpp
index 15b71f2d339..b7f35b850c4 100644
--- a/src/mame/drivers/magicfly.cpp
+++ b/src/mame/drivers/magicfly.cpp
@@ -457,37 +457,41 @@
class magicfly_state : public driver_device
{
public:
- magicfly_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ magicfly_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
m_dac(*this, "dac"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void bchance(machine_config &config);
void magicfly(machine_config &config);
void _7mezzo(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
int m_input_selector;
+ required_device<cpu_device> m_maincpu;
+ required_device<dac_bit_interface> m_dac;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(magicfly_videoram_w);
DECLARE_WRITE8_MEMBER(magicfly_colorram_w);
DECLARE_READ8_MEMBER(mux_port_r);
DECLARE_WRITE8_MEMBER(mux_port_w);
TILE_GET_INFO_MEMBER(get_magicfly_tile_info);
TILE_GET_INFO_MEMBER(get_7mezzo_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(magicfly);
- DECLARE_PALETTE_INIT(bchance);
+ void magicfly_palette(palette_device &palette) const;
+ void bchance_palette(palette_device &palette) const;
DECLARE_VIDEO_START(7mezzo);
uint32_t screen_update_magicfly(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<dac_bit_interface> m_dac;
- required_device<gfxdecode_device> m_gfxdecode;
void magicfly_map(address_map &map);
};
@@ -552,10 +556,10 @@ TILE_GET_INFO_MEMBER(magicfly_state::get_7mezzo_tile_info)
x--- ---- Mirrored from bit 2. The code check this one to boot the game.
*/
- int attr = m_colorram[tile_index];
- int code = m_videoram[tile_index];
- int bank = (attr & 0x10) >> 4; /* bit 4 switch the gfx banks */
- int color = attr & 0x07; /* bits 0-2 for color */
+ int const attr = m_colorram[tile_index];
+ int const code = m_videoram[tile_index];
+ int const bank = (attr & 0x10) >> 4; /* bit 4 switch the gfx banks */
+ int const color = attr & 0x07; /* bits 0-2 for color */
/* Seems that bit 7 is mirrored from bit 2 to have a normal boot */
/* Boot only check the first color RAM offset */
@@ -579,11 +583,9 @@ uint32_t magicfly_state::screen_update_magicfly(screen_device &screen, bitmap_in
}
-PALETTE_INIT_MEMBER(magicfly_state, magicfly)
+void magicfly_state::magicfly_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0x00; i < 0x10; i += 0x10)
+ for (int i = 0x00; i < 0x10; i += 0x10)
{
/* 1st gfx bank */
palette.set_pen_color(i + 0, rgb_t(0x00, 0x00, 0x00));
@@ -606,11 +608,9 @@ PALETTE_INIT_MEMBER(magicfly_state, magicfly)
}
}
-PALETTE_INIT_MEMBER(magicfly_state, bchance)
+void magicfly_state::bchance_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0x00; i < 0x10; i += 0x10)
+ for (int i = 0x00; i < 0x10; i += 0x10)
{
/* 1st gfx bank */
palette.set_pen_color(i + 0, rgb_t(0x00, 0x00, 0x00));
@@ -957,9 +957,8 @@ MACHINE_CONFIG_START(magicfly_state::magicfly)
MCFG_SCREEN_UPDATE_DRIVER(magicfly_state, screen_update_magicfly)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_magicfly)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(magicfly_state, magicfly)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_magicfly);
+ PALETTE(config, "palette", FUNC(magicfly_state::magicfly_palette), 32);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/16)); /* guess */
crtc.set_screen("screen");
@@ -984,14 +983,13 @@ MACHINE_CONFIG_START(magicfly_state::_7mezzo)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(magicfly_state::bchance)
+void magicfly_state::bchance(machine_config &config)
+{
magicfly(config);
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(magicfly_state, bchance)
-
-MACHINE_CONFIG_END
+ subdevice<palette_device>("palette")->set_init(FUNC(magicfly_state::bchance_palette));
+}
/*********************************************
diff --git a/src/mame/drivers/magmax.cpp b/src/mame/drivers/magmax.cpp
index f49e5b62df5..bce7832c872 100644
--- a/src/mame/drivers/magmax.cpp
+++ b/src/mame/drivers/magmax.cpp
@@ -347,10 +347,8 @@ MACHINE_CONFIG_START(magmax_state::magmax)
MCFG_SCREEN_UPDATE_DRIVER(magmax_state, screen_update)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_magmax)
- MCFG_PALETTE_ADD(m_palette, 1*16 + 16*16 + 256)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(magmax_state, magmax)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_magmax);
+ PALETTE(config, m_palette, FUNC(magmax_state::magmax_palette), 1*16 + 16*16 + 256, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/magnum.cpp b/src/mame/drivers/magnum.cpp
index e2287dce921..b1eb9b3c016 100644
--- a/src/mame/drivers/magnum.cpp
+++ b/src/mame/drivers/magnum.cpp
@@ -312,7 +312,7 @@ MACHINE_CONFIG_START(magnum_state::magnum)
//WD1793(config, "fdc", 1000000); // nothing known, type or if any disks even exist, port 0x44 is possibly motor control
- MCFG_PALETTE_ADD_MONOCHROME_INVERTED("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
SPEAKER(config, "speaker").front_center();
MCFG_DEVICE_ADD("beep", BEEP, 500) /// frequency is guessed
diff --git a/src/mame/drivers/mainevt.cpp b/src/mame/drivers/mainevt.cpp
index 17cbd9be568..73dca657958 100644
--- a/src/mame/drivers/mainevt.cpp
+++ b/src/mame/drivers/mainevt.cpp
@@ -444,9 +444,7 @@ void mainevt_state::mainevt(machine_config &config)
screen.set_screen_update(FUNC(mainevt_state::screen_update_mainevt));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 256));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 256).enable_shadows();
K052109(config, m_k052109, 24_MHz_XTAL);
m_k052109->set_palette("palette");
@@ -493,9 +491,7 @@ void mainevt_state::devstors(machine_config &config)
screen.set_screen_update(FUNC(mainevt_state::screen_update_dv));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 256));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 256).enable_shadows();
K052109(config, m_k052109, 24_MHz_XTAL);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/mainsnk.cpp b/src/mame/drivers/mainsnk.cpp
index b24c874af41..408822e302a 100644
--- a/src/mame/drivers/mainsnk.cpp
+++ b/src/mame/drivers/mainsnk.cpp
@@ -392,12 +392,11 @@ MACHINE_CONFIG_START(mainsnk_state::mainsnk)
MCFG_SCREEN_SIZE(36*8, 28*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 1*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mainsnk_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mainsnk)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_INIT_OWNER(mainsnk_state, mainsnk)
- MCFG_PALETTE_ENABLE_SHADOWS()
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mainsnk);
+ PALETTE(config, m_palette, FUNC(mainsnk_state::mainsnk_palette), 0x400);
+ m_palette->enable_shadows();
SPEAKER(config, "mono").front_center();
@@ -406,12 +405,11 @@ MACHINE_CONFIG_START(mainsnk_state::mainsnk)
m_soundlatch->set_separate_acknowledge(true);
AY8910(config, "ay1", 2000000).add_route(ALL_OUTPUTS, "mono", 0.35);
-
AY8910(config, "ay2", 2000000).add_route(ALL_OUTPUTS, "mono", 0.35);
MACHINE_CONFIG_END
-ROM_START( mainsnk)
+ROM_START(mainsnk)
ROM_REGION( 0x10000, "maincpu", 0 )
ROM_LOAD( "snk.p01", 0x0000, 0x2000, CRC(00db1ca2) SHA1(efe83488cf88adc185e6024b8f6ad5f8ef7f4cfd) )
ROM_LOAD( "snk.p02", 0x2000, 0x2000, CRC(df5c86b5) SHA1(e9c854524e3d8231c874314cdff321e66ec7f0c4) )
@@ -478,4 +476,4 @@ ROM_END
GAME( 1984, mainsnk, 0, mainsnk, mainsnk, mainsnk_state, empty_init, ROT180, "SNK", "Main Event (1984)", MACHINE_SUPPORTS_SAVE )
-GAME( 1985, canvas, 0, mainsnk, canvas, mainsnk_state, empty_init, ROT0, "SNK", "Canvas Croquis", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, canvas, 0, mainsnk, canvas, mainsnk_state, empty_init, ROT0, "SNK", "Canvas Croquis", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/majorpkr.cpp b/src/mame/drivers/majorpkr.cpp
index 9a38bfcc7de..a632af8ca67 100644
--- a/src/mame/drivers/majorpkr.cpp
+++ b/src/mame/drivers/majorpkr.cpp
@@ -488,6 +488,10 @@ public:
void init_majorpkr();
+protected:
+ virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(rom_bank_w);
DECLARE_WRITE8_MEMBER(palette_bank_w);
@@ -509,9 +513,6 @@ private:
void portmap(address_map &map);
void vrambanks(address_map &map);
- virtual void machine_start() override { m_lamps.resolve(); }
- virtual void video_start() override;
-
required_device<gfxdecode_device> m_gfxdecode;
required_device<address_map_bank_device> m_palette_bank;
required_device<address_map_bank_device> m_vram_bank;
@@ -1021,10 +1022,9 @@ MACHINE_CONFIG_START(majorpkr_state::majorpkr)
MCFG_SCREEN_UPDATE_DRIVER(majorpkr_state, screen_update_majorpkr)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_majorpkr)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_majorpkr);
- MCFG_PALETTE_ADD("palette", 0x100 * 16)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xGRB_555, 0x100 * 16);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); // verified.
crtc.set_screen("screen");
diff --git a/src/mame/drivers/malzak.cpp b/src/mame/drivers/malzak.cpp
index 1b28b1cd97c..58541cb3cc3 100644
--- a/src/mame/drivers/malzak.cpp
+++ b/src/mame/drivers/malzak.cpp
@@ -71,6 +71,8 @@
#include "sound/sn76477.h"
#include "speaker.h"
+#include <algorithm>
+
READ8_MEMBER(malzak_state::fake_VRLE_r)
{
@@ -261,11 +263,9 @@ static GFXDECODE_START( gfx_malzak )
GFXDECODE_END
-PALETTE_INIT_MEMBER(malzak_state, malzak)
+void malzak_state::malzak_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 8 * 8; i++)
+ for (int i = 0; i < 8 * 8; i++)
{
palette.set_pen_color(i * 2 + 0, pal1bit(i >> 3), pal1bit(i >> 4), pal1bit(i >> 5));
palette.set_pen_color(i * 2 + 1, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
@@ -290,7 +290,7 @@ void malzak_state::machine_start()
void malzak_state::machine_reset()
{
- memset(m_playfield_code, 0, 256 * sizeof(int));
+ std::fill(std::begin(m_playfield_code), std::end(m_playfield_code), 0);
m_malzak_x = 0;
m_malzak_y = 0;
@@ -314,7 +314,7 @@ void malzak_state::malzak(machine_config &config)
m_screen->set_screen_update(FUNC(malzak_state::screen_update));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_malzak);
- PALETTE(config, m_palette, 128).set_init(FUNC(malzak_state::palette_init_malzak));
+ PALETTE(config, m_palette, FUNC(malzak_state::malzak_palette), 128);
S2636(config, m_s2636[0], 0);
m_s2636[0]->set_offsets(0, -16); // -8, -16
diff --git a/src/mame/drivers/mappy.cpp b/src/mame/drivers/mappy.cpp
index 59fdc9b1d2b..38067a4ca1f 100644
--- a/src/mame/drivers/mappy.cpp
+++ b/src/mame/drivers/mappy.cpp
@@ -1342,9 +1342,7 @@ void mappy_state::superpac_common(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_superpac);
- PALETTE(config, m_palette, 64*4+64*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(mappy_state::palette_init_superpac));
+ PALETTE(config, m_palette, FUNC(mappy_state::superpac_palette), 64*4+64*4, 32);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
@@ -1469,9 +1467,7 @@ void mappy_state::phozon(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_phozon);
- PALETTE(config, m_palette, 64*4+64*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(mappy_state::palette_init_phozon));
+ PALETTE(config, m_palette, FUNC(mappy_state::phozon_palette), 64*4+64*4, 32);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
@@ -1517,9 +1513,7 @@ void mappy_state::mappy_common(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mappy);
- PALETTE(config, m_palette, 64*4+16*16);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(mappy_state::palette_init_mappy));
+ PALETTE(config, m_palette, FUNC(mappy_state::mappy_palette), 64*4+16*4, 32);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
diff --git a/src/mame/drivers/marineb.cpp b/src/mame/drivers/marineb.cpp
index 595ec675f0c..b1ac1423195 100644
--- a/src/mame/drivers/marineb.cpp
+++ b/src/mame/drivers/marineb.cpp
@@ -557,12 +557,11 @@ MACHINE_CONFIG_START(marineb_state::marineb)
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(marineb_state, screen_update_marineb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, marineb_state, marineb_vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_marineb)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(marineb_state, marineb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_marineb);
+ PALETTE(config, m_palette, FUNC(marineb_state::marineb_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/marinedt.cpp b/src/mame/drivers/marinedt.cpp
index 9549c0dd151..ff7d507c187 100644
--- a/src/mame/drivers/marinedt.cpp
+++ b/src/mame/drivers/marinedt.cpp
@@ -123,10 +123,17 @@ public:
void marinedt(machine_config &config);
+protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ virtual void video_start() override;
+
private:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(marinedt);
+ void marinedt_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(trackball_r);
DECLARE_READ8_MEMBER(pc3259_r);
DECLARE_WRITE8_MEMBER(vram_w);
@@ -141,12 +148,6 @@ private:
void marinedt_io(address_map &map);
void marinedt_map(address_map &map);
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void video_start() override;
-
// devices
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
@@ -587,44 +588,41 @@ void marinedt_state::machine_reset()
}
-PALETTE_INIT_MEMBER(marinedt_state, marinedt)
+void marinedt_state::marinedt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0, bit1, bit2;
- int r, g, b;
-
- for (i = 0; i < 64; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 64; i++)
{
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
-// bit2 = (color_prom[i] >> 2) & 0x01;
- r = (0x55 * bit0 + 0xaa * bit1);
-
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- g = (0x55 * bit0 + 0xaa * bit1);
-
- /* blue component */
- bit0 = (color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = (0x55 * bit0 + 0xaa * bit1);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ //bit2 = BIT(color_prom[i], 2);
+ int const r = (0x55 * bit0) + (0xaa * bit1);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ int const g = (0x55 * bit0) + (0xaa * bit1);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int b = (0x55 * bit0) + (0xaa * bit1);
// matches yellow haired siren
- if(bit2 == 0)
- b/=2;
+ if (bit2 == 0)
+ b /= 2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
-
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
- b = color_prom[i+0x60];
- palette.set_pen_color(64+31-i, rgb_t(0, 0, b));
- palette.set_pen_color(64+63-i, rgb_t(0xff, 0, b));
+ int const b = color_prom[i + 0x60];
+ palette.set_pen_color(64 + 31 - i, rgb_t(0, 0, b));
+ palette.set_pen_color(64 + 63 - i, rgb_t(0xff, 0, b));
}
}
@@ -642,13 +640,13 @@ MACHINE_CONFIG_START(marinedt_state::marinedt)
MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 328, 0, 256, 263, 32, 256) // template to get ~60 fps
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_marinedt)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_marinedt);
- MCFG_PALETTE_ADD("palette", 64+64)
- MCFG_PALETTE_INIT_OWNER(marinedt_state, marinedt)
+ PALETTE(config, "palette", FUNC(marinedt_state::marinedt_palette), 64 + 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
+ //AY8910(config, "aysnd", MAIN_CLOCK/4).add_route(ALL_OUTPUTS, "mono", 0.30);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/mario.cpp b/src/mame/drivers/mario.cpp
index 2ddbbfbf312..fa40440ebc3 100644
--- a/src/mame/drivers/mario.cpp
+++ b/src/mame/drivers/mario.cpp
@@ -362,19 +362,19 @@ MACHINE_CONFIG_START(mario_state::mario_base)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(mario_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mario_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mario)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(mario_state, mario)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mario);
+ PALETTE(config, m_palette, FUNC(mario_state::mario_palette), 256);
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(mario_state::mario)
+void mario_state::mario(machine_config &config)
+{
mario_base(config);
mario_audio(config);
-MACHINE_CONFIG_END
+}
MACHINE_CONFIG_START(mario_state::masao)
mario_base(config);
diff --git a/src/mame/drivers/markham.cpp b/src/mame/drivers/markham.cpp
index ef5c7c28986..5d7039eceec 100644
--- a/src/mame/drivers/markham.cpp
+++ b/src/mame/drivers/markham.cpp
@@ -560,12 +560,10 @@ MACHINE_CONFIG_START(markham_state::markham)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(markham_state, screen_update_markham)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_markham)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(markham_state, markham)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_markham);
+ PALETTE(config, m_palette, FUNC(markham_state::markham_palette), 1024, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mastboy.cpp b/src/mame/drivers/mastboy.cpp
index d110cc2bd75..70faffe7880 100644
--- a/src/mame/drivers/mastboy.cpp
+++ b/src/mame/drivers/mastboy.cpp
@@ -834,7 +834,7 @@ void mastboy_state::mastboy(machine_config &config)
screen.screen_vblank().set(FUNC(mastboy_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mastboy);
- PALETTE(config, m_palette, 0x100);
+ PALETTE(config, m_palette).set_entries(0x100);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mastboyo.cpp b/src/mame/drivers/mastboyo.cpp
index 792da1f95c1..fbb79301379 100644
--- a/src/mame/drivers/mastboyo.cpp
+++ b/src/mame/drivers/mastboyo.cpp
@@ -21,8 +21,8 @@
class mastboyo_state : public driver_device
{
public:
- mastboyo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mastboyo_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_fgram(*this, "fgram"),
m_fgram2(*this, "fgram2"),
m_maincpu(*this, "maincpu"),
@@ -57,7 +57,7 @@ private:
DECLARE_WRITE8_MEMBER(rombank_w);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update_mastboyo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(mastboyo);
+ void mastboyo_palette(palette_device &palette) const;
};
@@ -94,7 +94,7 @@ WRITE8_MEMBER(mastboyo_state::fgram2_w)
m_fg_tilemap->mark_tile_dirty(offset);
}
-PALETTE_INIT_MEMBER(mastboyo_state, mastboyo)
+void mastboyo_state::mastboyo_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
{
@@ -217,8 +217,7 @@ MACHINE_CONFIG_START(mastboyo_state::mastboyo)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mastboyo)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(mastboyo_state, mastboyo)
+ PALETTE(config, "palette", FUNC(mastboyo_state::mastboyo_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/matmania.cpp b/src/mame/drivers/matmania.cpp
index b5c3fd5f4d1..b7dd2692973 100644
--- a/src/mame/drivers/matmania.cpp
+++ b/src/mame/drivers/matmania.cpp
@@ -319,11 +319,10 @@ MACHINE_CONFIG_START(matmania_state::matmania)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(matmania_state, screen_update_matmania)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_matmania)
- MCFG_PALETTE_ADD("palette", 64+16)
- MCFG_PALETTE_INIT_OWNER(matmania_state, matmania)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_matmania);
+ PALETTE(config, m_palette, FUNC(matmania_state::matmania_palette), 64 + 16);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -331,7 +330,6 @@ MACHINE_CONFIG_START(matmania_state::matmania)
GENERIC_LATCH_8(config, m_soundlatch);
AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
-
AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.4) // unknown DAC
@@ -361,11 +359,10 @@ MACHINE_CONFIG_START(matmania_state::maniach)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(matmania_state, screen_update_maniach)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_maniach)
- MCFG_PALETTE_ADD("palette", 64+16)
- MCFG_PALETTE_INIT_OWNER(matmania_state, matmania)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_maniach);
+ PALETTE(config, m_palette, FUNC(matmania_state::matmania_palette), 64 + 16);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/maxaflex.cpp b/src/mame/drivers/maxaflex.cpp
index 27964085570..87e3fcfd91a 100644
--- a/src/mame/drivers/maxaflex.cpp
+++ b/src/mame/drivers/maxaflex.cpp
@@ -358,7 +358,7 @@ void maxaflex_state::maxaflex(machine_config &config)
screen.set_screen_update("antic", FUNC(antic_device::screen_update));
screen.set_palette("palette");
- PALETTE(config, "palette", 256).set_init(FUNC(maxaflex_state::palette_init_atari));
+ PALETTE(config, "palette", FUNC(maxaflex_state::atari_palette), 256);
config.set_default_layout(layout_maxaflex);
/* sound hardware */
diff --git a/src/mame/drivers/mazerbla.cpp b/src/mame/drivers/mazerbla.cpp
index 7e5b6ffc6e4..5ccac260c7e 100644
--- a/src/mame/drivers/mazerbla.cpp
+++ b/src/mame/drivers/mazerbla.cpp
@@ -157,7 +157,7 @@ private:
DECLARE_WRITE8_MEMBER(vsb_ls273_audio_control_w);
DECLARE_WRITE8_MEMBER(sound_int_clear_w);
DECLARE_WRITE8_MEMBER(gg_led_ctrl_w);
- DECLARE_PALETTE_INIT(mazerbla);
+ void mazerbla_palette(palette_device &palette);
uint32_t screen_update_mazerbla(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
INTERRUPT_GEN_MEMBER(sound_interrupt);
@@ -225,12 +225,12 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(mazerbla_state, mazerbla)
+void mazerbla_state::mazerbla_palette(palette_device &palette)
{
- static const int resistances_r[2] = { 4700, 2200 };
- static const int resistances_gb[3] = { 10000, 4700, 2200 };
+ static constexpr int resistances_r[2] = { 4700, 2200 };
+ static constexpr int resistances_gb[3] = { 10000, 4700, 2200 };
- /* just to calculate coefficients for later use */
+ // just to calculate coefficients for later use
compute_resistor_weights(0, 255, -1.0,
3, resistances_gb, m_weights_g, 3600, 0,
3, resistances_gb, m_weights_b, 3600, 0,
@@ -1011,8 +1011,7 @@ MACHINE_CONFIG_START(mazerbla_state::mazerbla)
MCFG_SCREEN_UPDATE_DRIVER(mazerbla_state, screen_update_mazerbla)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mazerbla_state, screen_vblank))
- MCFG_PALETTE_ADD("palette", 256+1)
- MCFG_PALETTE_INIT_OWNER(mazerbla_state, mazerbla)
+ PALETTE(config, "palette", FUNC(mazerbla_state::mazerbla_palette), 256+1);
/* sound hardware */
MACHINE_CONFIG_END
@@ -1054,8 +1053,7 @@ MACHINE_CONFIG_START(mazerbla_state::greatgun)
MCFG_SCREEN_UPDATE_DRIVER(mazerbla_state, screen_update_mazerbla)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mazerbla_state, screen_vblank))
- MCFG_PALETTE_ADD("palette", 256+1)
- MCFG_PALETTE_INIT_OWNER(mazerbla_state, mazerbla)
+ PALETTE(config, "palette", FUNC(mazerbla_state::mazerbla_palette), 246+1);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mbc200.cpp b/src/mame/drivers/mbc200.cpp
index e87aa2a7af5..62cb696500f 100644
--- a/src/mame/drivers/mbc200.cpp
+++ b/src/mame/drivers/mbc200.cpp
@@ -320,7 +320,7 @@ MACHINE_CONFIG_START(mbc200_state::mbc200)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", h46505_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mbc200)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
H46505(config, m_crtc, 8_MHz_XTAL / 4); // HD46505SP
m_crtc->set_screen("screen");
diff --git a/src/mame/drivers/mbc55x.cpp b/src/mame/drivers/mbc55x.cpp
index c5f4d03f57d..aa8b1bb7041 100644
--- a/src/mame/drivers/mbc55x.cpp
+++ b/src/mame/drivers/mbc55x.cpp
@@ -30,7 +30,7 @@ ToDo:
#include "softlist.h"
#include "speaker.h"
-static constexpr rgb_t mbc55x_palette[SCREEN_NO_COLOURS] =
+static constexpr rgb_t mbc55x_pens[SCREEN_NO_COLOURS]
{
// normal brightness
{ 0x00, 0x00, 0x00 }, // black
@@ -224,11 +224,11 @@ static INPUT_PORTS_START( mbc55x )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(mbc55x_state, mbc55x)
+void mbc55x_state::mbc55x_palette(palette_device &palette) const
{
logerror("initializing palette\n");
- palette.set_pen_colors(0, mbc55x_palette, ARRAY_LENGTH(mbc55x_palette));
+ palette.set_pen_colors(0, mbc55x_pens);
}
@@ -278,8 +278,7 @@ MACHINE_CONFIG_START(mbc55x_state::mbc55x)
screen.set_raw(14.318181_MHz_XTAL, 896, 0, 640, 262, 0, 200);
screen.set_screen_update(VID_MC6845_NAME, FUNC(mc6845_device::screen_update));
- MCFG_PALETTE_ADD("palette", SCREEN_NO_COLOURS * 3)
- MCFG_PALETTE_INIT_OWNER(mbc55x_state, mbc55x)
+ PALETTE(config, m_palette, FUNC(mbc55x_state::mbc55x_palette), SCREEN_NO_COLOURS * 3);
RAM(config, RAM_TAG).set_default_size("128K").set_extra_options("128K,192K,256K,320K,384K,448K,512K,576K,640K");
diff --git a/src/mame/drivers/mbee.cpp b/src/mame/drivers/mbee.cpp
index 95bdd25b898..adc737303a1 100644
--- a/src/mame/drivers/mbee.cpp
+++ b/src/mame/drivers/mbee.cpp
@@ -666,10 +666,9 @@ MACHINE_CONFIG_START(mbee_state::mbee)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 19*16-1)
MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mono)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_mono)
- MCFG_PALETTE_ADD("palette", 100)
- MCFG_PALETTE_INIT_OWNER(mbee_state, standard)
+ PALETTE(config, m_palette, FUNC(mbee_state::standard_palette), 100);
MCFG_VIDEO_START_OVERRIDE(mbee_state, mono)
@@ -724,10 +723,9 @@ MACHINE_CONFIG_START(mbee_state::mbeeic)
MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 19*16-1)
MCFG_SCREEN_UPDATE_DRIVER(mbee_state, screen_update_mbee)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_standard)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_standard)
- MCFG_PALETTE_ADD("palette", 100)
- MCFG_PALETTE_INIT_OWNER(mbee_state, standard)
+ PALETTE(config, m_palette, FUNC(mbee_state::standard_palette), 100);
MCFG_VIDEO_START_OVERRIDE(mbee_state, standard)
@@ -772,8 +770,7 @@ MACHINE_CONFIG_START(mbee_state::mbeeppc)
MCFG_DEVICE_IO_MAP(mbeeppc_io)
MCFG_VIDEO_START_OVERRIDE(mbee_state, premium)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_premium)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(mbee_state, premium)
+ m_palette->set_init(FUNC(mbee_state::premium_palette));
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(FUNC(mbee_state::rtc_irq_w));
diff --git a/src/mame/drivers/mc8020.cpp b/src/mame/drivers/mc8020.cpp
index 2017e971767..1a5d8dd041f 100644
--- a/src/mame/drivers/mc8020.cpp
+++ b/src/mame/drivers/mc8020.cpp
@@ -312,7 +312,7 @@ MACHINE_CONFIG_START(mc8020_state::mc8020)
MCFG_SCREEN_UPDATE_DRIVER(mc8020_state, screen_update_mc8020)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* devices */
z80pio_device& pio(Z80PIO(config, "pio", XTAL(2'457'600)));
diff --git a/src/mame/drivers/mc8030.cpp b/src/mame/drivers/mc8030.cpp
index 1d0008daa7a..cffbecdc3fb 100644
--- a/src/mame/drivers/mc8030.cpp
+++ b/src/mame/drivers/mc8030.cpp
@@ -200,7 +200,7 @@ MACHINE_CONFIG_START(mc8030_state::mc8030)
MCFG_SCREEN_UPDATE_DRIVER(mc8030_state, screen_update_mc8030)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Devices */
z80pio_device& zve_pio(Z80PIO(config, "zve_pio", XTAL(2'457'600)));
diff --git a/src/mame/drivers/mcatadv.cpp b/src/mame/drivers/mcatadv.cpp
index bc140379566..467de6c0205 100644
--- a/src/mame/drivers/mcatadv.cpp
+++ b/src/mame/drivers/mcatadv.cpp
@@ -454,11 +454,10 @@ MACHINE_CONFIG_START(mcatadv_state::mcatadv)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(mcatadv_state, screen_update_mcatadv)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mcatadv_state, screen_vblank_mcatadv))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mcatadv)
- MCFG_PALETTE_ADD("palette", 0x2000/2)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mcatadv);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x2000/2);
WATCHDOG_TIMER(config, m_watchdog).set_time(attotime::from_seconds(3)); /* a guess, and certainly wrong */
diff --git a/src/mame/drivers/mcr.cpp b/src/mame/drivers/mcr.cpp
index d3a74881da2..7ffb68a44cd 100644
--- a/src/mame/drivers/mcr.cpp
+++ b/src/mame/drivers/mcr.cpp
@@ -1778,7 +1778,7 @@ void mcr_state::mcr_90009(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mcr);
- PALETTE(config, m_palette, 32).set_format(PALETTE_FORMAT_xxxxRRRRBBBBGGGG);
+ PALETTE(config, m_palette).set_format(palette_device::xRBG_444, 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -1808,8 +1808,7 @@ void mcr_state::mcr_90010(machine_config &config)
m_maincpu->set_addrmap(AS_IO, &mcr_state::cpu_90010_portmap);
/* video hardware */
- m_palette->set_entries(64);
- m_palette->set_format(PALETTE_FORMAT_xxxxRRRRBBBBGGGG);
+ m_palette->set_format(palette_device::xRBG_444, 64);
}
/* as above, plus 8-track tape */
@@ -1831,8 +1830,7 @@ void mcr_state::mcr_91475(machine_config &config)
mcr_90010(config);
/* video hardware */
- m_palette->set_entries(128);
- m_palette->set_format(PALETTE_FORMAT_xxxxRRRRBBBBGGGG);
+ m_palette->set_format(palette_device::xRBG_444, 128);
/* sound hardware */
SAMPLES(config, m_samples);
diff --git a/src/mame/drivers/mcr3.cpp b/src/mame/drivers/mcr3.cpp
index fa2a86a9552..6e2d7191d51 100644
--- a/src/mame/drivers/mcr3.cpp
+++ b/src/mame/drivers/mcr3.cpp
@@ -1110,8 +1110,8 @@ MACHINE_CONFIG_START(mcr3_state::mcrmono)
MCFG_SCREEN_UPDATE_DRIVER(mcr3_state, screen_update_mcr3)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mcr3)
- MCFG_PALETTE_ADD("palette", 64)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_mcr3);
+ PALETTE(config, "palette").set_entries(64);
MACHINE_CONFIG_END
@@ -1172,10 +1172,8 @@ MACHINE_CONFIG_START(mcr3_state::mcrscroll)
MCFG_SCREEN_VISIBLE_AREA(0, 30*16-1, 0, 30*16-1)
MCFG_SCREEN_UPDATE_DRIVER(mcr3_state, screen_update_spyhunt)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_spyhunt)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(64+4)
+ subdevice<palette_device>("palette")->set_entries(64 + 4).set_init(FUNC(mcr3_state::spyhunt_palette));
- MCFG_PALETTE_INIT_OWNER(mcr3_state,spyhunt)
MCFG_VIDEO_START_OVERRIDE(mcr3_state,spyhunt)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/mcr68.cpp b/src/mame/drivers/mcr68.cpp
index 7548f3513e0..859c316cff7 100644
--- a/src/mame/drivers/mcr68.cpp
+++ b/src/mame/drivers/mcr68.cpp
@@ -920,9 +920,8 @@ MACHINE_CONFIG_START(mcr68_state::mcr68)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", mcr68_state, scanline_cb, "screen", 0, 1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mcr68)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_FORMAT(xxxxxxxRRRBBBGGG)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mcr68);
+ PALETTE(config, "palette").set_format(palette_device::xRBG_333, 64);
MCFG_VIDEO_START_OVERRIDE(mcr68_state,mcr68)
diff --git a/src/mame/drivers/meadows.cpp b/src/mame/drivers/meadows.cpp
index bf92c2823fe..4e8392ef9b2 100644
--- a/src/mame/drivers/meadows.cpp
+++ b/src/mame/drivers/meadows.cpp
@@ -643,7 +643,7 @@ void meadows_state::meadows(machine_config &config)
m_screen->screen_vblank().set(FUNC(meadows_state::meadows_vblank_irq)); // one interrupt per frame!?
GFXDECODE(config, m_gfxdecode, m_palette, gfx_meadows);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* audio hardware */
SPEAKER(config, "speaker").front_center();
@@ -676,7 +676,7 @@ void meadows_state::minferno(machine_config &config)
m_screen->screen_vblank().set(FUNC(meadows_state::minferno_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_minferno);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* audio hardware */
// TODO
@@ -704,7 +704,7 @@ void meadows_state::bowl3d(machine_config &config)
m_screen->screen_vblank().set(FUNC(meadows_state::meadows_vblank_irq)); // one interrupt per frame!?
GFXDECODE(config, m_gfxdecode, m_palette, gfx_meadows);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* audio hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/megasys1.cpp b/src/mame/drivers/megasys1.cpp
index 9236fd0e222..642e39daf2e 100644
--- a/src/mame/drivers/megasys1.cpp
+++ b/src/mame/drivers/megasys1.cpp
@@ -1702,13 +1702,11 @@ MACHINE_CONFIG_START(megasys1_state::system_A)
MCFG_SCREEN_UPDATE_DRIVER(megasys1_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, megasys1_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_abc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
- MCFG_PALETTE_INIT_OWNER(megasys1_state,megasys1)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_abc)
+ PALETTE(config, m_palette, FUNC(megasys1_state::megasys1_palette)).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(megasys1_state,megasys1)
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 256*0);
@@ -1807,13 +1805,11 @@ MACHINE_CONFIG_START(megasys1_state::system_Bbl)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(megasys1_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, megasys1_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_abc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
- MCFG_PALETTE_INIT_OWNER(megasys1_state,megasys1)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_abc)
+ PALETTE(config, m_palette, FUNC(megasys1_state::megasys1_palette)).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(megasys1_state,megasys1)
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 256*0);
@@ -1888,12 +1884,10 @@ MACHINE_CONFIG_START(megasys1_state::system_D)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(megasys1_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, megasys1_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_abc)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
- MCFG_PALETTE_INIT_OWNER(megasys1_state,megasys1)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_abc)
+ PALETTE(config, m_palette, FUNC(megasys1_state::megasys1_palette)).set_format(palette_device::RGBx_555, 1024);
MCFG_VIDEO_START_OVERRIDE(megasys1_state,megasys1)
MEGASYS1_TILEMAP(config, m_tmap[0], m_palette, 256*0);
@@ -1939,11 +1933,10 @@ MACHINE_CONFIG_START(megasys1_state::system_Z)
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(megasys1_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_z)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_z)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 768);
MCFG_VIDEO_START_OVERRIDE(megasys1_state,megasys1)
diff --git a/src/mame/drivers/megazone.cpp b/src/mame/drivers/megazone.cpp
index 973f2c1b058..5c477f1cf9d 100644
--- a/src/mame/drivers/megazone.cpp
+++ b/src/mame/drivers/megazone.cpp
@@ -326,13 +326,11 @@ MACHINE_CONFIG_START(megazone_state::megazone)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(megazone_state, screen_update_megazone)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, megazone_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_megazone)
- MCFG_PALETTE_ADD("palette", 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(megazone_state, megazone)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_megazone);
+ PALETTE(config, m_palette, FUNC(megazone_state::megazone_palette), 16*16+16*16, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/meijinsn.cpp b/src/mame/drivers/meijinsn.cpp
index 7e6beb344d2..9cc06506945 100644
--- a/src/mame/drivers/meijinsn.cpp
+++ b/src/mame/drivers/meijinsn.cpp
@@ -89,7 +89,7 @@ public:
private:
DECLARE_WRITE16_MEMBER(sound_w);
DECLARE_READ16_MEMBER(alpha_mcu_r);
- DECLARE_PALETTE_INIT(meijinsn);
+ void meijinsn_palette(palette_device &palette) const;
uint32_t screen_update_meijinsn(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(meijinsn_interrupt);
@@ -268,40 +268,38 @@ void meijinsn_state::video_start()
{
}
-PALETTE_INIT_MEMBER(meijinsn_state, meijinsn)
+void meijinsn_state::meijinsn_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
static const int resistances_b[2] = { 470, 220 };
static const int resistances_rg[3] = { 1000, 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
-
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 0, 1000+1000,
3, resistances_rg, weights_g, 0, 1000+1000,
2, resistances_b, weights_b, 0, 1000+1000);
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
/* red component */
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
/* green component */
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
/* blue component */
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = combine_2_weights(weights_b, bit0, bit1);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -381,8 +379,7 @@ MACHINE_CONFIG_START(meijinsn_state::meijinsn)
MCFG_SCREEN_UPDATE_DRIVER(meijinsn_state, screen_update_meijinsn)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(meijinsn_state, meijinsn)
+ PALETTE(config, "palette", FUNC(meijinsn_state::meijinsn_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/meritum.cpp b/src/mame/drivers/meritum.cpp
index 2fa35fc4d0a..89507372c4e 100644
--- a/src/mame/drivers/meritum.cpp
+++ b/src/mame/drivers/meritum.cpp
@@ -63,7 +63,7 @@ public:
, m_speaker(*this, "speaker")
, m_cassette(*this, "cassette")
, m_io_keyboard(*this, "LINE%u", 0)
- { }
+ { }
void meritum(machine_config &config);
@@ -429,8 +429,8 @@ MACHINE_CONFIG_START(meritum_state::meritum)
MCFG_SCREEN_UPDATE_DRIVER(meritum_state, screen_update_meritum)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_meritum)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ GFXDECODE(config, "gfxdecode", "palette", gfx_meritum);
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mermaid.cpp b/src/mame/drivers/mermaid.cpp
index f880ea86a19..3119a60617b 100644
--- a/src/mame/drivers/mermaid.cpp
+++ b/src/mame/drivers/mermaid.cpp
@@ -447,12 +447,10 @@ MACHINE_CONFIG_START(mermaid_state::mermaid)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mermaid_state, screen_update_mermaid)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mermaid_state, screen_vblank_mermaid))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mermaid)
- MCFG_PALETTE_ADD("palette", 4*16+2*2)
- MCFG_PALETTE_INDIRECT_ENTRIES(64+1)
- MCFG_PALETTE_INIT_OWNER(mermaid_state, mermaid)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mermaid);
+ PALETTE(config, m_palette, FUNC(mermaid_state::mermaid_palette), 4*16+2*2, 64+1);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -471,8 +469,7 @@ MACHINE_CONFIG_START(mermaid_state::rougien)
m_latch[1]->q_out_cb<2>().set(FUNC(mermaid_state::rougien_sample_rom_hi_w));
m_latch[1]->q_out_cb<3>().set(FUNC(mermaid_state::rougien_sample_rom_lo_w));
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(mermaid_state,rougien)
+ m_palette->set_init(FUNC(mermaid_state::rougien_palette));
MCFG_DEVICE_ADD("adpcm", MSM5205, 384000)
MCFG_MSM5205_VCK_CALLBACK(WRITELINE(*this, mermaid_state, rougien_adpcm_int))
diff --git a/src/mame/drivers/mes.cpp b/src/mame/drivers/mes.cpp
index 9f695399564..e8899cfc15e 100644
--- a/src/mame/drivers/mes.cpp
+++ b/src/mame/drivers/mes.cpp
@@ -146,7 +146,7 @@ MACHINE_CONFIG_START(mes_state::mes)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
Z80CTC(config, "ctc", 0);
Z80PIO(config, "pio", 0);
diff --git a/src/mame/drivers/metalmx.cpp b/src/mame/drivers/metalmx.cpp
index 9def94a4960..2270377cd69 100644
--- a/src/mame/drivers/metalmx.cpp
+++ b/src/mame/drivers/metalmx.cpp
@@ -286,18 +286,10 @@ uint32_t metalmx_state::screen_update_metalmx(screen_device &screen, bitmap_ind1
/* TODO: TMS34020 should take care of this */
// uint32_t *src_base = &gsp_vram[(vreg_base[0x40/4] & 0x40) ? 0x20000 : 0];
- uint16_t *src_base = m_gsp_vram;
- int y;
+ uint16_t const *const src_base = m_gsp_vram;
- for (y = 0; y < 384; ++y)
- {
- int x;
- uint16_t *src = &src_base[512 * y];
- uint16_t *dst = &bitmap.pix16(y);
-
- for(x = 0; x < 512; x++)
- *dst++ = *src++;
- }
+ for (int y = (std::max)(0, cliprect.min_y); y <= (std::min)(383, cliprect.max_y); ++y)
+ std::copy_n(&src_base[512 * y], 512, &bitmap.pix16(y));
return 0;
}
@@ -695,7 +687,7 @@ MACHINE_CONFIG_START(metalmx_state::metalmx)
MCFG_SCREEN_UPDATE_DRIVER(metalmx_state, screen_update_metalmx)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_RRRRRGGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_565);
ATARI_CAGE(config, m_cage, 0);
m_cage->set_speedup(0); // TODO: speedup address
diff --git a/src/mame/drivers/metlclsh.cpp b/src/mame/drivers/metlclsh.cpp
index 43b70004d47..54fbff18e71 100644
--- a/src/mame/drivers/metlclsh.cpp
+++ b/src/mame/drivers/metlclsh.cpp
@@ -294,11 +294,10 @@ MACHINE_CONFIG_START(metlclsh_state::metlclsh)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(metlclsh_state, screen_update_metlclsh)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_metlclsh)
- MCFG_PALETTE_ADD("palette", 3 * 16)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_metlclsh)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 3 * 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/metlfrzr.cpp b/src/mame/drivers/metlfrzr.cpp
index 58888eb8867..2cd3986f02f 100644
--- a/src/mame/drivers/metlfrzr.cpp
+++ b/src/mame/drivers/metlfrzr.cpp
@@ -33,8 +33,8 @@
class metlfrzr_state : public driver_device
{
public:
- metlfrzr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ metlfrzr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_decrypted_opcodes(*this, "decrypted_opcodes"),
m_work_ram(*this, "wram"),
@@ -376,11 +376,9 @@ MACHINE_CONFIG_START(metlfrzr_state::metlfrzr)
MCFG_DEVICE_ADD("t5182", T5182, 0)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INDIRECT_ENTRIES(256*2)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x200).set_indirect_entries(256 * 2);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_metlfrzr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_metlfrzr);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -389,7 +387,7 @@ MACHINE_CONFIG_START(metlfrzr_state::metlfrzr)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256 - 1, 16, 256 - 16 - 1)
MCFG_SCREEN_UPDATE_DRIVER(metlfrzr_state, screen_update_metlfrzr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mexico86.cpp b/src/mame/drivers/mexico86.cpp
index 968e2c2313b..92497781e06 100644
--- a/src/mame/drivers/mexico86.cpp
+++ b/src/mame/drivers/mexico86.cpp
@@ -457,9 +457,7 @@ void mexico86_state::mexico86(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mexico86);
- PALETTE(config, m_palette, 256);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/meyc8088.cpp b/src/mame/drivers/meyc8088.cpp
index dc8b2c91712..11fe7a0df0f 100644
--- a/src/mame/drivers/meyc8088.cpp
+++ b/src/mame/drivers/meyc8088.cpp
@@ -40,12 +40,12 @@
class meyc8088_state : public driver_device
{
public:
- meyc8088_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ meyc8088_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_vram(*this, "vram"),
m_heartbeat(*this, "heartbeat"),
- m_switches(*this, {"C0", "C1", "C2", "C3"}),
+ m_switches(*this, "C%u", 0U),
m_lamps(*this, "lamp%u", 0U)
{ }
@@ -77,7 +77,7 @@ private:
DECLARE_WRITE8_MEMBER(lights2_w);
DECLARE_WRITE8_MEMBER(common_w);
- DECLARE_PALETTE_INIT(meyc8088);
+ void meyc8088_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
TIMER_DEVICE_CALLBACK_MEMBER(heartbeat_callback);
@@ -131,9 +131,9 @@ static const res_net_info meyc8088_net_info =
}
};
-PALETTE_INIT_MEMBER(meyc8088_state, meyc8088)
+void meyc8088_state:: meyc8088_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, meyc8088_decode_info, meyc8088_net_info);
@@ -395,8 +395,7 @@ MACHINE_CONFIG_START(meyc8088_state::meyc8088)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, meyc8088_state, screen_vblank))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(meyc8088_state, meyc8088)
+ PALETTE(config, "palette", FUNC(meyc8088_state::meyc8088_palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/mgames.cpp b/src/mame/drivers/mgames.cpp
index 30c1533c586..f171c7ea4ce 100644
--- a/src/mame/drivers/mgames.cpp
+++ b/src/mame/drivers/mgames.cpp
@@ -247,7 +247,7 @@ private:
DECLARE_WRITE8_MEMBER(outport5_w);
DECLARE_WRITE8_MEMBER(outport6_w);
DECLARE_WRITE8_MEMBER(outport7_w);
- DECLARE_PALETTE_INIT(mgames);
+ void mgames_palette(palette_device &palette) const;
uint32_t screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
@@ -270,30 +270,25 @@ void mgames_state::video_start()
uint32_t mgames_state::screen_update_mgames(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int y,x;
- int count;
- gfx_element *gfx = m_gfxdecode->gfx(0);
+ gfx_element *const gfx = m_gfxdecode->gfx(0);
- count = 0;
- for (y = 0; y < 32; y++)
+ int count = 0;
+ for (int y = 0; y < 32; y++)
{
- for (x = 0; x < 32; x++)
+ for (int x = 0; x < 32; x++)
{
- uint16_t dat = m_video[count];
- uint16_t col = m_video[count + 0x400] & 0x7f;
+ uint16_t const dat = m_video[count];
+ uint16_t const col = m_video[count + 0x400] & 0x7f;
gfx->opaque(bitmap, cliprect, dat, col, 0, 0, x * 16, y * 16);
count++;
}
-
}
return 0;
}
-PALETTE_INIT_MEMBER(mgames_state, mgames)
+void mgames_state::mgames_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
rgb_t color;
@@ -659,11 +654,10 @@ MACHINE_CONFIG_START(mgames_state::mgames)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(mgames_state, screen_update_mgames)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mgames)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(mgames_state, mgames)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mgames);
+ PALETTE(config, m_palette, FUNC(mgames_state::mgames_palette), 0x200);
/* sound hardware */
// to do...
diff --git a/src/mame/drivers/mgolf.cpp b/src/mame/drivers/mgolf.cpp
index 5a75d7da045..3a496fb7fc6 100644
--- a/src/mame/drivers/mgolf.cpp
+++ b/src/mame/drivers/mgolf.cpp
@@ -39,7 +39,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(mgolf);
+ void mgolf_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -302,7 +302,7 @@ static INPUT_PORTS_START( mgolf )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(mgolf_state, mgolf)
+void mgolf_state::mgolf_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x80, 0x80, 0x80));
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00));
@@ -381,11 +381,10 @@ MACHINE_CONFIG_START(mgolf_state::mgolf)
MCFG_SCREEN_SIZE(256, 262)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 223)
MCFG_SCREEN_UPDATE_DRIVER(mgolf_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mgolf)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(mgolf_state, mgolf)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_mgolf)
+ PALETTE(config, m_palette, FUNC(mgolf_state::mgolf_palette), 4);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/micral.cpp b/src/mame/drivers/micral.cpp
index a5c17635a9d..a7575b3d30f 100644
--- a/src/mame/drivers/micral.cpp
+++ b/src/mame/drivers/micral.cpp
@@ -396,7 +396,7 @@ MACHINE_CONFIG_START(micral_state::micral)
MCFG_SCREEN_SIZE(640, 240)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 239)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
//MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_micral)
CRT5037(config, m_crtc, 4000000 / 8); // xtal freq unknown
diff --git a/src/mame/drivers/micro3d.cpp b/src/mame/drivers/micro3d.cpp
index 78f5009312a..6a322a88043 100644
--- a/src/mame/drivers/micro3d.cpp
+++ b/src/mame/drivers/micro3d.cpp
@@ -350,13 +350,12 @@ MACHINE_CONFIG_START(micro3d_state::micro3d)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MCFG_QUANTUM_TIME(attotime::from_hz(3000))
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(BBBBBRRRRRGGGGGx)
+ PALETTE(config, m_palette).set_format(palette_device::BRGx_555, 4096);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(40_MHz_XTAL/8*4, 192*4, 0, 144*4, 434, 0, 400)
MCFG_SCREEN_UPDATE_DEVICE("vgb", tms34010_device, tms340x0_ind16)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MC2661(config, m_vgb_uart, 40_MHz_XTAL / 8); // actually SCN2651
m_vgb_uart->txd_handler().set("monitor_vgb", FUNC(rs232_port_device::write_txd));
diff --git a/src/mame/drivers/micronic.cpp b/src/mame/drivers/micronic.cpp
index 360f53ed2cc..0a89a68fb01 100644
--- a/src/mame/drivers/micronic.cpp
+++ b/src/mame/drivers/micronic.cpp
@@ -309,10 +309,10 @@ void micronic_state::nvram_init(nvram_device &nvram, void *data, size_t size)
}
-PALETTE_INIT_MEMBER(micronic_state, micronic)
+void micronic_state::micronic_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
- palette.set_pen_color(1, rgb_t(92, 83, 88));
+ palette.set_pen_color(1, rgb_t( 92, 83, 88));
}
void micronic_state::machine_start()
@@ -363,21 +363,19 @@ MACHINE_CONFIG_START(micronic_state::micronic)
MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 64-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(micronic_state, micronic)
+ PALETTE(config, "palette", FUNC(micronic_state::micronic_palette), 2);
MCFG_DEVICE_ADD(HD61830_TAG, HD61830, 4.9152_MHz_XTAL / 2 / 2)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD( "beeper", BEEP, 0 )
- MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
+ BEEP(config, m_beep, 0).add_route(ALL_OUTPUTS, "mono", 1.00);
/* ram banks */
RAM(config, RAM_TAG).set_default_size("224K");
- NVRAM(config, "nvram1").set_custom_handler(FUNC(micronic_state::nvram_init)); // base ram
- NVRAM(config, "nvram2").set_custom_handler(FUNC(micronic_state::nvram_init)); // additional ram banks
+ NVRAM(config, "nvram1").set_custom_handler(FUNC(micronic_state::nvram_init)); // base RAM
+ NVRAM(config, "nvram2").set_custom_handler(FUNC(micronic_state::nvram_init)); // additional RAM banks
MC146818(config, m_rtc, 32.768_kHz_XTAL);
m_rtc->irq().set(FUNC(micronic_state::mc146818_irq));
diff --git a/src/mame/drivers/microtan.cpp b/src/mame/drivers/microtan.cpp
index 028187ced5e..16405bfab22 100644
--- a/src/mame/drivers/microtan.cpp
+++ b/src/mame/drivers/microtan.cpp
@@ -227,7 +227,7 @@ MACHINE_CONFIG_START(microtan_state::microtan)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_microtan)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/microvsn.cpp b/src/mame/drivers/microvsn.cpp
index 4233d5c5401..5763dd39e11 100644
--- a/src/mame/drivers/microvsn.cpp
+++ b/src/mame/drivers/microvsn.cpp
@@ -27,14 +27,17 @@ of the games were clocked at around 500KHz, 550KHz, or 300KHz.
#include "screen.h"
#include "speaker.h"
-#define LOG 0
+#include <algorithm>
+
+//#define VERBOSE 1
+#include "logmacro.h"
class microvision_state : public driver_device
{
public:
- microvision_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ microvision_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_dac( *this, "dac" ),
m_i8021( *this, "maincpu1" ),
m_tms1100( *this, "maincpu2" ),
@@ -43,12 +46,17 @@ public:
void microvision(machine_config &config);
+protected:
+ static constexpr device_timer_id TIMER_PADDLE = 0;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(microvision);
- DECLARE_MACHINE_START(microvision);
- DECLARE_MACHINE_RESET(microvision);
+ void microvision_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( microvsn_cart );
@@ -100,9 +108,7 @@ private:
required_device<generic_slot_device> m_cart;
// Timers
- static const device_timer_id TIMER_PADDLE = 0;
emu_timer *m_paddle_timer;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
// i8021 variables
uint8_t m_p0;
@@ -126,7 +132,7 @@ private:
};
-PALETTE_INIT_MEMBER(microvision_state,microvision)
+void microvision_state::microvision_palette(palette_device &palette) const
{
palette.set_pen_color( 15, 0x00, 0x00, 0x00 );
palette.set_pen_color( 14, 0x11, 0x11, 0x11 );
@@ -134,20 +140,20 @@ PALETTE_INIT_MEMBER(microvision_state,microvision)
palette.set_pen_color( 12, 0x33, 0x33, 0x33 );
palette.set_pen_color( 11, 0x44, 0x44, 0x44 );
palette.set_pen_color( 10, 0x55, 0x55, 0x55 );
- palette.set_pen_color( 9, 0x66, 0x66, 0x66 );
- palette.set_pen_color( 8, 0x77, 0x77, 0x77 );
- palette.set_pen_color( 7, 0x88, 0x88, 0x88 );
- palette.set_pen_color( 6, 0x99, 0x99, 0x99 );
- palette.set_pen_color( 5, 0xaa, 0xaa, 0xaa );
- palette.set_pen_color( 4, 0xbb, 0xbb, 0xbb );
- palette.set_pen_color( 3, 0xcc, 0xcc, 0xcc );
- palette.set_pen_color( 2, 0xdd, 0xdd, 0xdd );
- palette.set_pen_color( 1, 0xee, 0xee, 0xee );
- palette.set_pen_color( 0, 0xff, 0xff, 0xff );
+ palette.set_pen_color( 9, 0x66, 0x66, 0x66 );
+ palette.set_pen_color( 8, 0x77, 0x77, 0x77 );
+ palette.set_pen_color( 7, 0x88, 0x88, 0x88 );
+ palette.set_pen_color( 6, 0x99, 0x99, 0x99 );
+ palette.set_pen_color( 5, 0xaa, 0xaa, 0xaa );
+ palette.set_pen_color( 4, 0xbb, 0xbb, 0xbb );
+ palette.set_pen_color( 3, 0xcc, 0xcc, 0xcc );
+ palette.set_pen_color( 2, 0xdd, 0xdd, 0xdd );
+ palette.set_pen_color( 1, 0xee, 0xee, 0xee );
+ palette.set_pen_color( 0, 0xff, 0xff, 0xff );
}
-MACHINE_START_MEMBER(microvision_state, microvision)
+void microvision_state::machine_start()
{
m_paddle_timer = timer_alloc(TIMER_PADDLE);
@@ -165,20 +171,12 @@ MACHINE_START_MEMBER(microvision_state, microvision)
}
-MACHINE_RESET_MEMBER(microvision_state, microvision)
+void microvision_state::machine_reset()
{
- for (auto & elem : m_lcd_latch)
- {
- elem = 0;
- }
+ std::fill(std::begin(m_lcd_latch), std::end(m_lcd_latch), 0);
- for (auto & elem : m_lcd)
- {
- for (int j = 0; j < 16; j++)
- {
- elem[j] = 0;
- }
- }
+ for (auto &elem : m_lcd)
+ std::fill(std::begin(elem), std::end(elem), 0);
m_o = 0;
m_r = 0;
@@ -224,7 +222,7 @@ void microvision_state::update_lcd()
uint16_t row = ( m_lcd_holding_latch[0] << 12 ) | ( m_lcd_holding_latch[1] << 8 ) | ( m_lcd_holding_latch[2] << 4 ) | m_lcd_holding_latch[3];
uint16_t col = ( m_lcd_holding_latch[4] << 12 ) | ( m_lcd_holding_latch[5] << 8 ) | ( m_lcd_holding_latch[6] << 4 ) | m_lcd_holding_latch[7];
- if (LOG) logerror("row = %04x, col = %04x\n", row, col );
+ LOG( "row = %04x, col = %04x\n", row, col );
for ( int i = 0; i < 16; i++ )
{
uint16_t temp = row;
@@ -341,7 +339,7 @@ void microvision_state::device_timer(emu_timer &timer, device_timer_id id, int p
*/
WRITE8_MEMBER( microvision_state::i8021_p0_write )
{
- if (LOG) logerror( "p0_write: %02x\n", data );
+ LOG( "p0_write: %02x\n", data );
m_p0 = data;
}
@@ -357,7 +355,7 @@ WRITE8_MEMBER( microvision_state::i8021_p0_write )
*/
WRITE8_MEMBER( microvision_state::i8021_p1_write )
{
- if (LOG) logerror( "p1_write: %02x\n", data );
+ LOG( "p1_write: %02x\n", data );
lcd_write( data & 0x03, data >> 4 );
}
@@ -370,7 +368,7 @@ WRITE8_MEMBER( microvision_state::i8021_p1_write )
*/
WRITE8_MEMBER( microvision_state::i8021_p2_write )
{
- if (LOG) logerror( "p2_write: %02x\n", data );
+ LOG( "p2_write: %02x\n", data );
m_p2 = data;
@@ -438,7 +436,7 @@ READ8_MEMBER( microvision_state::tms1100_read_k )
{
uint8_t data = 0;
- if (LOG) logerror("read_k\n");
+ LOG("read_k\n");
if ( m_r & 0x100 )
{
@@ -458,7 +456,7 @@ READ8_MEMBER( microvision_state::tms1100_read_k )
WRITE16_MEMBER( microvision_state::tms1100_write_o )
{
- if (LOG) logerror("write_o: %04x\n", data);
+ LOG("write_o: %04x\n", data);
m_o = data;
@@ -477,7 +475,7 @@ x-- ---- ---- KEY2
*/
WRITE16_MEMBER( microvision_state::tms1100_write_r )
{
- if (LOG) logerror("write_r: %04x\n", data);
+ LOG("write_r: %04x\n", data);
m_r = data;
@@ -654,17 +652,13 @@ MACHINE_CONFIG_START(microvision_state::microvision)
MCFG_SCREEN_VBLANK_TIME(0)
MCFG_QUANTUM_TIME(attotime::from_hz(60))
- MCFG_MACHINE_START_OVERRIDE(microvision_state, microvision )
- MCFG_MACHINE_RESET_OVERRIDE(microvision_state, microvision )
-
MCFG_SCREEN_UPDATE_DRIVER(microvision_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, microvision_state, screen_vblank))
MCFG_SCREEN_SIZE(16, 16)
MCFG_SCREEN_VISIBLE_AREA(0, 15, 0, 15)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(microvision_state,microvision)
+ PALETTE(config, "palette", FUNC(microvision_state::microvision_palette), 16);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/midas.cpp b/src/mame/drivers/midas.cpp
index 02c607cee10..199a91a4c57 100644
--- a/src/mame/drivers/midas.cpp
+++ b/src/mame/drivers/midas.cpp
@@ -65,8 +65,8 @@
class midas_state : public driver_device
{
public:
- midas_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ midas_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
@@ -83,6 +83,11 @@ public:
void init_livequiz();
+protected:
+ virtual void video_start() override;
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_READ16_MEMBER(ret_ffff);
DECLARE_WRITE16_MEMBER(midas_gfxregs_w);
@@ -92,10 +97,6 @@ private:
DECLARE_WRITE16_MEMBER(hammer_motor_w);
DECLARE_WRITE16_MEMBER(midas_eeprom_w);
DECLARE_WRITE16_MEMBER(midas_zoomtable_w);
- virtual void video_start() override;
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
uint32_t screen_update_midas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
@@ -117,8 +118,6 @@ private:
-
-
void midas_state::video_start()
{
}
@@ -649,9 +648,8 @@ MACHINE_CONFIG_START(midas_state::livequiz)
MCFG_DEVICE_ADD("spritegen", NEOGEO_SPRITE_MIDAS, 0)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_midas)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_midas);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x10000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -682,10 +680,8 @@ MACHINE_CONFIG_START(midas_state::hammer)
MCFG_DEVICE_ADD("spritegen", NEOGEO_SPRITE_MIDAS, 0)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_midas)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(XRGB)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_midas);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x10000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/midtunit.cpp b/src/mame/drivers/midtunit.cpp
index f170ad24dca..7bfafb19de8 100644
--- a/src/mame/drivers/midtunit.cpp
+++ b/src/mame/drivers/midtunit.cpp
@@ -611,7 +611,7 @@ void midtunit_state::tunit_core(machine_config &config)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- PALETTE(config, m_palette, 32768).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 32768);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
// from TMS340 registers
diff --git a/src/mame/drivers/midwunit.cpp b/src/mame/drivers/midwunit.cpp
index c3a49753079..0925f6c168a 100644
--- a/src/mame/drivers/midwunit.cpp
+++ b/src/mame/drivers/midwunit.cpp
@@ -641,7 +641,7 @@ void midwunit_state::wunit(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
- PALETTE(config, m_palette, 32768).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 32768);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
// from TMS340 registers
diff --git a/src/mame/drivers/midxunit.cpp b/src/mame/drivers/midxunit.cpp
index 505ee7f0624..700457a87c7 100644
--- a/src/mame/drivers/midxunit.cpp
+++ b/src/mame/drivers/midxunit.cpp
@@ -259,7 +259,7 @@ void midxunit_state::midxunit(machine_config &config)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
- PALETTE(config, m_palette, 32768).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 32768);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(PIXEL_CLOCK, 506, 101, 501, 289, 20, 274);
diff --git a/src/mame/drivers/midyunit.cpp b/src/mame/drivers/midyunit.cpp
index df2382c0027..8a63bfb2fd1 100644
--- a/src/mame/drivers/midyunit.cpp
+++ b/src/mame/drivers/midyunit.cpp
@@ -1181,7 +1181,7 @@ MACHINE_CONFIG_START(midyunit_state::yunit_cvsd_4bit_slow)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(256)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_4bit)
MACHINE_CONFIG_END
@@ -1198,7 +1198,7 @@ MACHINE_CONFIG_START(midyunit_state::yunit_cvsd_4bit_fast)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(256)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_4bit)
MACHINE_CONFIG_END
@@ -1212,7 +1212,7 @@ MACHINE_CONFIG_START(midyunit_state::yunit_cvsd_6bit_slow)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(4096)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit)
MACHINE_CONFIG_END
@@ -1229,7 +1229,7 @@ MACHINE_CONFIG_START(midyunit_state::yunit_adpcm_6bit_fast)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(4096)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit)
MACHINE_CONFIG_END
@@ -1246,7 +1246,7 @@ MACHINE_CONFIG_START(midyunit_state::yunit_adpcm_6bit_faster)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(4096)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,midyunit_6bit)
MACHINE_CONFIG_END
@@ -1272,7 +1272,7 @@ MACHINE_CONFIG_START(midyunit_state::mkyawdim)
MCFG_DEVICE_PROGRAM_MAP(yawdim_sound_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(4096)
MCFG_VIDEO_START_OVERRIDE(midyunit_state,mkyawdim)
diff --git a/src/mame/drivers/midzeus.cpp b/src/mame/drivers/midzeus.cpp
index b9363d648a6..1beb25f7071 100644
--- a/src/mame/drivers/midzeus.cpp
+++ b/src/mame/drivers/midzeus.cpp
@@ -1267,7 +1267,7 @@ MACHINE_CONFIG_START(midzeus_state::midzeus)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
/* video hardware */
- PALETTE(config, "palette", 32768);
+ PALETTE(config, "palette").set_entries(32768);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MIDZEUS_VIDEO_CLOCK / 8, 529, 0, 400, 278, 0, 256);
diff --git a/src/mame/drivers/mikie.cpp b/src/mame/drivers/mikie.cpp
index 020dd4b7c48..3b8c548fdba 100644
--- a/src/mame/drivers/mikie.cpp
+++ b/src/mame/drivers/mikie.cpp
@@ -284,13 +284,11 @@ MACHINE_CONFIG_START(mikie_state::mikie)
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(mikie_state, screen_update_mikie)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mikie_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mikie)
- MCFG_PALETTE_ADD("palette", 16*8*16+16*8*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(mikie_state, mikie)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mikie);
+ PALETTE(config, m_palette, FUNC(mikie_state::mikie_palette), 16*8*16+16*8*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mikro80.cpp b/src/mame/drivers/mikro80.cpp
index ed8246ade0c..71169a78c75 100644
--- a/src/mame/drivers/mikro80.cpp
+++ b/src/mame/drivers/mikro80.cpp
@@ -186,7 +186,7 @@ MACHINE_CONFIG_START(mikro80_state::mikro80)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mikro80)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
SPEAKER(config, "speaker").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "speaker", 0.25);
diff --git a/src/mame/drivers/mikromik.cpp b/src/mame/drivers/mikromik.cpp
index 2aed1708195..5be831c4c2c 100644
--- a/src/mame/drivers/mikromik.cpp
+++ b/src/mame/drivers/mikromik.cpp
@@ -56,12 +56,14 @@
#include "includes/mikromik.h"
#include "softlist.h"
+//#define VERBOSE 1
+#include "logmacro.h"
+
+
//**************************************************************************
// MACROS / CONSTANTS
//**************************************************************************
-#define LOG 0
-
#define MMU_IOEN 0x01
#define MMU_RAMEN 0x02
#define MMU_CE4 0x08
@@ -215,12 +217,12 @@ WRITE8_MEMBER( mm1_state::ls259_w )
switch (offset)
{
case 0: // IC24 A8
- if (LOG) logerror("IC24 A8 %u\n", d);
+ LOG("IC24 A8 %u\n", d);
m_a8 = d;
break;
case 1: // RECALL
- if (LOG) logerror("RECALL %u\n", d);
+ LOG("RECALL %u\n", d);
m_recall = d;
if (d) m_fdc->soft_reset();
break;
@@ -242,12 +244,12 @@ WRITE8_MEMBER( mm1_state::ls259_w )
break;
case 6: // LLEN
- if (LOG) logerror("LLEN %u\n", d);
+ LOG("LLEN %u\n", d);
m_llen = d;
break;
case 7: // MOTOR ON
- if (LOG) logerror("MOTOR %u\n", d);
+ LOG("MOTOR %u\n", d);
m_floppy0->mon_w(!d);
m_floppy1->mon_w(!d);
break;
diff --git a/src/mame/drivers/mikrosha.cpp b/src/mame/drivers/mikrosha.cpp
index fa810323ace..9e67a919dbf 100644
--- a/src/mame/drivers/mikrosha.cpp
+++ b/src/mame/drivers/mikrosha.cpp
@@ -8,7 +8,6 @@
****************************************************************************/
-
#include "emu.h"
#include "includes/radio86.h"
@@ -169,9 +168,8 @@ WRITE_LINE_MEMBER(mikrosha_state::mikrosha_pit_out2)
I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels)
{
- int i;
- const rgb_t *palette = m_palette->palette()->entry_list_raw();
- const uint8_t *charmap = m_charmap + (m_mikrosha_font_page & 1) * 0x400;
+ rgb_t const *const palette = m_palette->palette()->entry_list_raw();
+ uint8_t const *const charmap = &m_charmap[(m_mikrosha_font_page & 1) * 0x400];
uint8_t pixels = charmap[(linecount & 7) + (charcode << 3)] ^ 0xff;
if (vsp) {
pixels = 0;
@@ -182,7 +180,7 @@ I8275_DRAW_CHARACTER_MEMBER(mikrosha_state::display_pixels)
if (rvv) {
pixels ^= 0xff;
}
- for(i=0;i<6;i++) {
+ for(int i=0;i<6;i++) {
bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0];
}
}
@@ -238,9 +236,8 @@ MACHINE_CONFIG_START(mikrosha_state::mikrosha)
MCFG_SCREEN_SIZE(78*6, 30*10)
MCFG_SCREEN_VISIBLE_AREA(0, 78*6-1, 0, 30*10-1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mikrosha)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(mikrosha_state,radio86)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_mikrosha);
+ PALETTE(config, m_palette, FUNC(mikrosha_state::radio86_palette), 3);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/mil4000.cpp b/src/mame/drivers/mil4000.cpp
index b0651448b06..fe28b93c707 100644
--- a/src/mame/drivers/mil4000.cpp
+++ b/src/mame/drivers/mil4000.cpp
@@ -127,15 +127,16 @@
class mil4000_state : public driver_device
{
public:
- mil4000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mil4000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_sc0_vram(*this, "sc0_vram"),
m_sc1_vram(*this, "sc1_vram"),
m_sc2_vram(*this, "sc2_vram"),
m_sc3_vram(*this, "sc3_vram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_lamps(*this, "lamp%u", 0U) { }
+ m_lamps(*this, "lamp%u", 0U)
+ { }
void chewheel(machine_config &config);
void mil4000(machine_config &config);
@@ -576,10 +577,8 @@ MACHINE_CONFIG_START(mil4000_state::mil4000)
MCFG_SCREEN_UPDATE_DRIVER(mil4000_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 0x800)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mil4000)
+ PALETTE(config, "palette", palette_device::BLACK).set_format(palette_device::RGBx_555, 0x800);
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mil4000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1000000, okim6295_device::PIN7_HIGH) // frequency from 1000 kHz resonator. pin 7 high not verified.
diff --git a/src/mame/drivers/miniboy7.cpp b/src/mame/drivers/miniboy7.cpp
index d3a1cd522b6..c72e1e188d5 100644
--- a/src/mame/drivers/miniboy7.cpp
+++ b/src/mame/drivers/miniboy7.cpp
@@ -178,11 +178,11 @@ private:
int get_color_offset(uint8_t tile, uint8_t attr, int ra, int px);
MC6845_UPDATE_ROW(crtc_update_row);
- DECLARE_PALETTE_INIT(miniboy7);
+ void miniboy7_palette(palette_device &palette) const;
void miniboy7_map(address_map &map);
- virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void machine_start() override;
virtual void machine_reset() override;
required_shared_ptr<uint8_t> m_videoram_a;
@@ -256,50 +256,52 @@ MC6845_UPDATE_ROW( miniboy7_state::crtc_update_row )
}
}
-PALETTE_INIT_MEMBER(miniboy7_state, miniboy7)
+void miniboy7_state::miniboy7_palette(palette_device &palette) const
{
-/*
- prom bits
- 7654 3210
- ---- ---x red component?.
- ---- --x- green component?.
- ---- -x-- blue component?.
- ---- x--- intensity?.
- xxxx ---- unused.
-*/
- int i;
+ /*
+ prom bits
+ 7654 3210
+ ---- ---x red component?.
+ ---- --x- green component?.
+ ---- -x-- blue component?.
+ ---- x--- intensity?.
+ xxxx ---- unused.
+ */
/* 0000IBGR */
- if (m_proms == nullptr) return;
+ if (!m_proms)
+ return;
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b, inten, intenmin, intenmax;
-
- intenmin = 0xe0;
-// intenmin = 0xc2;
- intenmax = 0xff;
-
- /* intensity component */
- inten = (m_proms[i] >> 3) & 0x01;
+ int const intenmin = 0xe0;
+// int const intenmin = 0xc2;
+ int const intenmax = 0xff;
- /* red component */
- bit0 = (m_proms[i] >> 0) & 0x01;
- r = (bit0 * intenmin) + (inten * (bit0 * (intenmax - intenmin)));
+ // intensity component
+ int const inten = BIT(m_proms[i], 3);
- /* green component */
- bit1 = (m_proms[i] >> 1) & 0x01;
- g = (bit1 * intenmin) + (inten * (bit1 * (intenmax - intenmin)));
+ // red component
+ int const r = BIT(m_proms[i], 0) * (inten ? intenmax : intenmin);
- /* blue component */
- bit2 = (m_proms[i] >> 2) & 0x01;
- b = (bit2 * intenmin) + (inten * (bit2 * (intenmax - intenmin)));
+ // green component
+ int const g = BIT(m_proms[i], 1) * (inten ? intenmax : intenmin);
+ // blue component
+ int const b = BIT(m_proms[i], 2) * (inten ? intenmax : intenmin);
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
+void miniboy7_state::machine_start()
+{
+ m_lamps.resolve();
+
+ save_item(NAME(m_ay_pb));
+ save_item(NAME(m_gpri));
+}
+
void miniboy7_state::machine_reset()
{
m_ay_pb = 0;
@@ -536,8 +538,7 @@ MACHINE_CONFIG_START(miniboy7_state::miniboy7)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_miniboy7)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(miniboy7_state, miniboy7)
+ PALETTE(config, m_palette, FUNC(miniboy7_state::miniboy7_palette), 256);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK / 12)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/minitel_2_rpic.cpp b/src/mame/drivers/minitel_2_rpic.cpp
index e4bdc694d62..29dfa0b53aa 100644
--- a/src/mame/drivers/minitel_2_rpic.cpp
+++ b/src/mame/drivers/minitel_2_rpic.cpp
@@ -424,7 +424,7 @@ void minitel_state::minitel2(machine_config &config)
screen.set_size(512, 312);
screen.set_visarea(2, 512-10, 0, 278-1);
- PALETTE(config, m_palette, 8+1);
+ PALETTE(config, m_palette).set_entries(8+1);
}
ROM_START( minitel2 )
diff --git a/src/mame/drivers/minivideo.cpp b/src/mame/drivers/minivideo.cpp
index 1447674cd7c..4231a7ab549 100644
--- a/src/mame/drivers/minivideo.cpp
+++ b/src/mame/drivers/minivideo.cpp
@@ -35,8 +35,8 @@ class minivideo_state : public driver_device
{
public:
minivideo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
void minivideo(machine_config &config);
@@ -101,8 +101,7 @@ void minivideo_state::minivideo(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx);
- palette_device& palette(PALETTE(config, "palette", 8));
- palette.set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, "palette", palette_device::RGB_3BIT);
// sound hw?
}
diff --git a/src/mame/drivers/mirage.cpp b/src/mame/drivers/mirage.cpp
index e4de0aa921a..661b70d0ecb 100644
--- a/src/mame/drivers/mirage.cpp
+++ b/src/mame/drivers/mirage.cpp
@@ -54,8 +54,8 @@ MR_01-.3A [a0b758aa]
class miragemj_state : public driver_device
{
public:
- miragemj_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ miragemj_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_deco_tilegen(*this, "tilegen"),
m_eeprom(*this, "eeprom"),
@@ -311,10 +311,8 @@ MACHINE_CONFIG_START(miragemj_state::mirage)
MCFG_SCREEN_UPDATE_DRIVER(miragemj_state, screen_update_mirage)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
-
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mirage)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 1024);
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
diff --git a/src/mame/drivers/mirax.cpp b/src/mame/drivers/mirax.cpp
index daf03bf9933..5a1f0233b93 100644
--- a/src/mame/drivers/mirax.cpp
+++ b/src/mame/drivers/mirax.cpp
@@ -113,8 +113,8 @@ Stephh's notes (based on the games Z80 code and some tests) :
class mirax_state : public driver_device
{
public:
- mirax_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mirax_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_ay(*this, "ay%u", 1),
@@ -123,12 +123,16 @@ public:
m_soundlatch(*this, "soundlatch"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
- m_colorram(*this, "colorram") { }
+ m_colorram(*this, "colorram")
+ { }
void mirax(machine_config &config);
void init_mirax();
+protected:
+ virtual void machine_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -156,8 +160,7 @@ private:
DECLARE_WRITE8_MEMBER(ay1_sel);
DECLARE_WRITE8_MEMBER(ay2_sel);
- DECLARE_PALETTE_INIT(mirax);
- virtual void machine_start() override;
+ void mirax_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t draw_flag);
@@ -169,31 +172,32 @@ private:
};
-PALETTE_INIT_MEMBER(mirax_state, mirax)
+void mirax_state::mirax_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -201,26 +205,24 @@ PALETTE_INIT_MEMBER(mirax_state, mirax)
void mirax_state::draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t draw_flag)
{
gfx_element *gfx = m_gfxdecode->gfx(0);
- int y,x;
- int res_x,res_y,wrapy;
- for (y=0;y<32;y++)
+ for (int y = 0; y < 32; y++)
{
- for (x=0;x<32;x++)
+ for (int x = 0; x < 32; x++)
{
int tile = m_videoram[32*y+x];
int color = (m_colorram[x*2]<<8) | (m_colorram[(x*2)+1]);
int x_scroll = (color & 0xff00)>>8;
tile |= ((color & 0xe0)<<3);
- res_x = (m_flipscreen_x) ? 248-x*8 : x*8;
- res_y = (m_flipscreen_y) ? 248-y*8+x_scroll : y*8-x_scroll;
- wrapy = (m_flipscreen_y) ? -256 : 256;
+ int const res_x = m_flipscreen_x ? (248 - x*8) : (x*8);
+ int const res_y = m_flipscreen_y ? (248 - y*8 + x_scroll) : (y*8 - x_scroll);
+ int const wrapy = m_flipscreen_y ? -256 : 256;
- if((x <= 1 || x >= 30) ^ draw_flag)
+ if ((x <= 1 || x >= 30) ^ draw_flag)
{
gfx->opaque(bitmap,cliprect,tile,color & 7,(m_flipscreen_x),(m_flipscreen_y),res_x,res_y);
- /* wrap-around */
+ // wrap-around
gfx->opaque(bitmap,cliprect,tile,color & 7,(m_flipscreen_x),(m_flipscreen_y),res_x,res_y+wrapy);
}
}
@@ -229,23 +231,21 @@ void mirax_state::draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect,
void mirax_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- for(int count=0;count<0x200;count+=4)
+ for (int count = 0; count < 0x200; count += 4)
{
- int spr_offs,x,y,color,fx,fy;
-
- if(m_spriteram[count] == 0x00 || m_spriteram[count+3] == 0x00)
+ if (!m_spriteram[count] || !m_spriteram[count + 3])
continue;
- spr_offs = (m_spriteram[count+1] & 0x3f);
- color = m_spriteram[count+2] & 0x7;
- fx = (m_flipscreen_x) ^ ((m_spriteram[count+1] & 0x40) >> 6); //<- guess
- fy = (m_flipscreen_y) ^ ((m_spriteram[count+1] & 0x80) >> 7);
-
+ int spr_offs = m_spriteram[count+1] & 0x3f;
spr_offs += (m_spriteram[count+2] & 0xe0)<<1;
spr_offs += (m_spriteram[count+2] & 0x10)<<5;
- y = (m_flipscreen_y) ? m_spriteram[count] : 0x100 - m_spriteram[count] - 16;
- x = (m_flipscreen_x) ? 240 - m_spriteram[count+3] : m_spriteram[count+3];
+ int const color = m_spriteram[count+2] & 0x7;
+ int const fx = m_flipscreen_x ^ BIT(m_spriteram[count + 1], 6); //<- guess
+ int const fy = m_flipscreen_y ^ BIT(m_spriteram[count + 1], 7);
+
+ int const y = m_flipscreen_y ? m_spriteram[count] : 0x100 - m_spriteram[count] - 16;
+ int const x = m_flipscreen_x ? 240 - m_spriteram[count+3] : m_spriteram[count+3];
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,spr_offs,color,fx,fy,x,y,0);
}
@@ -253,9 +253,9 @@ void mirax_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t mirax_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- draw_tilemap(bitmap,cliprect,1);
- draw_sprites(bitmap,cliprect);
- draw_tilemap(bitmap,cliprect,0);
+ draw_tilemap(bitmap, cliprect, 1);
+ draw_sprites(bitmap, cliprect);
+ draw_tilemap(bitmap, cliprect, 0);
return 0;
}
@@ -506,19 +506,17 @@ MACHINE_CONFIG_START(mirax_state::mirax)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mirax_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mirax_state, vblank_irq))
- MCFG_PALETTE_ADD("palette", 0x40)
- MCFG_PALETTE_INIT_OWNER(mirax_state, mirax)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mirax)
+ PALETTE(config, m_palette, FUNC(mirax_state::mirax_palette), 0x40);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mirax);
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
AY8912(config, m_ay[0], 12000000/4).add_route(ALL_OUTPUTS, "mono", 0.80);
-
AY8912(config, m_ay[1], 12000000/4).add_route(ALL_OUTPUTS, "mono", 0.80);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/missb2.cpp b/src/mame/drivers/missb2.cpp
index 93cc408cc0a..ac0f0c529fc 100644
--- a/src/mame/drivers/missb2.cpp
+++ b/src/mame/drivers/missb2.cpp
@@ -41,13 +41,15 @@ public:
void init_missb2();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE8_MEMBER(missb2_bg_bank_w);
DECLARE_WRITE8_MEMBER(missb2_oki_w);
DECLARE_READ8_MEMBER(missb2_oki_r);
DECLARE_WRITE_LINE_MEMBER(irqhandler);
- DECLARE_MACHINE_START(missb2);
- DECLARE_MACHINE_RESET(missb2);
uint32_t screen_update_missb2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void maincpu_map(address_map &map);
@@ -449,18 +451,17 @@ WRITE_LINE_MEMBER(missb2_state::irqhandler)
/* Machine Driver */
-MACHINE_START_MEMBER(missb2_state,missb2)
+void missb2_state::machine_start()
{
- m_gfxdecode->gfx(1)->set_palette(*m_bgpalette);
+ MACHINE_START_CALL_MEMBER(common);
- m_sreset_old = CLEAR_LINE;
- save_item(NAME(m_video_enable));
- save_item(NAME(m_sreset_old));
+ m_gfxdecode->gfx(1)->set_palette(*m_bgpalette);
}
-MACHINE_RESET_MEMBER(missb2_state,missb2)
+void missb2_state::machine_reset()
{
MACHINE_RESET_CALL_MEMBER(common);
+
m_oki->reset();
bublbobl_bankswitch_w(m_maincpu->space(AS_PROGRAM), 0, 0x00, 0xFF); // force a bankswitch write of all zeroes, as /RESET clears the latch
}
@@ -484,9 +485,6 @@ MACHINE_CONFIG_START(missb2_state::missb2)
WATCHDOG_TIMER(config, "watchdog").set_vblank_count("screen", 128);
- MCFG_MACHINE_START_OVERRIDE(missb2_state,missb2)
- MCFG_MACHINE_RESET_OVERRIDE(missb2_state,missb2)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -495,20 +493,14 @@ MACHINE_CONFIG_START(missb2_state::missb2)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(missb2_state, screen_update_missb2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_missb2)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
- MCFG_PALETTE_ADD("bgpalette", 256)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_missb2);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256).set_endianness(ENDIANNESS_BIG);
+ PALETTE(config, m_bgpalette).set_format(palette_device::RGBx_444, 256).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_INPUT_MERGER_ALL_HIGH("soundnmi")
- MCFG_INPUT_MERGER_OUTPUT_HANDLER(INPUTLINE("audiocpu", INPUT_LINE_NMI))
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, m_main_to_sound);
m_main_to_sound->data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<1>));
@@ -525,6 +517,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(missb2_state::bublpong)
missb2(config);
+
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_bublpong)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp
index 0da3bd88a0d..87112ab0d88 100644
--- a/src/mame/drivers/missile.cpp
+++ b/src/mame/drivers/missile.cpp
@@ -1160,7 +1160,7 @@ void missile_state::missile(machine_config &config)
WATCHDOG_TIMER(config, m_watchdog).set_vblank_count(m_screen, 8);
/* video hardware */
- PALETTE(config, m_palette, 8);
+ PALETTE(config, m_palette).set_entries(8);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
diff --git a/src/mame/drivers/mitchell.cpp b/src/mame/drivers/mitchell.cpp
index 1b552d77dd5..79ac84f231f 100644
--- a/src/mame/drivers/mitchell.cpp
+++ b/src/mame/drivers/mitchell.cpp
@@ -1181,12 +1181,11 @@ MACHINE_CONFIG_START(mitchell_state::mgakuen)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(mitchell_state, screen_update_pang)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mgakuen)
- MCFG_PALETTE_ADD("palette", 1024) /* less colors than the others */
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024); // less colors than the others
MCFG_VIDEO_START_OVERRIDE(mitchell_state,pang)
@@ -1222,12 +1221,11 @@ MACHINE_CONFIG_START(mitchell_state::pang)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(mitchell_state, screen_update_pang)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mitchell)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
MCFG_VIDEO_START_OVERRIDE(mitchell_state,pang)
@@ -1341,12 +1339,11 @@ MACHINE_CONFIG_START(mitchell_state::mstworld)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(mitchell_state, screen_update_pang)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mstworld)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
MCFG_VIDEO_START_OVERRIDE(mitchell_state,pang)
@@ -1378,12 +1375,11 @@ MACHINE_CONFIG_START(mitchell_state::marukin)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(mitchell_state, screen_update_pang)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_marukin)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
MCFG_VIDEO_START_OVERRIDE(mitchell_state,pang)
@@ -1433,12 +1429,11 @@ MACHINE_CONFIG_START(mitchell_state::pkladiesbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(mitchell_state, screen_update_pang)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pkladiesbl)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 2048);
MCFG_VIDEO_START_OVERRIDE(mitchell_state,pang)
diff --git a/src/mame/drivers/mjkjidai.cpp b/src/mame/drivers/mjkjidai.cpp
index 53003806a13..8470d46d095 100644
--- a/src/mame/drivers/mjkjidai.cpp
+++ b/src/mame/drivers/mjkjidai.cpp
@@ -327,7 +327,7 @@ MACHINE_CONFIG_START(mjkjidai_state::mjkjidai)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mjkjidai_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mjkjidai)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x100)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mjsister.cpp b/src/mame/drivers/mjsister.cpp
index e0c458636fc..c150358cc9a 100644
--- a/src/mame/drivers/mjsister.cpp
+++ b/src/mame/drivers/mjsister.cpp
@@ -25,13 +25,14 @@
class mjsister_state : public driver_device
{
public:
- mjsister_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mjsister_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_mainlatch(*this, "mainlatch%u", 1),
m_palette(*this, "palette"),
m_dac(*this, "dac"),
- m_rombank(*this, "bank1") { }
+ m_rombank(*this, "bank1")
+ { }
void mjsister(machine_config &config);
@@ -522,9 +523,9 @@ MACHINE_CONFIG_START(mjsister_state::mjsister)
MCFG_SCREEN_SIZE(256+4, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 255+4, 8, 247)
MCFG_SCREEN_UPDATE_DRIVER(mjsister_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
diff --git a/src/mame/drivers/mk85.cpp b/src/mame/drivers/mk85.cpp
index 54aa9cfa102..55d5e71bc08 100644
--- a/src/mame/drivers/mk85.cpp
+++ b/src/mame/drivers/mk85.cpp
@@ -89,7 +89,7 @@ void mk85_state::mk85(machine_config &config)
screen.set_screen_update(FUNC(mk85_state::screen_update_mk85));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/mk90.cpp b/src/mame/drivers/mk90.cpp
index 776f2268281..68d835d4f08 100644
--- a/src/mame/drivers/mk90.cpp
+++ b/src/mame/drivers/mk90.cpp
@@ -26,8 +26,9 @@ class mk90_state : public driver_device
{
public:
mk90_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
- m_maincpu(*this, "maincpu") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ { }
void mk90(machine_config &config);
@@ -92,7 +93,7 @@ void mk90_state::mk90(machine_config &config)
screen.set_screen_update(FUNC(mk90_state::screen_update_mk90));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/mlanding.cpp b/src/mame/drivers/mlanding.cpp
index 83f551b399d..0326639fbfd 100644
--- a/src/mame/drivers/mlanding.cpp
+++ b/src/mame/drivers/mlanding.cpp
@@ -100,6 +100,7 @@ public:
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
private:
@@ -108,7 +109,7 @@ private:
TIMER_DMA_COMPLETE
};
- static const uint32_t c_dma_bank_words = 0x2000;
+ static constexpr uint32_t c_dma_bank_words = 0x2000;
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
@@ -980,7 +981,7 @@ void mlanding_state::mlanding(machine_config &config)
screen.set_screen_update(FUNC(mlanding_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 32768).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 32768);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mmagic.cpp b/src/mame/drivers/mmagic.cpp
index d5dd9491fd5..1dc4bc13657 100644
--- a/src/mame/drivers/mmagic.cpp
+++ b/src/mame/drivers/mmagic.cpp
@@ -69,8 +69,8 @@
class mmagic_state : public driver_device
{
public:
- mmagic_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mmagic_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
@@ -82,7 +82,7 @@ public:
m_ball_y(0x00),
m_color(0x00),
m_audio(0x00)
- {}
+ { }
void mmagic(machine_config &config);
@@ -318,8 +318,7 @@ void mmagic_state::mmagic(machine_config &config)
m_screen->set_raw(6.144_MHz_XTAL, 384, 0, 256, 264, 0, 192);
m_screen->set_screen_update(FUNC(mmagic_state::screen_update));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/model1.cpp b/src/mame/drivers/model1.cpp
index 4ef24124c2c..ce2ddeb1042 100644
--- a/src/mame/drivers/model1.cpp
+++ b/src/mame/drivers/model1.cpp
@@ -1709,8 +1709,7 @@ MACHINE_CONFIG_START(model1_state::model1)
MCFG_SCREEN_UPDATE_DRIVER(model1_state, screen_update_model1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, model1_state, screen_vblank_model1))
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 8192);
SEGAM1AUDIO(config, m_m1audio, 0);
m_m1audio->rxd_handler().set(m_m1uart, FUNC(i8251_device::write_rxd));
diff --git a/src/mame/drivers/model2.cpp b/src/mame/drivers/model2.cpp
index 37298b9b9d4..2ef11e43ab9 100644
--- a/src/mame/drivers/model2.cpp
+++ b/src/mame/drivers/model2.cpp
@@ -2444,7 +2444,7 @@ void model2_state::model2_screen(machine_config &config)
m_screen->set_raw(VIDEO_CLOCK/2, 656, 0/*+69*/, 496/*+69*/, 424, 0/*+25*/, 384/*+25*/);
m_screen->set_screen_update(FUNC(model2_state::screen_update_model2));
- PALETTE(config, m_palette, 8192);
+ PALETTE(config, m_palette).set_entries(8192);
}
void model2_state::model2_scsp(machine_config &config)
diff --git a/src/mame/drivers/model3.cpp b/src/mame/drivers/model3.cpp
index e856f29449f..6d91183246e 100644
--- a/src/mame/drivers/model3.cpp
+++ b/src/mame/drivers/model3.cpp
@@ -6036,8 +6036,7 @@ void model3_state::add_base_devices(machine_config &config)
m_screen->set_size(512, 400);
m_screen->set_screen_update(FUNC(model3_state::screen_update_model3));
- PALETTE(config, m_palette, 32768);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGBBBBB));
+ PALETTE(config, m_palette, palette_device::RGB_555);
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
diff --git a/src/mame/drivers/modellot.cpp b/src/mame/drivers/modellot.cpp
index 365d41e9464..c87ed0f9719 100644
--- a/src/mame/drivers/modellot.cpp
+++ b/src/mame/drivers/modellot.cpp
@@ -194,7 +194,7 @@ MACHINE_CONFIG_START(modellot_state::modellot)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_modellot)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Devices */
generic_keyboard_device &keyboard(GENERIC_KEYBOARD(config, "keyboard", 0));
diff --git a/src/mame/drivers/mogura.cpp b/src/mame/drivers/mogura.cpp
index 2a645e90c24..d2e4acbc668 100644
--- a/src/mame/drivers/mogura.cpp
+++ b/src/mame/drivers/mogura.cpp
@@ -16,8 +16,8 @@
class mogura_state : public driver_device
{
public:
- mogura_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mogura_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ldac(*this, "ldac"),
m_rdac(*this, "rdac"),
@@ -43,42 +43,40 @@ private:
TILE_GET_INFO_MEMBER(get_mogura_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(mogura);
+ void mogura_palette(palette_device &palette) const;
uint32_t screen_update_mogura(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mogura_io_map(address_map &map);
void mogura_map(address_map &map);
};
-PALETTE_INIT_MEMBER(mogura_state, mogura)
+void mogura_state::mogura_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, j;
-
- j = 0;
- for (i = 0; i < 0x20; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0, j = 0; i < 0x20; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(j, rgb_t(r, g, b));
j += 4;
- if (j > 31) j -= 31;
+ if (j > 31)
+ j -= 31;
}
}
@@ -227,9 +225,8 @@ MACHINE_CONFIG_START(mogura_state::mogura)
MCFG_SCREEN_UPDATE_DRIVER(mogura_state, screen_update_mogura)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mogura)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(mogura_state, mogura)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mogura);
+ PALETTE(config, "palette", FUNC(mogura_state::mogura_palette), 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/mole.cpp b/src/mame/drivers/mole.cpp
index 7b59ff49056..bf8ddf93453 100644
--- a/src/mame/drivers/mole.cpp
+++ b/src/mame/drivers/mole.cpp
@@ -60,8 +60,8 @@
class mole_state : public driver_device
{
public:
- mole_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mole_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode")
{ }
@@ -340,7 +340,7 @@ MACHINE_CONFIG_START(mole_state::mole)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mole)
- MCFG_PALETTE_ADD_3BIT_RBG("palette")
+ PALETTE(config, "palette", palette_device::RBG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/molecular.cpp b/src/mame/drivers/molecular.cpp
index 0a464b99c01..fafed97a8b9 100644
--- a/src/mame/drivers/molecular.cpp
+++ b/src/mame/drivers/molecular.cpp
@@ -63,23 +63,30 @@ class molecula_state : public driver_device
{
public:
molecula_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_filecpu(*this, "filecpu")
+ : driver_device(mconfig, type, tag)
+ , m_filecpu(*this, "filecpu")
{ }
void molecula(machine_config &config);
+protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
// devices
required_device<cpu_device> m_filecpu;
- // screen updates
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
-
uint8_t *m_file_rom;
uint8_t *m_app_rom;
std::unique_ptr<uint8_t[]> m_file_ram;
std::unique_ptr<uint8_t[]> m_app_ram;
+
+ // screen updates
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
DECLARE_READ8_MEMBER(file_r);
DECLARE_WRITE8_MEMBER(file_w);
@@ -95,18 +102,12 @@ private:
uint8_t app_ram_enable;
uint8_t file_ram_enable;
- DECLARE_PALETTE_INIT(molecula);
+ void molecula_palette(palette_device &palette) const;
void molecula_app_io(address_map &map);
void molecula_app_map(address_map &map);
void molecula_file_io(address_map &map);
void molecula_file_map(address_map &map);
-
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void video_start() override;
};
void molecula_state::video_start()
@@ -292,7 +293,7 @@ void molecula_state::machine_reset()
}
-PALETTE_INIT_MEMBER(molecula_state, molecula)
+void molecula_state::molecula_palette(palette_device &palette) const
{
}
@@ -324,8 +325,7 @@ MACHINE_CONFIG_START(molecula_state::molecula)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_molecula)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(molecula_state, molecula)
+ PALETTE(config, "palette", FUNC(molecula_state::molecula_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/momoko.cpp b/src/mame/drivers/momoko.cpp
index ce9fdd74539..c3aea29e4e9 100644
--- a/src/mame/drivers/momoko.cpp
+++ b/src/mame/drivers/momoko.cpp
@@ -274,12 +274,11 @@ MACHINE_CONFIG_START(momoko_state::momoko)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 2*8, 29*8-1)
MCFG_SCREEN_UPDATE_DRIVER(momoko_state, screen_update_momoko)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_momoko)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_momoko);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 512);
+ m_palette->set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/monzagp.cpp b/src/mame/drivers/monzagp.cpp
index d181f85c513..43c4d2dfea0 100644
--- a/src/mame/drivers/monzagp.cpp
+++ b/src/mame/drivers/monzagp.cpp
@@ -43,8 +43,8 @@ Lower board (MGP_01):
class monzagp_state : public driver_device
{
public:
- monzagp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ monzagp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_crtc(*this, "crtc"),
m_gfxdecode(*this, "gfxdecode"),
@@ -60,20 +60,26 @@ public:
m_in1(*this, "IN1"),
m_dsw(*this, "DSW"),
m_digits(*this, "digit%u%u", 0U, 0U)
- { }
+ { }
void monzagp(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
DECLARE_READ8_MEMBER(port_r);
DECLARE_WRITE8_MEMBER(port_w);
DECLARE_WRITE8_MEMBER(port1_w);
DECLARE_WRITE8_MEMBER(port2_w);
DECLARE_READ8_MEMBER(port2_r);
- virtual void machine_start() override;
TIMER_DEVICE_CALLBACK_MEMBER(time_tick_timer);
- DECLARE_PALETTE_INIT(monzagp);
+ void monzagp_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
+ void monzagp_io(address_map &map);
+ void monzagp_map(address_map &map);
+
required_device<i8035_device> m_maincpu;
required_device<dp8350_device> m_crtc;
required_device<gfxdecode_device> m_gfxdecode;
@@ -90,9 +96,6 @@ private:
required_ioport m_dsw;
output_finder<4, 7> m_digits;
- void monzagp_io(address_map &map);
- void monzagp_map(address_map &map);
-
uint8_t m_p1;
uint8_t m_p2;
uint8_t m_video_ctrl[2][8];
@@ -111,14 +114,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(monzagp_state::time_tick_timer)
m_time_tick = !m_time_tick;
}
-PALETTE_INIT_MEMBER(monzagp_state, monzagp)
+void monzagp_state::monzagp_palette(palette_device &palette) const
{
- static const int r_resistances[3] = { 220, 1000, 3300 };
- static const int g_resistances[3] = { 100, 470 , 1500 };
- static const int b_resistances[3] = { 100, 470 , 1500 };
- double rweights[3], gweights[3], bweights[3];
+ static constexpr int r_resistances[3] = { 220, 1000, 3300 };
+ static constexpr int g_resistances[3] = { 100, 470 , 1500 };
+ static constexpr int b_resistances[3] = { 100, 470 , 1500 };
// compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[3];
compute_resistor_weights(0, 255, -1.0,
3, &r_resistances[0], rweights, 0, 0,
3, &g_resistances[0], gweights, 0, 0,
@@ -126,9 +129,9 @@ PALETTE_INIT_MEMBER(monzagp_state, monzagp)
for (int i = 0; i < 0x100; i++)
{
- int bit0 = 0, bit1 = 0, bit2 = 0;
- uint8_t d = m_proms->base()[0x400 + i] ^ 0x0f;
+ uint8_t const d = m_proms->base()[0x400 + i] ^ 0x0f;
+ int bit0 = 0, bit1 = 0, bit2 = 0;
if (d & 0x08)
{
bit1 = BIT(i, 0);
@@ -136,16 +139,16 @@ PALETTE_INIT_MEMBER(monzagp_state, monzagp)
}
// red component
- bit0 = (d >> 2) & 0x01;
- int r = combine_3_weights(rweights, bit0, bit1, bit2);
+ bit0 = BIT(d, 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
// green component
- bit0 = (d >> 1) & 0x01;
- int g = combine_3_weights(gweights, bit0, bit1, bit2);
+ bit0 = BIT(d, 1);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
// blue component
- bit0 = (d >> 0) & 0x01;
- int b = combine_3_weights(bweights, bit0, bit1, bit2);
+ bit0 = BIT(d, 0);
+ int const b = combine_3_weights(bweights, bit0, bit1, bit2);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -520,9 +523,8 @@ MACHINE_CONFIG_START(monzagp_state::monzagp)
m_crtc->refresh_control(0);
m_crtc->vsync_callback().set_inputline(m_maincpu, MCS48_INPUT_IRQ).invert(); // active low; no inverter should be needed
- PALETTE(config, m_palette, 0x200).set_init(FUNC(monzagp_state::palette_init_monzagp));
-
- GFXDECODE(config, "gfxdecode", "palette", gfx_monzagp);
+ PALETTE(config, m_palette, FUNC(monzagp_state::monzagp_palette), 0x200);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_monzagp);
MCFG_TIMER_DRIVER_ADD_PERIODIC("time_tick_timer", monzagp_state, time_tick_timer, attotime::from_hz(4))
diff --git a/src/mame/drivers/moo.cpp b/src/mame/drivers/moo.cpp
index 5fa487908f0..f2ea25096f8 100644
--- a/src/mame/drivers/moo.cpp
+++ b/src/mame/drivers/moo.cpp
@@ -521,10 +521,9 @@ MACHINE_CONFIG_START(moo_state::moo)
MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1)
MCFG_SCREEN_UPDATE_DRIVER(moo_state, screen_update_moo)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XRGB)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_ENABLE_HILIGHTS()
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 2048);
+ m_palette->enable_shadows();
+ m_palette->enable_hilights();
MCFG_VIDEO_START_OVERRIDE(moo_state,moo)
@@ -576,10 +575,9 @@ MACHINE_CONFIG_START(moo_state::moobl)
MCFG_SCREEN_VISIBLE_AREA(40, 40+384-1, 16, 16+224-1)
MCFG_SCREEN_UPDATE_DRIVER(moo_state, screen_update_moo)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(XRGB)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_ENABLE_HILIGHTS()
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 2048);
+ m_palette->enable_shadows();
+ m_palette->enable_hilights();
MCFG_VIDEO_START_OVERRIDE(moo_state,moo)
@@ -617,11 +615,7 @@ MACHINE_CONFIG_START(moo_state::bucky)
m_k053246->set_config("gfx2", NORMAL_PLANE_ORDER, -48, 23);
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(4096)
- MCFG_PALETTE_FORMAT(XRGB)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_ENABLE_HILIGHTS()
+ m_palette->set_format(palette_device::xRGB_888, 4096);
MCFG_VIDEO_START_OVERRIDE(moo_state,bucky)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/mosaic.cpp b/src/mame/drivers/mosaic.cpp
index 58af0266ad7..37cabb24b2d 100644
--- a/src/mame/drivers/mosaic.cpp
+++ b/src/mame/drivers/mosaic.cpp
@@ -295,9 +295,8 @@ MACHINE_CONFIG_START(mosaic_state::mosaic)
MCFG_SCREEN_UPDATE_DRIVER(mosaic_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mosaic)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mosaic);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 256);
/* sound hardware */
@@ -310,6 +309,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(mosaic_state::gfire2)
mosaic(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(gfire2_map)
MCFG_DEVICE_IO_MAP(gfire2_io_map)
diff --git a/src/mame/drivers/mouser.cpp b/src/mame/drivers/mouser.cpp
index 253fd39f026..4dd9341441c 100644
--- a/src/mame/drivers/mouser.cpp
+++ b/src/mame/drivers/mouser.cpp
@@ -216,18 +216,16 @@ MACHINE_CONFIG_START(mouser_state::mouser)
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(mouser_state, screen_update_mouser)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mouser_state, mouser_nmi_interrupt))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mouser)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(mouser_state, mouser)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mouser);
+ PALETTE(config, m_palette, FUNC(mouser_state::mouser_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
AY8910(config, "ay1", 4000000/2).add_route(ALL_OUTPUTS, "mono", 0.50);
-
AY8910(config, "ay2", 4000000/2).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/mpc3000.cpp b/src/mame/drivers/mpc3000.cpp
index 41db7183a7d..799ee2b5c94 100644
--- a/src/mame/drivers/mpc3000.cpp
+++ b/src/mame/drivers/mpc3000.cpp
@@ -105,7 +105,7 @@ private:
DECLARE_WRITE16_MEMBER(dsp_0008_hack_w);
DECLARE_READ16_MEMBER(dma_memr_cb);
DECLARE_WRITE16_MEMBER(dma_memw_cb);
- DECLARE_PALETTE_INIT(mpc3000);
+ void mpc3000_palette(palette_device &palette) const;
};
void mpc3000_state::machine_start()
@@ -168,7 +168,7 @@ WRITE16_MEMBER(mpc3000_state::dma_memw_cb)
m_maincpu->space(AS_PROGRAM).write_word(offset, data);
}
-PALETTE_INIT_MEMBER(mpc3000_state, mpc3000)
+void mpc3000_state::mpc3000_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -213,8 +213,7 @@ void mpc3000_state::mpc3000(machine_config &config)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(mpc3000_state, mpc3000)
+ PALETTE(config, "palette", FUNC(mpc3000_state::mpc3000_palette), 2);
UPD72065(config, m_fdc, 16_MHz_XTAL, true, true); // clocked by V53 CLKOUT (TODO: upd72068 supports motor control)
//m_fdc->intrq_wr_callback().set(m_maincpu, FUNC(v53a_device::ir?_w));
diff --git a/src/mame/drivers/mpu12wbk.cpp b/src/mame/drivers/mpu12wbk.cpp
index 9e33d4a0779..f1e22b2bf43 100644
--- a/src/mame/drivers/mpu12wbk.cpp
+++ b/src/mame/drivers/mpu12wbk.cpp
@@ -221,29 +221,33 @@
class mpu12wbk_state : public driver_device
{
public:
- mpu12wbk_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mpu12wbk_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void mpu12wbk(machine_config &config);
void init_mpu12wbk();
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(mpu12wbk_videoram_w);
DECLARE_WRITE8_MEMBER(mpu12wbk_colorram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(mpu12wbk);
+ void mpu12wbk_palette(palette_device &palette) const;
uint32_t screen_update_mpu12wbk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
void mpu12wbk_map(address_map &map);
};
@@ -296,7 +300,7 @@ uint32_t mpu12wbk_state::screen_update_mpu12wbk(screen_device &screen, bitmap_in
}
-PALETTE_INIT_MEMBER(mpu12wbk_state, mpu12wbk)
+void mpu12wbk_state::mpu12wbk_palette(palette_device &palette) const
{
}
@@ -507,9 +511,8 @@ MACHINE_CONFIG_START(mpu12wbk_state::mpu12wbk)
MCFG_SCREEN_UPDATE_DRIVER(mpu12wbk_state, screen_update_mpu12wbk)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mpu12wbk)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(mpu12wbk_state, mpu12wbk)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_mpu12wbk);
+ PALETTE(config, "palette", FUNC(mpu12wbk_state::mpu12wbk_palette), 512);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/4)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/mpu4dealem.cpp b/src/mame/drivers/mpu4dealem.cpp
index fe416263410..0b599667a2e 100644
--- a/src/mame/drivers/mpu4dealem.cpp
+++ b/src/mame/drivers/mpu4dealem.cpp
@@ -38,7 +38,7 @@ public:
private:
optional_shared_ptr<uint8_t> m_dealem_videoram;
DECLARE_MACHINE_RESET(dealem_vid);
- DECLARE_PALETTE_INIT(dealem);
+ void dealem_palette(palette_device &palette) const;
uint32_t screen_update_dealem(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(dealem_vsync_changed);
required_device<gfxdecode_device> m_gfxdecode;
@@ -86,40 +86,39 @@ GFXDECODE_END
***************************************************************************/
-PALETTE_INIT_MEMBER(mpu4dealem_state,dealem)
+void mpu4dealem_state::dealem_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, len;
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 1000, 0,
3, resistances_rg, weights_g, 1000, 0,
2, resistances_b, weights_b, 1000, 0);
- len = memregion("proms")->bytes();
- for (i = 0; i < len; i++)
+ uint8_t const *color_prom = memregion("proms")->base();
+ unsigned const len = memregion("proms")->bytes();
+ for (int i = 0; i < len; i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0, bit1, bit2;
/* red component */
- bit0 = BIT(*color_prom,0);
- bit1 = BIT(*color_prom,1);
- bit2 = BIT(*color_prom,2);
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
/* green component */
- bit0 = BIT(*color_prom,3);
- bit1 = BIT(*color_prom,4);
- bit2 = BIT(*color_prom,5);
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
/* blue component */
- bit0 = BIT(*color_prom,6);
- bit1 = BIT(*color_prom,7);
- b = combine_2_weights(weights_b, bit0, bit1);
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
@@ -127,19 +126,16 @@ PALETTE_INIT_MEMBER(mpu4dealem_state,dealem)
uint32_t mpu4dealem_state::screen_update_dealem(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x,y;
int count = 0;
-
- for (y = 0; y < 32; y++)
+ for (int y = 0; y < 32; y++)
{
- for (x = 0; x < 40; x++)
+ for (int x = 0; x < 40; x++)
{
- int tile = m_dealem_videoram[count + 0x1000] | (m_dealem_videoram[count] << 8);
+ int const tile = m_dealem_videoram[count + 0x1000] | (m_dealem_videoram[count] << 8);
count++;
- m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,tile,0,0,0,x * 8,y * 8);
+ m_gfxdecode->gfx(0)->opaque(bitmap, cliprect, tile, 0, 0, 0, x * 8, y * 8);
}
}
-
return 0;
}
@@ -227,8 +223,7 @@ MACHINE_CONFIG_START(mpu4dealem_state::dealem)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dealem)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(mpu4dealem_state,dealem)
+ PALETTE(config, "palette", FUNC(mpu4dealem_state::dealem_palette), 32);
hd6845_device &crtc(HD6845(config, "crtc", MPU4_MASTER_CLOCK / 4 / 8)); /* HD68B45 */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/mpu4vid.cpp b/src/mame/drivers/mpu4vid.cpp
index 6c7db86d86f..38311f62c20 100644
--- a/src/mame/drivers/mpu4vid.cpp
+++ b/src/mame/drivers/mpu4vid.cpp
@@ -1309,7 +1309,7 @@ void mpu4vid_state::mpu4_vid(machine_config &config)
MCFG_MACHINE_RESET_OVERRIDE(mpu4vid_state,mpu4_vid)
MCFG_VIDEO_START_OVERRIDE (mpu4vid_state,mpu4_vid)
- PALETTE(config, m_palette, ef9369_device::NUMCOLORS);
+ PALETTE(config, m_palette).set_entries(ef9369_device::NUMCOLORS);
EF9369(config, "ef9369").set_color_update_callback(FUNC(mpu4vid_state::ef9369_color_update));
diff --git a/src/mame/drivers/mquake.cpp b/src/mame/drivers/mquake.cpp
index d37ff7c5813..1fdf926f4bb 100644
--- a/src/mame/drivers/mquake.cpp
+++ b/src/mame/drivers/mquake.cpp
@@ -47,8 +47,8 @@
class mquake_state : public amiga_state
{
public:
- mquake_state(const machine_config &mconfig, device_type type, const char *tag)
- : amiga_state(mconfig, type, tag),
+ mquake_state(const machine_config &mconfig, device_type type, const char *tag) :
+ amiga_state(mconfig, type, tag),
m_es5503(*this, "es5503"),
m_es5503_rom(*this, "es5503")
{ }
@@ -326,8 +326,7 @@ void mquake_state::mquake(machine_config &config)
/* video hardware */
ntsc_video(config);
- PALETTE(config, m_palette, 4096);
- m_palette->set_init(FUNC(mquake_state::palette_init_amiga));
+ PALETTE(config, m_palette, FUNC(mquake_state::amiga_palette), 4096);
MCFG_VIDEO_START_OVERRIDE(mquake_state,amiga)
diff --git a/src/mame/drivers/mrdo.cpp b/src/mame/drivers/mrdo.cpp
index 6f579ffc6db..7a26840f18c 100644
--- a/src/mame/drivers/mrdo.cpp
+++ b/src/mame/drivers/mrdo.cpp
@@ -30,8 +30,12 @@ There's a chance that certain bootlegs might have the different 8/20 MHz XTALS.
#include "speaker.h"
-#define MAIN_CLOCK XTAL(8'200'000)
-#define VIDEO_CLOCK XTAL(19'600'000)
+namespace {
+
+constexpr XTAL MAIN_CLOCK = 8.2_MHz_XTAL;
+constexpr XTAL VIDEO_CLOCK = 19.6_MHz_XTAL;
+
+} // anonymous namespace
@@ -182,12 +186,10 @@ MACHINE_CONFIG_START(mrdo_state::mrdo)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(VIDEO_CLOCK/4, 312, 8, 248, 262, 32, 224)
MCFG_SCREEN_UPDATE_DRIVER(mrdo_state, screen_update_mrdo)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mrdo)
- MCFG_PALETTE_ADD("palette", 64*4+16*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(mrdo_state, mrdo)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrdo);
+ PALETTE(config, m_palette, FUNC(mrdo_state::mrdo_palette), 64*4 + 16*4, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mrflea.cpp b/src/mame/drivers/mrflea.cpp
index 7e0de9fc710..b7f5f795d2d 100644
--- a/src/mame/drivers/mrflea.cpp
+++ b/src/mame/drivers/mrflea.cpp
@@ -293,10 +293,8 @@ MACHINE_CONFIG_START(mrflea_state::mrflea)
MCFG_SCREEN_UPDATE_DRIVER(mrflea_state, screen_update_mrflea)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mrflea)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrflea);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mrgame.cpp b/src/mame/drivers/mrgame.cpp
index 8a358f08e40..e966ad5c383 100644
--- a/src/mame/drivers/mrgame.cpp
+++ b/src/mame/drivers/mrgame.cpp
@@ -72,8 +72,12 @@ public:
void init_mrgame();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
- DECLARE_PALETTE_INIT(mrgame);
+ void mrgame_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(ack1_w);
DECLARE_WRITE8_MEMBER(ack2_w);
DECLARE_WRITE8_MEMBER(portb_w);
@@ -105,9 +109,6 @@ private:
void video_map(address_map &map);
void wcup90_video_map(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
std::unique_ptr<bitmap_ind16> m_tile_bitmap;
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_p_videoram;
@@ -446,41 +447,42 @@ static GFXDECODE_START(gfx_mrgame)
GFXDECODE_ENTRY("chargen", 0, spritelayout, 0, 16)
GFXDECODE_END
-PALETTE_INIT_MEMBER(mrgame_state, mrgame)
+void mrgame_state::mrgame_palette(palette_device &palette) const
{
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- uint8_t i, bit0, bit1, bit2, r, g, b;
- const uint8_t *color_prom = machine().root_device().memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
+ uint8_t const *const color_prom = machine().root_device().memregion("proms")->base();
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 0, 0,
3, &resistances[0], gweights, 0, 0,
2, &resistances[1], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 32; i++)
+ // create a lookup table for the palette
+ for (uint8_t i = 0; i < 32; i++)
{
- /* red component */
+ uint8_t bit0, bit1, bit2;
+
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ uint8_t const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ uint8_t const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = combine_2_weights(bweights, bit0, bit1);
+ uint8_t const b = combine_2_weights(bweights, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
- palette.set_pen_color(i+32, rgb_t(r, g, b));
+ palette.set_pen_color(i + 32, rgb_t(r, g, b));
}
}
@@ -572,7 +574,7 @@ void mrgame_state::mrgame(machine_config &config)
screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(mrgame_state::vblank_nmi_w));
- PALETTE(config, m_palette, 64).set_init(FUNC(mrgame_state::palette_init_mrgame));
+ PALETTE(config, m_palette, FUNC(mrgame_state::mrgame_palette), 64);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrgame);
diff --git a/src/mame/drivers/mrjong.cpp b/src/mame/drivers/mrjong.cpp
index 1342c1c9d49..f0cafad98c4 100644
--- a/src/mame/drivers/mrjong.cpp
+++ b/src/mame/drivers/mrjong.cpp
@@ -199,22 +199,16 @@ MACHINE_CONFIG_START(mrjong_state::mrjong)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 30*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mrjong_state, screen_update_mrjong)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mrjong)
- MCFG_PALETTE_ADD("palette", 4*32)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(mrjong_state, mrjong)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mrjong);
+ PALETTE(config, m_palette, FUNC(mrjong_state::mrjong_palette), 4 * 32, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
-
- MCFG_DEVICE_ADD("sn1", SN76489, 15468000/6)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn2", SN76489, 15468000/6)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ SN76489(config, "sn1", 15468000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76489(config, "sn2", 15468000 / 6).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ms0515.cpp b/src/mame/drivers/ms0515.cpp
index dcd7ceb96a5..3d2de87af00 100644
--- a/src/mame/drivers/ms0515.cpp
+++ b/src/mame/drivers/ms0515.cpp
@@ -81,8 +81,11 @@ public:
void ms0515(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+
private:
- DECLARE_PALETTE_INIT(ms0515);
+ void ms0515_palette(palette_device &palette) const;
uint32_t screen_update_ms0515(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
@@ -109,8 +112,6 @@ private:
void ms0515_mem(address_map &map);
- virtual void machine_reset() override;
-
void irq_encoder(int irq, int state);
required_device<t11_device> m_maincpu; // actual CPU is T11 clone, KR1807VM1
@@ -444,7 +445,7 @@ WRITE_LINE_MEMBER(ms0515_state::screen_vblank)
irq11_w(state ? ASSERT_LINE : CLEAR_LINE);
}
-PALETTE_INIT_MEMBER(ms0515_state, ms0515)
+void ms0515_state::ms0515_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0, 0, 0));
palette.set_pen_color(1, rgb_t(0, 0, 127));
@@ -536,8 +537,7 @@ MACHINE_CONFIG_START(ms0515_state::ms0515)
MCFG_SCREEN_PALETTE("palette")
config.set_default_layout(layout_ms0515);
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(ms0515_state, ms0515)
+ PALETTE(config, "palette", FUNC(ms0515_state::ms0515_palette), 16);
KR1818VG93(config, m_fdc, 1000000);
MCFG_FLOPPY_DRIVE_ADD("vg93:0", ms0515_floppies, "525qd", ms0515_state::floppy_formats)
diff --git a/src/mame/drivers/ms6102.cpp b/src/mame/drivers/ms6102.cpp
index 0753718cfea..81014c88938 100644
--- a/src/mame/drivers/ms6102.cpp
+++ b/src/mame/drivers/ms6102.cpp
@@ -323,7 +323,7 @@ void ms6102_state::ms6102(machine_config &config)
m_screen->set_raw(XTAL(16'400'000), 784, 0, 80*8, 375, 0, 25*12);
GFXDECODE(config, "gfxdecode", m_palette, gfx_ms6102);
- PALETTE(config, m_palette, 3).set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
I8257(config, m_dma8257, XTAL(18'432'000) / 9);
m_dma8257->out_hrq_cb().set(FUNC(ms6102_state::hrq_w));
diff --git a/src/mame/drivers/msisaac.cpp b/src/mame/drivers/msisaac.cpp
index 0fa86c5eff6..6aeb46add8f 100644
--- a/src/mame/drivers/msisaac.cpp
+++ b/src/mame/drivers/msisaac.cpp
@@ -472,8 +472,7 @@ void msisaac_state::msisaac(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msisaac);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xxxxRRRRGGGGBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mstation.cpp b/src/mame/drivers/mstation.cpp
index ac763f03fce..767fcbcc163 100644
--- a/src/mame/drivers/mstation.cpp
+++ b/src/mame/drivers/mstation.cpp
@@ -53,6 +53,10 @@ public:
void mstation(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
@@ -94,10 +98,8 @@ private:
DECLARE_WRITE_LINE_MEMBER( rtc_irq );
- virtual void machine_start() override;
- virtual void machine_reset() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(mstation);
+ void mstation_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(mstation_1hz_timer);
TIMER_DEVICE_CALLBACK_MEMBER(mstation_kb_timer);
void mstation_banked_map(address_map &map);
@@ -437,7 +439,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mstation_state::mstation_kb_timer)
refresh_ints();
}
-PALETTE_INIT_MEMBER(mstation_state, mstation)
+void mstation_state::mstation_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -459,8 +461,7 @@ MACHINE_CONFIG_START(mstation_state::mstation)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 128-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(mstation_state, mstation)
+ PALETTE(config, "palette", FUNC(mstation_state::mstation_palette), 2);
AMD_29F080(config, "flash0");
SST_28SF040(config, "flash1");
diff --git a/src/mame/drivers/mugsmash.cpp b/src/mame/drivers/mugsmash.cpp
index f8a2d19882d..29a30f43244 100644
--- a/src/mame/drivers/mugsmash.cpp
+++ b/src/mame/drivers/mugsmash.cpp
@@ -414,13 +414,11 @@ MACHINE_CONFIG_START(mugsmash_state::mugsmash)
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(mugsmash_state, screen_update_mugsmash)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mugsmash)
- MCFG_PALETTE_ADD("palette", 0x300)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x300);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/multi8.cpp b/src/mame/drivers/multi8.cpp
index 1bf84aaf00b..e205ed3e2ad 100644
--- a/src/mame/drivers/multi8.cpp
+++ b/src/mame/drivers/multi8.cpp
@@ -580,7 +580,7 @@ MACHINE_CONFIG_START(multi8_state::multi8)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_multi8)
/* Audio */
diff --git a/src/mame/drivers/multigam.cpp b/src/mame/drivers/multigam.cpp
index cd4b919dbca..be652b261df 100644
--- a/src/mame/drivers/multigam.cpp
+++ b/src/mame/drivers/multigam.cpp
@@ -117,13 +117,14 @@ Eproms are 27512,27010,274001
class multigam_state : public driver_device
{
public:
- multigam_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ multigam_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ppu(*this, "ppu"),
m_p1(*this, "P1"),
m_p2(*this, "P2"),
- m_dsw(*this, "DSW") { }
+ m_dsw(*this, "DSW")
+ { }
void multigam(machine_config &config);
void supergm3(machine_config &config);
@@ -136,6 +137,11 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(multigam_inputs_r);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<ppu2c0x_device> m_ppu;
@@ -177,6 +183,7 @@ private:
int m_vrom4k;
uint8_t m_supergm3_prg_bank;
uint8_t m_supergm3_chr_bank;
+
DECLARE_WRITE8_MEMBER(multigam_nt_w);
DECLARE_READ8_MEMBER(multigam_nt_r);
DECLARE_WRITE8_MEMBER(sprite_dma_w);
@@ -195,10 +202,6 @@ private:
DECLARE_WRITE8_MEMBER(supergm3_prg_bank_w);
DECLARE_WRITE8_MEMBER(supergm3_chr_bank_w);
void set_mirroring(int mirroring);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(multigam);
DECLARE_MACHINE_START(multigm3);
DECLARE_MACHINE_RESET(multigm3);
DECLARE_MACHINE_START(supergm3);
diff --git a/src/mame/drivers/munchmo.cpp b/src/mame/drivers/munchmo.cpp
index ed26996398e..a39e3b96a85 100644
--- a/src/mame/drivers/munchmo.cpp
+++ b/src/mame/drivers/munchmo.cpp
@@ -345,9 +345,8 @@ MACHINE_CONFIG_START(munchmo_state::mnchmobl)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, munchmo_state, vblank_irq))
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_mnchmobl)
- MCFG_PALETTE_ADD(m_palette, 256)
- MCFG_PALETTE_INIT_OWNER(munchmo_state, munchmo)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mnchmobl);
+ PALETTE(config, m_palette, FUNC(munchmo_state::munchmo_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mupid2.cpp b/src/mame/drivers/mupid2.cpp
index d0222f9975e..50c028176f3 100644
--- a/src/mame/drivers/mupid2.cpp
+++ b/src/mame/drivers/mupid2.cpp
@@ -247,8 +247,7 @@ void mupid2_state::c2a2(machine_config &config)
M58990(config, "adc", 1000000);
- PALETTE(config, m_palette, 32);
- m_palette->set_init(DEVICE_SELF, FUNC(mupid2_state::palette_init));
+ PALETTE(config, m_palette, FUNC(mupid2_state::palette_init), 32);
}
diff --git a/src/mame/drivers/murogem.cpp b/src/mame/drivers/murogem.cpp
index 6fd53520315..af2d453ca44 100644
--- a/src/mame/drivers/murogem.cpp
+++ b/src/mame/drivers/murogem.cpp
@@ -119,13 +119,14 @@ val (hex): 27 20 22 04 26 00 20 20 00 07 00 00 80 00 00 00 ns
class murogem_state : public driver_device
{
public:
- murogem_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ murogem_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_dac(*this, "dac"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_videoram(*this, "videoram") { }
+ m_videoram(*this, "videoram")
+ { }
void murogem(machine_config &config);
@@ -138,7 +139,7 @@ private:
required_shared_ptr<uint8_t> m_videoram;
DECLARE_WRITE8_MEMBER(outport_w);
- DECLARE_PALETTE_INIT(murogem);
+ void murogem_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void murogem_map(address_map &map);
@@ -222,29 +223,26 @@ static GFXDECODE_START( gfx_murogem )
GFXDECODE_END
-PALETTE_INIT_MEMBER(murogem_state, murogem)
-{}
+void murogem_state::murogem_palette(palette_device &palette) const
+{
+}
uint32_t murogem_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int xx,yy,count;
- count = 0x000;
-
bitmap.fill(0, cliprect);
- for (yy=0;yy<32;yy++)
+ int count = 0x000;
+ for (int yy = 0; yy < 32; yy++)
{
- for(xx=0;xx<32;xx++)
+ for (int xx = 0; xx < 32; xx++)
{
- int tileno = m_videoram[count]&0x3f;
- int attr = m_videoram[count+0x400]&0x0f;
+ int const tileno = m_videoram[count] & 0x3f;
+ int const attr = m_videoram[count + 0x400] & 0x0f;
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,tileno,attr,0,0,xx*8,yy*8,0);
count++;
-
}
-
}
return 0;
@@ -264,11 +262,10 @@ MACHINE_CONFIG_START(murogem_state::murogem)
MCFG_SCREEN_SIZE((39+1)*8, (38+1)*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(murogem_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_murogem)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(murogem_state, murogem)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_murogem);
+ PALETTE(config, m_palette, FUNC(murogem_state::murogem_palette), 0x100);
mc6845_device &crtc(MC6845(config, "crtc", 750000)); /* ? MHz */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/murogmbl.cpp b/src/mame/drivers/murogmbl.cpp
index 0d977d65bee..18d51977af9 100644
--- a/src/mame/drivers/murogmbl.cpp
+++ b/src/mame/drivers/murogmbl.cpp
@@ -48,15 +48,19 @@ Dumped: 06/04/2009 f205v
class murogmbl_state : public driver_device
{
public:
- murogmbl_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ murogmbl_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_video(*this, "video") { }
+ m_video(*this, "video")
+ { }
void murogmbl(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -64,8 +68,7 @@ private:
required_shared_ptr<uint8_t> m_video;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(murogmbl);
+ void murogmbl_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void murogmbl_map(address_map &map);
@@ -74,15 +77,19 @@ private:
class slotunbl_state : public driver_device
{
public:
- slotunbl_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ slotunbl_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_video(*this, "video") { }
+ m_video(*this, "video")
+ { }
void slotunbl(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -90,62 +97,63 @@ private:
required_shared_ptr<uint8_t> m_video;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(slotunbl);
+ void slotunbl_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void slotunbl_map(address_map &map);
};
-PALETTE_INIT_MEMBER(murogmbl_state, murogmbl)
+void murogmbl_state::murogmbl_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[0] >> 4) & 0x01;
- bit2 = (color_prom[0] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
bit0 = 0;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
-PALETTE_INIT_MEMBER(slotunbl_state, slotunbl)
+void slotunbl_state::slotunbl_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x20; ++i)
+ for (int i = 0; i < 0x20; ++i)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[0] >> 4) & 0x01;
- bit2 = (color_prom[0] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
bit0 = 0;
- bit1 = (color_prom[0] >> 6) & 0x01;
- bit2 = (color_prom[0] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -345,7 +353,7 @@ MACHINE_CONFIG_START(murogmbl_state::murogmbl)
MCFG_DEVICE_ADD("maincpu", Z80, 1000000) /* Z80? */
MCFG_DEVICE_PROGRAM_MAP(murogmbl_map)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_murogmbl)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_murogmbl);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -354,10 +362,9 @@ MACHINE_CONFIG_START(murogmbl_state::murogmbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(murogmbl_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(murogmbl_state, murogmbl)
+ PALETTE(config, m_palette, FUNC(murogmbl_state::murogmbl_palette), 0x100);
SPEAKER(config, "speaker").front_center();
MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
@@ -370,8 +377,7 @@ MACHINE_CONFIG_START(slotunbl_state::slotunbl)
MCFG_DEVICE_ADD("maincpu", Z80, 1000000) /* Z80? */
MCFG_DEVICE_PROGRAM_MAP(slotunbl_map)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slotunbl)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_slotunbl);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -380,10 +386,9 @@ MACHINE_CONFIG_START(slotunbl_state::slotunbl)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(slotunbl_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(slotunbl_state, slotunbl)
+ PALETTE(config, m_palette, FUNC(slotunbl_state::slotunbl_palette), 0x100);
SPEAKER(config, "speaker").front_center();
MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
diff --git a/src/mame/drivers/mustache.cpp b/src/mame/drivers/mustache.cpp
index 5400b2e1024..eae1abaf643 100644
--- a/src/mame/drivers/mustache.cpp
+++ b/src/mame/drivers/mustache.cpp
@@ -198,10 +198,10 @@ MACHINE_CONFIG_START(mustache_state::mustache)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 0, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mustache_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mustache)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mwarr.cpp b/src/mame/drivers/mwarr.cpp
index 1b9e1093ddc..c52875f14e0 100644
--- a/src/mame/drivers/mwarr.cpp
+++ b/src/mame/drivers/mwarr.cpp
@@ -319,11 +319,10 @@ MACHINE_CONFIG_START(mwarr_state::mwarr)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8+1, 48*8-1-8-1, 0, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(mwarr_state, screen_update_mwarr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mwarr)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
EDEVICES_VID(config, m_video, 0);
m_video->set_bg_videoram_tag("bg_videoram");
diff --git a/src/mame/drivers/mx2178.cpp b/src/mame/drivers/mx2178.cpp
index 23948f56824..e81d39dc860 100644
--- a/src/mame/drivers/mx2178.cpp
+++ b/src/mame/drivers/mx2178.cpp
@@ -145,7 +145,7 @@ MACHINE_CONFIG_START(mx2178_state::mx2178)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mx2178)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* Devices */
mc6845_device &crtc(MC6845(config, "crtc", XTAL(18'869'600) / 8)); // clk unknown
diff --git a/src/mame/drivers/mycom.cpp b/src/mame/drivers/mycom.cpp
index 8500fbed27d..e4a7e440c27 100644
--- a/src/mame/drivers/mycom.cpp
+++ b/src/mame/drivers/mycom.cpp
@@ -536,7 +536,7 @@ MACHINE_CONFIG_START(mycom_state::mycom)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0, 192-1)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mycom)
/* Manual states clock is 1.008mhz for 40 cols, and 2.016 mhz for 80 cols.
diff --git a/src/mame/drivers/mystwarr.cpp b/src/mame/drivers/mystwarr.cpp
index 219f7993465..ccf8a2721c7 100644
--- a/src/mame/drivers/mystwarr.cpp
+++ b/src/mame/drivers/mystwarr.cpp
@@ -968,8 +968,7 @@ void mystwarr_state::mystwarr(machine_config &config)
m_screen->set_visarea(24, 24+288-1, 16, 16+224-1);
m_screen->set_screen_update(FUNC(mystwarr_state::screen_update_mystwarr));
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -1138,10 +1137,6 @@ void mystwarr_state::martchmp(machine_config &config)
m_k053252->set_clock(16000000/2);
m_k053252->set_offsets(32, 24-1);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
- m_palette->enable_shadows();
- m_palette->enable_hilights();
-
MCFG_VIDEO_START_OVERRIDE(mystwarr_state, martchmp)
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
diff --git a/src/mame/drivers/mz2000.cpp b/src/mame/drivers/mz2000.cpp
index 1707b7cf3fa..05a52679b10 100644
--- a/src/mame/drivers/mz2000.cpp
+++ b/src/mame/drivers/mz2000.cpp
@@ -53,8 +53,8 @@
class mz2000_state : public driver_device
{
public:
- mz2000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ mz2000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_cass(*this, "cassette"),
m_floppy(nullptr),
m_maincpu(*this, "maincpu"),
@@ -73,7 +73,8 @@ public:
m_region_wram(*this, "wram"),
m_io_keys(*this, {"KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5", "KEY6", "KEY7", "KEY8", "KEY9", "KEYA", "KEYB", "KEYC", "KEYD", "UNUSED", "UNUSED"}),
m_io_config(*this, "CONFIG"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void mz2000(machine_config &config);
void mz80b(machine_config &config);
@@ -923,10 +924,10 @@ MACHINE_CONFIG_START(mz2000_state::mz2000)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 400-1)
MCFG_SCREEN_UPDATE_DRIVER(mz2000_state, screen_update_mz2000)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mz2000)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mz2500.cpp b/src/mame/drivers/mz2500.cpp
index 9ec57559e98..73bbf18b4d4 100644
--- a/src/mame/drivers/mz2500.cpp
+++ b/src/mame/drivers/mz2500.cpp
@@ -42,7 +42,7 @@
#define WRAM_RESET 0
#define IPL_RESET 1
-static const uint8_t bank_reset_val[2][8] =
+static constexpr uint8_t bank_reset_val[2][8] =
{
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 },
{ 0x34, 0x35, 0x36, 0x37, 0x04, 0x05, 0x06, 0x07 }
@@ -1730,42 +1730,36 @@ WRITE8_MEMBER(mz2500_state::opn_porta_w)
m_ym_porta = data;
}
-PALETTE_INIT_MEMBER(mz2500_state, mz2500)
+void mz2500_state::mz2500_palette(palette_device &palette) const
{
- int i;
-
- for(i=0;i<0x200;i++)
+ for (int i = 0; i < 0x200; i++)
palette.set_pen_color(i,pal1bit(0),pal1bit(0),pal1bit(0));
- /* set up 8 colors (PCG) */
- for(i=0;i<8;i++)
- m_palette->set_pen_color(i+8,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0));
+ // set up 8 colors (PCG)
+ for (int i = 0; i < 8; i++)
+ palette.set_pen_color(i+8,pal1bit((i & 2)>>1),pal1bit((i & 4)>>2),pal1bit((i & 1)>>0));
- /* set up 16 colors (PCG / CG) */
+ // set up 16 colors (PCG / CG)
- /* set up 256 colors (CG) */
+ // set up 256 colors (CG)
+ for (int i = 0; i < 0x100; i++)
{
- int r,g,b;
-
- for(i = 0;i < 0x100;i++)
- {
- int bit0,bit1,bit2;
-
- bit0 = pal_256_param(i,0) ? 1 : 0;
- bit1 = i & 0x01 ? 2 : 0;
- bit2 = i & 0x10 ? 4 : 0;
- b = bit0|bit1|bit2;
- bit0 = pal_256_param(i,0) ? 1 : 0;
- bit1 = i & 0x02 ? 2 : 0;
- bit2 = i & 0x20 ? 4 : 0;
- r = bit0|bit1|bit2;
- bit0 = pal_256_param(i,0) ? 1 : 0;
- bit1 = i & 0x04 ? 2 : 0;
- bit2 = i & 0x40 ? 4 : 0;
- g = bit0|bit1|bit2;
-
- m_palette->set_pen_color(i+0x100,pal3bit(r),pal3bit(g),pal3bit(b));
- }
+ int bit0, bit1, bit2;
+
+ bit0 = pal_256_param(i,0) ? 1 : 0;
+ bit1 = i & 0x01 ? 2 : 0;
+ bit2 = i & 0x10 ? 4 : 0;
+ int const b = bit0|bit1|bit2;
+ bit0 = pal_256_param(i,0) ? 1 : 0;
+ bit1 = i & 0x02 ? 2 : 0;
+ bit2 = i & 0x20 ? 4 : 0;
+ int const r = bit0|bit1|bit2;
+ bit0 = pal_256_param(i,0) ? 1 : 0;
+ bit1 = i & 0x04 ? 2 : 0;
+ bit2 = i & 0x40 ? 4 : 0;
+ int const g = bit0|bit1|bit2;
+
+ palette.set_pen_color(i + 0x100, pal3bit(r), pal3bit(g), pal3bit(b));
}
}
@@ -1845,12 +1839,11 @@ MACHINE_CONFIG_START(mz2500_state::mz2500)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(21'477'272, 640+108, 0, 640, 480, 0, 200) //unknown clock / divider
MCFG_SCREEN_UPDATE_DRIVER(mz2500_state, screen_update_mz2500)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(mz2500_state, mz2500)
+ PALETTE(config, m_palette, FUNC(mz2500_state::mz2500_palette), 0x200);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mz2500)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_mz2500);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/mz3500.cpp b/src/mame/drivers/mz3500.cpp
index 5fceed32114..42040e8d6f8 100644
--- a/src/mame/drivers/mz3500.cpp
+++ b/src/mame/drivers/mz3500.cpp
@@ -46,18 +46,18 @@ class mz3500_state : public driver_device
{
public:
mz3500_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_master(*this, "master"),
- m_slave(*this, "slave"),
- m_hgdc1(*this, "upd7220_chr"),
- m_hgdc2(*this, "upd7220_gfx"),
- m_fdc(*this, "upd765a"),
- m_video_ram(*this, "video_ram"),
- m_beeper(*this, "beeper"),
- m_palette(*this, "palette"),
- m_system_dsw(*this, "SYSTEM_DSW"),
- m_fd_dsw(*this, "FD_DSW"),
- m_floppy_connector(*this, "upd765a:%u", 0U)
+ : driver_device(mconfig, type, tag)
+ , m_master(*this, "master")
+ , m_slave(*this, "slave")
+ , m_hgdc1(*this, "upd7220_chr")
+ , m_hgdc2(*this, "upd7220_gfx")
+ , m_fdc(*this, "upd765a")
+ , m_video_ram(*this, "video_ram")
+ , m_beeper(*this, "beeper")
+ , m_palette(*this, "palette")
+ , m_system_dsw(*this, "SYSTEM_DSW")
+ , m_fd_dsw(*this, "FD_DSW")
+ , m_floppy_connector(*this, "upd765a:%u", 0U)
{ }
void mz3500(machine_config &config);
@@ -853,13 +853,12 @@ MACHINE_CONFIG_START(mz3500_state::mz3500)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mz3500)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 2400)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15)
+ BEEP(config, m_beeper, 2400).add_route(ALL_OUTPUTS, "mono", 0.15);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/mz700.cpp b/src/mame/drivers/mz700.cpp
index 490b89a7e88..4affb3ddcee 100644
--- a/src/mame/drivers/mz700.cpp
+++ b/src/mame/drivers/mz700.cpp
@@ -386,8 +386,8 @@ MACHINE_CONFIG_START(mz_state::mz700)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(17'734'470)/2, 568, 0, 40*8, 312, 0, 25*8)
MCFG_SCREEN_UPDATE_DRIVER(mz_state, screen_update_mz700)
- MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mz700)
diff --git a/src/mame/drivers/mz80.cpp b/src/mame/drivers/mz80.cpp
index dec43e3b58c..78a4aaeaba7 100644
--- a/src/mame/drivers/mz80.cpp
+++ b/src/mame/drivers/mz80.cpp
@@ -295,7 +295,7 @@ MACHINE_CONFIG_START(mz80_state::mz80k)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mz80k)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Audio */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/n64.cpp b/src/mame/drivers/n64.cpp
index b43391bf9c9..56c34dbff4c 100644
--- a/src/mame/drivers/n64.cpp
+++ b/src/mame/drivers/n64.cpp
@@ -456,7 +456,7 @@ void n64_mess_state::n64(machine_config &config)
screen.set_screen_update(FUNC(n64_state::screen_update_n64));
screen.screen_vblank().set(FUNC(n64_state::screen_vblank_n64));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/n8080.cpp b/src/mame/drivers/n8080.cpp
index 87d2246d0dd..224b638e527 100644
--- a/src/mame/drivers/n8080.cpp
+++ b/src/mame/drivers/n8080.cpp
@@ -521,7 +521,7 @@ void n8080_state::spacefev(machine_config &config)
m_screen->set_screen_update(FUNC(n8080_state::screen_update_spacefev));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 8).set_init(FUNC(n8080_state::palette_init_n8080));
+ PALETTE(config, m_palette, FUNC(n8080_state::n8080_palette), 8);
MCFG_VIDEO_START_OVERRIDE(n8080_state,spacefev)
@@ -552,7 +552,7 @@ void n8080_state::sheriff(machine_config &config)
m_screen->set_screen_update(FUNC(n8080_state::screen_update_sheriff));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 8).set_init(FUNC(n8080_state::palette_init_n8080));
+ PALETTE(config, m_palette, FUNC(n8080_state::n8080_palette), 8);
MCFG_VIDEO_START_OVERRIDE(n8080_state,sheriff)
@@ -595,7 +595,7 @@ void n8080_state::helifire(machine_config &config)
m_screen->screen_vblank().set(FUNC(n8080_state::screen_vblank_helifire));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 8 + 0x400).set_init(FUNC(n8080_state::palette_init_helifire));
+ PALETTE(config, m_palette, FUNC(n8080_state::helifire_palette), 8 + 0x400);
MCFG_VIDEO_START_OVERRIDE(n8080_state,helifire)
diff --git a/src/mame/drivers/nakajies.cpp b/src/mame/drivers/nakajies.cpp
index ff86ff1b0ed..e6b91e59e4c 100644
--- a/src/mame/drivers/nakajies.cpp
+++ b/src/mame/drivers/nakajies.cpp
@@ -300,11 +300,11 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(trigger_irq);
-private:
- required_device<cpu_device> m_maincpu;
-
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+
+private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void nakajies_update_irqs();
@@ -327,6 +327,13 @@ private:
DECLARE_WRITE8_MEMBER( bank6_w );
DECLARE_WRITE8_MEMBER( bank7_w );
+ void nakajies_palette(palette_device &palette) const;
+ TIMER_DEVICE_CALLBACK_MEMBER(kb_timer);
+ void nakajies_io_map(address_map &map);
+ void nakajies_map(address_map &map);
+
+ required_device<cpu_device> m_maincpu;
+
/* IRQ handling */
uint8_t m_irq_enabled;
uint8_t m_irq_active;
@@ -346,10 +353,6 @@ private:
/* Banking */
uint8_t m_bank[8];
uint8_t *m_bank_base[8];
- DECLARE_PALETTE_INIT(nakajies);
- TIMER_DEVICE_CALLBACK_MEMBER(kb_timer);
- void nakajies_io_map(address_map &map);
- void nakajies_map(address_map &map);
};
@@ -710,7 +713,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(nakajies_state::kb_timer)
}
-PALETTE_INIT_MEMBER(nakajies_state, nakajies)
+void nakajies_state::nakajies_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -759,14 +762,12 @@ MACHINE_CONFIG_START(nakajies_state::nakajies210)
MCFG_SCREEN_VISIBLE_AREA( 0, 6 * 80 - 1, 0, 8 * 8 - 1 )
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wales210)
- MCFG_PALETTE_ADD( "palette", 2 )
- MCFG_PALETTE_INIT_OWNER(nakajies_state, nakajies)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_wales210);
+ PALETTE(config, "palette", FUNC(nakajies_state::nakajies_palette), 2);
/* sound */
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);
/* rtc */
RP5C01(config, "rtc", XTAL(32'768));
diff --git a/src/mame/drivers/namcona1.cpp b/src/mame/drivers/namcona1.cpp
index 635d4d18290..f8553076ba8 100644
--- a/src/mame/drivers/namcona1.cpp
+++ b/src/mame/drivers/namcona1.cpp
@@ -995,7 +995,7 @@ void namcona1_state::namcona_base(machine_config &config)
m_screen->set_screen_update(FUNC(namcona1_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, m_palette, 0x2000).enable_shadows();
+ PALETTE(config, m_palette).set_entries(0x2000).enable_shadows();
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcona1);
diff --git a/src/mame/drivers/namconb1.cpp b/src/mame/drivers/namconb1.cpp
index f9693d8304d..eacff54e35a 100644
--- a/src/mame/drivers/namconb1.cpp
+++ b/src/mame/drivers/namconb1.cpp
@@ -1059,7 +1059,7 @@ MACHINE_CONFIG_START(namconb1_state::namconb1)
m_screen->screen_vblank().set(m_c355spr, FUNC(namco_c355spr_device::vblank));
m_screen->set_palette(m_c116);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_c116, gfx_namconb1)
+ GFXDECODE(config, "gfxdecode", m_c116, gfx_namconb1);
NAMCO_C355SPR(config, m_c355spr, 0);
m_c355spr->set_screen(m_screen);
@@ -1091,6 +1091,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(namconb1_state::namconb2)
namconb1(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(namconb2_am)
@@ -1101,7 +1102,6 @@ MACHINE_CONFIG_START(namconb1_state::namconb2)
m_c169roz->set_is_namcofl(false);
m_c169roz->set_ram_words(0x20000/2);
m_c169roz->set_color_base(0x1800);
-
MACHINE_CONFIG_END
MACHINE_CONFIG_START(namconb1_state::machbrkr)
diff --git a/src/mame/drivers/namcops2.cpp b/src/mame/drivers/namcops2.cpp
index 0667fb02c31..55275c1cac1 100644
--- a/src/mame/drivers/namcops2.cpp
+++ b/src/mame/drivers/namcops2.cpp
@@ -933,7 +933,7 @@ void namcops2_state::system246(machine_config &config)
screen.set_size(640, 480);
screen.set_visarea(0, 639, 0, 479);
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
}
void namcops2_state::system256(machine_config &config)
diff --git a/src/mame/drivers/namcos21.cpp b/src/mame/drivers/namcos21.cpp
index f232fd7710d..656a683bc33 100644
--- a/src/mame/drivers/namcos21.cpp
+++ b/src/mame/drivers/namcos21.cpp
@@ -858,7 +858,6 @@ void namcos21_state::configure_c148_standard(machine_config &config)
m_slave_intc->link_c148_device(m_master_intc);
}
-// winrun, winrungp, winrun91
MACHINE_CONFIG_START(namcos21_state::winrun)
MCFG_DEVICE_ADD("maincpu", M68000,12288000) /* Master */
MCFG_DEVICE_PROGRAM_MAP(winrun_master_map)
@@ -891,10 +890,9 @@ MACHINE_CONFIG_START(namcos21_state::winrun)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS_NAMCO480I
MCFG_SCREEN_UPDATE_DRIVER(namcos21_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", NAMCOS21_NUM_COLORS)
- MCFG_PALETTE_FORMAT(XBRG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_888, NAMCOS21_NUM_COLORS);
NAMCOS21_3D(config, m_namcos21_3d, 0);
m_namcos21_3d->set_fixed_palbase(0x4000);
diff --git a/src/mame/drivers/namcos21_c67.cpp b/src/mame/drivers/namcos21_c67.cpp
index e49b8a49a9c..dc2c5a0adbb 100644
--- a/src/mame/drivers/namcos21_c67.cpp
+++ b/src/mame/drivers/namcos21_c67.cpp
@@ -835,7 +835,7 @@ MACHINE_CONFIG_START(namcos21_c67_state::namcos21)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS_NAMCO480I
MCFG_SCREEN_UPDATE_DRIVER(namcos21_c67_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
NAMCOS21_3D(config, m_namcos21_3d, 0);
m_namcos21_3d->set_zz_shift_mult(11, 0x200);
@@ -845,9 +845,8 @@ MACHINE_CONFIG_START(namcos21_c67_state::namcos21)
configure_c148_standard(config);
NAMCO_C139(config, m_sci, 0);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_namcos21)
- MCFG_PALETTE_ADD("palette", NAMCOS21_NUM_COLORS)
- MCFG_PALETTE_FORMAT(XBRG)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_namcos21);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_888, NAMCOS21_NUM_COLORS);
NAMCO_C355SPR(config, m_c355spr, 0);
m_c355spr->set_screen(m_screen);
diff --git a/src/mame/drivers/namcos21_de.cpp b/src/mame/drivers/namcos21_de.cpp
index c2ace71c309..f06353186cd 100644
--- a/src/mame/drivers/namcos21_de.cpp
+++ b/src/mame/drivers/namcos21_de.cpp
@@ -148,7 +148,8 @@ namco_de_pcbstack_device::namco_de_pcbstack_device(const machine_config &mconfig
m_dpram(*this, "dpram"),
m_namcos21_3d(*this, "namcos21_3d"),
m_namcos21_dsp(*this, "namcos21dsp")
-{}
+{
+}
INTERRUPT_GEN_MEMBER( namco_de_pcbstack_device::irq0_line_hold ) { device.execute().set_input_line(0, HOLD_LINE); }
INTERRUPT_GEN_MEMBER( namco_de_pcbstack_device::irq1_line_hold ) { device.execute().set_input_line(1, HOLD_LINE); }
@@ -210,11 +211,10 @@ MACHINE_CONFIG_START(namco_de_pcbstack_device::device_add_mconfig)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS_NAMCO480I
MCFG_SCREEN_UPDATE_DRIVER(namco_de_pcbstack_device, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_namcos21)
- MCFG_PALETTE_ADD("palette", NAMCOS21_NUM_COLORS)
- MCFG_PALETTE_FORMAT(XBRG)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_namcos21);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_888, NAMCOS21_NUM_COLORS);
NAMCOS21_3D(config, m_namcos21_3d, 0);
m_namcos21_3d->set_fixed_palbase(0x3f00);
diff --git a/src/mame/drivers/namcos23.cpp b/src/mame/drivers/namcos23.cpp
index 2ce2143ffeb..f07f0112576 100644
--- a/src/mame/drivers/namcos23.cpp
+++ b/src/mame/drivers/namcos23.cpp
@@ -3641,7 +3641,7 @@ void namcos23_state::gorgon(machine_config &config)
m_screen->set_screen_update(FUNC(namcos23_state::screen_update));
m_screen->screen_vblank().set(FUNC(namcos23_state::sub_irq));
- PALETTE(config, m_palette, 0x8000);
+ PALETTE(config, m_palette).set_entries(0x8000);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos23);
@@ -3706,7 +3706,7 @@ void namcos23_state::s23(machine_config &config)
m_screen->set_screen_update(FUNC(namcos23_state::screen_update));
m_screen->screen_vblank().set(FUNC(namcos23_state::sub_irq));
- PALETTE(config, m_palette, 0x8000);
+ PALETTE(config, m_palette).set_entries(0x8000);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos23);
@@ -3785,7 +3785,7 @@ void namcos23_state::ss23(machine_config &config)
m_screen->set_screen_update(FUNC(namcos23_state::screen_update));
m_screen->screen_vblank().set(FUNC(namcos23_state::sub_irq));
- PALETTE(config, m_palette, 0x8000);
+ PALETTE(config, m_palette).set_entries(0x8000);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos23);
diff --git a/src/mame/drivers/namcos86.cpp b/src/mame/drivers/namcos86.cpp
index 5f2d4c155c4..f049d822f17 100644
--- a/src/mame/drivers/namcos86.cpp
+++ b/src/mame/drivers/namcos86.cpp
@@ -1077,8 +1077,7 @@ void namcos86_state::hopmappy(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_namcos86);
- PALETTE(config, m_palette, 4096);
- m_palette->set_init(FUNC(namcos86_state::palette_init_namcos86));
+ PALETTE(config, m_palette, FUNC(namcos86_state::namcos86_palette), 4096);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/nanos.cpp b/src/mame/drivers/nanos.cpp
index cec0b5669b9..a2198847cad 100644
--- a/src/mame/drivers/nanos.cpp
+++ b/src/mame/drivers/nanos.cpp
@@ -483,7 +483,7 @@ MACHINE_CONFIG_START(nanos_state::nanos)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nanos)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* devices */
Z80CTC(config, m_ctc_0, XTAL(4'000'000));
diff --git a/src/mame/drivers/naomi.cpp b/src/mame/drivers/naomi.cpp
index d8a464a6f8b..62ac2911252 100644
--- a/src/mame/drivers/naomi.cpp
+++ b/src/mame/drivers/naomi.cpp
@@ -2923,7 +2923,7 @@ void dc_state::naomi_aw_base(machine_config &config)
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(13458568*2, 820, 0, 640, 532, 0, 480); /* TODO: where does pclk actually come from? */
screen.set_screen_update("powervr2", FUNC(powervr2_device::screen_update));
- PALETTE(config, "palette", 0x1000);
+ PALETTE(config, "palette").set_entries(0x1000);
POWERVR2(config, m_powervr2, 0);
m_powervr2->irq_callback().set(FUNC(dc_state::pvr_irq));
diff --git a/src/mame/drivers/nascom1.cpp b/src/mame/drivers/nascom1.cpp
index 35edc4d8208..b03189cd72e 100644
--- a/src/mame/drivers/nascom1.cpp
+++ b/src/mame/drivers/nascom1.cpp
@@ -697,7 +697,7 @@ void nascom_state::nascom(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nascom1);
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
// uart
AY31015(config, m_hd6402);
diff --git a/src/mame/drivers/naughtyb.cpp b/src/mame/drivers/naughtyb.cpp
index b8b7632ae28..10294400632 100644
--- a/src/mame/drivers/naughtyb.cpp
+++ b/src/mame/drivers/naughtyb.cpp
@@ -422,7 +422,7 @@ void naughtyb_state::naughtyb_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_naughtyb);
- PALETTE(config, m_palette, 256).set_init(FUNC(naughtyb_state::palette_init_naughtyb));
+ PALETTE(config, m_palette, FUNC(naughtyb_state::naughtyb_palette), 256);
/* sound hardware */
/* uses the TMS3615NS for sound */
diff --git a/src/mame/drivers/nbmj8688.cpp b/src/mame/drivers/nbmj8688.cpp
index 9dedd89aea4..d4ebe4c45ed 100644
--- a/src/mame/drivers/nbmj8688.cpp
+++ b/src/mame/drivers/nbmj8688.cpp
@@ -2471,9 +2471,8 @@ MACHINE_CONFIG_START(nbmj8688_state::NBMJDRV_4096)
MCFG_SCREEN_UPDATE_DRIVER(nbmj8688_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 4096)
+ PALETTE(config, "palette", FUNC(nbmj8688_state::mbmj8688_12bit), 4096);
- MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_12bit)
MCFG_VIDEO_START_OVERRIDE(nbmj8688_state,mbmj8688_pure_12bit)
/* sound hardware */
@@ -2495,10 +2494,8 @@ MACHINE_CONFIG_START(nbmj8688_state::NBMJDRV_256)
/* basic machine hardware */
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(256)
+ subdevice<palette_device>("palette")->set_entries(256).set_init(FUNC(nbmj8688_state::mbmj8688_8bit));
- MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_8bit)
MCFG_VIDEO_START_OVERRIDE(nbmj8688_state,mbmj8688_8bit)
MACHINE_CONFIG_END
@@ -2508,11 +2505,8 @@ MACHINE_CONFIG_START(nbmj8688_state::NBMJDRV_65536)
/* basic machine hardware */
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(65536)
+ subdevice<palette_device>("palette")->set_entries(65536).set_init(FUNC(nbmj8688_state::mbmj8688_16bit));
- MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_16bit)
MCFG_VIDEO_START_OVERRIDE(nbmj8688_state,mbmj8688_hybrid_16bit)
MACHINE_CONFIG_END
@@ -2629,8 +2623,7 @@ MACHINE_CONFIG_START(nbmj8688_state::mbmj_p16bit_LCD)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
- MCFG_PALETTE_ADD("palette", 65536)
- MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_16bit)
+ PALETTE(config, "palette", FUNC(nbmj8688_state::mbmj8688_16bit), 65536);
config.set_default_layout(layout_nbmj8688);
MCFG_SCREEN_ADD("screen", RASTER)
@@ -2641,8 +2634,7 @@ MACHINE_CONFIG_START(nbmj8688_state::mbmj_p16bit_LCD)
MCFG_SCREEN_UPDATE_DRIVER(nbmj8688_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette_lcd", 2)
- MCFG_PALETTE_INIT_OWNER(nbmj8688_state,mbmj8688_lcd)
+ PALETTE(config, "palette_lcd", FUNC(nbmj8688_state::mbmj8688_lcd), 2);
screen_device &lcd0(SCREEN(config, "lcd0", SCREEN_TYPE_LCD));
lcd0.set_physical_aspect(15, 3);
diff --git a/src/mame/drivers/nbmj9195.cpp b/src/mame/drivers/nbmj9195.cpp
index 39e2b2c3185..8c1a270fe72 100644
--- a/src/mame/drivers/nbmj9195.cpp
+++ b/src/mame/drivers/nbmj9195.cpp
@@ -2579,7 +2579,7 @@ MACHINE_CONFIG_START(nbmj9195_state::NBMJDRV3)
MSCOUTM_TMZ84C011_MAIN_PORTS
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(512)
MCFG_VIDEO_START_OVERRIDE(nbmj9195_state,nb22090)
diff --git a/src/mame/drivers/nc.cpp b/src/mame/drivers/nc.cpp
index 9401f3e773e..48f562c3dee 100644
--- a/src/mame/drivers/nc.cpp
+++ b/src/mame/drivers/nc.cpp
@@ -1388,8 +1388,7 @@ MACHINE_CONFIG_START(nc_state::nc_base)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", NC_NUM_COLOURS)
- MCFG_PALETTE_INIT_OWNER(nc_state, nc)
+ PALETTE(config, "palette", FUNC(nc_state::nc_colours), NC_NUM_COLOURS);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1471,9 +1470,9 @@ MACHINE_CONFIG_START(nc200_state::nc200)
MCFG_SCREEN_VISIBLE_AREA(0, NC200_SCREEN_WIDTH-1, 0, NC200_SCREEN_HEIGHT-1)
MCFG_SCREEN_UPDATE_DRIVER(nc200_state, screen_update_nc200)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(NC200_NUM_COLOURS)
- MCFG_PALETTE_INIT_OWNER(nc200_state, nc)
+ palette_device &palette(*subdevice<palette_device>("palette"));
+ palette.set_entries(NC200_NUM_COLOURS);
+ palette.set_init(FUNC(nc200_state::nc_colours));
/* printer */
MCFG_DEVICE_MODIFY("centronics")
diff --git a/src/mame/drivers/nemesis.cpp b/src/mame/drivers/nemesis.cpp
index ee23fbba0d8..ef4fd5af181 100644
--- a/src/mame/drivers/nemesis.cpp
+++ b/src/mame/drivers/nemesis.cpp
@@ -1491,7 +1491,7 @@ void nemesis_state::nemesis(machine_config &config)
m_screen->screen_vblank().set(FUNC(nemesis_state::nemesis_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1558,7 +1558,7 @@ void nemesis_state::gx400(machine_config &config)
m_screen->screen_vblank().set_inputline("audiocpu", INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1627,7 +1627,7 @@ void nemesis_state::konamigt(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1694,7 +1694,7 @@ void nemesis_state::rf2_gx400(machine_config &config)
m_screen->screen_vblank().set_inputline("audiocpu", INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1753,8 +1753,7 @@ void nemesis_state::salamand(machine_config &config)
m_screen->screen_vblank().set(FUNC(nemesis_state::nemesis_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->set_membits(8);
/* sound hardware */
@@ -1804,8 +1803,7 @@ void nemesis_state::blkpnthr(machine_config &config)
m_screen->screen_vblank().set(FUNC(nemesis_state::blkpnthr_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->set_membits(8);
/* sound hardware */
@@ -1850,8 +1848,7 @@ void nemesis_state::citybomb(machine_config &config)
m_screen->screen_vblank().set(FUNC(nemesis_state::nemesis_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->set_membits(8);
/* sound hardware */
@@ -1900,8 +1897,7 @@ void nemesis_state::nyanpani(machine_config &config)
m_screen->screen_vblank().set(FUNC(nemesis_state::nemesis_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->set_membits(8);
/* sound hardware */
@@ -1954,8 +1950,7 @@ void nemesis_state::hcrash(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->set_membits(8);
/* sound hardware */
@@ -2717,7 +2712,7 @@ void nemesis_state::bubsys(machine_config &config)
m_screen->screen_vblank().set_inputline("audiocpu", INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nemesis);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp
index d2607f3d393..a472b602d20 100644
--- a/src/mame/drivers/neogeo.cpp
+++ b/src/mame/drivers/neogeo.cpp
@@ -1932,7 +1932,7 @@ MACHINE_CONFIG_START(neogeo_base_state::neogeo_base)
MCFG_SCREEN_UPDATE_DRIVER(neogeo_base_state, screen_update)
/* 4096 colors * two banks * normal and shadow */
- MCFG_PALETTE_ADD_INIT_BLACK(m_palette, 4096*2*2)
+ MCFG_DEVICE_ADD(m_palette, PALETTE, palette_device::BLACK, 4096*2*2)
MCFG_DEVICE_ADD(m_sprgen, NEOGEO_SPRITE_OPTIMZIED, 0)
diff --git a/src/mame/drivers/neoprint.cpp b/src/mame/drivers/neoprint.cpp
index acbf3641ed1..9a099fba973 100644
--- a/src/mame/drivers/neoprint.cpp
+++ b/src/mame/drivers/neoprint.cpp
@@ -35,8 +35,10 @@
class neoprint_state : public driver_device
{
public:
- neoprint_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ static constexpr feature_type unemulated_features() { return feature::CAMERA | feature::PRINTER; }
+
+ neoprint_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_npvidram(*this, "npvidram"),
m_npvidregs(*this, "npvidregs"),
m_maincpu(*this, "maincpu"),
@@ -57,10 +59,11 @@ public:
void init_nprsp();
void init_unkneo();
- static constexpr feature_type unemulated_features() { return feature::CAMERA | feature::PRINTER; }
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
private:
-
DECLARE_READ8_MEMBER(neoprint_calendar_r);
DECLARE_WRITE8_MEMBER(neoprint_calendar_w);
DECLARE_READ8_MEMBER(neoprint_unk_r);
@@ -81,9 +84,6 @@ private:
void neoprint_map(address_map &map);
void nprsp_map(address_map &map);
- virtual void machine_start() override;
- virtual void video_start() override;
-
required_shared_ptr<uint16_t> m_npvidram;
required_shared_ptr<uint16_t> m_npvidregs;
required_device<cpu_device> m_maincpu;
@@ -512,7 +512,7 @@ MACHINE_CONFIG_START(neoprint_state::neoprint)
UPD4990A(config, m_upd4990a);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_neoprint)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_neoprint);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -520,10 +520,9 @@ MACHINE_CONFIG_START(neoprint_state::neoprint)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(neoprint_state, screen_update_neoprint)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
@@ -556,7 +555,7 @@ MACHINE_CONFIG_START(neoprint_state::nprsp)
UPD4990A(config, m_upd4990a);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_neoprint)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_neoprint);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -564,12 +563,11 @@ MACHINE_CONFIG_START(neoprint_state::nprsp)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(neoprint_state, screen_update_nprsp)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_MACHINE_RESET_OVERRIDE(neoprint_state,nprsp)
- MCFG_PALETTE_ADD("palette", 0x10000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/news.cpp b/src/mame/drivers/news.cpp
index 6f59a8821d5..f3314c0a476 100644
--- a/src/mame/drivers/news.cpp
+++ b/src/mame/drivers/news.cpp
@@ -147,10 +147,8 @@ MACHINE_CONFIG_START(news_state::news)
MCFG_SCREEN_UPDATE_DRIVER(news_state, screen_update_news)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_news)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_news);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_444, 0x100).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/nibble.cpp b/src/mame/drivers/nibble.cpp
index 7080295d298..76710cc0714 100644
--- a/src/mame/drivers/nibble.cpp
+++ b/src/mame/drivers/nibble.cpp
@@ -62,28 +62,33 @@
class nibble_state : public driver_device
{
public:
- nibble_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ nibble_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void nibble(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(nibble_videoram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(nibble);
+ void nibble_palette(palette_device &palette) const;
uint32_t screen_update_nibble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(nibble_interrupt);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
+
void nibble_map(address_map &map);
void ramdac1_map(address_map &map);
void ramdac2_map(address_map &map);
@@ -126,7 +131,7 @@ uint32_t nibble_state::screen_update_nibble(screen_device &screen, bitmap_ind16
return 0;
}
-PALETTE_INIT_MEMBER(nibble_state, nibble)
+void nibble_state::nibble_palette(palette_device &palette) const
{
}
@@ -343,7 +348,7 @@ MACHINE_CONFIG_START(nibble_state::nibble)
MCFG_SCREEN_UPDATE_DRIVER(nibble_state, screen_update_nibble)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nibble)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_nibble);
ramdac_device &ramdac1(RAMDAC(config, "ramdac1", 0, "palette"));
ramdac1.set_addrmap(0, &nibble_state::ramdac1_map);
@@ -353,7 +358,7 @@ MACHINE_CONFIG_START(nibble_state::nibble)
ramdac2.set_addrmap(0, &nibble_state::ramdac2_map);
ramdac2.set_color_base(0x100);
- MCFG_PALETTE_ADD("palette", 0x200)
+ PALETTE(config, "palette", FUNC(nibble_state::nibble_palette), 0x200);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/nightgal.cpp b/src/mame/drivers/nightgal.cpp
index a3e743ca27d..6e1440b4a66 100644
--- a/src/mame/drivers/nightgal.cpp
+++ b/src/mame/drivers/nightgal.cpp
@@ -44,8 +44,8 @@ TODO:
class nightgal_state : public driver_device
{
public:
- nightgal_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ nightgal_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_comms_ram(*this, "comms_ram"),
m_sound_ram(*this, "sound_ram"),
m_maincpu(*this, "maincpu"),
@@ -70,7 +70,8 @@ public:
m_io_dswb(*this, "DSWB"),
m_io_dswc(*this, "DSWC"),
m_palette(*this, "palette"),
- m_blitter(*this, "blitter") { }
+ m_blitter(*this, "blitter")
+ { }
void ngalsumr(machine_config &config);
void sexygal(machine_config &config);
@@ -114,7 +115,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(nightgal);
+ void nightgal_palette(palette_device &palette) const;
uint32_t screen_update_nightgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void common_nsc_map(address_map &map);
@@ -193,42 +194,40 @@ uint32_t nightgal_state::screen_update_nightgal(screen_device &screen, bitmap_in
return 0;
}
-/* guess: use the same resistor values as Crazy Climber (needs checking on the real HW) */
-PALETTE_INIT_MEMBER(nightgal_state, nightgal)
+// guess: use the same resistor values as Crazy Climber (needs checking on the real HW)
+void nightgal_state::nightgal_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_rg[3], weights_b[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = combine_2_weights(weights_b, bit0, bit1);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -808,10 +807,9 @@ MACHINE_CONFIG_START(nightgal_state::royalqn)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/4,320,0,256,264,16,240)
MCFG_SCREEN_UPDATE_DRIVER(nightgal_state, screen_update_nightgal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x20)
- MCFG_PALETTE_INIT_OWNER(nightgal_state, nightgal)
+ PALETTE(config, m_palette, FUNC(nightgal_state::nightgal_palette), 0x20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ninjakd2.cpp b/src/mame/drivers/ninjakd2.cpp
index 67528ba4bf9..929234a722e 100644
--- a/src/mame/drivers/ninjakd2.cpp
+++ b/src/mame/drivers/ninjakd2.cpp
@@ -986,8 +986,7 @@ void ninjakd2_state::ninjakd2_core(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ninjakd2);
- PALETTE(config, m_palette, 0x300);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 0x300);
m_palette->set_endianness(ENDIANNESS_BIG);
/* sound hardware */
@@ -1062,9 +1061,7 @@ void robokid_state::robokid(machine_config &config)
m_soundcpu->set_addrmap(AS_PROGRAM, &robokid_state::ninjakid_nopcm_sound_cpu);
/* video hardware */
- m_gfxdecode->set_info(gfx_robokid);
- m_palette->set_entries(0x400); // RAM is this large, but still only 0x300 colors used
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ m_palette->set_format(palette_device::RGBx_444, 0x400); // RAM is this large, but still only 0x300 colors used
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(robokid_state,robokid)
diff --git a/src/mame/drivers/nitedrvr.cpp b/src/mame/drivers/nitedrvr.cpp
index b7c7af0ab08..9d8a10441bf 100644
--- a/src/mame/drivers/nitedrvr.cpp
+++ b/src/mame/drivers/nitedrvr.cpp
@@ -156,11 +156,11 @@ MACHINE_CONFIG_START(nitedrvr_state::nitedrvr)
MCFG_SCREEN_RAW_PARAMS(12.096_MHz_XTAL / 2, 384, 0, 256, 278, 0, 256) // ~57 Hz
// PROM derives VRESET, VBLANK, VSYNC, IRQ from vertical scan count and last VBLANK
MCFG_SCREEN_UPDATE_DRIVER(nitedrvr_state, screen_update_nitedrvr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nitedrvr)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/nmg5.cpp b/src/mame/drivers/nmg5.cpp
index 56dc76c158a..d9299865926 100644
--- a/src/mame/drivers/nmg5.cpp
+++ b/src/mame/drivers/nmg5.cpp
@@ -260,6 +260,11 @@ public:
void init_prot_val_20();
void init_prot_val_40();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
/* memory pointers */
required_shared_ptr<uint16_t> m_spriteram;
@@ -294,9 +299,6 @@ private:
DECLARE_WRITE16_MEMBER(priority_reg_w);
DECLARE_WRITE8_MEMBER(oki_banking_w);
template<int Layer> TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void nmg5_map(address_map &map);
void nmg5_sound_map(address_map &map);
@@ -996,9 +998,8 @@ MACHINE_CONFIG_START(nmg5_state::nmg5)
MCFG_SCREEN_UPDATE_DRIVER(nmg5_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nmg5)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_nmg5);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 0x400);
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(1);
diff --git a/src/mame/drivers/nmk16.cpp b/src/mame/drivers/nmk16.cpp
index 0b4de42022c..7e7cb1b77d7 100644
--- a/src/mame/drivers/nmk16.cpp
+++ b/src/mame/drivers/nmk16.cpp
@@ -4032,9 +4032,8 @@ MACHINE_CONFIG_START(nmk16_state::tharrier)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_tharrier)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tharrier)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tharrier);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
/* sound hardware */
@@ -4070,9 +4069,8 @@ MACHINE_CONFIG_START(nmk16_state::mustang)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4113,9 +4111,8 @@ MACHINE_CONFIG_START(nmk16_state::mustangb)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4151,9 +4148,8 @@ MACHINE_CONFIG_START(nmk16_state::bioship)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_strahl)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bioship)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bioship);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,bioship)
@@ -4190,9 +4186,8 @@ MACHINE_CONFIG_START(nmk16_state::vandyke)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4232,9 +4227,8 @@ MACHINE_CONFIG_START(nmk16_state::vandykeb)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4257,9 +4251,8 @@ MACHINE_CONFIG_START(nmk16_state::acrobatm)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 768);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4301,9 +4294,8 @@ MACHINE_CONFIG_START(nmk16_state::tdragonb) /* bootleg using Raiden sound har
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4336,9 +4328,8 @@ MACHINE_CONFIG_START(nmk16_state::tdragon)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4383,9 +4374,8 @@ MACHINE_CONFIG_START(nmk16_state::ssmissin)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4412,9 +4402,8 @@ MACHINE_CONFIG_START(nmk16_state::strahl)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_strahl)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_strahl)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_strahl);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,strahl)
@@ -4451,9 +4440,8 @@ MACHINE_CONFIG_START(nmk16_state::hachamf)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4496,9 +4484,8 @@ MACHINE_CONFIG_START(nmk16_state::macross)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4535,9 +4522,8 @@ MACHINE_CONFIG_START(nmk16_state::blkheart)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4574,9 +4560,8 @@ MACHINE_CONFIG_START(nmk16_state::gunnail)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,gunnail)
@@ -4617,9 +4602,8 @@ MACHINE_CONFIG_START(nmk16_state::macross2)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross2)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross2)
@@ -4662,9 +4646,8 @@ MACHINE_CONFIG_START(nmk16_state::tdragon2)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_tdragon2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross2)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross2)
@@ -4714,10 +4697,8 @@ MACHINE_CONFIG_START(nmk16_state::raphero)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_tdragon2)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross2)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,gunnail)
@@ -4756,10 +4737,8 @@ MACHINE_CONFIG_START(nmk16_state::bjtwin)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_bjtwin)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bjtwin)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bjtwin);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,bjtwin)
@@ -4819,9 +4798,8 @@ MACHINE_CONFIG_START(nmk16_state::manybloc)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tharrier)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tharrier);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
@@ -4864,9 +4842,8 @@ MACHINE_CONFIG_START(nmk16_tomagic_state::tomagic)
NMK_HACKY_SCREEN_HIRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,gunnail)
@@ -5388,10 +5365,8 @@ MACHINE_CONFIG_START(nmk16_state::stagger1)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_afega)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_stagger1)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_stagger1);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 768);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,afega)
@@ -5479,10 +5454,8 @@ MACHINE_CONFIG_START(nmk16_state::firehawk)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_firehawk)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_grdnstrm)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_grdnstrm);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 768);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,grdnstrm)
@@ -5520,10 +5493,8 @@ MACHINE_CONFIG_START(nmk16_state::twinactn)
NMK_HACKY_SCREEN_LOWRES
MCFG_SCREEN_UPDATE_DRIVER(nmk16_state, screen_update_macross)
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_macross)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
diff --git a/src/mame/drivers/nokia_3310.cpp b/src/mame/drivers/nokia_3310.cpp
index a4046499fb5..86cbbd2d2b8 100644
--- a/src/mame/drivers/nokia_3310.cpp
+++ b/src/mame/drivers/nokia_3310.cpp
@@ -715,7 +715,7 @@ MACHINE_CONFIG_START(noki3310_state::noki3310)
MCFG_SCREEN_UPDATE_DEVICE("pcd8544", pcd8544_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME_INVERTED("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
MCFG_PCD8544_ADD("pcd8544")
MCFG_PCD8544_SCREEN_UPDATE_CALLBACK(noki3310_state, pcd8544_screen_update)
diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp
index 744a417e9c3..55998287bb3 100644
--- a/src/mame/drivers/norautp.cpp
+++ b/src/mame/drivers/norautp.cpp
@@ -614,7 +614,7 @@ uint32_t norautp_state::screen_update_norautp(screen_device &screen, bitmap_ind1
}
-PALETTE_INIT_MEMBER(norautp_state, norautp)
+void norautp_state::norautp_palette(palette_device &palette) const
{
/* 1st gfx bank */
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0xff)); /* blue */
@@ -1280,9 +1280,7 @@ void norautp_state::noraut_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_norautp);
-
- PALETTE(config, m_palette, 8);
- m_palette->set_init(FUNC(norautp_state::palette_init_norautp));
+ PALETTE(config, m_palette, FUNC(norautp_state::norautp_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp
index d26dd61c627..65a1d53ab0b 100644
--- a/src/mame/drivers/notetaker.cpp
+++ b/src/mame/drivers/notetaker.cpp
@@ -828,7 +828,7 @@ MACHINE_CONFIG_START(notetaker_state::notetakr)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Devices */
CRT5027(config, m_crtc, (36_MHz_XTAL / 4) / 8); // See below
diff --git a/src/mame/drivers/nova2001.cpp b/src/mame/drivers/nova2001.cpp
index 2a32c296723..70cd70d8a2a 100644
--- a/src/mame/drivers/nova2001.cpp
+++ b/src/mame/drivers/nova2001.cpp
@@ -661,13 +661,11 @@ MACHINE_CONFIG_START(nova2001_state::nova2001)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(nova2001_state, screen_update_nova2001)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nova2001)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_nova2001);
+ PALETTE(config, m_palette, FUNC(nova2001_state::nova2001_palette)).set_format(1, &nova2001_state::BBGGRRII, 512);
- MCFG_PALETTE_INIT_OWNER(nova2001_state,nova2001)
MCFG_VIDEO_START_OVERRIDE(nova2001_state,nova2001)
/* sound hardware */
@@ -706,11 +704,10 @@ MACHINE_CONFIG_START(nova2001_state::ninjakun)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(nova2001_state, screen_update_ninjakun)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ninjakun)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ninjakun);
+ PALETTE(config, m_palette).set_format(1, &nova2001_state::BBGGRRII, 768);
MCFG_VIDEO_START_OVERRIDE(nova2001_state,ninjakun)
@@ -742,13 +739,11 @@ MACHINE_CONFIG_START(nova2001_state::pkunwar)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(nova2001_state, screen_update_pkunwar)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pkunwar)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pkunwar);
+ PALETTE(config, m_palette, FUNC(nova2001_state::nova2001_palette)).set_format(1, &nova2001_state::BBGGRRII, 512);
- MCFG_PALETTE_INIT_OWNER(nova2001_state,nova2001)
MCFG_VIDEO_START_OVERRIDE(nova2001_state,pkunwar)
/* sound hardware */
@@ -785,11 +780,10 @@ MACHINE_CONFIG_START(nova2001_state::raiders5)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(nova2001_state, screen_update_raiders5)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_raiders5)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT_CLASS(1, nova2001_state, BBGGRRII)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_raiders5);
+ PALETTE(config, m_palette).set_format(1, &nova2001_state::BBGGRRII, 768);
MCFG_VIDEO_START_OVERRIDE(nova2001_state,raiders5)
diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp
index c94290627dd..0b01b43c99d 100644
--- a/src/mame/drivers/novag6502.cpp
+++ b/src/mame/drivers/novag6502.cpp
@@ -255,7 +255,7 @@ void novagbase_state::display_matrix(int maxx, int maxy, u32 setx, u32 sety, boo
// LCD
-PALETTE_INIT_MEMBER(novagbase_state, novag_lcd)
+void novagbase_state::novag_lcd_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on
@@ -885,8 +885,8 @@ MACHINE_CONFIG_START(novag6502_state::supercon)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 1024) // guessed
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ BEEP(config, m_beeper, 1024); // guessed
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(novag6502_state::cforte)
@@ -909,8 +909,8 @@ MACHINE_CONFIG_START(novag6502_state::cforte)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 32.768_kHz_XTAL/32) // 1024Hz
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ BEEP(config, m_beeper, 32.768_kHz_XTAL/32); // 1024Hz
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(novag6502_state::sexpert)
@@ -945,8 +945,7 @@ MACHINE_CONFIG_START(novag6502_state::sexpert)
MCFG_SCREEN_VISIBLE_AREA(0, 6*16, 0, 10-1)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(novag6502_state, novag_lcd)
+ PALETTE(config, "palette", FUNC(novag6502_state::novag_lcd_palette), 3);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 8)
@@ -957,8 +956,8 @@ MACHINE_CONFIG_START(novag6502_state::sexpert)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 32.768_kHz_XTAL/32) // 1024Hz
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ BEEP(config, m_beeper, 32.768_kHz_XTAL/32); // 1024Hz
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(novag6502_state::sforte)
diff --git a/src/mame/drivers/novag68k.cpp b/src/mame/drivers/novag68k.cpp
index aa0cba70ccf..358e41755d6 100644
--- a/src/mame/drivers/novag68k.cpp
+++ b/src/mame/drivers/novag68k.cpp
@@ -257,8 +257,7 @@ MACHINE_CONFIG_START(novag68k_state::diablo68k)
MCFG_SCREEN_VISIBLE_AREA(0, 6*16, 0, 10-1)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(novag68k_state, novag_lcd)
+ PALETTE(config, "palette", FUNC(novag68k_state::novag_lcd_palette), 3);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 8)
@@ -269,8 +268,8 @@ MACHINE_CONFIG_START(novag68k_state::diablo68k)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 32.768_kHz_XTAL/32) // 1024Hz
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ BEEP(config, m_beeper, 32.768_kHz_XTAL/32); // 1024Hz
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(novag68k_state::scorpio68k)
diff --git a/src/mame/drivers/nsmpoker.cpp b/src/mame/drivers/nsmpoker.cpp
index 3e48e85c58b..3245fade5a9 100644
--- a/src/mame/drivers/nsmpoker.cpp
+++ b/src/mame/drivers/nsmpoker.cpp
@@ -71,30 +71,33 @@
class nsmpoker_state : public driver_device
{
public:
- nsmpoker_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ nsmpoker_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void nsmpoker(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
+ required_device<tms9995_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(nsmpoker_videoram_w);
DECLARE_WRITE8_MEMBER(nsmpoker_colorram_w);
DECLARE_READ8_MEMBER(debug_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(nsmpoker);
- virtual void machine_reset() override;
+ void nsmpoker_palette(palette_device &palette) const;
uint32_t screen_update_nsmpoker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(nsmpoker_interrupt);
- required_device<tms9995_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
void nsmpoker_map(address_map &map);
void nsmpoker_portmap(address_map &map);
};
@@ -149,7 +152,7 @@ uint32_t nsmpoker_state::screen_update_nsmpoker(screen_device &screen, bitmap_in
}
-PALETTE_INIT_MEMBER(nsmpoker_state, nsmpoker)
+void nsmpoker_state::nsmpoker_palette(palette_device &palete) const
{
}
@@ -433,10 +436,8 @@ MACHINE_CONFIG_START(nsmpoker_state::nsmpoker)
MCFG_SCREEN_UPDATE_DRIVER(nsmpoker_state, screen_update_nsmpoker)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nsmpoker)
-
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(nsmpoker_state, nsmpoker)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_nsmpoker);
+ PALETTE(config, "palette", FUNC(nsmpoker_state::nsmpoker_palette), 16);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp
index 371b88fcf05..c057ba4466b 100644
--- a/src/mame/drivers/nwk-tr.cpp
+++ b/src/mame/drivers/nwk-tr.cpp
@@ -884,7 +884,7 @@ void nwktr_state::nwktr(machine_config &config)
rscreen.set_visarea(0, 511, 0, 383);
rscreen.set_screen_update(FUNC(nwktr_state::screen_update_rscreen));
- PALETTE(config, m_palette, 65536);
+ PALETTE(config, m_palette).set_entries(65536);
K001604(config, m_k001604, 0);
m_k001604->set_layer_size(0);
diff --git a/src/mame/drivers/nycaptor.cpp b/src/mame/drivers/nycaptor.cpp
index 873ba5cbfdc..722a9e3853a 100644
--- a/src/mame/drivers/nycaptor.cpp
+++ b/src/mame/drivers/nycaptor.cpp
@@ -761,16 +761,14 @@ void nycaptor_state::nycaptor(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nycaptor);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- INPUT_MERGER_ALL_HIGH(config, "soundnmi").output_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, m_soundlatch2);
@@ -834,15 +832,13 @@ void nycaptor_state::cyclshtg(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nycaptor);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
SPEAKER(config, "speaker").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- INPUT_MERGER_ALL_HIGH(config, "soundnmi").output_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, m_soundlatch2);
@@ -904,15 +900,13 @@ void nycaptor_state::bronx(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_nycaptor);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
SPEAKER(config, "speaker").front_center();
- GENERIC_LATCH_8(config, m_soundlatch);
- m_soundlatch->data_pending_callback().set("soundnmi", FUNC(input_merger_device::in_w<0>));
+ GENERIC_LATCH_8(config, m_soundlatch).data_pending_callback().set(m_soundnmi, FUNC(input_merger_device::in_w<0>));
- INPUT_MERGER_ALL_HIGH(config, "soundnmi").output_handler().set_inputline("audiocpu", INPUT_LINE_NMI);
+ INPUT_MERGER_ALL_HIGH(config, m_soundnmi).output_handler().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, m_soundlatch2);
diff --git a/src/mame/drivers/nyny.cpp b/src/mame/drivers/nyny.cpp
index 2aae25f7b74..c8f9650be34 100644
--- a/src/mame/drivers/nyny.cpp
+++ b/src/mame/drivers/nyny.cpp
@@ -96,8 +96,8 @@
class nyny_state : public driver_device
{
public:
- nyny_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ nyny_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram1(*this, "videoram1"),
m_colorram1(*this, "colorram1"),
m_videoram2(*this, "videoram2"),
@@ -112,7 +112,8 @@ public:
m_pia2(*this, "pia2"),
m_soundlatch(*this, "soundlatch"),
m_soundlatch2(*this, "soundlatch2"),
- m_soundlatch3(*this, "soundlatch3") { }
+ m_soundlatch3(*this, "soundlatch3")
+ { }
void nyny(machine_config &config);
@@ -615,7 +616,7 @@ MACHINE_CONFIG_START(nyny_state::nyny)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
H46505(config, m_mc6845, CRTC_CLOCK);
m_mc6845->set_screen("screen");
diff --git a/src/mame/drivers/odyssey2.cpp b/src/mame/drivers/odyssey2.cpp
index a238708acc3..514a9ec6228 100644
--- a/src/mame/drivers/odyssey2.cpp
+++ b/src/mame/drivers/odyssey2.cpp
@@ -29,13 +29,14 @@
class odyssey2_state : public driver_device
{
public:
- odyssey2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ odyssey2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_i8244(*this, "i8244"),
m_cart(*this, "cartslot"),
m_keyboard(*this, "KEY.%u", 0),
- m_joysticks(*this, "JOY.%u", 0) { }
+ m_joysticks(*this, "JOY.%u", 0)
+ { }
void odyssey2_cartslot(machine_config &config);
void videopac(machine_config &config);
@@ -58,7 +59,7 @@ protected:
DECLARE_READ_LINE_MEMBER(t1_read);
- DECLARE_PALETTE_INIT(odyssey2);
+ void odyssey2_palette(palette_device &palette) const;
DECLARE_WRITE16_MEMBER(scanline_postprocess);
@@ -107,7 +108,7 @@ private:
required_device<i8243_device> m_i8243;
required_device<ef9340_1_device> m_ef9340_1;
- DECLARE_PALETTE_INIT(g7400);
+ void g7400_palette(palette_device &palette) const;
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_WRITE8_MEMBER(p2_write);
@@ -232,67 +233,59 @@ INPUT_PORTS_END
light back / grid colors
black, blue, green, light green, red, violet, yellow, light grey */
-const uint8_t odyssey2_colors[] =
-{
- /* Background,Grid Dim */
- 0x00,0x00,0x00, /* Black */ // i r g b
- 0x1A,0x37,0xBE, /* Blue - Calibrated To Real VideoPac */ // i r g B
- 0x00,0x6D,0x07, /* Green - Calibrated To Real VideoPac */ // i r G b
- 0x2A,0xAA,0xBE, /* Blue-Green - Calibrated To Real VideoPac */ // i r G B
- 0x79,0x00,0x00, /* Red - Calibrated To Real VideoPac */ // i R g b
- 0x94,0x30,0x9F, /* Violet - Calibrated To Real VideoPac */ // i R g B
- 0x77,0x67,0x0B, /* Khaki - Calibrated To Real VideoPac */ // i R g B
- 0xCE,0xCE,0xCE, /* Lt Grey */ // i R G B
-
- /* Background,Grid Bright */
- 0x67,0x67,0x67, /* Grey - Calibrated To Real VideoPac */ // I R g B
- 0x5C,0x80,0xF6, /* Lt Blue - Calibrated To Real VideoPac */ // I R g B
- 0x56,0xC4,0x69, /* Lt Green - Calibrated To Real VideoPac */ // I R g B
- 0x77,0xE6,0xEB, /* Lt Blue-Green - Calibrated To Real VideoPac */ // I R g b
- 0xC7,0x51,0x51, /* Lt Red - Calibrated To Real VideoPac */ // I R g b
- 0xDC,0x84,0xE8, /* Lt Violet - Calibrated To Real VideoPac */ // I R g B
- 0xC6,0xB8,0x6A, /* Lt Yellow - Calibrated To Real VideoPac */ // I R G b
- 0xFF,0xFF,0xFF, /* White */ // I R G B
+constexpr rgb_t odyssey2_colors[] =
+{
+ // Background,Grid Dim
+ { 0x00, 0x00, 0x00 }, /* Black */ // i r g b
+ { 0x1a, 0x37, 0xbe }, /* Blue - Calibrated To Real VideoPac */ // i r g B
+ { 0x00, 0x6d, 0x07 }, /* Green - Calibrated To Real VideoPac */ // i r G b
+ { 0x2a, 0xaa, 0xbe }, /* Blue-Green - Calibrated To Real VideoPac */ // i r G B
+ { 0x79, 0x00, 0x00 }, /* Red - Calibrated To Real VideoPac */ // i R g b
+ { 0x94, 0x30, 0x9f }, /* Violet - Calibrated To Real VideoPac */ // i R g B
+ { 0x77, 0x67, 0x0b }, /* Khaki - Calibrated To Real VideoPac */ // i R g B
+ { 0xce, 0xce, 0xce }, /* Lt Grey */ // i R G B
+
+ // Background,Grid Bright
+ { 0x67, 0x67, 0x67 }, /* Grey - Calibrated To Real VideoPac */ // I R g B
+ { 0x5c, 0x80, 0xf6 }, /* Lt Blue - Calibrated To Real VideoPac */ // I R g B
+ { 0x56, 0xc4, 0x69 }, /* Lt Green - Calibrated To Real VideoPac */ // I R g B
+ { 0x77, 0xe6, 0xeb }, /* Lt Blue-Green - Calibrated To Real VideoPac */ // I R g b
+ { 0xc7, 0x51, 0x51 }, /* Lt Red - Calibrated To Real VideoPac */ // I R g b
+ { 0xdc, 0x84, 0xe8 }, /* Lt Violet - Calibrated To Real VideoPac */ // I R g B
+ { 0xc6, 0xb8, 0x6a }, /* Lt Yellow - Calibrated To Real VideoPac */ // I R G b
+ { 0xff, 0xff, 0xff } /* White */ // I R G B
};
-PALETTE_INIT_MEMBER(odyssey2_state, odyssey2)
+void odyssey2_state::odyssey2_palette(palette_device &palette) const
{
- for ( int i = 0; i < 16; i++ )
- {
- palette.set_pen_color( i, odyssey2_colors[i*3], odyssey2_colors[i*3+1], odyssey2_colors[i*3+2] );
- }
+ palette.set_pen_colors(0, odyssey2_colors);
}
-PALETTE_INIT_MEMBER(g7400_state, g7400)
-{
- const uint8_t g7400_colors[] =
- {
- 0x00,0x00,0x00, // Black
- 0x1A,0x37,0xBE, // Blue
- 0x00,0x6D,0x07, // Green
- 0x2A,0xAA,0xBE, // Blue-Green
- 0x79,0x00,0x00, // Red
- 0x94,0x30,0x9F, // Violet
- 0x77,0x67,0x0B, // Khaki
- 0xCE,0xCE,0xCE, // Lt Grey
-
- 0x67,0x67,0x67, // Grey
- 0x5C,0x80,0xF6, // Lt Blue
- 0x56,0xC4,0x69, // Lt Green
- 0x77,0xE6,0xEB, // Lt Blue-Green
- 0xC7,0x51,0x51, // Lt Red
- 0xDC,0x84,0xE8, // Lt Violet
- 0xC6,0xB8,0x6A, // Lt Yellow
- 0xff,0xff,0xff // White
-
+void g7400_state::g7400_palette(palette_device &palette) const
+{
+ constexpr rgb_t g7400_colors[]{
+ { 0x00, 0x00, 0x00 }, // Black
+ { 0x1a, 0x37, 0xbe }, // Blue
+ { 0x00, 0x6d, 0x07 }, // Green
+ { 0x2a, 0xaa, 0xbe }, // Blue-Green
+ { 0x79, 0x00, 0x00 }, // Red
+ { 0x94, 0x30, 0x9f }, // Violet
+ { 0x77, 0x67, 0x0b }, // Khaki
+ { 0xce, 0xce, 0xce }, // Lt Grey
+
+ { 0x67, 0x67, 0x67 }, // Grey
+ { 0x5c, 0x80, 0xf6 }, // Lt Blue
+ { 0x56, 0xc4, 0x69 }, // Lt Green
+ { 0x77, 0xe6, 0xeb }, // Lt Blue-Green
+ { 0xc7, 0x51, 0x51 }, // Lt Red
+ { 0xdc, 0x84, 0xe8 }, // Lt Violet
+ { 0xc6, 0xb8, 0x6a }, // Lt Yellow
+ { 0xff, 0xff, 0xff } // White
};
- for ( int i = 0; i < 16; i++ )
- {
- palette.set_pen_color( i, g7400_colors[i*3], g7400_colors[i*3+1], g7400_colors[i*3+2] );
- }
+ palette.set_pen_colors(0, g7400_colors);
}
void odyssey2_state::init_odyssey2()
@@ -709,9 +702,8 @@ MACHINE_CONFIG_START(odyssey2_state::odyssey2)
MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_odyssey2)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_odyssey2);
+ PALETTE(config, "palette", FUNC(odyssey2_state::odyssey2_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -736,9 +728,8 @@ MACHINE_CONFIG_START(odyssey2_state::videopac)
MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_odyssey2)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(odyssey2_state, odyssey2)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_odyssey2);
+ PALETTE(config, "palette", FUNC(odyssey2_state::odyssey2_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -772,9 +763,8 @@ MACHINE_CONFIG_START(g7400_state::g7400)
MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_odyssey2)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(g7400_state, g7400)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_odyssey2);
+ PALETTE(config, "palette", FUNC(g7400_state::g7400_palette), 16);
I8243(config, m_i8243);
m_i8243->p4_out_cb().set(FUNC(g7400_state::i8243_p4_w));
@@ -818,9 +808,8 @@ MACHINE_CONFIG_START(g7400_state::odyssey3)
MCFG_SCREEN_UPDATE_DRIVER(odyssey2_state, screen_update_odyssey2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_odyssey2)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(g7400_state, g7400)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_odyssey2);
+ PALETTE(config, "palette", FUNC(g7400_state::g7400_palette), 16);
I8243(config, m_i8243);
m_i8243->p4_out_cb().set(FUNC(g7400_state::i8243_p4_w));
diff --git a/src/mame/drivers/offtwall.cpp b/src/mame/drivers/offtwall.cpp
index 348d182c4c0..4ccdaba7da1 100644
--- a/src/mame/drivers/offtwall.cpp
+++ b/src/mame/drivers/offtwall.cpp
@@ -348,8 +348,7 @@ MACHINE_CONFIG_START(offtwall_state::offtwall)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_offtwall)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
ATARI_VAD(config, m_vad, 0, "screen");
m_vad->scanline_int_cb().set_inputline(m_maincpu, M68K_IRQ_4);
diff --git a/src/mame/drivers/ohmygod.cpp b/src/mame/drivers/ohmygod.cpp
index 30bc747b09b..bc50df1fd15 100644
--- a/src/mame/drivers/ohmygod.cpp
+++ b/src/mame/drivers/ohmygod.cpp
@@ -337,12 +337,11 @@ MACHINE_CONFIG_START(ohmygod_state::ohmygod)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(12*8, (64-12)*8-1, 0*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(ohmygod_state, screen_update_ohmygod)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ohmygod)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ojankohs.cpp b/src/mame/drivers/ojankohs.cpp
index 391881bed32..07afdc92e42 100644
--- a/src/mame/drivers/ojankohs.cpp
+++ b/src/mame/drivers/ojankohs.cpp
@@ -730,10 +730,10 @@ MACHINE_CONFIG_START(ojankohs_state::ojankohs)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 288-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(ojankohs_state, screen_update_ojankohs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ojankohs)
- MCFG_PALETTE_ADD("palette", 1024)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ojankohs);
+ PALETTE(config, m_palette).set_entries(1024);
VSYSTEM_GGA(config, "gga", XTAL(13'333'000)/2); // divider not verified
@@ -771,11 +771,10 @@ MACHINE_CONFIG_START(ojankohs_state::ojankoy)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 288-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(ojankohs_state, screen_update_ojankohs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ojankohs)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INIT_OWNER(ojankohs_state,ojankoy)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ojankohs);
+ PALETTE(config, m_palette, FUNC(ojankohs_state::ojankoy_palette), 1024);
MCFG_VIDEO_START_OVERRIDE(ojankohs_state,ojankoy)
@@ -811,10 +810,10 @@ MACHINE_CONFIG_START(ojankohs_state::ccasino)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 288-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(ojankohs_state, screen_update_ojankohs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ojankohs)
- MCFG_PALETTE_ADD("palette", 1024)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ojankohs);
+ PALETTE(config, m_palette).set_entries(1024);
VSYSTEM_GGA(config, "gga", XTAL(13'333'000)/2); // divider not verified
@@ -852,9 +851,9 @@ MACHINE_CONFIG_START(ojankohs_state::ojankoc)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 8, 248-1)
MCFG_SCREEN_UPDATE_DRIVER(ojankohs_state, screen_update_ojankoc)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 16)
+ PALETTE(config, m_palette).set_entries(16);
MCFG_VIDEO_START_OVERRIDE(ojankohs_state,ojankoc)
diff --git a/src/mame/drivers/okean240.cpp b/src/mame/drivers/okean240.cpp
index 30c102ce069..ce1a6af84e8 100644
--- a/src/mame/drivers/okean240.cpp
+++ b/src/mame/drivers/okean240.cpp
@@ -549,7 +549,7 @@ MACHINE_CONFIG_START(okean240_state::okean240t)
MCFG_SCREEN_UPDATE_DRIVER(okean240_state, screen_update_okean240)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(okean240_state::okean240a)
diff --git a/src/mame/drivers/olibochu.cpp b/src/mame/drivers/olibochu.cpp
index bcd2fd700e5..c2e3866edd9 100644
--- a/src/mame/drivers/olibochu.cpp
+++ b/src/mame/drivers/olibochu.cpp
@@ -65,8 +65,8 @@ $7004 writes, related to $7000 reads
class olibochu_state : public driver_device
{
public:
- olibochu_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ olibochu_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
@@ -74,7 +74,8 @@ public:
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void olibochu(machine_config &config);
@@ -104,7 +105,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(olibochu);
+ void olibochu_palette(palette_device &palette) const;
uint32_t screen_update_olibochu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(olibochu_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
@@ -114,39 +115,32 @@ private:
-PALETTE_INIT_MEMBER(olibochu_state, olibochu)
+void olibochu_state::olibochu_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- uint8_t pen;
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- if (i < 0x100)
- /* characters */
- pen = (color_prom[0x020 + (i - 0x000)] & 0x0f) | 0x10;
- else
- /* sprites */
- pen = (color_prom[0x120 + (i - 0x100)] & 0x0f) | 0x00;
+ uint8_t const pen = (color_prom[0x20 + i] & 0x0f) | ((i < 0x100) ? 0x10 : 0x00);
- /* red component */
+ // red component
bit0 = BIT(color_prom[pen], 0);
bit1 = BIT(color_prom[pen], 1);
bit2 = BIT(color_prom[pen], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = BIT(color_prom[pen], 3);
bit1 = BIT(color_prom[pen], 4);
bit2 = BIT(color_prom[pen], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[pen], 6);
bit1 = BIT(color_prom[pen], 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -478,7 +472,6 @@ MACHINE_CONFIG_START(olibochu_state::olibochu)
// MCFG_QUANTUM_PERFECT_CPU("maincpu")
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -486,18 +479,17 @@ MACHINE_CONFIG_START(olibochu_state::olibochu)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(olibochu_state, screen_update_olibochu)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_olibochu)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(olibochu_state, olibochu)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_olibochu)
+ PALETTE(config, m_palette, FUNC(olibochu_state::olibochu_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
- AY8910(config, "aysnd", 2000000).add_route(ALL_OUTPUTS, "mono", 0.50);
+ AY8910(config, "aysnd", 2'000'000).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
@@ -538,9 +530,9 @@ ROM_START( olibochu )
ROM_LOAD( "12.2a", 0x3000, 0x1000, CRC(d8f0c157) SHA1(a7b0c873e016c3b3252c2c9b6400b0fd3d650b2f) )
ROM_REGION( 0x0220, "proms", 0 )
- ROM_LOAD( "c-1", 0x0000, 0x0020, CRC(e488e831) SHA1(6264741f7091c614093ae1ea4f6ead3d0cef83d3) ) /* palette */
- ROM_LOAD( "c-2", 0x0020, 0x0100, CRC(698a3ba0) SHA1(3c1a6cb881ef74647c651462a27d812234408e45) ) /* sprite lookup table */
- ROM_LOAD( "c-3", 0x0120, 0x0100, CRC(efc4e408) SHA1(f0796426cf324791853aa2ae6d0c3d1f8108d5c2) ) /* char lookup table */
+ ROM_LOAD( "c-1", 0x0000, 0x0020, CRC(e488e831) SHA1(6264741f7091c614093ae1ea4f6ead3d0cef83d3) ) // palette
+ ROM_LOAD( "c-2", 0x0020, 0x0100, CRC(698a3ba0) SHA1(3c1a6cb881ef74647c651462a27d812234408e45) ) // sprite lookup table
+ ROM_LOAD( "c-3", 0x0120, 0x0100, CRC(efc4e408) SHA1(f0796426cf324791853aa2ae6d0c3d1f8108d5c2) ) // char lookup table
ROM_END
diff --git a/src/mame/drivers/olytext.cpp b/src/mame/drivers/olytext.cpp
index ed80b13dfd3..0512ddb6f52 100644
--- a/src/mame/drivers/olytext.cpp
+++ b/src/mame/drivers/olytext.cpp
@@ -161,7 +161,7 @@ MACHINE_CONFIG_START( olytext_state::olytext )
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_UPDATE_DRIVER(olytext_state, screen_update)
//MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* devices */
WD1772(config, "fdc", 16_MHz_XTAL / 8); // divisor guess
diff --git a/src/mame/drivers/ondra.cpp b/src/mame/drivers/ondra.cpp
index ce83be5ca44..12c9f073cd2 100644
--- a/src/mame/drivers/ondra.cpp
+++ b/src/mame/drivers/ondra.cpp
@@ -138,7 +138,7 @@ MACHINE_CONFIG_START(ondra_state::ondra)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ondra_state, vblank_irq))
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// sound hardware
diff --git a/src/mame/drivers/oneshot.cpp b/src/mame/drivers/oneshot.cpp
index d7a3e8860b1..1664d9f8fa1 100644
--- a/src/mame/drivers/oneshot.cpp
+++ b/src/mame/drivers/oneshot.cpp
@@ -380,11 +380,10 @@ MACHINE_CONFIG_START(oneshot_state::oneshot)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 20*16-1, 0*16, 15*16-1)
MCFG_SCREEN_UPDATE_DRIVER(oneshot_state, screen_update_oneshot)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_oneshot)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_oneshot);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x400);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/onetwo.cpp b/src/mame/drivers/onetwo.cpp
index c6f76a78746..2bfb51fcb1d 100644
--- a/src/mame/drivers/onetwo.cpp
+++ b/src/mame/drivers/onetwo.cpp
@@ -63,7 +63,8 @@ public:
m_watchdog(*this, "watchdog"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
- m_soundlatch(*this, "soundlatch") { }
+ m_soundlatch(*this, "soundlatch")
+ { }
void onetwo(machine_config &config);
@@ -92,7 +93,7 @@ private:
DECLARE_WRITE8_MEMBER(coin_counters_w);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_DECODER(BBBGGGGGxBBRRRRR);
+ static rgb_t BBBGGGGGxBBRRRRR(uint32_t raw);
void main_cpu(address_map &map);
void main_cpu_io(address_map &map);
void sound_cpu(address_map &map);
@@ -152,7 +153,7 @@ WRITE8_MEMBER(onetwo_state::coin_counters_w)
machine().bookkeeping().coin_counter_w(1, BIT(data, 2));
}
-PALETTE_DECODER_MEMBER(onetwo_state, BBBGGGGGxBBRRRRR)
+rgb_t onetwo_state::BBBGGGGGxBBRRRRR(uint32_t raw)
{
uint8_t const r = pal5bit((raw >> 0) & 0x1f);
uint8_t const g = pal5bit((raw >> 8) & 0x1f);
@@ -363,7 +364,7 @@ void onetwo_state::onetwo(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_onetwo);
- PALETTE(config, m_palette, 0x80).set_format(raw_to_rgb_converter(2, &onetwo_state::BBBGGGGGxBBRRRRR_decoder));
+ PALETTE(config, m_palette).set_format(2, &onetwo_state::BBBGGGGGxBBRRRRR, 0x80);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/opwolf.cpp b/src/mame/drivers/opwolf.cpp
index 6166f0d908f..71f6202ef6c 100644
--- a/src/mame/drivers/opwolf.cpp
+++ b/src/mame/drivers/opwolf.cpp
@@ -963,9 +963,8 @@ MACHINE_CONFIG_START(opwolf_state::opwolf)
MCFG_SCREEN_UPDATE_DRIVER(opwolf_state, screen_update_opwolf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_opwolf)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_opwolf);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_444, 2048);
PC080SN(config, m_pc080sn, 0);
m_pc080sn->set_gfx_region(1);
@@ -1038,9 +1037,8 @@ MACHINE_CONFIG_START(opwolf_state::opwolfb) /* OSC clocks unknown for the bootle
MCFG_SCREEN_UPDATE_DRIVER(opwolf_state, screen_update_opwolf)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_opwolfb)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_opwolfb);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_444, 2048);
PC080SN(config, m_pc080sn, 0);
m_pc080sn->set_gfx_region(1);
diff --git a/src/mame/drivers/orao.cpp b/src/mame/drivers/orao.cpp
index 745c3d445cd..f8f98b1934e 100644
--- a/src/mame/drivers/orao.cpp
+++ b/src/mame/drivers/orao.cpp
@@ -185,7 +185,7 @@ MACHINE_CONFIG_START(orao_state::orao)
MCFG_SCREEN_UPDATE_DRIVER(orao_state, screen_update_orao)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* audio hardware */
diff --git a/src/mame/drivers/orbit.cpp b/src/mame/drivers/orbit.cpp
index 5ea517896e1..41097621386 100644
--- a/src/mame/drivers/orbit.cpp
+++ b/src/mame/drivers/orbit.cpp
@@ -298,7 +298,7 @@ MACHINE_CONFIG_START(orbit_state::orbit)
MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_orbit)
- MCFG_PALETTE_ADD_MONOCHROME(m_palette)
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/oric.cpp b/src/mame/drivers/oric.cpp
index 6c48048db54..2f931263de7 100644
--- a/src/mame/drivers/oric.cpp
+++ b/src/mame/drivers/oric.cpp
@@ -791,8 +791,7 @@ void oric_state::oric(machine_config &config, bool add_ext)
screen.set_screen_update(FUNC(oric_state::screen_update_oric));
screen.screen_vblank().set(FUNC(oric_state::vblank_w));
- PALETTE(config, m_palette, 8);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/orion.cpp b/src/mame/drivers/orion.cpp
index f324ef9ee72..fdde04dd27a 100644
--- a/src/mame/drivers/orion.cpp
+++ b/src/mame/drivers/orion.cpp
@@ -113,8 +113,7 @@ void orion_state::orion128(machine_config &config)
m_screen->set_screen_update(FUNC(orion_state::screen_update_orion128));
m_screen->set_palette(m_palette);
- auto &palette(PALETTE(config, m_palette, 18));
- palette.set_init(palette_init_delegate(FUNC(orion_state::palette_init_orion128), this));
+ PALETTE(config, m_palette, FUNC(orion_state::orion128_palette), 18);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
@@ -184,8 +183,7 @@ void orion_z80_state::orionz80(machine_config &config)
m_screen->set_screen_update(FUNC(orion_z80_state::screen_update_orion128));
m_screen->set_palette(m_palette);
- auto &palette(PALETTE(config, m_palette, 18));
- palette.set_init(palette_init_delegate(FUNC(orion_z80_state::palette_init_orion128), this));
+ PALETTE(config, m_palette, FUNC(orion_z80_state::orion128_palette), 18);
MC146818(config, "rtc", 4.194304_MHz_XTAL);
@@ -260,9 +258,7 @@ void orion_pro_state::orionpro(machine_config &config)
m_screen->set_screen_update(FUNC(orion_pro_state::screen_update_orion128));
m_screen->set_palette(m_palette);
- auto &palette(PALETTE(config, m_palette, 18));
- palette.set_init(palette_init_delegate(FUNC(orion_pro_state::palette_init_orion128), this));
-
+ PALETTE(config, m_palette, FUNC(orion_pro_state::orion128_palette), 18);
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 1.0);
diff --git a/src/mame/drivers/osbexec.cpp b/src/mame/drivers/osbexec.cpp
index e01519bcbf0..0c2b1e31d79 100644
--- a/src/mame/drivers/osbexec.cpp
+++ b/src/mame/drivers/osbexec.cpp
@@ -537,12 +537,12 @@ MACHINE_CONFIG_START(osbexec_state::osbexec)
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_color(rgb_t::green());
m_screen->set_screen_update(FUNC(osbexec_state::screen_update));
- m_screen->set_raw(MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240); /* May not be correct */
+ m_screen->set_raw(MAIN_CLOCK/2, 768, 0, 640, 260, 0, 240); // May not be correct
m_screen->set_palette("palette");
m_screen->screen_vblank().set(m_pia[0], FUNC(pia6821_device::cb1_w));
m_screen->screen_vblank().append(m_rtc, FUNC(ripple_counter_device::clock_w)).invert();
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME_HIGHLIGHT);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD(m_speaker, SPEAKER_SOUND)
diff --git a/src/mame/drivers/osborne1.cpp b/src/mame/drivers/osborne1.cpp
index 15653f27b1b..21d1f6ea938 100644
--- a/src/mame/drivers/osborne1.cpp
+++ b/src/mame/drivers/osborne1.cpp
@@ -298,7 +298,7 @@ void osborne1_state::osborne1(machine_config &config)
m_screen->set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_osborne1);
- PALETTE(config, "palette", 3).set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, "palette", palette_device::MONOCHROME_HIGHLIGHT);
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker);
diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp
index 1f27adf7746..7e2d26959c6 100644
--- a/src/mame/drivers/othello.cpp
+++ b/src/mame/drivers/othello.cpp
@@ -59,8 +59,8 @@ constexpr uint8_t TILE_WIDTH = 6;
class othello_state : public driver_device
{
public:
- othello_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ othello_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_ay(*this, "ay%u", 0U),
@@ -120,7 +120,7 @@ private:
template<int Shift> void n7751_rom_addr_w(uint8_t data);
void n7751_rom_select_w(uint8_t data);
- DECLARE_PALETTE_INIT(othello);
+ void othello_palette(palette_device &palette) const;
MC6845_UPDATE_ROW(crtc_update_row);
void audio_map(address_map &map);
@@ -149,14 +149,12 @@ MC6845_UPDATE_ROW( othello_state::crtc_update_row )
}
}
-PALETTE_INIT_MEMBER(othello_state, othello)
+void othello_state::othello_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
- {
palette.set_pen_color(i, rgb_t(0xff, 0x00, 0xff));
- }
- /* only colors 2,3,7,9,c,d,f are used */
+ // only colors 2,3,7,9,c,d,f are used
palette.set_pen_color(0x02, rgb_t(0x00, 0xff, 0x00));
palette.set_pen_color(0x03, rgb_t(0xff, 0x7f, 0x00));
palette.set_pen_color(0x07, rgb_t(0x00, 0x00, 0x00));
@@ -183,8 +181,6 @@ READ8_MEMBER(othello_state::unk_87_r)
WRITE8_MEMBER(othello_state::unk_8a_w)
{
/*
-
-
m_n7751_command = (data & 0x07);
m_n7751->set_input_line(0, ((data & 0x08) == 0) ? ASSERT_LINE : CLEAR_LINE);
//m_n7751->set_input_line(0, (data & 0x02) ? CLEAR_LINE : ASSERT_LINE);
@@ -421,7 +417,7 @@ void othello_state::othello(machine_config &config)
screen.set_visarea(0*8, 64*6-1, 0*8, 64*8-1);
screen.set_screen_update("crtc", FUNC(h46505_device::screen_update));
- PALETTE(config, m_palette, 0x10).set_init(palette_init_delegate(FUNC(othello_state::palette_init_othello), this));
+ PALETTE(config, m_palette, FUNC(othello_state::othello_palette), 0x10);
h46505_device &crtc(H46505(config, "crtc", 1000000 /* ? MHz */)); /* H46505 @ CPU clock */
crtc.set_screen("screen");
@@ -435,7 +431,6 @@ void othello_state::othello(machine_config &config)
GENERIC_LATCH_8(config, m_soundlatch);
AY8910(config, m_ay[0], 2000000).add_route(ALL_OUTPUTS, "speaker", 0.15);
-
AY8910(config, m_ay[1], 2000000).add_route(ALL_OUTPUTS, "speaker", 0.15);
DAC_8BIT_R2R(config, "dac", 0).add_route(ALL_OUTPUTS, "speaker", 0.3); // unknown DAC
diff --git a/src/mame/drivers/overdriv.cpp b/src/mame/drivers/overdriv.cpp
index 7e6f1e58ec7..7f829d59bce 100644
--- a/src/mame/drivers/overdriv.cpp
+++ b/src/mame/drivers/overdriv.cpp
@@ -353,9 +353,7 @@ void overdriv_state::overdriv(machine_config &config)
screen.set_screen_update(FUNC(overdriv_state::screen_update_overdriv));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- palette.enable_shadows();
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K053246(config, m_k053246, 0);
m_k053246->set_sprite_callback(FUNC(overdriv_state::sprite_callback), this);
diff --git a/src/mame/drivers/p112.cpp b/src/mame/drivers/p112.cpp
index 5ba2a118d72..178c57f5d9d 100644
--- a/src/mame/drivers/p112.cpp
+++ b/src/mame/drivers/p112.cpp
@@ -43,8 +43,9 @@ class p112_state : public driver_device
{
public:
p112_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
- m_maincpu(*this, "maincpu") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ { }
void p112(machine_config &config);
@@ -105,7 +106,7 @@ MACHINE_CONFIG_START(p112_state::p112)
MCFG_SCREEN_UPDATE_DRIVER(p112_state, screen_update_p112)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/p2000t.cpp b/src/mame/drivers/p2000t.cpp
index be24e37b5ac..67d0cb832a7 100644
--- a/src/mame/drivers/p2000t.cpp
+++ b/src/mame/drivers/p2000t.cpp
@@ -83,12 +83,12 @@ static const gfx_layout p2000m_charlayout =
8 * 10
};
-PALETTE_INIT_MEMBER(p2000m_state,p2000m)
+void p2000m_state::p2000m_palette(palette_device &palette) const
{
- palette.set_pen_color(0,rgb_t::white()); /* white */
- palette.set_pen_color(1,rgb_t::black()); /* black */
- palette.set_pen_color(2,rgb_t::black()); /* black */
- palette.set_pen_color(3,rgb_t::white()); /* white */
+ palette.set_pen_color(0, rgb_t::white()); // white
+ palette.set_pen_color(1, rgb_t::black()); // black
+ palette.set_pen_color(2, rgb_t::black()); // black
+ palette.set_pen_color(3, rgb_t::white()); // white
}
static GFXDECODE_START( gfx_p2000m )
@@ -263,16 +263,14 @@ MACHINE_CONFIG_START(p2000m_state::p2000m)
MCFG_SCREEN_SIZE(80 * 12, 24 * 20)
MCFG_SCREEN_VISIBLE_AREA(0, 80 * 12 - 1, 0, 24 * 20 - 1)
MCFG_SCREEN_UPDATE_DRIVER(p2000m_state, screen_update_p2000m)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_p2000m)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(p2000m_state,p2000m)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_p2000m);
+ PALETTE(config, m_palette, FUNC(p2000m_state::p2000m_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/pacland.cpp b/src/mame/drivers/pacland.cpp
index c0291f71d81..79d5851b8e1 100644
--- a/src/mame/drivers/pacland.cpp
+++ b/src/mame/drivers/pacland.cpp
@@ -438,9 +438,7 @@ void pacland_state::pacland(machine_config &config)
m_screen->screen_vblank().set(FUNC(pacland_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pacland);
- PALETTE(config, m_palette, 256*4+256*4+64*16);
- m_palette->set_indirect_entries(256);
- m_palette->set_init(FUNC(pacland_state::palette_init_pacland));
+ PALETTE(config, m_palette, FUNC(pacland_state::pacland_palette), 256*4 + 256*4 + 64*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pacman.cpp b/src/mame/drivers/pacman.cpp
index d93521c16cf..a7f551473d0 100644
--- a/src/mame/drivers/pacman.cpp
+++ b/src/mame/drivers/pacman.cpp
@@ -3544,11 +3544,9 @@ void pacman_state::pacman(machine_config &config, bool latch)
m_watchdog->set_vblank_count("screen", 16);
/* video hardware */
- GFXDECODE(config, m_gfxdecode, "palette", gfx_pacman);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pacman);
- PALETTE(config, m_palette, 128*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(DEVICE_SELF, FUNC(pacman_state::palette_init_pacman));
+ PALETTE(config, m_palette, FUNC(pacman_state::pacman_palette), 128*4, 32);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
diff --git a/src/mame/drivers/palm.cpp b/src/mame/drivers/palm.cpp
index 68874958871..21643b58ecd 100644
--- a/src/mame/drivers/palm.cpp
+++ b/src/mame/drivers/palm.cpp
@@ -48,29 +48,31 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(pen_check);
DECLARE_INPUT_CHANGED_MEMBER(button_check);
-private:
- required_device<cpu_device> m_maincpu;
- required_device<mc68328_device> m_lsi;
- required_device<ram_device> m_ram;
- uint8_t m_port_f_latch;
- uint16_t m_spim_data;
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+
+private:
DECLARE_WRITE8_MEMBER(palm_port_f_out);
DECLARE_READ8_MEMBER(palm_port_c_in);
DECLARE_READ8_MEMBER(palm_port_f_in);
DECLARE_WRITE16_MEMBER(palm_spim_out);
DECLARE_READ16_MEMBER(palm_spim_in);
DECLARE_WRITE_LINE_MEMBER(palm_spim_exchange);
- DECLARE_PALETTE_INIT(palm);
+ void palm_palette(palette_device &palette) const;
+ offs_t palm_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer &params);
+ void palm_map(address_map &map);
+
+ required_device<cpu_device> m_maincpu;
+ required_device<mc68328_device> m_lsi;
+ required_device<ram_device> m_ram;
+ uint8_t m_port_f_latch;
+ uint16_t m_spim_data;
required_ioport m_io_penx;
required_ioport m_io_peny;
required_ioport m_io_penb;
required_ioport m_io_portd;
-
- offs_t palm_dasm_override(std::ostream &stream, offs_t pc, const util::disasm_interface::data_buffer &opcodes, const util::disasm_interface::data_buffer &params);
- void palm_map(address_map &map);
};
@@ -158,7 +160,7 @@ void palm_state::machine_reset()
}
/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */
-PALETTE_INIT_MEMBER(palm_state, palm)
+void palm_state::palm_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0x7b, 0x8c, 0x5a);
palette.set_pen_color(1, 0x00, 0x00, 0x00);
@@ -198,8 +200,7 @@ MACHINE_CONFIG_START(palm_state::palm)
MCFG_SCREEN_UPDATE_DEVICE(MC68328_TAG, mc68328_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD( "palette", 2 )
- MCFG_PALETTE_INIT_OWNER(palm_state, palm)
+ PALETTE(config, "palette", FUNC(palm_state::palm_palette), 2);
/* audio hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/pandoras.cpp b/src/mame/drivers/pandoras.cpp
index 545220ea313..a6ceb3c40f6 100644
--- a/src/mame/drivers/pandoras.cpp
+++ b/src/mame/drivers/pandoras.cpp
@@ -343,14 +343,11 @@ MACHINE_CONFIG_START(pandoras_state::pandoras)
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(pandoras_state, screen_update_pandoras)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, pandoras_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pandoras)
-
- MCFG_PALETTE_ADD("palette", 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(pandoras_state, pandoras)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pandoras);
+ PALETTE(config, m_palette, FUNC(pandoras_state::pandoras_palette), 16*16+16*16, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/panicr.cpp b/src/mame/drivers/panicr.cpp
index d238882b2e5..a4cef282692 100644
--- a/src/mame/drivers/panicr.cpp
+++ b/src/mame/drivers/panicr.cpp
@@ -74,8 +74,8 @@ D.9B [f99cac4b] /
class panicr_state : public driver_device
{
public:
- panicr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ panicr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_t5182(*this, "t5182"),
m_gfxdecode(*this, "gfxdecode"),
@@ -84,7 +84,8 @@ public:
m_mainram(*this, "mainram"),
m_spriteram(*this, "spriteram"),
m_textram(*this, "textram"),
- m_spritebank(*this, "spritebank") { }
+ m_spritebank(*this, "spritebank")
+ { }
void panicr(machine_config &config);
@@ -123,10 +124,10 @@ private:
TILE_GET_INFO_MEMBER(get_txttile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(panicr);
+ void panicr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect );
+ void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
void panicr_map(address_map &map);
@@ -144,57 +145,45 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(panicr_state, panicr)
+void panicr_state::panicr_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
// txt lookup table
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
-
- if (color_prom[i] & 0x40)
- ctabentry = 0;
- else
- ctabentry = (color_prom[i] & 0x3f) | 0x80;
-
+ uint8_t const ctabentry = (color_prom[i] & 0x40) ? 0 : ((color_prom[i] & 0x3f) | 0x80);
palette.set_pen_indirect(i, ctabentry);
}
// tile lookup table
- for (i = 0x000; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i+0x100] & 0x3f) | 0x00;
+ uint8_t const ctabentry = (color_prom[i + 0x100] & 0x3f) | 0x00;
- palette.set_pen_indirect(((i&0x0f) + ((i&0xf0)<<1)) +0x200, ctabentry);
- palette.set_pen_indirect(((i&0x0f) + ((i&0xf0)<<1)) +0x210, ctabentry);
+ palette.set_pen_indirect(((i & 0x0f) + ((i & 0xf0) << 1)) + 0x200, ctabentry);
+ palette.set_pen_indirect(((i & 0x0f) + ((i & 0xf0) << 1)) + 0x210, ctabentry);
}
// sprite lookup table
- for (i = 0x000; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
-
- if (color_prom[i+0x200] & 0x40)
- ctabentry = 0;
- else
- ctabentry = (color_prom[i+0x200] & 0x3f) | 0x40;
+ uint8_t const ctabentry = (color_prom[i + 0x200] & 0x40) ? 0 : ((color_prom[i + 0x200] & 0x3f) | 0x40);
- palette.set_pen_indirect(i+0x100, ctabentry);
+ palette.set_pen_indirect(i + 0x100, ctabentry);
}
}
@@ -628,12 +617,10 @@ MACHINE_CONFIG_START(panicr_state::panicr)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(panicr_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_panicr)
- MCFG_PALETTE_ADD("palette", 256*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(panicr_state, panicr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_panicr);
+ PALETTE(config, m_palette, FUNC(panicr_state::panicr_palette), 256 * 4, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/paradise.cpp b/src/mame/drivers/paradise.cpp
index 78ffc541953..0db6858a5d7 100644
--- a/src/mame/drivers/paradise.cpp
+++ b/src/mame/drivers/paradise.cpp
@@ -747,10 +747,10 @@ MACHINE_CONFIG_START(paradise_state::paradise)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0+16, 256-1-16)
MCFG_SCREEN_UPDATE_DRIVER(paradise_state, screen_update_paradise)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_paradise)
- MCFG_PALETTE_ADD("palette", 0x800 + 16)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_paradise);
+ PALETTE(config, m_palette).set_entries(0x800 + 16);
/* sound hardware */
diff --git a/src/mame/drivers/parodius.cpp b/src/mame/drivers/parodius.cpp
index ad3dce6d847..1d4bb5f05ff 100644
--- a/src/mame/drivers/parodius.cpp
+++ b/src/mame/drivers/parodius.cpp
@@ -253,9 +253,7 @@ void parodius_state::parodius(machine_config &config)
screen.set_screen_update(FUNC(parodius_state::screen_update_parodius));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/partner.cpp b/src/mame/drivers/partner.cpp
index e9920997add..367f0122f96 100644
--- a/src/mame/drivers/partner.cpp
+++ b/src/mame/drivers/partner.cpp
@@ -188,9 +188,8 @@ void partner_state::partner(machine_config &config)
screen.set_size(78*6, 30*10);
screen.set_visarea(0, 78*6-1, 0, 30*10-1);
- GFXDECODE(config, "gfxdecode", "palette", gfx_partner);
- auto &palette(PALETTE(config, m_palette, 3));
- palette.set_init(palette_init_delegate(FUNC(radio86_state::palette_init_radio86), this));
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_partner);
+ PALETTE(config, m_palette, FUNC(partner_state::radio86_palette), 3);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/pasha2.cpp b/src/mame/drivers/pasha2.cpp
index 664e65ccaef..9acbc634bb2 100644
--- a/src/mame/drivers/pasha2.cpp
+++ b/src/mame/drivers/pasha2.cpp
@@ -418,9 +418,9 @@ MACHINE_CONFIG_START(pasha2_state::pasha2)
MCFG_SCREEN_SIZE(512, 512)
MCFG_SCREEN_VISIBLE_AREA(0, 383, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(pasha2_state, screen_update_pasha2)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x200)
+ PALETTE(config, m_palette).set_entries(0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pasopia7.cpp b/src/mame/drivers/pasopia7.cpp
index 08a7a753c8c..ce1d0834d02 100644
--- a/src/mame/drivers/pasopia7.cpp
+++ b/src/mame/drivers/pasopia7.cpp
@@ -92,7 +92,7 @@ private:
DECLARE_READ8_MEMBER(nmi_portb_r);
TIMER_CALLBACK_MEMBER(pio_timer);
DECLARE_VIDEO_START(pasopia7);
- DECLARE_PALETTE_INIT(p7_lcd);
+ void p7_lcd_palette(palette_device &palette) const;
uint32_t screen_update_pasopia7(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void pasopia7_io(address_map &map);
@@ -900,14 +900,12 @@ void pasopia7_state::machine_reset()
m_nmi_reset |= 4;
}
-/* TODO: palette values are mostly likely to be wrong in there */
-PALETTE_INIT_MEMBER(pasopia7_state,p7_lcd)
+// TODO: palette values are mostly likely to be wrong in there
+void pasopia7_state::p7_lcd_palette(palette_device &palette) const
{
- int i;
-
palette.set_pen_color(0, 0xa0, 0xa8, 0xa0);
- for( i = 1; i < 8; i++)
+ for (int i = 1; i < 8; i++)
palette.set_pen_color(i, 0x30, 0x38, 0x10);
}
@@ -978,12 +976,12 @@ MACHINE_CONFIG_START(pasopia7_state::p7_raster)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 32-1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7)
MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7)
- MCFG_PALETTE_ADD_3BIT_BRG("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pasopia7)
+ PALETTE(config, m_palette, palette_device::BRG_3BIT);
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_pasopia7);
H46505(config, m_crtc, VDP_CLOCK); /* unknown clock, hand tuned to get ~60 fps */
m_crtc->set_screen("screen");
@@ -1001,11 +999,10 @@ MACHINE_CONFIG_START(pasopia7_state::p7_lcd)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_VIDEO_START_OVERRIDE(pasopia7_state,pasopia7)
MCFG_SCREEN_UPDATE_DRIVER(pasopia7_state, screen_update_pasopia7)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(pasopia7_state,p7_lcd)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pasopia7)
+ PALETTE(config, m_palette, FUNC(pasopia7_state::p7_lcd_palette), 8);
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_pasopia7);
H46505(config, m_crtc, LCD_CLOCK); /* unknown clock, hand tuned to get ~60 fps */
m_crtc->set_screen("screen");
diff --git a/src/mame/drivers/pass.cpp b/src/mame/drivers/pass.cpp
index 2a20556b217..4bc1a2f511f 100644
--- a/src/mame/drivers/pass.cpp
+++ b/src/mame/drivers/pass.cpp
@@ -262,9 +262,8 @@ MACHINE_CONFIG_START(pass_state::pass)
MCFG_SCREEN_UPDATE_DRIVER(pass_state, screen_update_pass)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pass)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_pass);
/* sound hardware */
diff --git a/src/mame/drivers/pastelg.cpp b/src/mame/drivers/pastelg.cpp
index 9bb5ed4c1df..84d48465236 100644
--- a/src/mame/drivers/pastelg.cpp
+++ b/src/mame/drivers/pastelg.cpp
@@ -418,8 +418,7 @@ MACHINE_CONFIG_START(pastelg_state::pastelg)
MCFG_SCREEN_UPDATE_DRIVER(pastelg_state, screen_update_pastelg)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(pastelg_state, pastelg)
+ PALETTE(config, "palette", FUNC(pastelg_state::pastelg_palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -477,8 +476,7 @@ MACHINE_CONFIG_START(pastelg_state::threeds)
MCFG_SCREEN_UPDATE_DRIVER(pastelg_state, screen_update_pastelg)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(pastelg_state, pastelg)
+ PALETTE(config, "palette", FUNC(pastelg_state::pastelg_palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/patapata.cpp b/src/mame/drivers/patapata.cpp
index b79926f4405..21386d69fa7 100644
--- a/src/mame/drivers/patapata.cpp
+++ b/src/mame/drivers/patapata.cpp
@@ -292,7 +292,7 @@ MACHINE_CONFIG_START(patapata_state::patapata)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", patapata_state, irq4_line_hold) // 1 + 4 valid? (4 main VBL)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", patapata_state, scanline, "screen", 0, 1)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_patapata)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_patapata)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -302,8 +302,7 @@ MACHINE_CONFIG_START(patapata_state::patapata)
MCFG_SCREEN_UPDATE_DRIVER(patapata_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x600/2)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, "palette").set_format(palette_device::RRRRGGGGBBBBRGBx, 0x600/2);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pb1000.cpp b/src/mame/drivers/pb1000.cpp
index ef6071ea5ed..71e02d06613 100644
--- a/src/mame/drivers/pb1000.cpp
+++ b/src/mame/drivers/pb1000.cpp
@@ -37,14 +37,14 @@
class pb1000_state : public driver_device
{
public:
- pb1000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_beeper(*this, "beeper"),
- m_hd44352(*this, "hd44352"),
- m_card1(*this, "cardslot1"),
- m_card2(*this, "cardslot2")
- { }
+ pb1000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_beeper(*this, "beeper"),
+ m_hd44352(*this, "hd44352"),
+ m_card1(*this, "cardslot1"),
+ m_card2(*this, "cardslot2")
+ { }
void pb2000c(machine_config &config);
void pb1000(machine_config &config);
@@ -76,7 +76,7 @@ private:
DECLARE_READ8_MEMBER( pb2000c_port_r );
DECLARE_WRITE8_MEMBER( port_w );
uint16_t read_touchscreen(uint8_t line);
- DECLARE_PALETTE_INIT(pb1000);
+ void pb1000_palette(palette_device &palette) const;
TIMER_CALLBACK_MEMBER(keyboard_timer);
void pb1000_mem(address_map &map);
void pb2000c_mem(address_map &map);
@@ -308,7 +308,7 @@ static INPUT_PORTS_START( pb2000c )
PORT_BIT(0xffff, IP_ACTIVE_HIGH, IPT_UNUSED)
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(pb1000_state, pb1000)
+void pb1000_state::pb1000_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -504,7 +504,7 @@ void pb1000_state::pb1000(machine_config &config)
screen.set_visarea(0, 192-1, 0, 32-1);
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init(FUNC(pb1000_state::palette_init_pb1000));
+ PALETTE(config, "palette", FUNC(pb1000_state::pb1000_palette), 2);
GFXDECODE(config, "gfxdecode", "palette", gfx_pb1000);
HD44352(config, m_hd44352, 910000);
@@ -521,6 +521,7 @@ void pb1000_state::pb1000(machine_config &config)
void pb1000_state::pb2000c(machine_config &config)
{
pb1000(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &pb1000_state::pb2000c_mem);
m_maincpu->kb_read().set(FUNC(pb1000_state::pb2000c_kb_r));
diff --git a/src/mame/drivers/pbaction.cpp b/src/mame/drivers/pbaction.cpp
index 45bc9428afb..0e12ebdd703 100644
--- a/src/mame/drivers/pbaction.cpp
+++ b/src/mame/drivers/pbaction.cpp
@@ -469,12 +469,11 @@ MACHINE_CONFIG_START(pbaction_state::pbaction)
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(pbaction_state, screen_update_pbaction)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, pbaction_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pbaction)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pbaction);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -482,9 +481,7 @@ MACHINE_CONFIG_START(pbaction_state::pbaction)
GENERIC_LATCH_8(config, m_soundlatch);
AY8910(config, "ay1", 12_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.25);
-
AY8910(config, "ay2", 12_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.25);
-
AY8910(config, "ay3", 12_MHz_XTAL/8).add_route(ALL_OUTPUTS, "mono", 0.25);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/pc100.cpp b/src/mame/drivers/pc100.cpp
index deee05ca664..5faf9330f26 100644
--- a/src/mame/drivers/pc100.cpp
+++ b/src/mame/drivers/pc100.cpp
@@ -75,8 +75,8 @@
class pc100_state : public driver_device
{
public:
- pc100_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pc100_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beeper(*this, "beeper"),
m_rtc(*this, "rtc"),
@@ -687,14 +687,12 @@ MACHINE_CONFIG_START(pc100_state::pc100)
MCFG_SCREEN_UPDATE_DRIVER(pc100_state, screen_update_pc100)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc100)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_FORMAT(xxxxxxxBBBGGGRRR)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_pc100);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_333, 16);
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 2400)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
+ BEEP(config, m_beeper, 2400).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/pc1500.cpp b/src/mame/drivers/pc1500.cpp
index 4a19eb5fd1b..e8985bc15f1 100644
--- a/src/mame/drivers/pc1500.cpp
+++ b/src/mame/drivers/pc1500.cpp
@@ -37,6 +37,9 @@ public:
void pc1500(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+
private:
required_device<lh5801_cpu_device> m_maincpu;
required_device<upd1990a_device> m_rtc;
@@ -48,7 +51,6 @@ private:
uint8_t m_kb_matrix;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- virtual void machine_reset() override;
DECLARE_WRITE8_MEMBER( kb_matrix_w );
DECLARE_READ8_MEMBER( port_a_r );
@@ -56,7 +58,7 @@ private:
DECLARE_WRITE8_MEMBER( port_c_w );
DECLARE_READ8_MEMBER( pc1500_kb_r );
- DECLARE_PALETTE_INIT(pc1500);
+ void pc1500_palette(palette_device &palette) const;
void pc1500_mem(address_map &map);
void pc1500_mem_io(address_map &map);
};
@@ -264,7 +266,7 @@ READ8_MEMBER( pc1500_state::port_a_r )
return 0xff;
}
-PALETTE_INIT_MEMBER(pc1500_state, pc1500)
+void pc1500_state::pc1500_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -286,7 +288,7 @@ void pc1500_state::pc1500(machine_config &config)
screen.set_palette("palette");
config.set_default_layout(layout_pc1500);
- PALETTE(config, "palette", 2).set_init(FUNC(pc1500_state::palette_init_pc1500));
+ PALETTE(config, "palette", FUNC(pc1500_state::pc1500_palette), 2);
lh5810_device &ioports(LH5810(config, "lh5810"));
ioports.porta_r().set(FUNC(pc1500_state::port_a_r));
diff --git a/src/mame/drivers/pc2000.cpp b/src/mame/drivers/pc2000.cpp
index 1d690b99170..0cf410cf845 100644
--- a/src/mame/drivers/pc2000.cpp
+++ b/src/mame/drivers/pc2000.cpp
@@ -62,7 +62,7 @@ protected:
DECLARE_WRITE8_MEMBER( rombank2_w );
DECLARE_READ8_MEMBER( beep_r );
DECLARE_WRITE8_MEMBER( beep_w );
- DECLARE_PALETTE_INIT(pc2000);
+ void pc2000_palette(palette_device &palette) const;
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pc2000_cart);
void pc2000_io(address_map &map);
@@ -846,7 +846,7 @@ void pc1000_state::machine_reset()
m_bank1->set_entry(0);
}
-PALETTE_INIT_MEMBER(pc2000_state, pc2000)
+void pc2000_state::pc2000_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -897,7 +897,7 @@ void pc2000_state::pc2000(machine_config &config)
m_screen->set_visarea(0, 120-1, 0, 18-1);
m_screen->set_palette("palette");
- PALETTE(config, "palette", 2).set_init(FUNC(pc2000_state::palette_init_pc2000));
+ PALETTE(config, "palette", FUNC(pc2000_state::pc2000_palette), 2);
GFXDECODE(config, "gfxdecode", "palette", gfx_pc2000);
HD44780(config, m_lcdc, 0);
@@ -916,6 +916,7 @@ void pc2000_state::pc2000(machine_config &config)
void pc2000_state::gl2000(machine_config &config)
{
pc2000(config);
+
SOFTWARE_LIST(config, "cart_list").set_original("gl2000");
SOFTWARE_LIST(config, "misterx_cart").set_compatible("misterx");
}
@@ -940,6 +941,7 @@ HD44780_PIXEL_UPDATE(gl4004_state::gl4000_pixel_update)
void gl3000s_state::gl3000s(machine_config &config)
{
pc2000(config);
+
m_maincpu->set_addrmap(AS_IO, &gl3000s_state::gl3000s_io);
config.device_remove("hd44780");
@@ -960,6 +962,7 @@ MACHINE_CONFIG_END
void gl4004_state::gl4000(machine_config &config)
{
pc2000(config);
+
m_screen->set_size(120, 36); // 4x20 chars
m_screen->set_visarea(0, 120-1, 0, 36-1);
@@ -973,6 +976,7 @@ void gl4004_state::gl4000(machine_config &config)
void pc1000_state::misterx(machine_config &config)
{
pc2000(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &pc1000_state::pc1000_mem);
m_maincpu->set_addrmap(AS_IO, &pc1000_state::pc1000_io);
@@ -992,6 +996,7 @@ void pc1000_state::misterx(machine_config &config)
void pc1000_state::pc1000(machine_config &config)
{
misterx(config);
+
config.device_remove("cart_list");
config.device_remove("pc1000_cart");
SOFTWARE_LIST(config, "cart_list").set_original("pc1000");
diff --git a/src/mame/drivers/pc4.cpp b/src/mame/drivers/pc4.cpp
index 0859094e4c2..a2661b1aa1c 100644
--- a/src/mame/drivers/pc4.cpp
+++ b/src/mame/drivers/pc4.cpp
@@ -166,7 +166,7 @@ static INPUT_PORTS_START( pc4 )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_UNUSED)
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(pc4_state, pc4)
+void pc4_state::pc4_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -231,14 +231,12 @@ MACHINE_CONFIG_START(pc4_state::pc4)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 36-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pc4_state, pc4)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc4)
+ PALETTE(config, "palette", FUNC(pc4_state::pc4_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_pc4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD( "beeper", BEEP, 3250 )
- MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 1.00);
RP5C01(config, "rtc", XTAL(32'768));
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/pc6001.cpp b/src/mame/drivers/pc6001.cpp
index 107118c63d3..8ce0970755b 100644
--- a/src/mame/drivers/pc6001.cpp
+++ b/src/mame/drivers/pc6001.cpp
@@ -1491,7 +1491,7 @@ MACHINE_CONFIG_START(pc6001_state::pc6001)
// MCFG_DEVICE_ADD("subcpu", I8049, 7987200)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc6001m2)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_pc6001m2);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
@@ -1499,10 +1499,9 @@ MACHINE_CONFIG_START(pc6001_state::pc6001)
MCFG_SCREEN_UPDATE_DRIVER(pc6001_state, screen_update_pc6001)
MCFG_SCREEN_SIZE(320, 25+192+26)
MCFG_SCREEN_VISIBLE_AREA(0, 319, 0, 239)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 16+4)
- MCFG_PALETTE_INIT_OWNER(pc6001_state, pc6001)
+ PALETTE(config, m_palette, FUNC(pc6001_state::pc6001_palette), 16+4);
I8255(config, m_ppi);
m_ppi->in_pa_callback().set(FUNC(pc6001_state::ppi_porta_r));
@@ -1547,9 +1546,8 @@ MACHINE_CONFIG_START(pc6001mk2_state::pc6001mk2)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(pc6001mk2_state, screen_update_pc6001mk2)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(16+16)
- MCFG_PALETTE_INIT_OWNER(pc6001mk2_state,pc6001mk2)
+ m_palette->set_entries(16+16);
+ m_palette->set_init(FUNC(pc6001mk2_state::pc6001mk2_palette));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_pc6001m2)
diff --git a/src/mame/drivers/pc8801.cpp b/src/mame/drivers/pc8801.cpp
index aaef108e59a..874ffa4b93d 100644
--- a/src/mame/drivers/pc8801.cpp
+++ b/src/mame/drivers/pc8801.cpp
@@ -2303,11 +2303,9 @@ MACHINE_RESET_MEMBER(pc8801_state,pc8801_cdrom)
}
}
-PALETTE_INIT_MEMBER(pc8801_state, pc8801)
+void pc8801_state::pc8801_palette(palette_device &palette) const
{
- int i;
-
- for(i=0;i<0x10;i++) //text + bitmap
+ for(int i = 0; i< 0x10; i++) //text + bitmap
palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
}
@@ -2395,11 +2393,10 @@ MACHINE_CONFIG_START(pc8801_state::pc8801)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK_24KHz,848,0,640,448,0,400)
MCFG_SCREEN_UPDATE_DRIVER(pc8801_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pc8801)
- MCFG_PALETTE_ADD("palette", 0x10)
- MCFG_PALETTE_INIT_OWNER(pc8801_state, pc8801)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_pc8801);
+ PALETTE(config, m_palette, FUNC(pc8801_state::pc8801_palette), 0x10);
// MCFG_VIDEO_START_OVERRIDE(pc8801_state,pc8801)
diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp
index bb5ab0fffed..63a1b75d4ad 100644
--- a/src/mame/drivers/pc9801.cpp
+++ b/src/mame/drivers/pc9801.cpp
@@ -2030,14 +2030,13 @@ uint32_t pc9801_state::a20_286(bool state)
****************************************/
//
-PALETTE_INIT_MEMBER(pc9801_state,pc9801)
+void pc9801_state::pc9801_palette(palette_device &palette) const
{
- int i;
-
- for(i=0;i<8;i++)
+ for(int i = 0; i < 8; i++)
palette.set_pen_color(i, pal1bit(i >> 1), pal1bit(i >> 2), pal1bit(i >> 0));
- for(i=8;i<palette.entries();i++)
- palette.set_pen_color(i, pal1bit(0), pal1bit(0), pal1bit(0));
+
+ for(int i = 8; i < palette.entries(); i++)
+ palette.set_pen_color(i, rgb_t::black());
}
MACHINE_START_MEMBER(pc9801_state,pc9801_common)
@@ -2408,7 +2407,7 @@ void pc9801_state::pc9801(machine_config &config)
m_dmac->in_ior_callback<3>().set(m_fdc_2dd, FUNC(upd765a_device::mdma_r));
m_dmac->out_iow_callback<3>().set(m_fdc_2dd, FUNC(upd765a_device::mdma_w));
- PALETTE(config, m_palette, 16).set_init(FUNC(pc9801_state::palette_init_pc9801));
+ PALETTE(config, m_palette, FUNC(pc9801_state::pc9801_palette), 16);
}
@@ -2435,7 +2434,7 @@ void pc9801_state::pc9801rs(machine_config &config)
m_hgdc2->set_addrmap(0, &pc9801_state::upd7220_grcg_2_map);
- PALETTE(config, m_palette, 16+16).set_init(FUNC(pc9801_state::palette_init_pc9801));
+ PALETTE(config, m_palette, FUNC(pc9801_state::pc9801_palette), 16 + 16);
}
void pc9801_state::pc9801vm(machine_config &config)
@@ -2491,7 +2490,7 @@ void pc9801_state::pc9821(machine_config &config)
m_dmac->set_clock(16000000); // unknown clock
- PALETTE(config.replace(), m_palette, 16+16+256).set_init(FUNC(pc9801_state::palette_init_pc9801));
+ PALETTE(config.replace(), m_palette, FUNC(pc9801_state::pc9801_palette), 16 + 16 + 256);
}
void pc9801_state::pc9821ap2(machine_config &config)
diff --git a/src/mame/drivers/pce220.cpp b/src/mame/drivers/pce220.cpp
index 3e494d389a4..fbc1dee727b 100644
--- a/src/mame/drivers/pce220.cpp
+++ b/src/mame/drivers/pce220.cpp
@@ -47,22 +47,18 @@ class pce220_state : public driver_device
{
public:
pce220_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_beep(*this, "beeper"),
- m_serial(*this, PCE220SERIAL_TAG)
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_ram(*this, RAM_TAG)
+ , m_beep(*this, "beeper")
+ , m_serial(*this, PCE220SERIAL_TAG)
+ { }
void pce220(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER(kb_irq);
DECLARE_INPUT_CHANGED_MEMBER(on_irq);
- TIMER_DEVICE_CALLBACK_MEMBER(pce220_timer_callback);
-
- DECLARE_PALETTE_INIT(pce220);
-
protected:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
@@ -88,6 +84,11 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+
+ TIMER_DEVICE_CALLBACK_MEMBER(pce220_timer_callback);
+
+ void pce220_palette(palette_device &palette) const;
+
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( lcd_status_r );
DECLARE_WRITE8_MEMBER( lcd_control_w );
@@ -936,7 +937,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(pce220_state::pce220_timer_callback)
}
}
-PALETTE_INIT_MEMBER(pce220_state,pce220)
+void pce220_state::pce220_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -959,13 +960,11 @@ MACHINE_CONFIG_START(pce220_state::pce220)
MCFG_SCREEN_VISIBLE_AREA(0, 24*6-1, 0, 4*8-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pce220_state,pce220)
+ PALETTE(config, "palette", FUNC(pce220_state::pce220_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 3250)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 0.50);
MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468))
@@ -993,15 +992,13 @@ MACHINE_CONFIG_START(pcg850v_state::pcg815)
MCFG_SCREEN_VISIBLE_AREA(0, 144-1, 0, 32-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pce220_state,pce220)
+ PALETTE(config, "palette", FUNC(pcg850v_state::pce220_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 3250)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 0.50);
- MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pcg850v_state, pce220_timer_callback, attotime::from_msec(468))
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
@@ -1027,15 +1024,13 @@ MACHINE_CONFIG_START(pcg850v_state::pcg850v)
MCFG_SCREEN_VISIBLE_AREA(0, 144-1, 0, 48-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pce220_state,pce220)
+ PALETTE(config, "palette", FUNC(pcg850v_state::pce220_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 3250)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 0.50);
- MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pce220_state, pce220_timer_callback, attotime::from_msec(468))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("pce220_timer", pcg850v_state, pce220_timer_callback, attotime::from_msec(468))
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/drivers/pcktgal.cpp b/src/mame/drivers/pcktgal.cpp
index 8867f728aef..405055488ab 100644
--- a/src/mame/drivers/pcktgal.cpp
+++ b/src/mame/drivers/pcktgal.cpp
@@ -241,12 +241,11 @@ MACHINE_CONFIG_START(pcktgal_state::pcktgal)
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(pcktgal_state, screen_update_pcktgal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pcktgal)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(pcktgal_state, pcktgal)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_pcktgal);
+ PALETTE(config, m_palette, FUNC(pcktgal_state::pcktgal_palette), 512);
DECO_BAC06(config, m_tilegen, 0);
m_tilegen->set_gfx_region_wide(0, 0, 0);
@@ -264,8 +263,8 @@ MACHINE_CONFIG_START(pcktgal_state::pcktgal)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MCFG_DEVICE_ADD("msm", MSM5205, 384000)
- MCFG_MSM5205_VCLK_CB(WRITELINE(*this, pcktgal_state, adpcm_int)) /* interrupt function */
- MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) /* 8KHz */
+ MCFG_MSM5205_VCLK_CB(WRITELINE(*this, pcktgal_state, adpcm_int)) // interrupt function
+ MCFG_MSM5205_PRESCALER_SELECTOR(S48_4B) // 8kHz
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.70)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/pcm.cpp b/src/mame/drivers/pcm.cpp
index 77452c327f8..e8dc1e64561 100644
--- a/src/mame/drivers/pcm.cpp
+++ b/src/mame/drivers/pcm.cpp
@@ -273,7 +273,7 @@ MACHINE_CONFIG_START(pcm_state::pcm)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pcm)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Sound */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp
index c0f1a3626f1..43f851910ec 100644
--- a/src/mame/drivers/pcw.cpp
+++ b/src/mame/drivers/pcw.cpp
@@ -1254,8 +1254,7 @@ void pcw_state::pcw(machine_config &config)
m_screen->set_screen_update(FUNC(pcw_state::screen_update_pcw));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, PCW_NUM_COLOURS);
- m_palette->set_init(palette_init_delegate(FUNC(pcw_state::palette_init_pcw), this));
+ PALETTE(config, m_palette, FUNC(pcw_state::pcw_colours), PCW_NUM_COLOURS);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pcw16.cpp b/src/mame/drivers/pcw16.cpp
index f05ee9717b5..c527eb293d7 100644
--- a/src/mame/drivers/pcw16.cpp
+++ b/src/mame/drivers/pcw16.cpp
@@ -1051,13 +1051,11 @@ MACHINE_CONFIG_START(pcw16_state::pcw16)
MCFG_SCREEN_UPDATE_DRIVER(pcw16_state, screen_update_pcw16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", PCW16_NUM_COLOURS)
- MCFG_PALETTE_INIT_OWNER(pcw16_state, pcw16)
+ PALETTE(config, "palette", FUNC(pcw16_state::pcw16_colours), PCW16_NUM_COLOURS);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 3750)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
+ BEEP(config, m_beeper, 3750).add_route(ALL_OUTPUTS, "mono", 1.00);
/* printer */
pc_lpt_device &lpt(PC_LPT(config, "lpt"));
diff --git a/src/mame/drivers/pda600.cpp b/src/mame/drivers/pda600.cpp
index f8097204e70..72e1ae8338e 100644
--- a/src/mame/drivers/pda600.cpp
+++ b/src/mame/drivers/pda600.cpp
@@ -221,7 +221,7 @@ void pda600_state::pda600(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_pda600);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// NVRAM needs to be filled with random data to fail the checksum and be initialized correctly
NVRAM(config, "nvram", nvram_device::DEFAULT_RANDOM);
diff --git a/src/mame/drivers/pdp1.cpp b/src/mame/drivers/pdp1.cpp
index cd11926b641..5c8171f6888 100644
--- a/src/mame/drivers/pdp1.cpp
+++ b/src/mame/drivers/pdp1.cpp
@@ -281,17 +281,17 @@ static const gfx_layout fontlayout =
black. Grey levels follow an exponential law, so that decrementing the
color index periodically will simulate the remanence of a cathode ray tube.
*/
-static const uint8_t pdp1_colors[] =
+static constexpr rgb_t pdp1_colors[] =
{
- 0x00,0x00,0x00, /* black */
- 0xFF,0xFF,0xFF, /* white */
- 0x00,0xFF,0x00, /* green */
- 0x00,0x40,0x00, /* dark green */
- 0xFF,0x00,0x00, /* red */
- 0x80,0x80,0x80 /* light gray */
+ {0x00, 0x00, 0x00 }, // black
+ {0xff, 0xff, 0xff }, // white
+ {0x00, 0xff, 0x00 }, // green
+ {0x00, 0x40, 0x00 }, // dark green
+ {0xff, 0x00, 0x00 }, // red
+ {0x80, 0x80, 0x80 } // light gray
};
-static const uint8_t pdp1_palette[] =
+static constexpr uint8_t pdp1_pens[] =
{
pen_panel_bg, pen_panel_caption,
pen_typewriter_bg, pen_black,
@@ -305,55 +305,51 @@ static GFXDECODE_START( gfx_pdp1 )
GFXDECODE_END
/* Initialise the palette */
-PALETTE_INIT_MEMBER(pdp1_state, pdp1)
+void pdp1_state::pdp1_palette(palette_device &palette) const
{
- /* rgb components for the two color emissions */
- const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076;
- /* half period in seconds for the two color emissions */
- const double half_period_1 = .05, half_period_2 = .20;
- /* refresh period in seconds */
- const double update_period = 1./refresh_rate;
+ // rgb components for the two color emissions
+ constexpr double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076;
+ // half period in seconds for the two color emissions
+ constexpr double half_period_1 = .05, half_period_2 = .20;
+ // refresh period in seconds
+ constexpr double update_period = 1./refresh_rate;
double decay_1, decay_2;
double cur_level_1, cur_level_2;
- uint8_t i, r, g, b;
- /* initialize CRT palette */
+ // initialize CRT palette
- /* compute the decay factor per refresh frame */
+ // compute the decay factor per refresh frame
decay_1 = pow(.5, update_period / half_period_1);
decay_2 = pow(.5, update_period / half_period_2);
- cur_level_1 = cur_level_2 = 255.; /* start with maximum level */
+ cur_level_1 = cur_level_2 = 255.; // start with maximum level
- for (i=pen_crt_max_intensity; i>0; i--)
+ for (int i = pen_crt_max_intensity; i>0; i--)
{
- /* compute the current color */
- r = (int) ((r1*cur_level_1 + r2*cur_level_2) + .5);
- g = (int) ((g1*cur_level_1 + g2*cur_level_2) + .5);
- b = (int) ((b1*cur_level_1 + b2*cur_level_2) + .5);
- /* write color in palette */
- m_palette->set_indirect_color(i, rgb_t(r, g, b));
- /* apply decay for next iteration */
+ // compute the current color
+ int const r = int((r1*cur_level_1 + r2*cur_level_2) + .5);
+ int const g = int((g1*cur_level_1 + g2*cur_level_2) + .5);
+ int const b = int((b1*cur_level_1 + b2*cur_level_2) + .5);
+ // write color in palette
+ palette.set_indirect_color(i, rgb_t(r, g, b));
+ // apply decay for next iteration
cur_level_1 *= decay_1;
cur_level_2 *= decay_2;
}
- m_palette->set_indirect_color(0, rgb_t(0, 0, 0));
+ palette.set_indirect_color(0, rgb_t(0, 0, 0));
- /* load static palette */
- for ( i = 0; i < 6; i++ )
- {
- r = pdp1_colors[i*3]; g = pdp1_colors[i*3+1]; b = pdp1_colors[i*3+2];
- m_palette->set_indirect_color(pen_crt_num_levels + i, rgb_t(r, g, b));
- }
+ // load static palette
+ for (int i = 0; i < 6; i++)
+ palette.set_indirect_color(pen_crt_num_levels + i, pdp1_colors[i]);
- /* copy colortable to palette */
- for( i = 0; i < total_colors_needed; i++ )
- m_palette->set_pen_indirect(i, i);
+ // copy colortable to palette
+ for (int i = 0; i < total_colors_needed; i++)
+ palette.set_pen_indirect(i, i);
- /* set up palette for text */
- for( i = 0; i < 6; i++ )
- m_palette->set_pen_indirect(total_colors_needed + i, pdp1_palette[i]);
+ // set up palette for text
+ for (int i = 0; i < 6; i++)
+ palette.set_pen_indirect(total_colors_needed + i, pdp1_pens[i]);
}
@@ -1948,9 +1944,7 @@ void pdp1_state::pdp1(machine_config &config)
PDP1_CYLINDER(config, "drum", 0);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pdp1);
- PALETTE(config, m_palette, total_colors_needed + sizeof(pdp1_palette));
- m_palette->set_indirect_entries(total_colors_needed);
- m_palette->set_init(FUNC(pdp1_state::palette_init_pdp1));
+ PALETTE(config, m_palette, FUNC(pdp1_state::pdp1_palette), total_colors_needed + ARRAY_LENGTH(pdp1_pens), total_colors_needed);
}
/*
diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp
index cb4b647d0f3..74bce94db65 100644
--- a/src/mame/drivers/pegasus.cpp
+++ b/src/mame/drivers/pegasus.cpp
@@ -504,7 +504,7 @@ MACHINE_CONFIG_START(pegasus_state::pegasus)
MCFG_SCREEN_VISIBLE_AREA(0, 32*8-1, 0, 16*16-1)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pegasus)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pengo.cpp b/src/mame/drivers/pengo.cpp
index 160511dcae4..650bfb08e38 100644
--- a/src/mame/drivers/pengo.cpp
+++ b/src/mame/drivers/pengo.cpp
@@ -404,9 +404,7 @@ void pengo_state::pengo(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pengo);
- PALETTE(config, m_palette, 128*4);
- m_palette->set_indirect_entries(32);
- m_palette->set_init(FUNC(pengo_state::palette_init_pacman));
+ PALETTE(config, m_palette, FUNC(pengo_state::pacman_palette), 128 * 4, 32);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_raw(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART);
diff --git a/src/mame/drivers/peoplepc.cpp b/src/mame/drivers/peoplepc.cpp
index d747c97ed5c..7b426d6057a 100644
--- a/src/mame/drivers/peoplepc.cpp
+++ b/src/mame/drivers/peoplepc.cpp
@@ -274,7 +274,7 @@ MACHINE_CONFIG_START(peoplepc_state::olypeopl)
MCFG_SCREEN_UPDATE_DEVICE( "h46505", mc6845_device, screen_update )
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
h46505_device &crtc(H46505(config, "h46505", XTAL(22'000'000)/8));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/peplus.cpp b/src/mame/drivers/peplus.cpp
index 59c5e954156..f9763d64bce 100644
--- a/src/mame/drivers/peplus.cpp
+++ b/src/mame/drivers/peplus.cpp
@@ -20,10 +20,10 @@
History:
- This form of video poker machine has the ability to use different game roms. The operator
- changes the game by placing the rom at U68 on the motherboard. This driver currently supports
- several PE+ game roms, but should work with all other compatible game roms as far as cpu, video,
- sound, and inputs are concerned. Some games can share the same color prom and graphic roms,
+ This form of video poker machine has the ability to use different game ROMs. The operator
+ changes the game by placing the ROM at U68 on the motherboard. This driver currently supports
+ several PE+ game ROMs, but should work with all other compatible game ROMs as far as CPU, video,
+ sound, and inputs are concerned. Some games can share the same color PROM and graphic ROMs,
but this is not always the case. It is best to confirm the game, color and graphic combinations.
The game code runs in two different modes, game mode and operator mode. Game mode is what a
@@ -33,8 +33,8 @@
has two additional inputs (jackpot reset and self-test) to navigate with, along with the
normal buttons available to the player.
- A normal machine keeps all coin counts and settings in a battery-backed ram, and will
- periodically update an external eeprom for an even more secure backup. This eeprom
+ A normal machine keeps all coin counts and settings in a battery-backed RAM, and will
+ periodically update an external EEPROM for an even more secure backup. This EEPROM
also holds the current game state in order to recover the player from a full power failure.
@@ -348,7 +348,7 @@ private:
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_addr);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void load_superdata(const char *bank_name);
- DECLARE_PALETTE_INIT(peplus);
+ void peplus_palette(palette_device &palette) const;
void handle_lightpen();
void main_iomap(address_map &map);
@@ -973,36 +973,36 @@ uint32_t peplus_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
return 0;
}
-PALETTE_INIT_MEMBER(peplus_state, peplus)
+void peplus_state::peplus_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- uint32_t proms_size = memregion("proms")->bytes();
-/* prom bits
- 7654 3210
- ---- -xxx red component.
- --xx x--- green component.
- xx-- ---- blue component.
-*/
-
- for (int i = 0;i < palette.entries();i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ uint32_t const proms_size = memregion("proms")->bytes();
+ /* prom bits
+ 7654 3210
+ ---- -xxx red component.
+ --xx x--- green component.
+ xx-- ---- blue component.
+ */
+
+ for (int i = 0; i < palette.entries(); i++)
{
/* red component */
- int bit0 = (~color_prom[i % proms_size] >> 0) & 0x01;
- int bit1 = (~color_prom[i % proms_size] >> 1) & 0x01;
- int bit2 = (~color_prom[i % proms_size] >> 2) & 0x01;
- int r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
+ int bit0 = BIT(~color_prom[i % proms_size], 0);
+ int bit1 = BIT(~color_prom[i % proms_size], 1);
+ int bit2 = BIT(~color_prom[i % proms_size], 2);
+ int const r = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
/* green component */
- bit0 = (~color_prom[i % proms_size] >> 3) & 0x01;
- bit1 = (~color_prom[i % proms_size] >> 4) & 0x01;
- bit2 = (~color_prom[i % proms_size] >> 5) & 0x01;
- int g = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
+ bit0 = BIT(~color_prom[i % proms_size], 3);
+ bit1 = BIT(~color_prom[i % proms_size], 4);
+ bit2 = BIT(~color_prom[i % proms_size], 5);
+ int const g = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
/* blue component */
- bit0 = (~color_prom[i % proms_size] >> 6) & 0x01;
- bit1 = (~color_prom[i % proms_size] >> 7) & 0x01;
+ bit0 = BIT(~color_prom[i % proms_size], 6);
+ bit1 = BIT(~color_prom[i % proms_size], 7);
bit2 = 0;
- int b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
+ int const b = 0x21 * bit2 + 0x47 * bit1 + 0x97 * bit0;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -1373,7 +1373,7 @@ void peplus_state::machine_start()
MACHINE_CONFIG_START(peplus_state::peplus)
// basic machine hardware
- I80C32(config, m_maincpu, XTAL(20'000'000)/2); /* 10MHz */
+ I80C32(config, m_maincpu, XTAL(20'000'000)/2); // 10MHz
m_maincpu->set_addrmap(AS_PROGRAM, &peplus_state::main_map);
m_maincpu->set_addrmap(AS_IO, &peplus_state::main_iomap);
m_maincpu->port_out_cb<1>().set(FUNC(peplus_state::paldata_w<0>));
@@ -1390,8 +1390,7 @@ MACHINE_CONFIG_START(peplus_state::peplus)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_peplus);
-
- PALETTE(config, m_palette, 16*16*2).set_init(FUNC(peplus_state::palette_init_peplus));
+ PALETTE(config, m_palette, FUNC(peplus_state::peplus_palette), 16*16*2);
R6545_1(config, m_crtc, XTAL(20'000'000)/8/3);
m_crtc->set_screen(m_screen);
diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp
index 7180b7b04d2..bc66b62bb8e 100644
--- a/src/mame/drivers/pet.cpp
+++ b/src/mame/drivers/pet.cpp
@@ -1731,8 +1731,7 @@ void pet_state::_32k(machine_config &config)
void pet_state::base_pet_devices(machine_config &config, const char *default_drive)
{
- PALETTE(config, m_palette, 2);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
VIA6522(config, m_via, XTAL(16'000'000)/16);
m_via->readpb_handler().set(FUNC(pet_state::via_pb_r));
diff --git a/src/mame/drivers/pgm.cpp b/src/mame/drivers/pgm.cpp
index 9bfd609a681..188c1103104 100644
--- a/src/mame/drivers/pgm.cpp
+++ b/src/mame/drivers/pgm.cpp
@@ -538,8 +538,7 @@ void pgm_state::pgmbase(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pgm);
- PALETTE(config, m_palette, 0x1200/2);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1200/2);
MCFG_VIDEO_START_OVERRIDE(pgm_state,pgm)
diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp
index 8a23ba68dd5..00faaf66c0c 100644
--- a/src/mame/drivers/pgm2.cpp
+++ b/src/mame/drivers/pgm2.cpp
@@ -781,9 +781,9 @@ void pgm2_state::pgm2(machine_config &config)
GFXDECODE(config, m_gfxdecode2, m_tx_palette, pgm2_tx);
GFXDECODE(config, m_gfxdecode3, m_bg_palette, pgm2_bg);
- PALETTE(config, m_sp_palette, 0x4000/4).set_format(PALETTE_FORMAT_XRGB); // sprites
- PALETTE(config, m_tx_palette, 0x800/4).set_format(PALETTE_FORMAT_XRGB); // text
- PALETTE(config, m_bg_palette, 0x2000/4).set_format(PALETTE_FORMAT_XRGB); // bg
+ PALETTE(config, m_sp_palette).set_format(palette_device::xRGB_888, 0x4000 / 4); // sprites
+ PALETTE(config, m_tx_palette).set_format(palette_device::xRGB_888, 0x800 / 4); // text
+ PALETTE(config, m_bg_palette).set_format(palette_device::xRGB_888, 0x2000 / 4); // bg
NVRAM(config, "sram", nvram_device::DEFAULT_ALL_0);
diff --git a/src/mame/drivers/phoenix.cpp b/src/mame/drivers/phoenix.cpp
index cc114cc5eb9..7e8701817d0 100644
--- a/src/mame/drivers/phoenix.cpp
+++ b/src/mame/drivers/phoenix.cpp
@@ -455,8 +455,7 @@ void phoenix_state::phoenix(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_phoenix);
-
- PALETTE(config, m_palette, 256).set_init(FUNC(phoenix_state::palette_init_phoenix));
+ PALETTE(config, m_palette, FUNC(phoenix_state::phoenix_palette), 256);
MCFG_VIDEO_START_OVERRIDE(phoenix_state,phoenix)
@@ -484,7 +483,7 @@ void phoenix_state::pleiads(machine_config &config)
/* video hardware */
m_gfxdecode->set_info(gfx_pleiads);
- m_palette->set_init(FUNC(phoenix_state::palette_init_pleiads));
+ m_palette->set_init(FUNC(phoenix_state::pleiads_palette));
/* sound hardware */
tms36xx_device &tms(TMS36XX(config.replace(), "tms", 247));
@@ -524,8 +523,7 @@ void phoenix_state::survival(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_phoenix);
-
- PALETTE(config, m_palette, 256).set_init(FUNC(phoenix_state::palette_init_survival));
+ PALETTE(config, m_palette, FUNC(phoenix_state::survival_palette), 256);
MCFG_VIDEO_START_OVERRIDE(phoenix_state,phoenix)
diff --git a/src/mame/drivers/photon.cpp b/src/mame/drivers/photon.cpp
index 05d42c37606..a895d38de4c 100644
--- a/src/mame/drivers/photon.cpp
+++ b/src/mame/drivers/photon.cpp
@@ -31,90 +31,98 @@ class photon_state : public pk8000_base_state
{
public:
photon_state(const machine_config &mconfig, device_type type, const char *tag)
- : pk8000_base_state(mconfig, type, tag),
- m_speaker(*this, "speaker") { }
+ : pk8000_base_state(mconfig, type, tag)
+ , m_speaker(*this, "speaker")
+ , m_banks(*this, "bank%u", 1U)
+ { }
void photon(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(_80_porta_w);
DECLARE_READ8_MEMBER(_80_portb_r);
DECLARE_WRITE8_MEMBER(_80_portc_w);
- virtual void machine_reset() override;
- virtual void video_start() override;
-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(interrupt);
IRQ_CALLBACK_MEMBER(irq_callback);
void set_bank(uint8_t data);
- required_device<speaker_sound_device> m_speaker;
void pk8000_io(address_map &map);
void pk8000_mem(address_map &map);
+
+ required_device<speaker_sound_device> m_speaker;
+ required_memory_bank_array<8> m_banks;
};
void photon_state::set_bank(uint8_t data)
{
- uint8_t *rom = memregion("maincpu")->base();
- uint8_t *ram = memregion("maincpu")->base();
- uint8_t block1 = data & 3;
- uint8_t block2 = (data >> 2) & 3;
- uint8_t block3 = (data >> 4) & 3;
- uint8_t block4 = (data >> 6) & 3;
+ uint8_t *const rom = memregion("maincpu")->base();
+ uint8_t *const ram = memregion("maincpu")->base();
+ uint8_t const block1 = data & 3;
+ uint8_t const block2 = (data >> 2) & 3;
+ uint8_t const block3 = (data >> 4) & 3;
+ uint8_t const block4 = (data >> 6) & 3;
switch(block1) {
- case 0:
- membank("bank1")->set_base(rom + 0x10000);
- membank("bank5")->set_base(ram);
- break;
- case 1: break;
- case 2: break;
- case 3:
- membank("bank1")->set_base(ram);
- membank("bank5")->set_base(ram);
- break;
+ case 0:
+ m_banks[0]->set_base(rom + 0x10000);
+ m_banks[4]->set_base(ram);
+ break;
+ case 1: break;
+ case 2: break;
+ case 3:
+ m_banks[0]->set_base(ram);
+ m_banks[4]->set_base(ram);
+ break;
}
switch(block2) {
- case 0:
- membank("bank2")->set_base(rom + 0x14000);
- membank("bank6")->set_base(ram + 0x4000);
- break;
- case 1: break;
- case 2: break;
- case 3:
- membank("bank2")->set_base(ram + 0x4000);
- membank("bank6")->set_base(ram + 0x4000);
- break;
+ case 0:
+ m_banks[1]->set_base(rom + 0x14000);
+ m_banks[5]->set_base(ram + 0x4000);
+ break;
+ case 1: break;
+ case 2: break;
+ case 3:
+ m_banks[1]->set_base(ram + 0x4000);
+ m_banks[5]->set_base(ram + 0x4000);
+ break;
}
+
switch(block3) {
- case 0:
- membank("bank3")->set_base(rom + 0x18000);
- membank("bank7")->set_base(ram + 0x8000);
- break;
- case 1: break;
- case 2: break;
- case 3:
- membank("bank3")->set_base(ram + 0x8000);
- membank("bank7")->set_base(ram + 0x8000);
- break;
+ case 0:
+ m_banks[2]->set_base(rom + 0x18000);
+ m_banks[6]->set_base(ram + 0x8000);
+ break;
+ case 1: break;
+ case 2: break;
+ case 3:
+ m_banks[2]->set_base(ram + 0x8000);
+ m_banks[6]->set_base(ram + 0x8000);
+ break;
}
+
switch(block4) {
- case 0:
- membank("bank4")->set_base(rom + 0x1c000);
- membank("bank8")->set_base(ram + 0xc000);
- break;
- case 1: break;
- case 2: break;
- case 3:
- membank("bank4")->set_base(ram + 0xc000);
- membank("bank8")->set_base(ram + 0xc000);
- break;
+ case 0:
+ m_banks[3]->set_base(rom + 0x1c000);
+ m_banks[7]->set_base(ram + 0xc000);
+ break;
+ case 1: break;
+ case 2: break;
+ case 3:
+ m_banks[3]->set_base(ram + 0xc000);
+ m_banks[7]->set_base(ram + 0xc000);
+ break;
}
}
+
WRITE8_MEMBER(photon_state::_80_porta_w)
{
set_bank(data);
@@ -127,7 +135,7 @@ READ8_MEMBER(photon_state::_80_portb_r)
WRITE8_MEMBER(photon_state::_80_portc_w)
{
- m_speaker->level_w(BIT(data,7));
+ m_speaker->level_w(BIT(data, 7));
}
void photon_state::pk8000_mem(address_map &map)
@@ -182,11 +190,15 @@ IRQ_CALLBACK_MEMBER(photon_state::irq_callback)
void photon_state::machine_reset()
{
+ pk8000_base_state::machine_reset();
+
set_bank(0);
}
void photon_state::video_start()
{
+ pk8000_base_state::video_start();
+
save_item(NAME(m_text_start));
save_item(NAME(m_chargen_start));
save_item(NAME(m_video_start));
@@ -220,8 +232,7 @@ MACHINE_CONFIG_START(photon_state::photon)
MCFG_SCREEN_UPDATE_DRIVER(photon_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(photon_state, pk8000)
+ PALETTE(config, "palette", FUNC(photon_state::pk8000_palette), 16);
i8255_device &ppi1(I8255(config, "ppi8255_1"));
ppi1.out_pa_callback().set(FUNC(photon_state::_80_porta_w));
@@ -235,8 +246,7 @@ MACHINE_CONFIG_START(photon_state::photon)
/* audio hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
/*
diff --git a/src/mame/drivers/photon2.cpp b/src/mame/drivers/photon2.cpp
index e6bd36e206b..2ca17daaecf 100644
--- a/src/mame/drivers/photon2.cpp
+++ b/src/mame/drivers/photon2.cpp
@@ -33,14 +33,19 @@
class photon2_state : public driver_device
{
public:
- photon2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ photon2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_speaker(*this, "speaker"),
- m_spectrum_video_ram(*this, "spectrum_vram") { }
+ m_spectrum_video_ram(*this, "spectrum_vram")
+ { }
void photon2(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<speaker_sound_device> m_speaker;
@@ -57,9 +62,7 @@ private:
DECLARE_WRITE8_MEMBER(fe_w);
DECLARE_WRITE8_MEMBER(misc_w);
- virtual void machine_start() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(photon2);
+ void photon2_palette(palette_device &palette) const;
uint32_t screen_update_spectrum(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_spectrum);
@@ -96,7 +99,7 @@ private:
#define SPEC_RETRACE_CYCLES 48 /* Cycles taken for horizonal retrace */
#define SPEC_CYCLES_PER_LINE 224 /* Number of cycles to display a single line */
-static const rgb_t spectrum_palette[16] = {
+static constexpr rgb_t spectrum_palette[16] = {
rgb_t(0x00, 0x00, 0x00),
rgb_t(0x00, 0x00, 0xbf),
rgb_t(0xbf, 0x00, 0x00),
@@ -115,10 +118,10 @@ static const rgb_t spectrum_palette[16] = {
rgb_t(0xff, 0xff, 0xff)
};
-/* Initialise the palette */
-PALETTE_INIT_MEMBER(photon2_state, photon2)
+// Initialise the palette
+void photon2_state::photon2_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
+ palette.set_pen_colors(0, spectrum_palette);
}
void photon2_state::video_start()
@@ -362,7 +365,6 @@ MACHINE_CONFIG_START(photon2_state::photon2)
MCFG_DEVICE_IO_MAP(spectrum_io)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", photon2_state, spec_interrupt_hack, "screen", 0, 1)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(50.08)
@@ -373,14 +375,11 @@ MACHINE_CONFIG_START(photon2_state::photon2)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, photon2_state, screen_vblank_spectrum))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(photon2_state, photon2)
+ PALETTE(config, "palette", FUNC(photon2_state::photon2_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
-
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
/*************************************
diff --git a/src/mame/drivers/phunsy.cpp b/src/mame/drivers/phunsy.cpp
index 88349136d82..53bf403f95d 100644
--- a/src/mame/drivers/phunsy.cpp
+++ b/src/mame/drivers/phunsy.cpp
@@ -65,7 +65,7 @@ private:
DECLARE_READ_LINE_MEMBER(cass_r);
DECLARE_WRITE_LINE_MEMBER(cass_w);
DECLARE_QUICKLOAD_LOAD_MEMBER(phunsy);
- DECLARE_PALETTE_INIT(phunsy);
+ void phunsy_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void phunsy_data(address_map &map);
@@ -210,14 +210,10 @@ void phunsy_state::machine_reset()
}
-PALETTE_INIT_MEMBER(phunsy_state, phunsy)
+void phunsy_state::phunsy_palette(palette_device &palette) const
{
- for ( int i = 0; i < 8; i++ )
- {
- int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 );
-
- palette.set_pen_color( i, j, j, j );
- }
+ for (int i = 0; i < 8; i++)
+ palette.set_pen_color(i, pal3bit(i), pal3bit(i), pal3bit(i));
}
@@ -364,7 +360,7 @@ void phunsy_state::phunsy(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_phunsy);
- PALETTE(config, "palette", 8).set_init(FUNC(phunsy_state::palette_init_phunsy));
+ PALETTE(config, "palette", FUNC(phunsy_state::phunsy_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/piggypas.cpp b/src/mame/drivers/piggypas.cpp
index f4f0165e835..3d5493df5cb 100644
--- a/src/mame/drivers/piggypas.cpp
+++ b/src/mame/drivers/piggypas.cpp
@@ -221,7 +221,7 @@ void piggypas_state::piggypas(machine_config &config)
screen.set_visarea(0, 16*6-1, 0, 8-1);
screen.set_palette("palette");
- PALETTE(config, "palette", 2);
+ PALETTE(config, "palette").set_entries(2);
config.set_default_layout(layout_piggypas);
hd44780_device &hd44780(HD44780(config, "hd44780"));
diff --git a/src/mame/drivers/pingpong.cpp b/src/mame/drivers/pingpong.cpp
index edb55a309ca..9f03d6454fb 100644
--- a/src/mame/drivers/pingpong.cpp
+++ b/src/mame/drivers/pingpong.cpp
@@ -463,12 +463,10 @@ MACHINE_CONFIG_START(pingpong_state::pingpong)
MCFG_SCREEN_SIZE(456, 262)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pingpong_state, screen_update_pingpong)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pingpong)
- MCFG_PALETTE_ADD("palette", 64*4+64*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(pingpong_state, pingpong)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pingpong);
+ PALETTE(config, m_palette, FUNC(pingpong_state::pingpong_palette), 64*4+64*4, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pipedrm.cpp b/src/mame/drivers/pipedrm.cpp
index ebdb8256bfb..732daefecde 100644
--- a/src/mame/drivers/pipedrm.cpp
+++ b/src/mame/drivers/pipedrm.cpp
@@ -175,8 +175,8 @@ Added Multiple Coin Feature:
class pipedrm_state : public fromance_state
{
public:
- pipedrm_state(const machine_config &mconfig, device_type type, const char *tag)
- : fromance_state(mconfig, type, tag),
+ pipedrm_state(const machine_config &mconfig, device_type type, const char *tag) :
+ fromance_state(mconfig, type, tag),
m_soundlatch(*this, "soundlatch")
{ }
@@ -601,11 +601,10 @@ MACHINE_CONFIG_START(pipedrm_state::pipedrm)
MCFG_SCREEN_SIZE(44*8, 30*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pipedrm_state, screen_update_pipedrm)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pipedrm)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pipedrm);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_GGA(config, m_gga, XTAL(14'318'181) / 2); // divider not verified
m_gga->write_cb().set(FUNC(fromance_state::fromance_gga_data_w));
@@ -655,11 +654,10 @@ MACHINE_CONFIG_START(pipedrm_state::hatris)
MCFG_SCREEN_SIZE(44*8, 30*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 44*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pipedrm_state, screen_update_fromance)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hatris)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_hatris);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
VSYSTEM_GGA(config, m_gga, XTAL(14'318'181) / 2); // divider not verified
m_gga->write_cb().set(FUNC(fromance_state::fromance_gga_data_w));
diff --git a/src/mame/drivers/pipeline.cpp b/src/mame/drivers/pipeline.cpp
index 0bdeb9272f2..a6a0194655a 100644
--- a/src/mame/drivers/pipeline.cpp
+++ b/src/mame/drivers/pipeline.cpp
@@ -97,6 +97,10 @@ public:
void pipeline(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(vram2_w);
DECLARE_WRITE8_MEMBER(vram1_w);
@@ -108,9 +112,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info2);
- virtual void machine_start() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(pipeline);
+ void pipeline_palette(palette_device &palette) const;
u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -181,7 +183,7 @@ WRITE8_MEMBER(pipeline_state::vidctrl_w)
WRITE8_MEMBER(pipeline_state::vram2_w)
{
- if(!(m_vidctrl & 1))
+ if (!(m_vidctrl & 1))
{
m_tilemap1->mark_tile_dirty(offset & 0x7ff);
m_vram2[offset] = data;
@@ -334,21 +336,18 @@ static const z80_daisy_config daisy_chain_sound[] =
{ nullptr }
};
-PALETTE_INIT_MEMBER(pipeline_state, pipeline)
+void pipeline_state::pipeline_palette(palette_device &palette) const
{
- u8 *prom1 = &memregion("proms")->base()[0x000];
- u8 *prom2 = &memregion("proms")->base()[0x100];
+ u8 const *const prom1 = &memregion("proms")->base()[0x000];
+ u8 const *const prom2 = &memregion("proms")->base()[0x100];
for (int i = 0; i < 0x100; i++)
{
- int c = prom1[i] | (prom2[i] << 4);
- int r = c & 7;
- int g = (c >> 3) & 7;
- int b = (c >> 6) & 3;
- r *= 36;
- g *= 36;
- b *= 85;
- palette.set_pen_color(0x100+i, rgb_t(r, g, b));
+ int const c = prom1[i] | (prom2[i] << 4);
+ int const r = c & 7;
+ int const g = (c >> 3) & 7;
+ int const b = (c >> 6) & 3;
+ palette.set_pen_color(0x100 + i, rgb_t(pal3bit(r), pal3bit(g), pal2bit(b)));
}
}
@@ -389,11 +388,11 @@ void pipeline_state::pipeline(machine_config &config)
screen.set_size(512, 512);
screen.set_visarea(0, 319, 16, 239);
screen.set_screen_update(FUNC(pipeline_state::screen_update));
- screen.set_palette("palette");
+ screen.set_palette(m_palette);
screen.screen_vblank().set_inputline("maincpu", INPUT_LINE_NMI);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pipeline);
- PALETTE(config, m_palette, 0x100+0x100).set_init(FUNC(pipeline_state::palette_init_pipeline));
+ PALETTE(config, m_palette, FUNC(pipeline_state::pipeline_palette), 0x100 + 0x100);
/* audio hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pirates.cpp b/src/mame/drivers/pirates.cpp
index 31bcbfcc393..07595c472c4 100644
--- a/src/mame/drivers/pirates.cpp
+++ b/src/mame/drivers/pirates.cpp
@@ -259,8 +259,7 @@ MACHINE_CONFIG_START(pirates_state::pirates)
EEPROM_93C46_16BIT(config, "eeprom");
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pirates)
-
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pirates);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -268,11 +267,9 @@ MACHINE_CONFIG_START(pirates_state::pirates)
MCFG_SCREEN_SIZE(36*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 36*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pirates_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_SCREEN_PALETTE(m_palette)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x2000);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/piratesh.cpp b/src/mame/drivers/piratesh.cpp
index f7f1ec0d56c..0dfc7b2a8bb 100644
--- a/src/mame/drivers/piratesh.cpp
+++ b/src/mame/drivers/piratesh.cpp
@@ -623,10 +623,7 @@ void piratesh_state::piratesh(machine_config &config)
screen.set_visarea(24, 24+288-1, 16, 16+224-1);
screen.set_screen_update(FUNC(piratesh_state::screen_update_piratesh));
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.set_format(PALETTE_FORMAT_BGRX);
- palette.enable_shadows();
- palette.enable_hilights();
+ PALETTE(config, "palette").set_format(palette_device::BGRx_888, 2048).enable_shadows().enable_hilights();
K056832(config, m_k056832, 0);
m_k056832->set_tile_callback(FUNC(piratesh_state::piratesh_tile_callback), this);
diff --git a/src/mame/drivers/pitagjr.cpp b/src/mame/drivers/pitagjr.cpp
index 4f8b4cd7a3b..f2b30986bfc 100644
--- a/src/mame/drivers/pitagjr.cpp
+++ b/src/mame/drivers/pitagjr.cpp
@@ -168,12 +168,14 @@ public:
void pitajr(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_memory_bank m_rombank;
- virtual void machine_start() override;
- DECLARE_PALETTE_INIT(pitagjr);
+ void pitagjr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void pitajr_mem(address_map &map);
};
@@ -196,7 +198,7 @@ void pitagjr_state::machine_start()
m_rombank->set_entry(1);
}
-PALETTE_INIT_MEMBER(pitagjr_state, pitagjr)
+void pitagjr_state::pitagjr_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -221,8 +223,7 @@ MACHINE_CONFIG_START(pitagjr_state::pitajr)
MCFG_SCREEN_VISIBLE_AREA( 0, 200-1, 0, 100-1 )
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pitagjr_state, pitagjr)
+ PALETTE(config, "palette", FUNC(pitagjr_state::pitagjr_palette), 2);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/pitnrun.cpp b/src/mame/drivers/pitnrun.cpp
index d4d8b36d448..ecf1231ecd0 100644
--- a/src/mame/drivers/pitnrun.cpp
+++ b/src/mame/drivers/pitnrun.cpp
@@ -310,7 +310,7 @@ void pitnrun_state::pitnrun(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pitnrun);
- PALETTE(config, m_palette, 32*3).set_init(FUNC(pitnrun_state::palette_init_pitnrun));
+ PALETTE(config, m_palette, FUNC(pitnrun_state::pitnrun_palette), 32 * 3);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -327,12 +327,13 @@ void pitnrun_state::pitnrun(machine_config &config)
ay2.port_b_read_callback().set("soundlatch", FUNC(generic_latch_8_device::read));
ay2.add_route(ALL_OUTPUTS, "mono", 0.50);
- LS259(config, "noiselatch", 0); // 1J
+ LS259(config, "noiselatch"); // 1J
}
void pitnrun_state::pitnrun_mcu(machine_config &config)
{
pitnrun(config);
+
m_maincpu->set_addrmap(AS_PROGRAM, &pitnrun_state::pitnrun_map_mcu);
M68705P5(config, m_mcu, XTAL(18'432'000)/6); /* verified on pcb */
diff --git a/src/mame/drivers/pk8000.cpp b/src/mame/drivers/pk8000.cpp
index c832f6127c7..941ad1c568f 100644
--- a/src/mame/drivers/pk8000.cpp
+++ b/src/mame/drivers/pk8000.cpp
@@ -377,8 +377,7 @@ MACHINE_CONFIG_START(pk8000_state::pk8000)
MCFG_SCREEN_UPDATE_DRIVER(pk8000_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(pk8000_state, pk8000)
+ PALETTE(config, "palette", FUNC(pk8000_state::pk8000_palette), 16);
i8255_device &ppi1(I8255(config, "ppi8255_1"));
ppi1.out_pa_callback().set(FUNC(pk8000_state::_80_porta_w));
diff --git a/src/mame/drivers/pk8020.cpp b/src/mame/drivers/pk8020.cpp
index 00f9f48087e..c845ad68667 100644
--- a/src/mame/drivers/pk8020.cpp
+++ b/src/mame/drivers/pk8020.cpp
@@ -204,11 +204,10 @@ MACHINE_CONFIG_START(pk8020_state::pk8020)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(pk8020_state, screen_update_pk8020)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pk8020)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(pk8020_state, pk8020)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_pk8020)
+ PALETTE(config, m_palette, FUNC(pk8020_state::pk8020_palette), 16);
I8255(config, m_ppi8255_1);
m_ppi8255_1->in_pa_callback().set(FUNC(pk8020_state::pk8020_porta_r));
diff --git a/src/mame/drivers/pkscram.cpp b/src/mame/drivers/pkscram.cpp
index 25c94e6b4e4..6b5ee993352 100644
--- a/src/mame/drivers/pkscram.cpp
+++ b/src/mame/drivers/pkscram.cpp
@@ -26,15 +26,15 @@ driver by David Haywood and few bits by Pierpaolo Prazzoli
class pkscram_state : public driver_device
{
public:
- pkscram_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pkscram_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_scan_timer(*this, "scan_timer"),
- m_pkscramble_fgtilemap_ram(*this, "fgtilemap_ram"),
- m_pkscramble_mdtilemap_ram(*this, "mdtilemap_ram"),
- m_pkscramble_bgtilemap_ram(*this, "bgtilemap_ram")
+ m_fgtilemap_ram(*this, "fgtilemap_ram"),
+ m_mdtilemap_ram(*this, "mdtilemap_ram"),
+ m_bgtilemap_ram(*this, "bgtilemap_ram")
{ }
void pkscramble(machine_config &config);
@@ -62,9 +62,9 @@ private:
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<timer_device> m_scan_timer;
- required_shared_ptr<uint16_t> m_pkscramble_fgtilemap_ram;
- required_shared_ptr<uint16_t> m_pkscramble_mdtilemap_ram;
- required_shared_ptr<uint16_t> m_pkscramble_bgtilemap_ram;
+ required_shared_ptr<uint16_t> m_fgtilemap_ram;
+ required_shared_ptr<uint16_t> m_mdtilemap_ram;
+ required_shared_ptr<uint16_t> m_bgtilemap_ram;
uint16_t m_out;
uint8_t m_interrupt_line_active;
@@ -79,19 +79,19 @@ enum { interrupt_scanline=192 };
WRITE16_MEMBER(pkscram_state::pkscramble_fgtilemap_w)
{
- COMBINE_DATA(&m_pkscramble_fgtilemap_ram[offset]);
+ COMBINE_DATA(&m_fgtilemap_ram[offset]);
m_fg_tilemap->mark_tile_dirty(offset >> 1);
}
WRITE16_MEMBER(pkscram_state::pkscramble_mdtilemap_w)
{
- COMBINE_DATA(&m_pkscramble_mdtilemap_ram[offset]);
+ COMBINE_DATA(&m_mdtilemap_ram[offset]);
m_md_tilemap->mark_tile_dirty(offset >> 1);
}
WRITE16_MEMBER(pkscram_state::pkscramble_bgtilemap_w)
{
- COMBINE_DATA(&m_pkscramble_bgtilemap_ram[offset]);
+ COMBINE_DATA(&m_bgtilemap_ram[offset]);
m_bg_tilemap->mark_tile_dirty(offset >> 1);
}
@@ -220,26 +220,26 @@ INPUT_PORTS_END
TILE_GET_INFO_MEMBER(pkscram_state::get_bg_tile_info)
{
- int tile = m_pkscramble_bgtilemap_ram[tile_index*2];
- int color = m_pkscramble_bgtilemap_ram[tile_index*2 + 1] & 0x7f;
+ int const tile = m_bgtilemap_ram[tile_index*2];
+ int const color = m_bgtilemap_ram[tile_index*2 + 1] & 0x7f;
- SET_TILE_INFO_MEMBER(0,tile,color,0);
+ SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
TILE_GET_INFO_MEMBER(pkscram_state::get_md_tile_info)
{
- int tile = m_pkscramble_mdtilemap_ram[tile_index*2];
- int color = m_pkscramble_mdtilemap_ram[tile_index*2 + 1] & 0x7f;
+ int const tile = m_mdtilemap_ram[tile_index*2];
+ int const color = m_mdtilemap_ram[tile_index*2 + 1] & 0x7f;
- SET_TILE_INFO_MEMBER(0,tile,color,0);
+ SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
TILE_GET_INFO_MEMBER(pkscram_state::get_fg_tile_info)
{
- int tile = m_pkscramble_fgtilemap_ram[tile_index*2];
- int color = m_pkscramble_fgtilemap_ram[tile_index*2 + 1] & 0x7f;
+ int const tile = m_fgtilemap_ram[tile_index*2];
+ int const color = m_fgtilemap_ram[tile_index*2 + 1] & 0x7f;
- SET_TILE_INFO_MEMBER(0,tile,color,0);
+ SET_TILE_INFO_MEMBER(0, tile, color, 0);
}
TIMER_DEVICE_CALLBACK_MEMBER(pkscram_state::scanline_callback)
@@ -333,10 +333,8 @@ MACHINE_CONFIG_START(pkscram_state::pkscramble)
MCFG_SCREEN_UPDATE_DRIVER(pkscram_state, screen_update_pkscramble)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pkscram)
-
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x800);
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_pkscram);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pktgaldx.cpp b/src/mame/drivers/pktgaldx.cpp
index 608eacba75c..242f251ce0c 100644
--- a/src/mame/drivers/pktgaldx.cpp
+++ b/src/mame/drivers/pktgaldx.cpp
@@ -353,10 +353,9 @@ MACHINE_CONFIG_START(pktgaldx_state::pktgaldx)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pktgaldx_state, screen_update_pktgaldx)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, pktgaldx_state, vblank_w))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_888, 4096);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pktgaldx)
@@ -414,12 +413,11 @@ MACHINE_CONFIG_START(pktgaldx_state::pktgaldb)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pktgaldx_state, screen_update_pktgaldb)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, pktgaldx_state, vblank_w))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(XBGR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 4096);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bootleg)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_bootleg)
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/plan80.cpp b/src/mame/drivers/plan80.cpp
index d56976a7f48..773d2f2ebe0 100644
--- a/src/mame/drivers/plan80.cpp
+++ b/src/mame/drivers/plan80.cpp
@@ -249,7 +249,7 @@ MACHINE_CONFIG_START(plan80_state::plan80)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_plan80)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp
index 3380cc639d4..95c6e23bb36 100644
--- a/src/mame/drivers/playch10.cpp
+++ b/src/mame/drivers/playch10.cpp
@@ -671,7 +671,7 @@ void playch10_state::playch10(machine_config &config)
// video hardware
GFXDECODE(config, m_gfxdecode, "palette", gfx_playch10);
- PALETTE(config, "palette", 256).set_init(FUNC(playch10_state::palette_init_playch10));
+ PALETTE(config, "palette", FUNC(playch10_state::playch10_palette), 256);
config.set_default_layout(layout_playch10);
screen_device &top(SCREEN(config, "top", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/playmark.cpp b/src/mame/drivers/playmark.cpp
index 96f27d33106..80c6e5a51ac 100644
--- a/src/mame/drivers/playmark.cpp
+++ b/src/mame/drivers/playmark.cpp
@@ -1065,11 +1065,10 @@ MACHINE_CONFIG_START(playmark_state::bigtwin)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_bigtwin)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bigtwin)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bigtwin);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,bigtwin)
@@ -1105,11 +1104,10 @@ MACHINE_CONFIG_START(playmark_state::bigtwinb)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_bigtwinb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_bigtwinb)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bigtwinb);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,bigtwinb)
@@ -1148,11 +1146,10 @@ MACHINE_CONFIG_START(playmark_state::wbeachvl)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_wbeachvl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wbeachvl)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wbeachvl);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 2048);
MCFG_VIDEO_START_OVERRIDE(playmark_state,wbeachvl)
@@ -1188,11 +1185,10 @@ MACHINE_CONFIG_START(playmark_state::excelsr)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_excelsr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_excelsr)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_excelsr);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,excelsr)
@@ -1229,11 +1225,10 @@ MACHINE_CONFIG_START(playmark_state::hrdtimes)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_hrdtimes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hrdtimes)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_hrdtimes);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,hrdtimes)
@@ -1271,11 +1266,10 @@ MACHINE_CONFIG_START(playmark_state::hotmind)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_hrdtimes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_hotmind)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_hotmind);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,hotmind)
@@ -1316,11 +1310,10 @@ MACHINE_CONFIG_START(playmark_state::luckboomh)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(playmark_state, screen_update_hrdtimes)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_luckboomh)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_luckboomh);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(playmark_state,luckboomh)
diff --git a/src/mame/drivers/plygonet.cpp b/src/mame/drivers/plygonet.cpp
index 2d1cff6bfba..544b417338a 100644
--- a/src/mame/drivers/plygonet.cpp
+++ b/src/mame/drivers/plygonet.cpp
@@ -582,8 +582,7 @@ void polygonet_state::plygonet(machine_config &config)
screen.set_screen_update(FUNC(polygonet_state::screen_update_polygonet));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 32768);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 32768);
K053936(config, m_k053936, 0);
diff --git a/src/mame/drivers/pmd85.cpp b/src/mame/drivers/pmd85.cpp
index d516ac37498..2ffd4d5113b 100644
--- a/src/mame/drivers/pmd85.cpp
+++ b/src/mame/drivers/pmd85.cpp
@@ -622,10 +622,9 @@ void pmd85_state::pmd85(machine_config &config, bool with_uart)
screen.set_size(288, 256);
screen.set_visarea(0, 288-1, 0, 256-1);
screen.set_screen_update(FUNC(pmd85_state::screen_update_pmd85));
- screen.set_palette("palette");
+ screen.set_palette(m_palette);
- PALETTE(config, m_palette, 3);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pockchal.cpp b/src/mame/drivers/pockchal.cpp
index c55f93477ca..0d4a900e346 100644
--- a/src/mame/drivers/pockchal.cpp
+++ b/src/mame/drivers/pockchal.cpp
@@ -43,16 +43,19 @@ public:
void pockchalv1(machine_config &config);
-private:
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
+
+private:
uint32_t screen_update_pockchalv1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pockchalv1_cart);
+ void pockchalv1_map(address_map &map);
+
required_device<cpu_device> m_maincpu;
required_device<generic_slot_device> m_cart;
uint32_t m_rom_size;
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pockchalv1_cart);
- void pockchalv1_map(address_map &map);
};
@@ -105,9 +108,7 @@ MACHINE_CONFIG_START(pockchalv1_state::pockchalv1)
// MCFG_DEVICE_VBLANK_INT_DRIVER("screen", pockchalv1_state, irq0_line_hold)
// wrong, it's a b&w / greyscale thing
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_444, 0x100).set_endianness(ENDIANNESS_BIG);
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/pocketc.cpp b/src/mame/drivers/pocketc.cpp
index 4ba6701a99e..d35e3ffc747 100644
--- a/src/mame/drivers/pocketc.cpp
+++ b/src/mame/drivers/pocketc.cpp
@@ -731,9 +731,7 @@ void pocketc_state::pocketc_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pc1401);
- PALETTE(config, m_palette, 8*2);
- m_palette->set_indirect_entries(6);
- m_palette->set_init(palette_init_delegate(FUNC(pocketc_state::palette_init_pocketc), this));
+ PALETTE(config, m_palette, FUNC(pocketc_state::pocketc_palette), 8*2, 6);
}
void pc1401_state::pc1401(machine_config &config)
diff --git a/src/mame/drivers/pockstat.cpp b/src/mame/drivers/pockstat.cpp
index 2dd86fbdcdd..869cfc9bc0e 100644
--- a/src/mame/drivers/pockstat.cpp
+++ b/src/mame/drivers/pockstat.cpp
@@ -107,8 +107,8 @@ struct ps_rtc_regs_t
class pockstat_state : public driver_device
{
public:
- pockstat_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pockstat_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_lcd_buffer(*this, "lcd_buffer"),
m_maincpu(*this, "maincpu"),
m_cart(*this, "cartslot")
@@ -992,7 +992,7 @@ MACHINE_CONFIG_START(pockstat_state::pockstat)
MCFG_SCREEN_VISIBLE_AREA(0, 32-1, 0, 32-1)
MCFG_SCREEN_UPDATE_DRIVER(pockstat_state, screen_update_pockstat)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
SPEAKER(config, "speaker").front_center();
MCFG_DEVICE_ADD("dac", DAC_16BIT_R2R_TWOS_COMPLEMENT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.5) // unknown DAC
diff --git a/src/mame/drivers/pofo.cpp b/src/mame/drivers/pofo.cpp
index 6d61735c124..582d7baaaf8 100644
--- a/src/mame/drivers/pofo.cpp
+++ b/src/mame/drivers/pofo.cpp
@@ -141,7 +141,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( eint_w );
DECLARE_WRITE_LINE_MEMBER( wake_w );
- DECLARE_PALETTE_INIT(portfolio);
+ void portfolio_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(keyboard_tick);
TIMER_DEVICE_CALLBACK_MEMBER(system_tick);
TIMER_DEVICE_CALLBACK_MEMBER(counter_tick);
@@ -926,7 +926,7 @@ WRITE8_MEMBER( portfolio_state::contrast_w )
// PALETTE_INIT( portfolio )
//-------------------------------------------------
-PALETTE_INIT_MEMBER(portfolio_state, portfolio)
+void portfolio_state::portfolio_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(142, 193, 172));
palette.set_pen_color(1, rgb_t(67, 71, 151));
@@ -1029,10 +1029,9 @@ MACHINE_CONFIG_START(portfolio_state::portfolio)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(portfolio_state, portfolio)
+ PALETTE(config, "palette", FUNC(portfolio_state::portfolio_palette), 2);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_portfolio)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_portfolio);
MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL(4'915'200)/2/2)
MCFG_DEVICE_ADDRESS_MAP(0, portfolio_lcdc)
diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp
index d6a608a7854..ccb3a81dda8 100644
--- a/src/mame/drivers/poisk1.cpp
+++ b/src/mame/drivers/poisk1.cpp
@@ -84,6 +84,11 @@ public:
void init_poisk1();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<pic8259_device> m_pic8259;
@@ -99,19 +104,6 @@ private:
required_ioport_array<8> m_kbdio;
- DECLARE_MACHINE_START(poisk1);
- DECLARE_MACHINE_RESET(poisk1);
-
- DECLARE_PALETTE_INIT(p1);
- virtual void video_start() override;
- uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void set_palette_luts();
- POISK1_UPDATE_ROW(cga_gfx_2bpp_update_row);
- POISK1_UPDATE_ROW(cga_gfx_1bpp_update_row);
- POISK1_UPDATE_ROW(poisk1_gfx_1bpp_update_row);
-
- DECLARE_WRITE_LINE_MEMBER(p1_pit8253_out2_changed);
- DECLARE_WRITE_LINE_MEMBER(p1_speaker_set_spkrdata);
uint8_t m_p1_spkrdata;
uint8_t m_p1_input;
@@ -129,6 +121,15 @@ private:
void *update_row(bitmap_rgb32 &bitmap, const rectangle &cliprect, uint8_t *videoram, uint16_t ma, uint8_t ra, uint8_t stride);
} m_video;
+ void p1_palette(palette_device &palette) const;
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ void set_palette_luts();
+ POISK1_UPDATE_ROW(cga_gfx_2bpp_update_row);
+ POISK1_UPDATE_ROW(cga_gfx_1bpp_update_row);
+ POISK1_UPDATE_ROW(poisk1_gfx_1bpp_update_row);
+
+ DECLARE_WRITE_LINE_MEMBER(p1_pit8253_out2_changed);
+ DECLARE_WRITE_LINE_MEMBER(p1_speaker_set_spkrdata);
DECLARE_READ8_MEMBER(p1_trap_r);
DECLARE_WRITE8_MEMBER(p1_trap_w);
DECLARE_READ8_MEMBER(p1_cga_r);
@@ -145,7 +146,7 @@ private:
DECLARE_WRITE8_MEMBER(p1_ppi2_porta_w);
DECLARE_WRITE8_MEMBER(p1_ppi2_portb_w);
DECLARE_READ8_MEMBER(p1_ppi2_portc_r);
- const char *m_cputag;
+
void poisk1_io(address_map &map);
void poisk1_map(address_map &map);
};
@@ -402,17 +403,13 @@ POISK1_UPDATE_ROW(p1_state::poisk1_gfx_1bpp_update_row)
}
}
-/* Initialise the cga palette */
-PALETTE_INIT_MEMBER(p1_state, p1)
+// Initialise the cga palette
+void p1_state::p1_palette(palette_device &palette) const
{
- int i;
-
DBG_LOG(0, "init", ("palette_init()\n"));
- for (i = 0; i < CGA_PALETTE_SETS * 16; i++)
- {
+ for (int i = 0; i < CGA_PALETTE_SETS * 16; i++)
palette.set_pen_color(i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2]);
- }
}
void p1_state::video_start()
@@ -608,12 +605,12 @@ void p1_state::init_poisk1()
membank("bank10")->set_base(m_ram->pointer());
}
-MACHINE_START_MEMBER(p1_state, poisk1)
+void p1_state::machine_start()
{
DBG_LOG(0, "init", ("machine_start()\n"));
}
-MACHINE_RESET_MEMBER(p1_state, poisk1)
+void p1_state::machine_reset()
{
DBG_LOG(0, "init", ("machine_reset()\n"));
@@ -652,9 +649,6 @@ MACHINE_CONFIG_START(p1_state::poisk1)
m_maincpu->set_addrmap(AS_IO, &p1_state::poisk1_io);
m_maincpu->set_irq_acknowledge_callback("pic8259", FUNC(pic8259_device::inta_cb));
- MCFG_MACHINE_START_OVERRIDE( p1_state, poisk1 )
- MCFG_MACHINE_RESET_OVERRIDE( p1_state, poisk1 )
-
PIT8253(config, m_pit8253, 0);
m_pit8253->set_clk<0>(XTAL(15'000'000)/12); /* heartbeat IRQ */
m_pit8253->out_handler<0>().set(m_pic8259, FUNC(pic8259_device::ir0_w));
@@ -706,8 +700,7 @@ MACHINE_CONFIG_START(p1_state::poisk1)
MCFG_SCREEN_UPDATE_DRIVER( p1_state, screen_update )
/* XXX verify palette */
- MCFG_PALETTE_ADD("palette", CGA_PALETTE_SETS * 16 )
- MCFG_PALETTE_INIT_OWNER(p1_state, p1)
+ PALETTE(config, m_palette, FUNC(p1_state::p1_palette), CGA_PALETTE_SETS * 16);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("512K");
diff --git a/src/mame/drivers/pokechmp.cpp b/src/mame/drivers/pokechmp.cpp
index 90694075309..9dcdfdc4add 100644
--- a/src/mame/drivers/pokechmp.cpp
+++ b/src/mame/drivers/pokechmp.cpp
@@ -242,13 +242,12 @@ MACHINE_CONFIG_START(pokechmp_state::pokechmp)
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.set_palette(m_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)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pokemini.cpp b/src/mame/drivers/pokemini.cpp
index 45dd4a4837c..8fe2547852c 100644
--- a/src/mame/drivers/pokemini.cpp
+++ b/src/mame/drivers/pokemini.cpp
@@ -20,35 +20,6 @@ The LCD is likely to be a SSD1828 LCD.
#include "softlist.h"
#include "speaker.h"
-struct PRC
-{
- uint8_t colors_inverted;
- uint8_t background_enabled;
- uint8_t sprites_enabled;
- uint8_t copy_enabled;
- uint8_t map_size;
- uint8_t map_size_x;
- uint8_t frame_count;
- uint8_t max_frame_count;
- uint32_t bg_tiles;
- uint32_t spr_tiles;
- uint8_t count;
- emu_timer *count_timer;
-};
-
-
-struct TIMERS
-{
- emu_timer *seconds_timer;
- emu_timer *hz256_timer;
- emu_timer *timer1; /* Timer 1 low or 16bit */
- emu_timer *timer1_hi; /* Timer 1 hi */
- emu_timer *timer2; /* Timer 2 low or 16bit */
- emu_timer *timer2_hi; /* Timer 2 high */
- emu_timer *timer3; /* Timer 3 low or 16bit */
- emu_timer *timer3_hi; /* Timer 3 high */
-};
-
class pokemini_state : public driver_device
{
@@ -66,23 +37,7 @@ public:
void pokemini(machine_config &config);
-private:
- uint8_t m_pm_reg[0x100];
- PRC m_prc;
- TIMERS m_timers;
- bitmap_ind16 m_bitmap;
- virtual void video_start() override;
- virtual void machine_start() override;
-
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(pokemini);
- DECLARE_WRITE8_MEMBER(hwreg_w);
- DECLARE_READ8_MEMBER(hwreg_r);
- DECLARE_READ8_MEMBER(rom_r);
- DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pokemini_cart);
-
- void pokemini_mem_map(address_map &map);
-
+protected:
enum
{
TIMER_SECONDS,
@@ -98,6 +53,44 @@ private:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+ virtual void video_start() override;
+ virtual void machine_start() override;
+
+private:
+ struct PRC
+ {
+ uint8_t colors_inverted;
+ uint8_t background_enabled;
+ uint8_t sprites_enabled;
+ uint8_t copy_enabled;
+ uint8_t map_size;
+ uint8_t map_size_x;
+ uint8_t frame_count;
+ uint8_t max_frame_count;
+ uint32_t bg_tiles;
+ uint32_t spr_tiles;
+ uint8_t count;
+ emu_timer *count_timer;
+ };
+
+
+ struct TIMERS
+ {
+ emu_timer *seconds_timer;
+ emu_timer *hz256_timer;
+ emu_timer *timer1; // Timer 1 low or 16bit
+ emu_timer *timer1_hi; // Timer 1 hi
+ emu_timer *timer2; // Timer 2 low or 16bit
+ emu_timer *timer2_hi; // Timer 2 high
+ emu_timer *timer3; // Timer 3 low or 16bit
+ emu_timer *timer3_hi; // Timer 3 high
+ };
+
+ uint8_t m_pm_reg[0x100];
+ PRC m_prc;
+ TIMERS m_timers;
+ bitmap_ind16 m_bitmap;
+
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_shared_ptr<uint8_t> m_p_ram;
@@ -106,6 +99,15 @@ private:
required_device<generic_slot_device> m_cart;
required_ioport m_inputs;
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void pokemini_palette(palette_device &palette) const;
+ DECLARE_WRITE8_MEMBER(hwreg_w);
+ DECLARE_READ8_MEMBER(hwreg_r);
+ DECLARE_READ8_MEMBER(rom_r);
+ DECLARE_DEVICE_IMAGE_LOAD_MEMBER(pokemini_cart);
+
+ void pokemini_mem_map(address_map &map);
+
void check_irqs();
void update_sound();
void seconds_timer_callback();
@@ -149,7 +151,7 @@ static INPUT_PORTS_START( pokemini )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(pokemini_state, pokemini)
+void pokemini_state::pokemini_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0xff, 0xfb, 0x87));
palette.set_pen_color(1, rgb_t(0xb1, 0xae, 0x4e));
@@ -1778,7 +1780,7 @@ void pokemini_state::pokemini(machine_config &config)
m_screen->set_refresh_hz(72);
m_screen->set_palette("palette");
- PALETTE(config, "palette", 4).set_init(FUNC(pokemini_state::palette_init_pokemini));
+ PALETTE(config, "palette", FUNC(pokemini_state::pokemini_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/poker72.cpp b/src/mame/drivers/poker72.cpp
index 0f5f37e5d74..ff8c55b240a 100644
--- a/src/mame/drivers/poker72.cpp
+++ b/src/mame/drivers/poker72.cpp
@@ -29,32 +29,36 @@
class poker72_state : public driver_device
{
public:
- poker72_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ poker72_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
m_pal(*this, "pal"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void poker72(machine_config &config);
void init_poker72();
+protected:
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_vram;
required_shared_ptr<uint8_t> m_pal;
uint8_t m_tile_bank;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
DECLARE_WRITE8_MEMBER(poker72_paletteram_w);
DECLARE_WRITE8_MEMBER(output_w);
DECLARE_WRITE8_MEMBER(tile_bank_w);
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(poker72);
+ void poker72_palette(palette_device &palette) const;
uint32_t screen_update_poker72(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void poker72_map(address_map &map);
};
@@ -91,12 +95,11 @@ uint32_t poker72_state::screen_update_poker72(screen_device &screen, bitmap_ind1
WRITE8_MEMBER(poker72_state::poker72_paletteram_w)
{
- int r,g,b;
m_pal[offset] = data;
- r = m_pal[(offset & 0x3ff)+0x000] & 0x3f;
- g = m_pal[(offset & 0x3ff)+0x400] & 0x3f;
- b = m_pal[(offset & 0x3ff)+0x800] & 0x3f;
+ int const r = m_pal[(offset & 0x3ff) + 0x000] & 0x3f;
+ int const g = m_pal[(offset & 0x3ff) + 0x400] & 0x3f;
+ int const b = m_pal[(offset & 0x3ff) + 0x800] & 0x3f;
m_palette->set_pen_color( offset & 0x3ff, pal6bit(r), pal6bit(g), pal6bit(b));
}
@@ -352,16 +355,14 @@ static GFXDECODE_START( gfx_poker72 )
GFXDECODE_END
/* default 444 palette for debug purpose */
-PALETTE_INIT_MEMBER(poker72_state, poker72)
+void poker72_state::poker72_palette(palette_device &palette) const
{
- int x,r,g,b;
-
- for(x=0;x<0x100;x++)
+ for (int x = 0; x < 0x100; x++)
{
- r = (x & 0xf)*0x10;
- g = ((x & 0x3c)>>2)*0x10;
- b = ((x & 0xf0)>>4)*0x10;
- palette.set_pen_color(x,rgb_t(r,g,b));
+ int const r = (x & 0x0f);
+ int const g = (x & 0x3c) >> 2;
+ int const b = (x & 0xf0) >> 4;
+ palette.set_pen_color(x, rgb_t(pal4bit(r), pal4bit(g), pal4bit(b)));
}
}
@@ -371,14 +372,11 @@ void poker72_state::machine_reset()
}
MACHINE_CONFIG_START(poker72_state::poker72)
-
-
/* basic machine hardware */
MCFG_DEVICE_ADD("maincpu", Z80,8000000) /* ? MHz */
MCFG_DEVICE_PROGRAM_MAP(poker72_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", poker72_state, irq0_line_hold)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -386,11 +384,10 @@ MACHINE_CONFIG_START(poker72_state::poker72)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(poker72_state, screen_update_poker72)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_poker72)
- MCFG_PALETTE_ADD("palette", 0xe00)
- MCFG_PALETTE_INIT_OWNER(poker72_state, poker72)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_poker72);
+ PALETTE(config, m_palette, FUNC(poker72_state::poker72_palette), 0xe00);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/polepos.cpp b/src/mame/drivers/polepos.cpp
index 5aff7acec08..f08c869e3f8 100644
--- a/src/mame/drivers/polepos.cpp
+++ b/src/mame/drivers/polepos.cpp
@@ -923,9 +923,7 @@ void polepos_state::polepos(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_polepos);
- PALETTE(config, m_palette, 0x0f00);
- m_palette->set_indirect_entries(128);
- m_palette->set_init(FUNC(polepos_state::palette_init_polepos));
+ PALETTE(config, m_palette, FUNC(polepos_state::polepos_palette), 0x0f00, 128);
config.set_default_layout(layout_polepos);
@@ -1031,9 +1029,7 @@ void polepos_state::topracern(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_polepos);
- PALETTE(config, m_palette, 0x0f00);
- m_palette->set_indirect_entries(128);
- m_palette->set_init(FUNC(polepos_state::palette_init_polepos));
+ PALETTE(config, m_palette, FUNC(polepos_state::polepos_palette), 0x0f00, 128);
config.set_default_layout(layout_topracer);
diff --git a/src/mame/drivers/policetr.cpp b/src/mame/drivers/policetr.cpp
index b427da117da..c46eb3f2664 100644
--- a/src/mame/drivers/policetr.cpp
+++ b/src/mame/drivers/policetr.cpp
@@ -425,7 +425,7 @@ void policetr_state::policetr(machine_config &config)
m_screen->set_screen_update(FUNC(policetr_state::screen_update));
m_screen->screen_vblank().set(FUNC(policetr_state::vblank));
- PALETTE(config, m_palette, 256);
+ PALETTE(config, m_palette).set_entries(256);
/* sound hardware */
SPEAKER(config, m_lspeaker).front_left();
diff --git a/src/mame/drivers/poly88.cpp b/src/mame/drivers/poly88.cpp
index c6177449de5..3d24a4bf349 100644
--- a/src/mame/drivers/poly88.cpp
+++ b/src/mame/drivers/poly88.cpp
@@ -213,7 +213,7 @@ MACHINE_CONFIG_START(poly88_state::poly88)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_poly88)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* audio hardware */
diff --git a/src/mame/drivers/polyplay.cpp b/src/mame/drivers/polyplay.cpp
index d41a2cced96..276dec717b0 100644
--- a/src/mame/drivers/polyplay.cpp
+++ b/src/mame/drivers/polyplay.cpp
@@ -304,18 +304,15 @@ MACHINE_CONFIG_START(polyplay_state::polyplay_zre)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(polyplay_state, screen_update_polyplay)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_polyplay)
- MCFG_PALETTE_ADD("palette", 10)
- MCFG_PALETTE_INIT_OWNER(polyplay_state, polyplay)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_polyplay);
+ PALETTE(config, m_palette, FUNC(polyplay_state::polyplay_palette), 10);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker1", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
- MCFG_DEVICE_ADD("speaker2", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
+ SPEAKER_SOUND(config, m_speaker1).add_route(ALL_OUTPUTS, "mono", 0.5);
+ SPEAKER_SOUND(config, m_speaker2).add_route(ALL_OUTPUTS, "mono", 0.5);
MACHINE_CONFIG_END
void polyplay_state::polyplay_zrepp(machine_config &config)
diff --git a/src/mame/drivers/poolshrk.cpp b/src/mame/drivers/poolshrk.cpp
index 2f74274948c..ce6ca8118fb 100644
--- a/src/mame/drivers/poolshrk.cpp
+++ b/src/mame/drivers/poolshrk.cpp
@@ -207,12 +207,12 @@ static GFXDECODE_START( gfx_poolshrk )
GFXDECODE_END
-PALETTE_INIT_MEMBER(poolshrk_state, poolshrk)
+void poolshrk_state::poolshrk_palette(palette_device &palette) const
{
- palette.set_pen_color(0,rgb_t(0x7F, 0x7F, 0x7F));
- palette.set_pen_color(1,rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(2,rgb_t(0x7F, 0x7F, 0x7F));
- palette.set_pen_color(3,rgb_t(0x00, 0x00, 0x00));
+ palette.set_pen_color(0, rgb_t(0x7f, 0x7f, 0x7f));
+ palette.set_pen_color(1, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(2, rgb_t(0x7f, 0x7f, 0x7f));
+ palette.set_pen_color(3, rgb_t(0x00, 0x00, 0x00));
}
@@ -231,11 +231,10 @@ MACHINE_CONFIG_START(poolshrk_state::poolshrk)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(1, 255, 24, 255)
MCFG_SCREEN_UPDATE_DRIVER(poolshrk_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_poolshrk)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(poolshrk_state, poolshrk)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_poolshrk)
+ PALETTE(config, m_palette, FUNC(poolshrk_state::poolshrk_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pooyan.cpp b/src/mame/drivers/pooyan.cpp
index a3d1809e391..6bc9f9a649c 100644
--- a/src/mame/drivers/pooyan.cpp
+++ b/src/mame/drivers/pooyan.cpp
@@ -219,14 +219,11 @@ MACHINE_CONFIG_START(pooyan_state::pooyan)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, pooyan_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pooyan)
- MCFG_PALETTE_ADD("palette", 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(pooyan_state, pooyan)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pooyan);
+ PALETTE(config, m_palette, FUNC(pooyan_state::pooyan_palette), 16*16+16*16, 32);
/* sound hardware */
-
- MCFG_DEVICE_ADD("timeplt_audio", TIMEPLT_AUDIO)
+ TIMEPLT_AUDIO(config, "timeplt_audio");
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/popeye.cpp b/src/mame/drivers/popeye.cpp
index 05ae6f1a538..db9563448a8 100644
--- a/src/mame/drivers/popeye.cpp
+++ b/src/mame/drivers/popeye.cpp
@@ -604,7 +604,7 @@ void tnx1_state::config(machine_config &config)
screen.screen_vblank().set(FUNC(tnx1_state::screen_vblank));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_popeye);
- PALETTE(config, m_palette, 16+16*2+8*4).set_init(FUNC(tnx1_state::palette_init_tnx1));
+ PALETTE(config, m_palette, FUNC(tnx1_state::tnx1_palette), 16 + 16*2 + 8*4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp
index de8ae698ff4..a9f1823e99c 100644
--- a/src/mame/drivers/popobear.cpp
+++ b/src/mame/drivers/popobear.cpp
@@ -89,8 +89,8 @@ Component Side A B Solder Side
class popobear_state : public driver_device
{
public:
- popobear_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ popobear_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
@@ -654,13 +654,12 @@ MACHINE_CONFIG_START(popobear_state::popobear)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_UPDATE_DRIVER(popobear_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_SIZE(128*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 479, 0, 239)
- MCFG_PALETTE_ADD("palette", 256*2)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 256*2);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/popper.cpp b/src/mame/drivers/popper.cpp
index a4ea15e8d2d..40ee2ae1cfb 100644
--- a/src/mame/drivers/popper.cpp
+++ b/src/mame/drivers/popper.cpp
@@ -54,8 +54,8 @@
class popper_state : public driver_device
{
public:
- popper_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ popper_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "subcpu"),
m_screen(*this, "screen"),
@@ -99,7 +99,7 @@ private:
void main_map(address_map &map);
void sub_map(address_map &map);
- DECLARE_PALETTE_INIT(popper);
+ void popper_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(layer0_tile_info);
TILE_GET_INFO_MEMBER(layer1_tile_info);
@@ -259,9 +259,9 @@ static const res_net_decode_info popper_decode_info =
0,
63,
// R G B
- { 0, 0, 0, }, // offsets
- { 0, 3, 6, }, // shifts
- { 0x07, 0x07, 0x03, } // masks
+ { 0, 0, 0 }, // offsets
+ { 0, 3, 6 }, // shifts
+ { 0x07, 0x07, 0x03 } // masks
};
static const res_net_info popper_net_info =
@@ -274,7 +274,7 @@ static const res_net_info popper_net_info =
}
};
-PALETTE_INIT_MEMBER( popper_state, popper )
+void popper_state::popper_palette(palette_device &palette) const
{
const uint8_t *prom = memregion("colors")->base();
std::vector<rgb_t> rgb;
@@ -549,10 +549,9 @@ MACHINE_CONFIG_START(popper_state::popper)
MCFG_SCREEN_UPDATE_DRIVER(popper_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_popper)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_popper);
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(popper_state, popper)
+ PALETTE(config, "palette", FUNC(popper_state::popper_palette), 64);
// audio hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/portrait.cpp b/src/mame/drivers/portrait.cpp
index 4d1d4a11d67..385f5720e95 100644
--- a/src/mame/drivers/portrait.cpp
+++ b/src/mame/drivers/portrait.cpp
@@ -262,7 +262,6 @@ MACHINE_CONFIG_START(portrait_state::portrait)
MCFG_DEVICE_ADD("audiocpu", I8039, 3120000) /* ? */
MCFG_DEVICE_PROGRAM_MAP(portrait_sound_map)
-
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MCFG_SCREEN_ADD("screen", RASTER)
@@ -271,20 +270,17 @@ MACHINE_CONFIG_START(portrait_state::portrait)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 54*8-1, 0*8, 40*8-1)
MCFG_SCREEN_UPDATE_DRIVER(portrait_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_portrait)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x40)
- MCFG_PALETTE_INIT_OWNER(portrait_state, portrait)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_portrait);
+ PALETTE(config, m_palette, FUNC(portrait_state::portrait_palette), 0x800, 0x40);
/* sound hardware */
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, "soundlatch");
- MCFG_DEVICE_ADD("tms", TMS5200, 640000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ TMS5200(config, m_tms, 640000).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/powerbal.cpp b/src/mame/drivers/powerbal.cpp
index 27eae823577..09cca74a673 100644
--- a/src/mame/drivers/powerbal.cpp
+++ b/src/mame/drivers/powerbal.cpp
@@ -643,11 +643,10 @@ MACHINE_CONFIG_START(powerbal_state::powerbal)
MCFG_SCREEN_SIZE(128*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(powerbal_state, screen_update_powerbal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_powerbal)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_powerbal);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(powerbal_state,powerbal)
@@ -678,11 +677,10 @@ MACHINE_CONFIG_START(powerbal_state::magicstk)
MCFG_SCREEN_SIZE(128*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(powerbal_state, screen_update_powerbal)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_powerbal)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_powerbal);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(powerbal_state,powerbal)
diff --git a/src/mame/drivers/powerins.cpp b/src/mame/drivers/powerins.cpp
index 4a9f19b6d3d..fadeef8e1d3 100644
--- a/src/mame/drivers/powerins.cpp
+++ b/src/mame/drivers/powerins.cpp
@@ -305,11 +305,10 @@ MACHINE_CONFIG_START(powerins_state::powerins)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(powerins_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, powerins_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_powerins)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_powerins);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pp01.cpp b/src/mame/drivers/pp01.cpp
index e1fa74061ff..22386146fac 100644
--- a/src/mame/drivers/pp01.cpp
+++ b/src/mame/drivers/pp01.cpp
@@ -214,8 +214,7 @@ MACHINE_CONFIG_START(pp01_state::pp01)
MCFG_SCREEN_UPDATE_DRIVER(pp01_state, screen_update_pp01)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(pp01_state, pp01)
+ PALETTE(config, "palette", FUNC(pp01_state::pp01_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ppmast93.cpp b/src/mame/drivers/ppmast93.cpp
index 4ec692dd319..ed8d38628d9 100644
--- a/src/mame/drivers/ppmast93.cpp
+++ b/src/mame/drivers/ppmast93.cpp
@@ -145,12 +145,13 @@ Dip locations added based on the notes above.
class ppmast93_state : public driver_device
{
public:
- ppmast93_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ppmast93_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_bgram(*this, "bgram"),
- m_fgram(*this, "fgram") { }
+ m_fgram(*this, "fgram")
+ { }
void ppmast93(machine_config &config);
@@ -395,7 +396,7 @@ MACHINE_CONFIG_START(ppmast93_state::ppmast93)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ppmast93)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x100)
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 0x100);
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/prehisle.cpp b/src/mame/drivers/prehisle.cpp
index 22d00222fef..619e813cd48 100644
--- a/src/mame/drivers/prehisle.cpp
+++ b/src/mame/drivers/prehisle.cpp
@@ -216,10 +216,10 @@ MACHINE_CONFIG_START(prehisle_state::prehisle)
// rate on a snk68.c with very similar hardware board is 59.16Hz.
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000)/4, 384, 0, 256, 264, 16, 240)
MCFG_SCREEN_UPDATE_DRIVER(prehisle_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_prehisle);
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/prestige.cpp b/src/mame/drivers/prestige.cpp
index c0c047c9ce4..fbc565d4fd6 100644
--- a/src/mame/drivers/prestige.cpp
+++ b/src/mame/drivers/prestige.cpp
@@ -118,6 +118,9 @@ public:
void prestige(machine_config &config);
void gl7007sl(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
@@ -146,13 +149,12 @@ private:
uint8_t split_pos;
} m_lcdc;
- virtual void machine_start() override;
+ memory_region *m_cart_rom;
+
uint32_t screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_1bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_2bpp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- memory_region *m_cart_rom;
-
DECLARE_READ8_MEMBER( bankswitch_r );
DECLARE_WRITE8_MEMBER( bankswitch_w );
DECLARE_READ8_MEMBER( kb_r );
@@ -160,8 +162,8 @@ private:
DECLARE_READ8_MEMBER( mouse_r );
DECLARE_WRITE8_MEMBER( mouse_w );
DECLARE_WRITE8_MEMBER( lcdc_w );
- DECLARE_PALETTE_INIT(prestige);
- DECLARE_PALETTE_INIT(glcolor);
+ void prestige_palette(palette_device &palette) const;
+ void glcolor_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(irq_timer);
IRQ_CALLBACK_MEMBER(prestige_int_ack);
@@ -679,18 +681,18 @@ void prestige_state::machine_start()
m_vram = ram;
}
-PALETTE_INIT_MEMBER(prestige_state, prestige)
+void prestige_state::prestige_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(39, 108, 51));
- palette.set_pen_color(1, rgb_t(16, 37, 84));
+ palette.set_pen_color(1, rgb_t(16, 37, 84));
}
-PALETTE_INIT_MEMBER(prestige_state, glcolor)
+void prestige_state::glcolor_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x3f,0xbf,0x3f));
- palette.set_pen_color(1, rgb_t(0xff,0x3f,0x5f));
- palette.set_pen_color(2, rgb_t(0x1f,0x1f,0x3f));
- palette.set_pen_color(3, rgb_t(0xff,0xdf,0x1f));
+ palette.set_pen_color(0, rgb_t(0x3f, 0xbf, 0x3f));
+ palette.set_pen_color(1, rgb_t(0xff, 0x3f, 0x5f));
+ palette.set_pen_color(2, rgb_t(0x1f, 0x1f, 0x3f));
+ palette.set_pen_color(3, rgb_t(0xff, 0xdf, 0x1f));
}
uint32_t prestige_state::screen_update(int bpp, screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -759,8 +761,7 @@ MACHINE_CONFIG_START(prestige_state::prestige_base)
MCFG_SCREEN_VISIBLE_AREA( 0, 240-1, 0, 100-1 )
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(prestige_state, prestige)
+ PALETTE(config, "palette", FUNC(prestige_state::prestige_palette), 2);
/* cartridge */
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "genius_cart")
@@ -771,6 +772,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::glcolor)
prestige_base(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_IO_MAP(glcolor_io)
@@ -780,9 +782,7 @@ MACHINE_CONFIG_START(prestige_state::glcolor)
MCFG_SCREEN_SIZE( 160, 80 )
MCFG_SCREEN_VISIBLE_AREA( 0, 160-1, 0, 80-1 )
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(4)
- MCFG_PALETTE_INIT_OWNER(prestige_state, glcolor)
+ subdevice<palette_device>("palette")->set_entries(4).set_init(FUNC(prestige_state::glcolor_palette));
MCFG_SOFTWARE_LIST_ADD("cart_list", "glcolor")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("snotec_cart", "snotec")
@@ -790,12 +790,14 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::glmcolor)
glcolor(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_IO_MAP(prestige_io)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::snotec)
glcolor(config);
+
MCFG_SOFTWARE_LIST_REMOVE("cart_list")
MCFG_SOFTWARE_LIST_REMOVE("snotec_cart")
MCFG_SOFTWARE_LIST_ADD("cart_list", "snotec")
@@ -804,6 +806,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::prestige)
prestige_base(config);
+
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000")
@@ -811,6 +814,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::gl6000sl)
prestige_base(config);
+
MCFG_SOFTWARE_LIST_ADD("cart_list", "gl6000sl")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000")
@@ -818,6 +822,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::gl7007sl)
prestige_base(config);
+
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl6000sl_cart", "gl6000sl")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("gl2000_cart", "gl2000")
MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("misterx_cart", "misterx")
@@ -825,11 +830,13 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::gjmovie)
prestige_base(config);
+
MCFG_SOFTWARE_LIST_ADD("cart_list", "gjmovie")
MACHINE_CONFIG_END
MACHINE_CONFIG_START(prestige_state::princ)
prestige_base(config);
+
MCFG_DEVICE_REMOVE("cartslot")
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "princ_cart")
MCFG_SOFTWARE_LIST_ADD("cart_list", "princ")
diff --git a/src/mame/drivers/primo.cpp b/src/mame/drivers/primo.cpp
index 063dda9dd1e..803f97bcb58 100644
--- a/src/mame/drivers/primo.cpp
+++ b/src/mame/drivers/primo.cpp
@@ -262,7 +262,7 @@ MACHINE_CONFIG_START(primo_state::primoa32)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, primo_state, vblank_irq))
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/progolf.cpp b/src/mame/drivers/progolf.cpp
index 0025193a436..e84624d7d4f 100644
--- a/src/mame/drivers/progolf.cpp
+++ b/src/mame/drivers/progolf.cpp
@@ -67,14 +67,15 @@ Twenty four 8116 rams.
class progolf_state : public driver_device
{
public:
- progolf_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ progolf_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
- m_fbram(*this, "fbram") { }
+ m_fbram(*this, "fbram")
+ { }
void progolfa(machine_config &config);
void progolf(machine_config &config);
@@ -107,7 +108,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(progolf);
+ void progolf_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_cpu(address_map &map);
@@ -389,32 +390,31 @@ static GFXDECODE_START( gfx_progolf )
GFXDECODE_END
-PALETTE_INIT_MEMBER(progolf_state, progolf)
+void progolf_state::progolf_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < m_palette->entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- m_palette->set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -439,11 +439,10 @@ MACHINE_CONFIG_START(progolf_state::progolf)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(progolf_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_progolf)
- MCFG_PALETTE_ADD("palette", 32*3)
- MCFG_PALETTE_INIT_OWNER(progolf_state, progolf)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_progolf)
+ PALETTE(config, m_palette, FUNC(progolf_state::progolf_palette), 32 * 3);
mc6845_device &crtc(MC6845(config, "crtc", 3000000/4)); /* hand tuned to get ~57 fps */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/proteus3.cpp b/src/mame/drivers/proteus3.cpp
index 39332f15078..f6d8a4bb0af 100644
--- a/src/mame/drivers/proteus3.cpp
+++ b/src/mame/drivers/proteus3.cpp
@@ -394,7 +394,7 @@ MACHINE_CONFIG_START(proteus3_state::proteus3)
MCFG_SCREEN_UPDATE_DRIVER(proteus3_state, screen_update_proteus3)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_proteus3)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* Devices */
PIA6821(config, m_pia, 0);
diff --git a/src/mame/drivers/ps2sony.cpp b/src/mame/drivers/ps2sony.cpp
index c5329397ab5..6d3bf45ba8b 100644
--- a/src/mame/drivers/ps2sony.cpp
+++ b/src/mame/drivers/ps2sony.cpp
@@ -780,7 +780,7 @@ void ps2sony_state::ps2sony(machine_config &config)
screen.set_size(640, 256);
screen.set_visarea(0, 639, 0, 223);
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
}
diff --git a/src/mame/drivers/psikyo.cpp b/src/mame/drivers/psikyo.cpp
index 9f9f49b00f4..5492b3ce37c 100644
--- a/src/mame/drivers/psikyo.cpp
+++ b/src/mame/drivers/psikyo.cpp
@@ -1045,7 +1045,7 @@ void psikyo_state::sngkace(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_psikyo);
- PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
MCFG_VIDEO_START_OVERRIDE(psikyo_state,sngkace)
@@ -1090,7 +1090,7 @@ void psikyo_state::gunbird(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_psikyo);
- PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
MCFG_VIDEO_START_OVERRIDE(psikyo_state,psikyo)
@@ -1130,7 +1130,7 @@ void psikyo_state::s1945bl(machine_config &config) /* Bootleg hardware based on
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_psikyo);
- PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
MCFG_VIDEO_START_OVERRIDE(psikyo_state,psikyo)
@@ -1172,7 +1172,7 @@ void psikyo_state::s1945(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_psikyo);
- PALETTE(config, m_palette, 0x1000).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000);
MCFG_VIDEO_START_OVERRIDE(psikyo_state,psikyo)
diff --git a/src/mame/drivers/psikyo4.cpp b/src/mame/drivers/psikyo4.cpp
index 9a9173b194d..c31b86061b1 100644
--- a/src/mame/drivers/psikyo4.cpp
+++ b/src/mame/drivers/psikyo4.cpp
@@ -614,8 +614,8 @@ void psikyo4_state::ps4big(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette[0], gfx_ps4);
- PALETTE(config, m_palette[0], (0x2000/4) + 1); /* palette + clear colour */
- PALETTE(config, m_palette[1], (0x2000/4) + 1);
+ PALETTE(config, m_palette[0]).set_entries((0x2000/4) + 1); /* palette + clear colour */
+ PALETTE(config, m_palette[1]).set_entries((0x2000/4) + 1);
config.set_default_layout(layout_dualhsxs);
diff --git a/src/mame/drivers/psikyosh.cpp b/src/mame/drivers/psikyosh.cpp
index 123edf11b55..57308ca514f 100644
--- a/src/mame/drivers/psikyosh.cpp
+++ b/src/mame/drivers/psikyosh.cpp
@@ -799,7 +799,7 @@ void psikyosh_state::psikyo3v1(machine_config &config)
m_screen->screen_vblank().set("spriteram", FUNC(buffered_spriteram32_device::vblank_copy_rising));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_psikyosh);
- PALETTE(config, m_palette, 0x5000/4).set_format(PALETTE_FORMAT_RGBX);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_888, 0x5000 / 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/psion.cpp b/src/mame/drivers/psion.cpp
index 1df9f392840..7396377a534 100644
--- a/src/mame/drivers/psion.cpp
+++ b/src/mame/drivers/psion.cpp
@@ -547,7 +547,7 @@ HD44780_PIXEL_UPDATE(psion1_state::psion1_pixel_update)
bitmap.pix16(y, (line * 8 + pos) * 6 + x) = state;
}
-PALETTE_INIT_MEMBER(psion_state, psion)
+void psion_state::psion_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -582,17 +582,15 @@ MACHINE_CONFIG_START(psion_state::psion_2lines)
MCFG_SCREEN_VISIBLE_AREA(0, 6*16-1, 0, 9*2-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(psion_state, psion)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_psion)
+ PALETTE(config, "palette", FUNC(psion_state::psion_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_psion);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD( "beeper", BEEP, 3250 )
- MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
+ BEEP(config, m_beep, 3250).add_route(ALL_OUTPUTS, "mono", 1.00);
NVRAM(config, "nvram1").set_custom_handler(FUNC(psion_state::nvram_init)); // sys_regs
NVRAM(config, "nvram2", nvram_device::DEFAULT_ALL_0); // RAM
diff --git a/src/mame/drivers/ptcsol.cpp b/src/mame/drivers/ptcsol.cpp
index e8429632831..381e6361a31 100644
--- a/src/mame/drivers/ptcsol.cpp
+++ b/src/mame/drivers/ptcsol.cpp
@@ -751,7 +751,7 @@ void sol20_state::sol20(machine_config &config)
m_screen->set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_sol20);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pturn.cpp b/src/mame/drivers/pturn.cpp
index add0ace9755..1f23febb9d2 100644
--- a/src/mame/drivers/pturn.cpp
+++ b/src/mame/drivers/pturn.cpp
@@ -541,9 +541,9 @@ MACHINE_CONFIG_START(pturn_state::pturn)
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(pturn_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x100)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x100);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pturn)
diff --git a/src/mame/drivers/pv1000.cpp b/src/mame/drivers/pv1000.cpp
index 560f05fbd21..5b3c23d7c52 100644
--- a/src/mame/drivers/pv1000.cpp
+++ b/src/mame/drivers/pv1000.cpp
@@ -134,8 +134,8 @@ void pv1000_sound_device::sound_stream_update(sound_stream &stream, stream_sampl
class pv1000_state : public driver_device
{
public:
- pv1000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pv1000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_sound(*this, "pv1000_sound"),
m_cart(*this, "cartslot"),
@@ -143,7 +143,7 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette")
- { }
+ { }
void pv1000(machine_config &config);
@@ -448,18 +448,17 @@ MACHINE_CONFIG_START(pv1000_state::pv1000)
/* D65010G031 - Video & sound chip */
- MCFG_SCREEN_ADD( "screen", RASTER )
- MCFG_SCREEN_RAW_PARAMS( 17897725/3, 380, 0, 256, 262, 0, 192 )
- MCFG_SCREEN_UPDATE_DRIVER(pv1000_state, screen_update_pv1000)
- MCFG_SCREEN_PALETTE("palette")
+ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ m_screen->set_raw(17897725/3, 380, 0, 256, 262, 0, 192);
+ m_screen->set_screen_update(FUNC(pv1000_state::screen_update_pv1000));
+ m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_3BIT);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pv1000 )
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pv1000)
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD( "pv1000_sound", PV1000, 17897725 )
- MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 )
+ PV1000(config, m_sound, 17897725).add_route(ALL_OUTPUTS, "mono", 1.00);
/* Cartridge slot */
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_linear_slot, "pv1000_cart")
diff --git a/src/mame/drivers/pv9234.cpp b/src/mame/drivers/pv9234.cpp
index caa3d7536aa..a3ff1a54d85 100644
--- a/src/mame/drivers/pv9234.cpp
+++ b/src/mame/drivers/pv9234.cpp
@@ -164,8 +164,7 @@ MACHINE_CONFIG_START(pv9234_state::pv9234)
MCFG_SCREEN_UPDATE_DRIVER(pv9234_state, screen_update_pv9234)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
-
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/px4.cpp b/src/mame/drivers/px4.cpp
index b582b4e5251..e3df0086904 100644
--- a/src/mame/drivers/px4.cpp
+++ b/src/mame/drivers/px4.cpp
@@ -91,7 +91,7 @@ public:
DECLARE_INPUT_CHANGED_MEMBER( key_callback );
protected:
- DECLARE_PALETTE_INIT( px4 );
+ void px4_palette(palette_device &palette) const;
uint32_t screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER( icrlc_r );
@@ -257,11 +257,11 @@ class px4p_state : public px4_state
{
public:
px4p_state(const machine_config &mconfig, device_type type, const char *tag) :
- px4_state(mconfig, type, tag),
- m_rdnvram(*this, "rdnvram"),
- m_rdsocket(*this, "ramdisk_socket"),
- m_ramdisk_address(0),
- m_ramdisk(nullptr)
+ px4_state(mconfig, type, tag),
+ m_rdnvram(*this, "rdnvram"),
+ m_rdsocket(*this, "ramdisk_socket"),
+ m_ramdisk_address(0),
+ m_ramdisk(nullptr)
{ }
void px4p(machine_config &config);
@@ -269,7 +269,7 @@ public:
void init_px4p();
private:
- DECLARE_PALETTE_INIT( px4p );
+ void px4p_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER( ramdisk_address_w );
DECLARE_READ8_MEMBER( ramdisk_data_r );
@@ -1468,13 +1468,13 @@ INPUT_PORTS_END
// PALETTE
//**************************************************************************
-PALETTE_INIT_MEMBER( px4_state, px4 )
+void px4_state::px4_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
}
-PALETTE_INIT_MEMBER( px4p_state, px4p )
+void px4p_state::px4p_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(149, 157, 130));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -1501,13 +1501,11 @@ MACHINE_CONFIG_START(px4_state::px4)
config.set_default_layout(layout_px4);
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(px4_state, px4)
+ PALETTE(config, "palette", FUNC(px4_state::px4_palette), 2);
// sound hardware
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.0);
MCFG_TIMER_DRIVER_ADD_PERIODIC("one_sec", px4_state, upd7508_1sec_callback, attotime::from_seconds(1))
MCFG_TIMER_DRIVER_ADD_PERIODIC("frc", px4_state, frc_tick, attotime::from_hz(XTAL(7'372'800) / 2 / 6))
@@ -1557,8 +1555,7 @@ MACHINE_CONFIG_START(px4p_state::px4p)
NVRAM(config, "rdnvram", nvram_device::DEFAULT_ALL_0);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(px4p_state, px4p)
+ subdevice<palette_device>("palette")->set_init(FUNC(px4p_state::px4p_palette));
MCFG_GENERIC_CARTSLOT_ADD("ramdisk_socket", generic_plain_slot, "px4_cart")
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/px8.cpp b/src/mame/drivers/px8.cpp
index 2137fd617c1..fdb96f8cb75 100644
--- a/src/mame/drivers/px8.cpp
+++ b/src/mame/drivers/px8.cpp
@@ -666,7 +666,7 @@ INPUT_PORTS_END
VIDEO
***************************************************************************/
-PALETTE_INIT_MEMBER(px8_state, px8)
+void px8_state::px8_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xa5, 0xad, 0xa5);
palette.set_pen_color(1, 0x31, 0x39, 0x10);
@@ -764,8 +764,7 @@ MACHINE_CONFIG_START(px8_state::px8)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_px8)
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(px8_state, px8)
+ PALETTE(config, "palette", FUNC(px8_state::px8_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pyl601.cpp b/src/mame/drivers/pyl601.cpp
index 76440684d7c..13c06294886 100644
--- a/src/mame/drivers/pyl601.cpp
+++ b/src/mame/drivers/pyl601.cpp
@@ -54,14 +54,15 @@
class pyl601_state : public driver_device
{
public:
- pyl601_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pyl601_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_speaker(*this, "speaker"),
m_fdc(*this, "upd765"),
m_floppy(*this, "upd765:%u", 0U),
m_ram(*this, RAM_TAG),
m_maincpu(*this, "maincpu"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void pyl601(machine_config &config);
void pyl601a(machine_config &config);
@@ -557,7 +558,7 @@ MACHINE_CONFIG_START(pyl601_state::pyl601)
MCFG_SCREEN_VISIBLE_AREA(0, 640 - 1, 0, 200 - 1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pyl601)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/pyson.cpp b/src/mame/drivers/pyson.cpp
index eaaaa296767..20c5a64d2f8 100644
--- a/src/mame/drivers/pyson.cpp
+++ b/src/mame/drivers/pyson.cpp
@@ -212,7 +212,7 @@ void pyson_state::pyson(machine_config &config)
screen.set_size(640, 480);
screen.set_visarea(0, 639, 0, 479);
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
}
#define PYSON_BIOS \
diff --git a/src/mame/drivers/pzletime.cpp b/src/mame/drivers/pzletime.cpp
index 35ada89f340..53a3015f514 100644
--- a/src/mame/drivers/pzletime.cpp
+++ b/src/mame/drivers/pzletime.cpp
@@ -28,8 +28,8 @@
class pzletime_state : public driver_device
{
public:
- pzletime_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pzletime_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_video_regs(*this, "video_regs"),
m_tilemap_regs(*this, "tilemap_regs"),
m_bg_videoram(*this, "bg_videoram"),
@@ -41,7 +41,8 @@ public:
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void pzletime(machine_config &config);
@@ -73,7 +74,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pzletime);
+ void pzletime_palette(palette_device &palette) const;
uint32_t screen_update_pzletime(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<okim6295_device> m_oki;
@@ -314,14 +315,12 @@ static GFXDECODE_START( gfx_pzletime )
GFXDECODE_ENTRY( "gfx3", 0, layout16x16, 0x000, 0x10 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(pzletime_state, pzletime)
+void pzletime_state::pzletime_palette(palette_device &palette) const
{
- int i;
-
- /* first 0x300 colors are dynamic */
+ // first 0x300 colors are dynamic
- /* initialize 555 RGB lookup */
- for (i = 0; i < 32768; i++)
+ // initialize 555 RGB lookup
+ for (int i = 0; i < 32768; i++)
palette.set_pen_color(i + 0x300, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0));
}
@@ -342,7 +341,6 @@ MACHINE_CONFIG_START(pzletime_state::pzletime)
MCFG_DEVICE_PROGRAM_MAP(pzletime_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", pzletime_state, irq4_line_hold)
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -350,20 +348,18 @@ MACHINE_CONFIG_START(pzletime_state::pzletime)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(pzletime_state, screen_update_pzletime)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pzletime)
- MCFG_PALETTE_ADD("palette", 0x300 + 32768)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_INIT_OWNER(pzletime_state, pzletime)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pzletime);
+ PALETTE(config, m_palette, FUNC(pzletime_state::pzletime_palette));
+ m_palette->set_format(palette_device::xRGB_555, 0x300 + 32768);
EEPROM_93C46_16BIT(config, "eeprom");
-
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("oki", OKIM6295, 937500, okim6295_device::PIN7_HIGH) //freq & pin7 taken from stlforce
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ OKIM6295(config, m_oki, 937500, okim6295_device::PIN7_HIGH); //freq & pin7 taken from stlforce
+ m_oki->add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
/***************************************************************************
diff --git a/src/mame/drivers/qdrmfgp.cpp b/src/mame/drivers/qdrmfgp.cpp
index ddcf12cfaa7..30b914bc6ba 100644
--- a/src/mame/drivers/qdrmfgp.cpp
+++ b/src/mame/drivers/qdrmfgp.cpp
@@ -547,8 +547,7 @@ void qdrmfgp_state::qdrmfgp(machine_config &config)
screen.set_screen_update(FUNC(qdrmfgp_state::screen_update_qdrmfgp));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp)
@@ -593,8 +592,7 @@ void qdrmfgp_state::qdrmfgp2(machine_config &config)
screen.set_screen_update(FUNC(qdrmfgp_state::screen_update_qdrmfgp));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_VIDEO_START_OVERRIDE(qdrmfgp_state,qdrmfgp2)
diff --git a/src/mame/drivers/quasar.cpp b/src/mame/drivers/quasar.cpp
index dd5ae4a64dc..d52d2abefa1 100644
--- a/src/mame/drivers/quasar.cpp
+++ b/src/mame/drivers/quasar.cpp
@@ -326,9 +326,7 @@ void quasar_state::quasar(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_quasar);
- PALETTE(config, m_palette, (64+1)*8+(4*256));
- m_palette->set_indirect_entries(0x500);
- m_palette->set_init(FUNC(quasar_state::palette_init_quasar));
+ PALETTE(config, m_palette, FUNC(quasar_state::quasar_palette), (64 + 1) * 8 + (4 * 256), 0x500);
S2636(config, m_s2636[0], 0);
m_s2636[0]->set_offsets(CVS_S2636_Y_OFFSET - 8, CVS_S2636_X_OFFSET - 9);
diff --git a/src/mame/drivers/quickpick5.cpp b/src/mame/drivers/quickpick5.cpp
index 83b84b9126a..a71f39a66c9 100644
--- a/src/mame/drivers/quickpick5.cpp
+++ b/src/mame/drivers/quickpick5.cpp
@@ -37,8 +37,8 @@
class quickpick5_state : public driver_device
{
public:
- quickpick5_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ quickpick5_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
m_k053245(*this, "k053245"),
@@ -421,9 +421,8 @@ void quickpick5_state::quickpick5(machine_config &config)
screen.set_screen_update(FUNC(quickpick5_state::screen_update_quickpick5));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K053245(config, m_k053245, 0);
m_k053245->set_palette(m_palette);
diff --git a/src/mame/drivers/quizo.cpp b/src/mame/drivers/quizo.cpp
index b9ee97557a0..25843af8f95 100644
--- a/src/mame/drivers/quizo.cpp
+++ b/src/mame/drivers/quizo.cpp
@@ -37,8 +37,9 @@ class quizo_state : public driver_device
{
public:
quizo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ { }
void quizo(machine_config &config);
@@ -55,7 +56,7 @@ private:
DECLARE_WRITE8_MEMBER(port70_w);
DECLARE_WRITE8_MEMBER(port60_w);
- DECLARE_PALETTE_INIT(quizo);
+ void quizo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void memmap(address_map &map);
@@ -67,42 +68,39 @@ private:
#define XTAL2 21477270
-static const uint8_t rombankLookup[]={ 2, 3, 4, 4, 4, 4, 4, 5, 0, 1};
+static constexpr uint8_t rombankLookup[]={ 2, 3, 4, 4, 4, 4, 4, 5, 0, 1};
-PALETTE_INIT_MEMBER(quizo_state, quizo)
+void quizo_state::quizo_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < 16;i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 16; i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0, bit1, bit2;
bit0 = 0;
- bit1 = (*color_prom >> 0) & 0x01;
- bit2 = (*color_prom >> 1) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = (*color_prom >> 2) & 0x01;
- bit1 = (*color_prom >> 3) & 0x01;
- bit2 = (*color_prom >> 4) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- bit0 = (*color_prom >> 5) & 0x01;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ bit1 = BIT(color_prom[i], 0);
+ bit2 = BIT(color_prom[i], 1);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 4);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
uint32_t quizo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x,y;
- for(y=0;y<200;y++)
+ for(int y = 0; y < 200; y++)
{
- for(x=0;x<80;x++)
+ for(int x = 0; x < 80; x++)
{
int data=m_videoram[y*80+x];
int data1=m_videoram[y*80+x+0x4000];
@@ -236,12 +234,11 @@ MACHINE_CONFIG_START(quizo_state::quizo)
MCFG_SCREEN_UPDATE_DRIVER(quizo_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(quizo_state, quizo)
+ PALETTE(config, "palette", FUNC(quizo_state::quizo_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- AY8910(config, "aysnd", XTAL2/16).add_route(ALL_OUTPUTS, "mono", 1.0);
+ AY8910(config, "aysnd", XTAL2 / 16).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/quizpani.cpp b/src/mame/drivers/quizpani.cpp
index f724091da97..2e694e4cfeb 100644
--- a/src/mame/drivers/quizpani.cpp
+++ b/src/mame/drivers/quizpani.cpp
@@ -201,9 +201,8 @@ MACHINE_CONFIG_START(quizpani_state::quizpani)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", quizpani_state, irq4_line_hold)
MCFG_DEVICE_PERIODIC_INT_DRIVER(quizpani_state, irq1_line_hold, 164) // music tempo
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_quizpani)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_quizpani);
+ PALETTE(config, "palette").set_format(palette_device::RRRRGGGGBBBBRGBx, 0x200);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/drivers/quizpun2.cpp b/src/mame/drivers/quizpun2.cpp
index 97c6cb9ace4..95ae03d6b56 100644
--- a/src/mame/drivers/quizpun2.cpp
+++ b/src/mame/drivers/quizpun2.cpp
@@ -100,8 +100,8 @@ Notes:
class quizpun2_state : public driver_device
{
public:
- quizpun2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ quizpun2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
@@ -116,6 +116,11 @@ public:
void quizpun(machine_config &config);
void quizpun2(machine_config &config);
+protected:
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -130,6 +135,12 @@ private:
tilemap_t *m_fg_tmap;
uint8_t m_scroll;
+ uint8_t m_mcu_data_port;
+ uint8_t m_mcu_control_port;
+ bool m_mcu_pending;
+ bool m_mcu_written;
+ bool m_mcu_repeat;
+
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
DECLARE_WRITE8_MEMBER(bg_ram_w);
@@ -139,9 +150,6 @@ private:
DECLARE_WRITE8_MEMBER(irq_ack);
DECLARE_WRITE8_MEMBER(soundlatch_w);
- virtual void machine_reset() override;
- virtual void machine_start() override;
- virtual void video_start() override;
uint32_t screen_update_quizpun2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
// quizpun2
@@ -164,11 +172,6 @@ private:
DECLARE_READ8_MEMBER(quizpun_protection_r);
DECLARE_WRITE8_MEMBER(quizpun_protection_w);
- uint8_t m_mcu_data_port;
- uint8_t m_mcu_control_port;
- bool m_mcu_pending;
- bool m_mcu_written;
- bool m_mcu_repeat;
void quizpun2_cop_map(address_map &map);
void quizpun2_io_map(address_map &map);
void quizpun2_map(address_map &map);
@@ -600,7 +603,7 @@ void quizpun2_state::quizpun2_base(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_quizpun2);
- PALETTE(config, m_palette, 0x200).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/quizshow.cpp b/src/mame/drivers/quizshow.cpp
index 62582da90ab..1cada31386d 100644
--- a/src/mame/drivers/quizshow.cpp
+++ b/src/mame/drivers/quizshow.cpp
@@ -73,7 +73,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(flag_output_w);
DECLARE_WRITE8_MEMBER(main_ram_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(quizshow);
+ void quizshow_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(clock_timer_cb);
@@ -99,13 +99,13 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(quizshow_state, quizshow)
+void quizshow_state::quizshow_palette(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t::black());
palette.set_indirect_color(1, rgb_t::white());
// normal, blink/off, invert, blink+invert
- const int lut_pal[16] = {
+ constexpr int lut_pal[16] = {
0, 0, 1, 0,
0, 0, 0, 0,
1, 0, 0, 0,
@@ -118,10 +118,10 @@ PALETTE_INIT_MEMBER(quizshow_state, quizshow)
TILE_GET_INFO_MEMBER(quizshow_state::get_tile_info)
{
- uint8_t code = m_main_ram[tile_index];
+ uint8_t const code = m_main_ram[tile_index];
// d6: blink, d7: invert
- uint8_t color = (code & (m_blink_state | 0x80)) >> 6;
+ uint8_t const color = (code & (m_blink_state | 0x80)) >> 6;
SET_TILE_INFO_MEMBER(0, code & 0x3f, color, 0);
}
@@ -407,9 +407,7 @@ void quizshow_state::quizshow(machine_config &config)
m_screen->set_palette("palette");
GFXDECODE(config, m_gfxdecode, m_palette, gfx_quizshow);
- PALETTE(config, m_palette, 8*2);
- m_palette->set_indirect_entries(2);
- m_palette->set_init(FUNC(quizshow_state::palette_init_quizshow));
+ PALETTE(config, m_palette, FUNC(quizshow_state::quizshow_palette), 8*2, 2);
/* sound hardware (discrete) */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/qvt102.cpp b/src/mame/drivers/qvt102.cpp
index 7577de33b4d..d11723fcee3 100644
--- a/src/mame/drivers/qvt102.cpp
+++ b/src/mame/drivers/qvt102.cpp
@@ -147,7 +147,7 @@ void qvt102_state::qvt102(machine_config &config)
m_screen->set_raw(MASTER_CLOCK, 882, 9, 729, 315, 0, 300); // 80x24+1
m_screen->set_screen_update("crtc", FUNC(mc6845_device::screen_update));
- PALETTE(config, m_palette, 3).set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
GFXDECODE(config, m_gfxdecode, m_palette, chars);
H46505(config, m_crtc, MASTER_CLOCK / 9);
diff --git a/src/mame/drivers/qx10.cpp b/src/mame/drivers/qx10.cpp
index 0c508a51f42..d391bf7047e 100644
--- a/src/mame/drivers/qx10.cpp
+++ b/src/mame/drivers/qx10.cpp
@@ -125,7 +125,7 @@ private:
DECLARE_QUICKLOAD_LOAD_MEMBER(qx10);
- DECLARE_PALETTE_INIT(qx10);
+ void qx10_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed);
UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
@@ -684,7 +684,7 @@ void qx10_state::video_start()
m_video_ram = make_unique_clear<uint16_t[]>(0x30000);
}
-PALETTE_INIT_MEMBER(qx10_state, qx10)
+void qx10_state::qx10_palette(palette_device &palette) const
{
// ...
}
@@ -735,9 +735,8 @@ MACHINE_CONFIG_START(qx10_state::qx10)
m_screen->set_screen_update(FUNC(qx10_state::screen_update));
m_screen->set_size(640, 480);
m_screen->set_visarea(0, 640-1, 0, 480-1);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_qx10)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(qx10_state, qx10)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_qx10)
+ PALETTE(config, m_palette, FUNC(qx10_state::qx10_palette), 8);
/* Devices */
diff --git a/src/mame/drivers/r2dtank.cpp b/src/mame/drivers/r2dtank.cpp
index 148dc1fcdcd..7714c7d9f44 100644
--- a/src/mame/drivers/r2dtank.cpp
+++ b/src/mame/drivers/r2dtank.cpp
@@ -56,8 +56,8 @@ RAM = 4116 (x11)
class r2dtank_state : public driver_device
{
public:
- r2dtank_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ r2dtank_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
@@ -68,7 +68,8 @@ public:
m_pia_main(*this, "pia_main"),
m_pia_audio(*this, "pia_audio"),
m_ay1(*this, "ay1"),
- m_ay2(*this, "ay2") { }
+ m_ay2(*this, "ay2")
+ { }
void r2dtank(machine_config &config);
@@ -455,7 +456,7 @@ MACHINE_CONFIG_START(r2dtank_state::r2dtank)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, m_palette, palette_device::BGR_3BIT);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/r2dx_v33.cpp b/src/mame/drivers/r2dx_v33.cpp
index e7b1fec67bf..baae42d1c53 100644
--- a/src/mame/drivers/r2dx_v33.cpp
+++ b/src/mame/drivers/r2dx_v33.cpp
@@ -80,8 +80,8 @@ Then it puts settings at 0x9e08 and 0x9e0a (bp 91acb)
class r2dx_v33_state : public raiden2_state
{
public:
- r2dx_v33_state(const machine_config &mconfig, device_type type, const char *tag)
- : raiden2_state(mconfig, type, tag),
+ r2dx_v33_state(const machine_config &mconfig, device_type type, const char *tag) :
+ raiden2_state(mconfig, type, tag),
m_r2dxbank(0),
m_r2dxgameselect(0),
m_eeprom(*this, "eeprom"),
@@ -802,9 +802,8 @@ MACHINE_CONFIG_START(r2dx_v33_state::rdx_v33)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(raiden2_state, screen_update_raiden2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rdx_v33)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rdx_v33);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_VIDEO_START_OVERRIDE(raiden2_state,raiden2)
@@ -841,9 +840,8 @@ MACHINE_CONFIG_START(r2dx_v33_state::nzerotea)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(raiden2_state, screen_update_raiden2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rdx_v33)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rdx_v33);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
MCFG_VIDEO_START_OVERRIDE(raiden2_state,raiden2)
diff --git a/src/mame/drivers/rabbit.cpp b/src/mame/drivers/rabbit.cpp
index 853fa6a9239..620b52b1e3e 100644
--- a/src/mame/drivers/rabbit.cpp
+++ b/src/mame/drivers/rabbit.cpp
@@ -96,8 +96,8 @@ public:
TIMER_BLIT_DONE
};
- rabbit_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ rabbit_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_gfxdecode(*this, "gfxdecode"),
@@ -110,7 +110,8 @@ public:
m_tilemap_regs(*this, "tilemap_regs.%u", 0),
m_spriteregs(*this, "spriteregs"),
m_blitterregs(*this, "blitterregs"),
- m_spriteram(*this, "spriteram") { }
+ m_spriteram(*this, "spriteram")
+ { }
void rabbit(machine_config &config);
@@ -921,9 +922,7 @@ void rabbit_state::rabbit(machine_config &config)
screen.set_screen_update(FUNC(rabbit_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 0x4000);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_all_black));
- m_palette->set_format(PALETTE_FORMAT_XGRB);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xGRB_888, 0x4000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -936,8 +935,6 @@ void rabbit_state::rabbit(machine_config &config)
-
-
void rabbit_state::init_rabbit()
{
m_banking = 1;
diff --git a/src/mame/drivers/radio86.cpp b/src/mame/drivers/radio86.cpp
index 480d4726773..808a14f5161 100644
--- a/src/mame/drivers/radio86.cpp
+++ b/src/mame/drivers/radio86.cpp
@@ -483,9 +483,8 @@ MACHINE_CONFIG_START(radio86_state::radio86)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_UPDATE_DEVICE("i8275", i8275_device, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(16'000'000) / 2, 516, 0, 78*6, 310, 0, 30*10)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_radio86)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(radio86_state,radio86)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_radio86);
+ PALETTE(config, m_palette, FUNC(radio86_state::radio86_palette), 3);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/raiden.cpp b/src/mame/drivers/raiden.cpp
index d20fe51f384..27da966fa2f 100644
--- a/src/mame/drivers/raiden.cpp
+++ b/src/mame/drivers/raiden.cpp
@@ -362,9 +362,8 @@ MACHINE_CONFIG_START(raiden_state::raiden)
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)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_raiden);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/raiden2.cpp b/src/mame/drivers/raiden2.cpp
index 211f0d5e7fc..c9ed29a310a 100644
--- a/src/mame/drivers/raiden2.cpp
+++ b/src/mame/drivers/raiden2.cpp
@@ -1440,9 +1440,8 @@ MACHINE_CONFIG_START(raiden2_state::raiden2)
MCFG_SCREEN_RAW_PARAMS(XTAL(32'000'000)/4,512,0,40*8,282,0,30*8) /* hand-tuned to match ~55.47 */
MCFG_SCREEN_UPDATE_DRIVER(raiden2_state, screen_update_raiden2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_raiden2)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_raiden2);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(raiden2_state::tilemap_enable_w));
@@ -1518,9 +1517,8 @@ MACHINE_CONFIG_START(raiden2_state::zeroteam)
MCFG_SCREEN_RAW_PARAMS(XTAL(32'000'000)/4,512,0,40*8,282,0,32*8) /* hand-tuned to match ~55.47 */
MCFG_SCREEN_UPDATE_DRIVER(raiden2_state, screen_update_raiden2)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_raiden2)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_raiden2);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(raiden2_state::tilemap_enable_w));
diff --git a/src/mame/drivers/rallyx.cpp b/src/mame/drivers/rallyx.cpp
index 1c643373c40..8cbcd8fa206 100644
--- a/src/mame/drivers/rallyx.cpp
+++ b/src/mame/drivers/rallyx.cpp
@@ -846,10 +846,8 @@ void rallyx_state::rallyx(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_rallyx);
- PALETTE(config, m_palette, 64*4+4);
- m_palette->set_indirect_entries(32);
+ PALETTE(config, m_palette, FUNC(rallyx_state::rallyx_palette), 64*4 + 4, 32);
m_palette->enable_shadows();
- m_palette->set_init(FUNC(rallyx_state::palette_init_rallyx));
MCFG_VIDEO_START_OVERRIDE(rallyx_state,rallyx)
@@ -898,10 +896,8 @@ void rallyx_state::jungler(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jungler);
- PALETTE(config, m_palette, 64*4+4+64);
- m_palette->set_indirect_entries(32+64);
+ PALETTE(config, m_palette, FUNC(rallyx_state::jungler_palette), 64*4 + 4 + 64, 32 + 64);
m_palette->enable_shadows();
- m_palette->set_init(FUNC(rallyx_state::palette_init_jungler));
MCFG_VIDEO_START_OVERRIDE(rallyx_state,jungler)
diff --git a/src/mame/drivers/rampart.cpp b/src/mame/drivers/rampart.cpp
index 189a8b4cbdc..be3258d26c3 100644
--- a/src/mame/drivers/rampart.cpp
+++ b/src/mame/drivers/rampart.cpp
@@ -352,9 +352,7 @@ MACHINE_CONFIG_START(rampart_state::rampart)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rampart)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 512).set_membits(8);
ATARI_MOTION_OBJECTS(config, m_mob, 0, m_screen, rampart_state::s_mob_config);
m_mob->set_gfxdecode(m_gfxdecode);
diff --git a/src/mame/drivers/rastan.cpp b/src/mame/drivers/rastan.cpp
index 79b5ecf7a6f..55e0f454b82 100644
--- a/src/mame/drivers/rastan.cpp
+++ b/src/mame/drivers/rastan.cpp
@@ -388,9 +388,8 @@ MACHINE_CONFIG_START(rastan_state::rastan)
MCFG_SCREEN_UPDATE_DRIVER(rastan_state, screen_update_rastan)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rastan)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_rastan);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048);
PC080SN(config, m_pc080sn, 0);
m_pc080sn->set_gfxdecode_tag("gfxdecode");
diff --git a/src/mame/drivers/rastersp.cpp b/src/mame/drivers/rastersp.cpp
index 718a9f48fd4..3161972b8e6 100644
--- a/src/mame/drivers/rastersp.cpp
+++ b/src/mame/drivers/rastersp.cpp
@@ -62,7 +62,8 @@ public:
, m_nvram(*this, "nvram")
, m_tms_timer1(nullptr)
, m_tms_tx_timer(nullptr)
- {}
+ {
+ }
void rastersp(machine_config &config);
@@ -904,11 +905,10 @@ void rastersp_state::rastersp(machine_config &config)
screen.set_screen_update(FUNC(rastersp_state::screen_update));
screen.set_refresh_hz(50);
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
- screen.set_palette("palette");
+ screen.set_palette(m_palette);
screen.screen_vblank().set(FUNC(rastersp_state::vblank_irq));
- PALETTE(config, m_palette, 65536);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRRGGGGGGBBBBB));
+ PALETTE(config, m_palette, palette_device::RGB_565);
/* Sound */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/rbisland.cpp b/src/mame/drivers/rbisland.cpp
index 8f457a9b1f9..38a9e8f2cc8 100644
--- a/src/mame/drivers/rbisland.cpp
+++ b/src/mame/drivers/rbisland.cpp
@@ -681,11 +681,10 @@ MACHINE_CONFIG_START(rbisland_state::rbisland)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(rbisland_state, screen_update_rainbow)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rbisland)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rbisland);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
PC080SN(config, m_pc080sn, 0);
m_pc080sn->set_gfx_region(1);
@@ -731,11 +730,10 @@ MACHINE_CONFIG_START(rbisland_state::jumping)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(rbisland_state, screen_update_jumping)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_jumping)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_jumping);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 2048);
MCFG_VIDEO_START_OVERRIDE(rbisland_state,jumping)
@@ -757,6 +755,7 @@ MACHINE_CONFIG_END
/* Imnoe PCB uses 16MHz CPU crystal instead of 18.432 for CPU */
MACHINE_CONFIG_START(rbisland_state::jumpingi)
jumping(config);
+
MCFG_DEVICE_REPLACE("maincpu", M68000, XTAL(16'000'000)/2) /* verified on pcb */
MCFG_DEVICE_PROGRAM_MAP(jumping_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", rbisland_state, irq4_line_hold)
diff --git a/src/mame/drivers/rbmk.cpp b/src/mame/drivers/rbmk.cpp
index 7f1d6311c00..dc15e500eb0 100644
--- a/src/mame/drivers/rbmk.cpp
+++ b/src/mame/drivers/rbmk.cpp
@@ -575,7 +575,7 @@ MACHINE_CONFIG_START(rbmk_state::rbmk)
m_mcu->set_addrmap(AS_IO, &rbmk_state::mcu_io);
m_mcu->port_out_cb<3>().set(FUNC(rbmk_state::mcu_io_mux_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rbmk)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rbmk);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(58)
@@ -583,12 +583,11 @@ MACHINE_CONFIG_START(rbmk_state::rbmk)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(rbmk_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
- EEPROM_93C46_16BIT(config, "eeprom");
+ EEPROM_93C46_16BIT(config, m_eeprom);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/rc702.cpp b/src/mame/drivers/rc702.cpp
index 42f71a295eb..3f4984c0f63 100644
--- a/src/mame/drivers/rc702.cpp
+++ b/src/mame/drivers/rc702.cpp
@@ -64,8 +64,10 @@ public:
void init_rc702();
-private:
+protected:
virtual void machine_reset() override;
+
+private:
DECLARE_READ8_MEMBER(memory_read_byte);
DECLARE_WRITE8_MEMBER(memory_write_byte);
DECLARE_WRITE8_MEMBER(port14_w);
@@ -78,7 +80,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(qbar_w);
DECLARE_WRITE_LINE_MEMBER(dack1_w);
I8275_DRAW_CHARACTER_MEMBER(display_pixels);
- DECLARE_PALETTE_INIT(rc702);
+ void rc702_palette(palette_device &palette) const;
void kbd_put(u8 data);
void rc702_io(address_map &map);
@@ -243,7 +245,7 @@ WRITE8_MEMBER( rc702_state::port1c_w )
}
// monitor is orange even when powered off
-PALETTE_INIT_MEMBER(rc702_state, rc702)
+void rc702_state::rc702_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0xc0, 0x60, 0x00));
palette.set_pen_color(1, rgb_t(0xff, 0xb4, 0x00));
@@ -389,13 +391,12 @@ MACHINE_CONFIG_START(rc702_state::rc702)
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)
- MCFG_PALETTE_INIT_OWNER(rc702_state, rc702)
+
+ PALETTE(config, m_palette, FUNC(rc702_state::rc702_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("beeper", BEEP, 1000)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ BEEP(config, m_beep, 1000).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/rd100.cpp b/src/mame/drivers/rd100.cpp
index 30cd28f9f32..881f999e2c1 100644
--- a/src/mame/drivers/rd100.cpp
+++ b/src/mame/drivers/rd100.cpp
@@ -119,7 +119,7 @@ MACHINE_CONFIG_START(rd100_state::rd100)
MCFG_SCREEN_UPDATE_DRIVER(rd100_state, screen_update)
MCFG_SCREEN_SIZE(64*6, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 64*6-1, 0, 32*8-1)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
//MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rd100)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/rd110.cpp b/src/mame/drivers/rd110.cpp
index cb3db246189..2b42e238061 100644
--- a/src/mame/drivers/rd110.cpp
+++ b/src/mame/drivers/rd110.cpp
@@ -60,10 +60,15 @@ public:
, m_memcs(*this, "memcs")
, m_lcd(*this, "lcd")
, m_midi_timer(*this, "midi_timer")
- , m_maincpu(*this, "maincpu") { }
+ , m_maincpu(*this, "maincpu")
+ { }
void d110(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE8_MEMBER(bank_w);
DECLARE_WRITE8_MEMBER(so_w);
@@ -74,7 +79,7 @@ private:
DECLARE_READ16_MEMBER(port0_r);
TIMER_DEVICE_CALLBACK_MEMBER(midi_timer_cb);
TIMER_DEVICE_CALLBACK_MEMBER(samples_timer_cb);
- DECLARE_PALETTE_INIT(d110);
+ void d110_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void d110_map(address_map &map);
@@ -84,8 +89,6 @@ private:
uint8_t m_midi;
int m_midi_pos;
uint8_t m_port0;
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<ram_device> m_ram;
required_device<nvram_device> m_rams;
required_device<ram_device> m_memc;
@@ -211,7 +214,7 @@ WRITE8_MEMBER(d110_state::so_w)
// logerror("so: rw=%d bank=%d led=%d\n", (data >> 3) & 1, (data >> 1) & 3, data & 1);
}
-PALETTE_INIT_MEMBER(d110_state, d110)
+void d110_state::d110_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0, 255, 0));
palette.set_pen_color(1, rgb_t(0, 0, 0));
@@ -252,8 +255,7 @@ MACHINE_CONFIG_START(d110_state::d110)
MCFG_SCREEN_VISIBLE_AREA(0, 16*6-2, 0, (16*6-1)*3/4-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(d110_state, d110)
+ PALETTE(config, "palette", FUNC(d110_state::d110_palette), 2);
MCFG_MSM6222B_01_ADD( m_lcd )
diff --git a/src/mame/drivers/realbrk.cpp b/src/mame/drivers/realbrk.cpp
index 22a747e78fb..464402e08dc 100644
--- a/src/mame/drivers/realbrk.cpp
+++ b/src/mame/drivers/realbrk.cpp
@@ -785,12 +785,11 @@ MACHINE_CONFIG_START(realbrk_state::realbrk)
MCFG_SCREEN_SIZE(0x140, 0xe0)
MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0, 0xe0-1)
MCFG_SCREEN_UPDATE_DRIVER(realbrk_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, realbrk_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_realbrk)
- MCFG_PALETTE_ADD("palette", 0x8000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x8000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/redclash.cpp b/src/mame/drivers/redclash.cpp
index 70433081ffc..6ce9e4ee47a 100644
--- a/src/mame/drivers/redclash.cpp
+++ b/src/mame/drivers/redclash.cpp
@@ -359,12 +359,10 @@ MACHINE_CONFIG_START(redclash_state::zerohour)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(redclash_state, screen_update_redclash)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, redclash_state, screen_vblank_redclash))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_redclash)
- MCFG_PALETTE_ADD("palette", 4*8+4*16+32)
- MCFG_PALETTE_INDIRECT_ENTRIES(32+32)
- MCFG_PALETTE_INIT_OWNER(redclash_state,redclash)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_redclash);
+ PALETTE(config, m_palette, FUNC(redclash_state::redclash_palette), 4*8 + 4*16 + 32, 32 + 32);
ZEROHOUR_STARS(config, m_stars, 0);
@@ -386,12 +384,10 @@ MACHINE_CONFIG_START(redclash_state::redclash)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(redclash_state, screen_update_redclash)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, redclash_state, screen_vblank_redclash))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_redclash)
- MCFG_PALETTE_ADD("palette", 4*8+4*16+32)
- MCFG_PALETTE_INDIRECT_ENTRIES(32+32)
- MCFG_PALETTE_INIT_OWNER(redclash_state,redclash)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_redclash);
+ PALETTE(config, m_palette, FUNC(redclash_state::redclash_palette), 4*8 + 4*16 + 32, 32 + 32);
ZEROHOUR_STARS(config, m_stars, 0);
diff --git a/src/mame/drivers/relief.cpp b/src/mame/drivers/relief.cpp
index 691b9c380d9..8b84b2f0999 100644
--- a/src/mame/drivers/relief.cpp
+++ b/src/mame/drivers/relief.cpp
@@ -267,8 +267,7 @@ MACHINE_CONFIG_START(relief_state::relief)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_relief)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
ATARI_VAD(config, m_vad, 0, m_screen);
m_vad->scanline_int_cb().set_inputline(m_maincpu, M68K_IRQ_4);
diff --git a/src/mame/drivers/renegade.cpp b/src/mame/drivers/renegade.cpp
index fb02847084c..ed78ab47bc5 100644
--- a/src/mame/drivers/renegade.cpp
+++ b/src/mame/drivers/renegade.cpp
@@ -492,9 +492,8 @@ MACHINE_CONFIG_START(renegade_state::renegade)
MCFG_SCREEN_UPDATE_DRIVER(renegade_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_renegade)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_renegade);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/replicator.cpp b/src/mame/drivers/replicator.cpp
index b62733c6a07..ac92256b446 100644
--- a/src/mame/drivers/replicator.cpp
+++ b/src/mame/drivers/replicator.cpp
@@ -153,8 +153,8 @@
class replicator_state : public driver_device
{
public:
- replicator_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ replicator_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_lcdc(*this, "hd44780"),
m_dac(*this, "dac")
@@ -189,7 +189,7 @@ private:
DECLARE_READ8_MEMBER(port_r);
DECLARE_WRITE8_MEMBER(port_w);
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(replicator);
+ void replicator_palette(palette_device &palette) const;
void replicator_data_map(address_map &map);
void replicator_io_map(address_map &map);
void replicator_prg_map(address_map &map);
@@ -587,11 +587,11 @@ void replicator_state::machine_reset()
m_port_l = 0;
}
-PALETTE_INIT_MEMBER(replicator_state, replicator)
+void replicator_state::replicator_palette(palette_device &palette) const
{
// These colors were picked with the color picker in Inkscape, based on a photo of the LCD used in the Replicator 1 3d printer:
- palette.set_pen_color(0, rgb_t(0xCA, 0xE7, 0xEB));
- palette.set_pen_color(1, rgb_t(0x78, 0xAB, 0xA8));
+ palette.set_pen_color(0, rgb_t(0xca, 0xe7, 0xeb));
+ palette.set_pen_color(1, rgb_t(0x78, 0xab, 0xa8));
}
static const gfx_layout hd44780_charlayout =
@@ -633,7 +633,7 @@ void replicator_state::replicator(machine_config &config)
screen.set_visarea(0, 120-1, 0, 18*2-1);
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init(FUNC(replicator_state::palette_init_replicator));
+ PALETTE(config, "palette", FUNC(replicator_state::replicator_palette), 2);
GFXDECODE(config, "gfxdecode", "palette", gfx_replicator);
HD44780(config, "hd44780", 0).set_lcd_size(4, 20);
diff --git a/src/mame/drivers/retofinv.cpp b/src/mame/drivers/retofinv.cpp
index f7af0a7db4f..1a7f11b9174 100644
--- a/src/mame/drivers/retofinv.cpp
+++ b/src/mame/drivers/retofinv.cpp
@@ -448,12 +448,10 @@ MACHINE_CONFIG_START(retofinv_state::retofinv)
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(retofinv_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_retofinv)
- MCFG_PALETTE_ADD("palette", 256*2+64*16+64*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(retofinv_state, retofinv)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_retofinv);
+ PALETTE(config, m_palette, FUNC(retofinv_state::retofinv_palette), 256*2 + 64*16 + 64*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -470,13 +468,14 @@ MACHINE_CONFIG_END
/* bootleg which has different palette clut */
MACHINE_CONFIG_START(retofinv_state::retofinvb1)
retofinv(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(retofinv_state, retofinv_bl)
+
+ m_palette->set_init(FUNC(retofinv_state::retofinv_bl_palette));
MACHINE_CONFIG_END
/* bootleg which has no mcu */
MACHINE_CONFIG_START(retofinv_state::retofinvb_nomcu)
retofinv(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(bootleg_map)
diff --git a/src/mame/drivers/rex6000.cpp b/src/mame/drivers/rex6000.cpp
index 67196aa7dd1..43c3a8b6209 100644
--- a/src/mame/drivers/rex6000.cpp
+++ b/src/mame/drivers/rex6000.cpp
@@ -59,26 +59,26 @@ class rex6000_state : public driver_device
{
public:
rex6000_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_beep(*this, "beeper"),
- m_uart(*this, "ns16550"),
- m_bankdev0(*this, "bank0"),
- m_bankdev1(*this, "bank1"),
- m_flash0a(*this, "flash0a"),
- m_flash0b(*this, "flash0b"),
- m_flash1a(*this, "flash1a"),
- m_flash1b(*this, "flash1b"),
- m_nvram(*this, "nvram"),
- m_battery(*this, "BATTERY"),
- m_pen_x(*this, "PENX"),
- m_pen_y(*this, "PENY")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_ram(*this, RAM_TAG)
+ , m_beep(*this, "beeper")
+ , m_uart(*this, "ns16550")
+ , m_bankdev0(*this, "bank0")
+ , m_bankdev1(*this, "bank1")
+ , m_flash0a(*this, "flash0a")
+ , m_flash0b(*this, "flash0b")
+ , m_flash1a(*this, "flash1a")
+ , m_flash1b(*this, "flash1b")
+ , m_nvram(*this, "nvram")
+ , m_battery(*this, "BATTERY")
+ , m_pen_x(*this, "PENX")
+ , m_pen_y(*this, "PENY")
+ { }
void rex6000(machine_config &config);
- DECLARE_PALETTE_INIT(rex6000);
+ void rex6000_palettte(palette_device &palette) const;
DECLARE_QUICKLOAD_LOAD_MEMBER(rex6000);
DECLARE_INPUT_CHANGED_MEMBER(trigger_irq);
DECLARE_WRITE_LINE_MEMBER(serial_irq);
@@ -722,7 +722,7 @@ WRITE_LINE_MEMBER( rex6000_state::serial_irq )
}
}
-PALETTE_INIT_MEMBER(rex6000_state, rex6000)
+void rex6000_state::rex6000_palettte(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -914,9 +914,8 @@ MACHINE_CONFIG_START(rex6000_state::rex6000)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 120-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(rex6000_state, rex6000)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rex6000)
+ PALETTE(config, "palette", FUNC(rex6000_state::rex6000_palettte), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_rex6000);
ADDRESS_MAP_BANK(config, "bank0").set_map(&rex6000_state::rex6000_banked_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x2000);
ADDRESS_MAP_BANK(config, "bank1").set_map(&rex6000_state::rex6000_banked_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x2000);
@@ -993,8 +992,7 @@ MACHINE_CONFIG_START(oz750_state::oz750)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 80-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(rex6000_state, rex6000)
+ PALETTE(config, "palette", FUNC(rex6000_state::rex6000_palettte), 2);
ADDRESS_MAP_BANK(config, "bank0").set_map(&oz750_state::oz750_banked_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x2000);
ADDRESS_MAP_BANK(config, "bank1").set_map(&oz750_state::oz750_banked_map).set_options(ENDIANNESS_LITTLE, 8, 32, 0x2000);
diff --git a/src/mame/drivers/risc2500.cpp b/src/mame/drivers/risc2500.cpp
index d7d928e90df..e84ed89901a 100644
--- a/src/mame/drivers/risc2500.cpp
+++ b/src/mame/drivers/risc2500.cpp
@@ -331,7 +331,7 @@ void risc2500_state::risc2500(machine_config &config)
config.set_default_layout(layout_risc2500);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
RAM(config, m_ram).set_default_size("2M").set_extra_options("128K, 256K, 512K, 1M, 2M");
diff --git a/src/mame/drivers/rm380z.cpp b/src/mame/drivers/rm380z.cpp
index 56373e7f788..e2215a65ba4 100644
--- a/src/mame/drivers/rm380z.cpp
+++ b/src/mame/drivers/rm380z.cpp
@@ -251,7 +251,7 @@ MACHINE_CONFIG_START(rm380z_state::rm380z)
MCFG_SCREEN_UPDATE_DRIVER(rm380z_state, screen_update_rm380z)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* cassette */
MCFG_CASSETTE_ADD( "cassette" )
diff --git a/src/mame/drivers/rmhaihai.cpp b/src/mame/drivers/rmhaihai.cpp
index 6f6cf05a12c..be4b0356e2b 100644
--- a/src/mame/drivers/rmhaihai.cpp
+++ b/src/mame/drivers/rmhaihai.cpp
@@ -525,7 +525,7 @@ MACHINE_CONFIG_START(rmhaihai_state::rmhaihai)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rmhaihai)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 0x100)
+ PALETTE(config, "palette", palette_device::RGB_444_PROMS, "proms", 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -547,7 +547,7 @@ MACHINE_CONFIG_START(rmhaisei_state::rmhaisei)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_themj)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(0x200)
MACHINE_CONFIG_END
@@ -564,7 +564,7 @@ MACHINE_CONFIG_START(themj_state::themj)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_themj)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(0x200)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/rmnimbus.cpp b/src/mame/drivers/rmnimbus.cpp
index eb52d9d7a4a..f8e367dda5d 100644
--- a/src/mame/drivers/rmnimbus.cpp
+++ b/src/mame/drivers/rmnimbus.cpp
@@ -130,7 +130,7 @@ void rmnimbus_state::nimbus(machine_config &config)
//MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
/* Backing storage */
WD2793(config, m_fdc, 1000000);
diff --git a/src/mame/drivers/rmt32.cpp b/src/mame/drivers/rmt32.cpp
index 27789179933..c704d07b21f 100644
--- a/src/mame/drivers/rmt32.cpp
+++ b/src/mame/drivers/rmt32.cpp
@@ -196,15 +196,17 @@ public:
void mt32(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
required_device<i8x9x_device> cpu;
required_device<ram_device> ram;
optional_device<sed1200d0a_device> lcd;
required_device<timer_device> midi_timer;
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(mt32);
+ void mt32_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -328,7 +330,7 @@ WRITE8_MEMBER(mt32_state::so_w)
// logerror("so: x1=%d bank=%d led=%d\n", (data >> 5) & 1, (data >> 1) & 3, data & 1);
}
-PALETTE_INIT_MEMBER(mt32_state, mt32)
+void mt32_state::mt32_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0, 0, 0));
palette.set_pen_color(1, rgb_t(0, 255, 0));
@@ -364,8 +366,7 @@ MACHINE_CONFIG_START(mt32_state::mt32)
MCFG_SCREEN_VISIBLE_AREA(0, 20*6-2, 0, (20*6-1)*3/4-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(mt32_state, mt32)
+ PALETTE(config, "palette", FUNC(mt32_state::mt32_palette), 2);
MCFG_SED1200D0A_ADD( "lcd" )
diff --git a/src/mame/drivers/rockrage.cpp b/src/mame/drivers/rockrage.cpp
index bf2c779d226..81abbeb1508 100644
--- a/src/mame/drivers/rockrage.cpp
+++ b/src/mame/drivers/rockrage.cpp
@@ -279,12 +279,10 @@ MACHINE_CONFIG_START(rockrage_state::rockrage)
m_k007420->set_sprite_callback(FUNC(rockrage_state::rockrage_sprite_callback), this);
m_k007420->set_palette_tag(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rockrage)
- MCFG_PALETTE_ADD("palette", 16*16*3)
- MCFG_PALETTE_INDIRECT_ENTRIES(64)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_LITTLE)
- MCFG_PALETTE_INIT_OWNER(rockrage_state, rockrage)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rockrage);
+ PALETTE(config, m_palette, FUNC(rockrage_state::rockrage_palette));
+ m_palette->set_format(palette_device::xBGR_555, 16*16*3, 64);
+ m_palette->set_endianness(ENDIANNESS_LITTLE);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/rocnrope.cpp b/src/mame/drivers/rocnrope.cpp
index 6a86ff017a5..d112e720d84 100644
--- a/src/mame/drivers/rocnrope.cpp
+++ b/src/mame/drivers/rocnrope.cpp
@@ -229,17 +229,14 @@ MACHINE_CONFIG_START(rocnrope_state::rocnrope)
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(rocnrope_state, screen_update_rocnrope)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, rocnrope_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rocnrope)
- MCFG_PALETTE_ADD("palette", 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(rocnrope_state, rocnrope)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rocnrope);
+ PALETTE(config, m_palette, FUNC(rocnrope_state::rocnrope_palette), 16*16+16*16, 32);
/* sound hardware */
-
- MCFG_DEVICE_ADD("timeplt_audio", TIMEPLT_AUDIO)
+ TIMEPLT_AUDIO(config, "timeplt_audio");
MACHINE_CONFIG_END
/*************************************
diff --git a/src/mame/drivers/rollerg.cpp b/src/mame/drivers/rollerg.cpp
index 1b760d1781f..885d6e72f8f 100644
--- a/src/mame/drivers/rollerg.cpp
+++ b/src/mame/drivers/rollerg.cpp
@@ -265,9 +265,7 @@ void rollerg_state::rollerg(machine_config &config)
screen.set_screen_update(FUNC(rollerg_state::screen_update_rollerg));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 1024));
- palette.enable_shadows();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 1024).enable_shadows();
K053244(config, m_k053244, 0);
m_k053244->set_palette("palette");
diff --git a/src/mame/drivers/rollrace.cpp b/src/mame/drivers/rollrace.cpp
index ccf716cefb0..b9e4655c71c 100644
--- a/src/mame/drivers/rollrace.cpp
+++ b/src/mame/drivers/rollrace.cpp
@@ -275,12 +275,11 @@ MACHINE_CONFIG_START(rollrace_state::rollrace)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0,256-1,16, 255-16)
MCFG_SCREEN_UPDATE_DRIVER(rollrace_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, rollrace_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rollrace)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(rollrace_state, rollrace)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rollrace);
+ PALETTE(config, m_palette, FUNC(rollrace_state::rollrace_palette), 256);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/ron.cpp b/src/mame/drivers/ron.cpp
index f6c418cde1b..0a1197e77fc 100644
--- a/src/mame/drivers/ron.cpp
+++ b/src/mame/drivers/ron.cpp
@@ -34,20 +34,20 @@ Debug cheats:
class ron_state : public driver_device
{
public:
- ron_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_audiocpu(*this, "audiocpu"),
- m_ay(*this, "aysnd"),
- m_gfxdecode(*this, "gfxdecode"),
- m_vram(*this, "vram"),
- m_cram(*this, "cram"),
- m_mj_ports1(*this, { "PL1_1", "PL1_2", "PL1_3", "PL1_4","PL1_5", "PL1_6", "PL1_7", "PL1_8" }),
- m_mj_ports2(*this, { "PL2_1", "PL2_2", "PL2_3", "PL2_4","PL2_5", "PL2_6", "PL2_7", "PL2_8" }),
- m_in0(*this, "IN0"),
- m_in1(*this, "IN1"),
- m_in2(*this, "IN2"),
- m_in3(*this, "IN3")
+ ron_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
+ m_maincpu(*this, "maincpu"),
+ m_audiocpu(*this, "audiocpu"),
+ m_ay(*this, "aysnd"),
+ m_gfxdecode(*this, "gfxdecode"),
+ m_vram(*this, "vram"),
+ m_cram(*this, "cram"),
+ m_mj_ports1(*this, "PL1_%u", 1U),
+ m_mj_ports2(*this, "PL2_%u", 1U),
+ m_in0(*this, "IN0"),
+ m_in1(*this, "IN1"),
+ m_in2(*this, "IN2"),
+ m_in3(*this, "IN3")
{
}
@@ -56,7 +56,7 @@ public:
private:
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(ron);
+ void ron_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
DECLARE_WRITE8_MEMBER(output_w);
@@ -417,7 +417,7 @@ void ron_state::machine_reset()
}
-PALETTE_INIT_MEMBER(ron_state, ron)
+void ron_state::ron_palette(palette_device &palette) const
{
// TODO: proms?
palette.set_pen_color(0, rgb_t(pal1bit(0), pal1bit(0), pal1bit(0)));
@@ -509,12 +509,10 @@ MACHINE_CONFIG_START(ron_state::ron)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ron_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ron)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_ron);
- MCFG_PALETTE_ADD("palette", 8)
- //MCFG_PALETTE_ADD("palette", 512)
- //MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(ron_state, ron)
+ PALETTE(config, "palette", FUNC(ron_state::ron_palette), 8);
+ //PALETTE(config, "palette", FUNC(ron_state::ron_palette), 512, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/roul.cpp b/src/mame/drivers/roul.cpp
index 32318e15658..1857d4bb465 100644
--- a/src/mame/drivers/roul.cpp
+++ b/src/mame/drivers/roul.cpp
@@ -87,13 +87,17 @@ public:
void roul(machine_config &config);
+protected:
+ virtual void machine_start() override { m_lamps.resolve(); }
+ virtual void video_start() override;
+
private:
DECLARE_READ8_MEMBER(blitter_status_r);
DECLARE_WRITE8_MEMBER(blitter_cmd_w);
DECLARE_WRITE8_MEMBER(sound_latch_w);
DECLARE_WRITE8_MEMBER(ball_w);
- DECLARE_PALETTE_INIT(roul);
+ void roul_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void roul_cpu_io_map(address_map &map);
@@ -101,9 +105,6 @@ private:
void sound_cpu_io_map(address_map &map);
void sound_map(address_map &map);
- virtual void machine_start() override { m_lamps.resolve(); }
- virtual void video_start() override;
-
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<generic_latch_8_device> m_soundlatch;
@@ -118,29 +119,29 @@ private:
#define VIDEOBUF_SIZE 256*256
-PALETTE_INIT_MEMBER(roul_state, roul)
+void roul_state::roul_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit6, bit7, bit0, bit1, r, g, b;
- int i;
-
- for (i = 0; i < 0x20; ++i)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x20; ++i)
{
- bit7 = (color_prom[0] >> 7) & 0x01;
- bit6 = (color_prom[0] >> 6) & 0x01;
-
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- b = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 2) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- g = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- r = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+ int bit0, bit1;
+
+ int const bit7 = BIT(color_prom[i], 7);
+ int const bit6 = BIT(color_prom[i], 6);
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const b = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ int const g = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
+
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ int const r = 0x0e * bit6 + 0x1f * bit7 + 0x43 * bit0 + 0x8f * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -323,7 +324,6 @@ MACHINE_CONFIG_START(roul_state::roul)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
-
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -334,8 +334,7 @@ MACHINE_CONFIG_START(roul_state::roul)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(roul_state, roul)
+ PALETTE(config, "palette", FUNC(roul_state::roul_palette), 0x100);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/route16.cpp b/src/mame/drivers/route16.cpp
index ffe89fb096a..fdd8eb2fc1d 100644
--- a/src/mame/drivers/route16.cpp
+++ b/src/mame/drivers/route16.cpp
@@ -611,7 +611,7 @@ void route16_state::route16(machine_config &config)
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
m_screen->set_screen_update(FUNC(route16_state::screen_update_route16));
- PALETTE(config, m_palette, 8).set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -694,7 +694,7 @@ void route16_state::jongpute(machine_config &config)
/* video hardware */
m_screen->set_screen_update(FUNC(route16_state::screen_update_jongpute));
- PALETTE(config.replace(), m_palette, 8).set_init("palette", FUNC(palette_device::palette_init_3bit_bgr));
+ PALETTE(config.replace(), m_palette, palette_device::BGR_3BIT);
}
diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp
index 945eef904e7..c8f71683e66 100644
--- a/src/mame/drivers/royalmah.cpp
+++ b/src/mame/drivers/royalmah.cpp
@@ -247,8 +247,8 @@ private:
DECLARE_WRITE8_MEMBER(mjvegasa_12400_w);
DECLARE_READ8_MEMBER(mjvegasa_12500_r);
- DECLARE_PALETTE_INIT(royalmah);
- DECLARE_PALETTE_INIT(mjderngr);
+ void royalmah_palette(palette_device &palette) const;
+ void mjderngr_palette(palette_device &palette) const;
uint32_t screen_update_royalmah(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -336,54 +336,52 @@ void royalmah_state::machine_start()
save_item(NAME(m_flip_screen));
}
-PALETTE_INIT_MEMBER(royalmah_state, royalmah)
+void royalmah_state::royalmah_palette(palette_device &palette) const
{
- offs_t i;
- const uint8_t *prom = memregion("proms")->base();
- int len = memregion("proms")->bytes();
+ uint8_t const *const prom = memregion("proms")->base();
- for (i = 0; i < len; i++)
+ offs_t const len(memregion("proms")->bytes());
+ for (offs_t i = 0; i < len; i++)
{
- uint8_t bit0, bit1, bit2, r, g, b;
+ uint8_t bit0, bit1, bit2;
- uint8_t data = prom[i];
+ uint8_t const data = prom[i];
- /* red component */
- bit0 = (data >> 0) & 0x01;
- bit1 = (data >> 1) & 0x01;
- bit2 = (data >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(data, 0);
+ bit1 = BIT(data, 1);
+ bit2 = BIT(data, 2);
+ uint8_t const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (data >> 3) & 0x01;
- bit1 = (data >> 4) & 0x01;
- bit2 = (data >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(data, 3);
+ bit1 = BIT(data, 4);
+ bit2 = BIT(data, 5);
+ uint8_t const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (data >> 6) & 0x01;
- bit2 = (data >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(data, 6);
+ bit2 = BIT(data, 7);
+ uint8_t const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, r,g,b);
+ palette.set_pen_color(i, r, g, b);
}
}
-PALETTE_INIT_MEMBER(royalmah_state,mjderngr)
+void royalmah_state::mjderngr_palette(palette_device &palette) const
{
- offs_t i;
- const uint8_t *prom = memregion("proms")->base();
- int len = memregion("proms")->bytes();
+ uint8_t const *const prom = memregion("proms")->base();
- for (i = 0; i < len / 2; i++)
+ offs_t const len(memregion("proms")->bytes());
+ for (offs_t i = 0; i < (len / 2); i++)
{
- uint16_t data = (prom[i] << 8) | prom[i + 0x200];
+ uint16_t const data = (prom[i] << 8) | prom[i + 0x200];
- /* the bits are in reverse order */
- uint8_t r = bitswap<8>((data >> 0) & 0x1f,7,6,5,0,1,2,3,4 );
- uint8_t g = bitswap<8>((data >> 5) & 0x1f,7,6,5,0,1,2,3,4 );
- uint8_t b = bitswap<8>((data >> 10) & 0x1f,7,6,5,0,1,2,3,4 );
+ // the bits are in reverse order
+ uint8_t const r = bitswap<5>((data >> 0) & 0x1f, 0, 1, 2, 3, 4);
+ uint8_t const g = bitswap<5>((data >> 5) & 0x1f, 0, 1, 2, 3, 4);
+ uint8_t const b = bitswap<5>((data >> 10) & 0x1f, 0, 1, 2, 3, 4);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
@@ -3545,8 +3543,7 @@ MACHINE_CONFIG_START(royalmah_state::royalmah)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
/* video hardware */
- MCFG_PALETTE_ADD("palette", 16*4)
- MCFG_PALETTE_INIT_OWNER(royalmah_state,royalmah)
+ PALETTE(config, "palette", FUNC(royalmah_state::royalmah_palette), 16*4);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_SIZE(256, 256)
@@ -3714,9 +3711,9 @@ MACHINE_CONFIG_START(royalmah_state::mjderngr)
MCFG_DEVICE_IO_MAP(mjderngr_iomap)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(16*32)
- MCFG_PALETTE_INIT_OWNER(royalmah_state,mjderngr)
+ auto &palette(*subdevice<palette_device>("palette"));
+ palette.set_entries(16*32);
+ palette.set_init(FUNC(royalmah_state::mjderngr_palette));
MACHINE_CONFIG_END
void royalmah_state::janptr96(machine_config &config)
diff --git a/src/mame/drivers/rpunch.cpp b/src/mame/drivers/rpunch.cpp
index 206453b8499..58707cda66d 100644
--- a/src/mame/drivers/rpunch.cpp
+++ b/src/mame/drivers/rpunch.cpp
@@ -478,11 +478,10 @@ MACHINE_CONFIG_START(rpunch_state::rpunch)
MCFG_SCREEN_SIZE(304, 224)
MCFG_SCREEN_VISIBLE_AREA(8, 303-8, 0, 223-8)
MCFG_SCREEN_UPDATE_DRIVER(rpunch_state, screen_update_rpunch)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rpunch)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rpunch);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, m_gga, VIDEO_CLOCK/2); // verified from rpunch schematics
m_gga->write_cb().set(FUNC(rpunch_state::rpunch_gga_data_w));
@@ -529,11 +528,10 @@ MACHINE_CONFIG_START(rpunch_state::svolleybl)
MCFG_SCREEN_SIZE(304, 224)
MCFG_SCREEN_VISIBLE_AREA(8, 303-8, 0, 223-8)
MCFG_SCREEN_UPDATE_DRIVER(rpunch_state, screen_update_rpunch)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_svolleybl)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_svolleybl);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024);
VSYSTEM_GGA(config, m_gga, VIDEO_CLOCK/2);
m_gga->write_cb().set(FUNC(rpunch_state::rpunch_gga_data_w));
diff --git a/src/mame/drivers/rt1715.cpp b/src/mame/drivers/rt1715.cpp
index 7b8b9b5ed84..d5e8aa00963 100644
--- a/src/mame/drivers/rt1715.cpp
+++ b/src/mame/drivers/rt1715.cpp
@@ -46,7 +46,7 @@ private:
DECLARE_READ8_MEMBER(k7658_data_r);
DECLARE_WRITE8_MEMBER(k7658_data_w);
DECLARE_WRITE8_MEMBER(rt1715_rom_disable);
- DECLARE_PALETTE_INIT(rt1715);
+ void rt1715_palette(palette_device &palette) const;
I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels );
void k7658_io(address_map &map);
@@ -179,11 +179,11 @@ GFXDECODE_END
PALETTE
***************************************************************************/
-PALETTE_INIT_MEMBER(rt1715_state, rt1715)
+void rt1715_state::rt1715_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* black */
- palette.set_pen_color(1, rgb_t(0x00, 0x7f, 0x00)); /* low intensity */
- palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); /* high intensitiy */
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // black
+ palette.set_pen_color(1, rgb_t(0x00, 0x7f, 0x00)); // low intensity
+ palette.set_pen_color(2, rgb_t(0x00, 0xff, 0x00)); // high intensitiy
}
@@ -301,9 +301,8 @@ MACHINE_CONFIG_START(rt1715_state::rt1715)
MCFG_SCREEN_UPDATE_DEVICE("a26", i8275_device, screen_update)
MCFG_SCREEN_RAW_PARAMS(13.824_MHz_XTAL, 864, 0, 624, 320, 0, 300) // ?
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rt1715)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(rt1715_state, rt1715)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_rt1715);
+ PALETTE(config, "palette", FUNC(rt1715_state::rt1715_palette), 3);
MCFG_DEVICE_ADD("a26", I8275, 13.824_MHz_XTAL / 8)
MCFG_I8275_CHARACTER_WIDTH(8)
diff --git a/src/mame/drivers/runaway.cpp b/src/mame/drivers/runaway.cpp
index 781e5c8b02b..96a05fbec07 100644
--- a/src/mame/drivers/runaway.cpp
+++ b/src/mame/drivers/runaway.cpp
@@ -369,7 +369,7 @@ void runaway_state::runaway(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_runaway);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/rungun.cpp b/src/mame/drivers/rungun.cpp
index 08fd70935c7..a96c39610d6 100644
--- a/src/mame/drivers/rungun.cpp
+++ b/src/mame/drivers/rungun.cpp
@@ -420,8 +420,7 @@ void rungun_state::rng(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->set_video_attributes(VIDEO_ALWAYS_UPDATE);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -438,10 +437,9 @@ void rungun_state::rng(machine_config &config)
m_k053252->set_offsets(9*8, 24);
m_k053252->set_screen("screen");
- PALETTE(config, m_palette2, 1024);
- m_palette2->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
- m_palette2->enable_shadows();
- m_palette2->enable_hilights();
+ PALETTE(config, m_palette2).set_format(palette_device::xBGR_555, 1024);
+ m_palette->enable_shadows();
+ m_palette->enable_hilights();
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -469,6 +467,7 @@ void rungun_state::rng(machine_config &config)
void rungun_state::rng_dual(machine_config &config)
{
rng(config);
+
m_screen->set_screen_update(FUNC(rungun_state::screen_update_rng_dual_left));
screen_device &demultiplex2(SCREEN(config, "demultiplex2", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/rz1.cpp b/src/mame/drivers/rz1.cpp
index 1b36b2141b4..6b92833fb52 100644
--- a/src/mame/drivers/rz1.cpp
+++ b/src/mame/drivers/rz1.cpp
@@ -61,7 +61,7 @@ public:
void rz1(machine_config &config);
- DECLARE_PALETTE_INIT(rz1);
+ void rz1_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(lcd_pixel_update);
protected:
@@ -335,7 +335,7 @@ void rz1_state::machine_reset()
{
}
-PALETTE_INIT_MEMBER(rz1_state, rz1)
+void rz1_state::rz1_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on
@@ -346,7 +346,8 @@ PALETTE_INIT_MEMBER(rz1_state, rz1)
// MACHINE DEFINTIONS
//**************************************************************************
-MACHINE_CONFIG_START( rz1_state::rz1 )
+void rz1_state::rz1(machine_config &config)
+{
UPD7811(config, m_maincpu, 12_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &rz1_state::map);
m_maincpu->pa_in_cb().set(FUNC(rz1_state::port_a_r));
@@ -364,8 +365,7 @@ MACHINE_CONFIG_START( rz1_state::rz1 )
screen.set_screen_update("hd44780", FUNC(hd44780_device::screen_update));
screen.set_palette("palette");
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(rz1_state, rz1)
+ PALETTE(config, "palette", FUNC(rz1_state::rz1_palette), 3);
HD44780(config, m_hd44780, 0);
m_hd44780->set_lcd_size(1, 16);
@@ -380,7 +380,7 @@ MACHINE_CONFIG_START( rz1_state::rz1 )
UPD934G(config, m_pg[1], 1280000);
m_pg[1]->data_callback().set(FUNC(rz1_state::upd934g_b_data_r));
m_pg[1]->add_route(ALL_OUTPUTS, "speaker", 1.0);
-MACHINE_CONFIG_END
+}
//**************************************************************************
diff --git a/src/mame/drivers/safarir.cpp b/src/mame/drivers/safarir.cpp
index f8b8a58498b..9f6451f38ca 100644
--- a/src/mame/drivers/safarir.cpp
+++ b/src/mame/drivers/safarir.cpp
@@ -59,8 +59,8 @@ modified by Hau
class safarir_state : public driver_device
{
public:
- safarir_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ safarir_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_samples(*this, "samples"),
m_ram(*this, "ram"),
@@ -93,7 +93,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(safarir);
+ void safarir_palette(palette_device &palette) const;
uint32_t screen_update_safarir(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void safarir_audio(machine_config &config);
void main_map(address_map &map);
@@ -156,14 +156,12 @@ static GFXDECODE_START( gfx_safarir )
GFXDECODE_END
-PALETTE_INIT_MEMBER(safarir_state, safarir)
+void safarir_state::safarir_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < palette.entries() / 2; i++)
+ for (int i = 0; i < palette.entries() >> 1; i++)
{
- palette.set_pen_color((i * 2) + 0, rgb_t::black());
- palette.set_pen_color((i * 2) + 1, rgb_t(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0)));
+ palette.set_pen_color((i << 1) | 0, rgb_t::black());
+ palette.set_pen_color((i << 1) | 1, rgb_t(pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0)));
}
}
@@ -414,8 +412,7 @@ void safarir_state::safarir(machine_config &config)
m_maincpu->set_addrmap(AS_PROGRAM, &safarir_state::main_map);
/* video hardware */
- PALETTE(config, "palette", 2*8).set_init(FUNC(safarir_state::palette_init_safarir));
-
+ PALETTE(config, "palette", FUNC(safarir_state::safarir_palette), 2 * 8);
GFXDECODE(config, m_gfxdecode, "palette", gfx_safarir);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
diff --git a/src/mame/drivers/samcoupe.cpp b/src/mame/drivers/samcoupe.cpp
index 372a6d4dde9..516f431c12a 100644
--- a/src/mame/drivers/samcoupe.cpp
+++ b/src/mame/drivers/samcoupe.cpp
@@ -472,22 +472,16 @@ INPUT_PORTS_END
nothing G+4 R+4 B+4 ALL+1 G+2 R+2 B+2
*/
-PALETTE_INIT_MEMBER(samcoupe_state, samcoupe)
+void samcoupe_state::samcoupe_palette(palette_device &palette) const
{
for (int i = 0; i < 128; i++)
{
- uint8_t b = BIT(i, 0) * 2 + BIT(i, 4) * 4 + BIT(i, 3);
- uint8_t r = BIT(i, 1) * 2 + BIT(i, 5) * 4 + BIT(i, 3);
- uint8_t g = BIT(i, 2) * 2 + BIT(i, 6) * 4 + BIT(i, 3);
+ uint8_t const b = bitswap<3>(i, 4, 0, 3);
+ uint8_t const r = bitswap<3>(i, 5, 1, 3);
+ uint8_t const g = bitswap<3>(i, 6, 2, 3);
- r <<= 5;
- g <<= 5;
- b <<= 5;
-
- palette.set_pen_color(i, rgb_t(r, g, b));
+ palette.set_pen_color(i, pal3bit(r), pal3bit(g), pal3bit(b));
}
-
- palette.palette()->normalize_range(0, 127);
}
@@ -519,7 +513,7 @@ void samcoupe_state::samcoupe(machine_config &config)
m_screen->set_screen_update(FUNC(samcoupe_state::screen_update));
m_screen->set_palette("palette");
- PALETTE(config, "palette", 128).set_init(FUNC(samcoupe_state::palette_init_samcoupe));
+ PALETTE(config, "palette", FUNC(samcoupe_state::samcoupe_palette), 128);
/* devices */
CENTRONICS(config, m_lpt1, centronics_devices, "printer");
diff --git a/src/mame/drivers/sandscrp.cpp b/src/mame/drivers/sandscrp.cpp
index a0ad49c5fa8..79d78641f22 100644
--- a/src/mame/drivers/sandscrp.cpp
+++ b/src/mame/drivers/sandscrp.cpp
@@ -98,7 +98,7 @@ public:
, m_view2(*this, "view2")
, m_soundlatch(*this, "soundlatch%u", 1)
, m_audiobank(*this, "audiobank")
- { }
+ { }
void sandscrp(machine_config &config);
@@ -490,9 +490,8 @@ MACHINE_CONFIG_START(sandscrp_state::sandscrp)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sandscrp_state, screen_vblank))
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sandscrp)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xGGGGGRRRRRBBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_sandscrp);
+ PALETTE(config, "palette").set_format(palette_device::xGRB_555, 2048);
KANEKO_TMAP(config, m_view2);
m_view2->set_gfx_region(1);
@@ -512,8 +511,7 @@ MACHINE_CONFIG_START(sandscrp_state::sandscrp)
GENERIC_LATCH_8(config, m_soundlatch[1]);
- MCFG_DEVICE_ADD("oki", OKIM6295, 12000000/6, okim6295_device::PIN7_HIGH)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.5)
+ OKIM6295(config, "oki", 12000000/6, okim6295_device::PIN7_HIGH).add_route(ALL_OUTPUTS, "mono", 0.5);
/* YM3014B + YM2203C */
ym2203_device &ymsnd(YM2203(config, "ymsnd", 4000000));
diff --git a/src/mame/drivers/sanremmg.cpp b/src/mame/drivers/sanremmg.cpp
index 6fecc4cca37..6bfed308e06 100644
--- a/src/mame/drivers/sanremmg.cpp
+++ b/src/mame/drivers/sanremmg.cpp
@@ -31,7 +31,6 @@ Others
M30624FG (M16C/62A family) needs CPU core and dumping of internal ROM
*/
-
#include "emu.h"
#include "cpu/arm7/arm7.h"
#include "cpu/arm7/arm7core.h"
@@ -43,8 +42,8 @@ class sanremmg_state : public driver_device
{
public:
sanremmg_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
void sanremmg(machine_config &config);
@@ -95,8 +94,7 @@ MACHINE_CONFIG_START(sanremmg_state::sanremmg)
MCFG_SCREEN_UPDATE_DRIVER(sanremmg_state, screen_update_sanremmg)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
MACHINE_CONFIG_END
/*
diff --git a/src/mame/drivers/sanremo.cpp b/src/mame/drivers/sanremo.cpp
index 8f6b2602911..74fde741300 100644
--- a/src/mame/drivers/sanremo.cpp
+++ b/src/mame/drivers/sanremo.cpp
@@ -112,12 +112,13 @@
class sanremo_state : public driver_device
{
public:
- sanremo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sanremo_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_lamps(*this, "lamp%u", 0U) { }
+ m_lamps(*this, "lamp%u", 0U)
+ { }
void sanremo(machine_config &config);
@@ -138,7 +139,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_WRITE8_MEMBER(banksel_w);
DECLARE_WRITE8_MEMBER(lamps_w);
- DECLARE_PALETTE_INIT(sanremo);
+ void sanremo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void sanremo_map(address_map &map);
void sanremo_portmap(address_map &map);
@@ -181,15 +182,15 @@ uint32_t sanremo_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
-PALETTE_INIT_MEMBER(sanremo_state, sanremo)
+void sanremo_state::sanremo_palette(palette_device &palette) const
{
- int index;
+ // high intensity BGR
+ for (int index = 0; index < 0x8; index++)
+ palette.set_pen_color(index, rgb_t(pal1bit(BIT(index, 0)), pal1bit(BIT(index, 1)), pal1bit(BIT(index, 2))));
- for (index = 0; index < 0x8; index++)
- palette.set_pen_color(index, rgb_t(pal1bit((index >> 0)&1), pal1bit((index >> 1)&1), pal1bit((index >> 2)&1)));
-
- for (index = 0x8; index < 0x10; index++)
- palette.set_pen_color(index, rgb_t(pal2bit((index >> 0)&1), pal2bit((index >> 1)&1), pal2bit((index >> 2)&1)));
+ // low intensity BGR
+ for (int index = 0x8; index < 0x10; index++)
+ palette.set_pen_color(index, rgb_t(pal2bit(BIT(index, 0)), pal2bit(BIT(index, 1)), pal2bit(BIT(index, 2))));
}
@@ -199,30 +200,30 @@ PALETTE_INIT_MEMBER(sanremo_state, sanremo)
WRITE8_MEMBER(sanremo_state::lamps_w)
{
-/* LAMPS:
-
- 7654 3210
- ---- ---x DISCARD 1
- ---- --x- DISCARD 2
- ---- -x-- DISCARD 3
- ---- x--- DISCARD 4
- ---x ---- DISCARD 5
- --x- ---- START
- -x-- ---- BET
- x--- ---- (always on)
-*/
+ /* LAMPS:
+
+ 7654 3210
+ ---- ---x DISCARD 1
+ ---- --x- DISCARD 2
+ ---- -x-- DISCARD 3
+ ---- x--- DISCARD 4
+ ---x ---- DISCARD 5
+ --x- ---- START
+ -x-- ---- BET
+ x--- ---- (always on)
+ */
for (int n = 0; n < 7; n++)
m_lamps[n] = BIT(data, n);
}
WRITE8_MEMBER(sanremo_state::banksel_w)
{
-/* GFX banks selector.
+ /* GFX banks selector.
- 7654 3210
- ---x xxxx GFX banks selector
- xxx- ---- unknown
-*/
+ 7654 3210
+ ---x xxxx GFX banks selector
+ xxx- ---- unknown
+ */
m_banksel = data & 0x1f;
}
@@ -382,9 +383,8 @@ MACHINE_CONFIG_START(sanremo_state::sanremo)
crtc.set_show_border_area(false);
crtc.set_char_width(8);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sanremo)
- MCFG_PALETTE_ADD("palette", 0x10)
- MCFG_PALETTE_INIT_OWNER(sanremo_state, sanremo)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sanremo);
+ PALETTE(config, "palette", FUNC(sanremo_state::sanremo_palette), 0x10);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sapi1.cpp b/src/mame/drivers/sapi1.cpp
index 6acc55165fa..e837307202e 100644
--- a/src/mame/drivers/sapi1.cpp
+++ b/src/mame/drivers/sapi1.cpp
@@ -46,8 +46,8 @@ ZPS stands for "Základní Počítačová Sestava" (basic computer system).
class sapi1_state : public driver_device
{
public:
- sapi1_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sapi1_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_p_videoram(*this, "videoram"),
m_bank1(*this, "bank1"),
m_line0(*this, "LINE0"),
@@ -636,9 +636,9 @@ MACHINE_CONFIG_START(sapi1_state::sapi1)
MCFG_SCREEN_SIZE(40*6, 24*9)
MCFG_SCREEN_VISIBLE_AREA(0, 40*6-1, 0, 24*9-1)
MCFG_SCREEN_UPDATE_DRIVER(sapi1_state, screen_update_sapi1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("64K");
diff --git a/src/mame/drivers/saturn.cpp b/src/mame/drivers/saturn.cpp
index 4f6d0d3394d..b4ddb342e4c 100644
--- a/src/mame/drivers/saturn.cpp
+++ b/src/mame/drivers/saturn.cpp
@@ -838,7 +838,7 @@ void sat_console_state::saturn(machine_config &config)
m_screen->set_raw(MASTER_CLOCK_320/8, 427, 0, 320, 263, 0, 224);
m_screen->set_screen_update(FUNC(sat_console_state::screen_update_stv_vdp2));
- PALETTE(config, m_palette, 2048+(2048*2)); //standard palette + extra memory for rgb brightness.
+ PALETTE(config, m_palette).set_entries(2048+(2048*2)); //standard palette + extra memory for rgb brightness.
GFXDECODE(config, m_gfxdecode, m_palette, gfx_stv);
diff --git a/src/mame/drivers/sauro.cpp b/src/mame/drivers/sauro.cpp
index 944cbb59616..f36aa333811 100644
--- a/src/mame/drivers/sauro.cpp
+++ b/src/mame/drivers/sauro.cpp
@@ -464,10 +464,10 @@ MACHINE_CONFIG_START(sauro_state::tecfri)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(5000)) // frames per second, vblank duration (otherwise sprites lag)
MCFG_SCREEN_SIZE(32 * 8, 32 * 8)
MCFG_SCREEN_VISIBLE_AREA(1 * 8, 31 * 8 - 1, 2 * 8, 30 * 8 - 1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sauro_state, vblank_irq))
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 1024)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sbasketb.cpp b/src/mame/drivers/sbasketb.cpp
index 8e40e7d3047..149426546b1 100644
--- a/src/mame/drivers/sbasketb.cpp
+++ b/src/mame/drivers/sbasketb.cpp
@@ -222,10 +222,8 @@ MACHINE_CONFIG_START(sbasketb_state::sbasketb)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sbasketb_state, vblank_irq))
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_sbasketb)
- MCFG_PALETTE_ADD(m_palette, 16*16+16*16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(sbasketb_state, sbasketb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sbasketb);
+ PALETTE(config, m_palette, FUNC(sbasketb_state::sbasketb_palette), 16*16+16*16*16, 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/sbc6510.cpp b/src/mame/drivers/sbc6510.cpp
index 5f4285b1d0a..6abb7f840ce 100644
--- a/src/mame/drivers/sbc6510.cpp
+++ b/src/mame/drivers/sbc6510.cpp
@@ -289,7 +289,7 @@ void sbc6510_state::sbc6510(machine_config &config)
m_videocpu->set_addrmap(AS_IO, &sbc6510_state::sbc6510_video_io);
m_videocpu->set_eeprom_tag("eeprom");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome)); // for F4 displayer only
+ PALETTE(config, "palette", palette_device::MONOCHROME); // for F4 displayer only
GFXDECODE(config, "gfxdecode", "palette", gfx_sbc6510);
/* video hardware */
diff --git a/src/mame/drivers/sbowling.cpp b/src/mame/drivers/sbowling.cpp
index 35e7a2781e9..cbdb28da395 100644
--- a/src/mame/drivers/sbowling.cpp
+++ b/src/mame/drivers/sbowling.cpp
@@ -53,14 +53,18 @@ PROMs : NEC B406 (1kx4) x2
class sbowling_state : public driver_device
{
public:
- sbowling_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sbowling_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_videoram(*this, "videoram"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void sbowling(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_shared_ptr<uint8_t> m_videoram;
@@ -85,8 +89,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(sbowling);
+ void sbowling_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void postload();
@@ -371,42 +374,41 @@ static GFXDECODE_START( gfx_sbowling )
GFXDECODE_END
-PALETTE_INIT_MEMBER(sbowling_state, sbowling)
+void sbowling_state::sbowling_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
-
- static const int resistances_rg[3] = { 470, 270, 100 };
- static const int resistances_b[2] = { 270, 100 };
- double outputs_r[1<<3], outputs_g[1<<3], outputs_b[1<<2];
+ static constexpr int resistances_rg[3] = { 470, 270, 100 };
+ static constexpr int resistances_b[2] = { 270, 100 };
- /* the game uses output collector PROMs type: NEC B406 */
+ // the game uses output collector PROMs type: NEC B406
+ double outputs_r[1 << 3], outputs_g[1 << 3], outputs_b[1 << 2];
compute_resistor_net_outputs(0, 255, -1.0,
- 3, resistances_rg, outputs_r, 0, 100,
- 3, resistances_rg, outputs_g, 0, 100,
- 2, resistances_b, outputs_b, 0, 100);
+ 3, resistances_rg, outputs_r, 0, 100,
+ 3, resistances_rg, outputs_g, 0, 100,
+ 2, resistances_b, outputs_b, 0, 100);
- for (int i = 0;i < palette.entries();i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* blue component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- b = (int)(outputs_b[ (bit0<<0) | (bit1<<1) ] + 0.5);
-
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i] >> 3) & 0x01;
- bit2 = (color_prom[i+0x400] >> 0) & 0x01;
- g = (int)(outputs_g[ (bit0<<0) | (bit1<<1) | (bit2<<2) ] + 0.5);
-
- /* red component */
- bit0 = (color_prom[i+0x400] >> 1) & 0x01;
- bit1 = (color_prom[i+0x400] >> 2) & 0x01;
- bit2 = (color_prom[i+0x400] >> 3) & 0x01;
- r = (int)(outputs_r[ (bit0<<0) | (bit1<<1) | (bit2<<2) ] + 0.5);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const b = int(outputs_b[(bit0 << 0) | (bit1 << 1)] + 0.5);
+
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i + 0x400], 0);
+ int const g = int(outputs_g[ (bit0<<0) | (bit1<<1) | (bit2<<2) ] + 0.5);
+
+ // red component
+ bit0 = BIT(color_prom[i + 0x400], 1);
+ bit1 = BIT(color_prom[i + 0x400], 2);
+ bit2 = BIT(color_prom[i + 0x400], 3);
+ int const r = int(outputs_r[ (bit0<<0) | (bit1<<1) | (bit2<<2) ] + 0.5);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -426,10 +428,9 @@ MACHINE_CONFIG_START(sbowling_state::sbowling)
MCFG_SCREEN_UPDATE_DRIVER(sbowling_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sbowling)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sbowling);
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_INIT_OWNER(sbowling_state, sbowling)
+ PALETTE(config, "palette", FUNC(sbowling_state::sbowling_palette), 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sbrkout.cpp b/src/mame/drivers/sbrkout.cpp
index d00321df0d2..9bfaeffec49 100644
--- a/src/mame/drivers/sbrkout.cpp
+++ b/src/mame/drivers/sbrkout.cpp
@@ -578,18 +578,17 @@ MACHINE_CONFIG_START(sbrkout_state::sbrkout)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sbrkout)
- MCFG_SCREEN_ADD(m_screen, RASTER)
- MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 384, 0, 256, 262, 0, 224)
- MCFG_SCREEN_UPDATE_DRIVER(sbrkout_state, screen_update_sbrkout)
- MCFG_SCREEN_PALETTE("palette")
+ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ m_screen->set_raw(MAIN_CLOCK/2, 384, 0, 256, 262, 0, 224);
+ m_screen->set_screen_update(FUNC(sbrkout_state::screen_update_sbrkout));
+ m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- MCFG_DEVICE_ADD("dac", DAC_1BIT, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.99)
- MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
- MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT)
+ DAC_1BIT(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.99);
+ VOLTAGE_REGULATOR(config, "vref").set_output(5.0).add_route(0, m_dac, 1.0, DAC_VREF_POS_INPUT);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/sbugger.cpp b/src/mame/drivers/sbugger.cpp
index b45c15a53cb..377222f1d9e 100644
--- a/src/mame/drivers/sbugger.cpp
+++ b/src/mame/drivers/sbugger.cpp
@@ -236,8 +236,7 @@ MACHINE_CONFIG_START(sbugger_state::sbugger)
MCFG_SCREEN_UPDATE_DRIVER(sbugger_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_INIT_OWNER(sbugger_state, sbugger)
+ PALETTE(config, "palette", FUNC(sbugger_state::sbugger_palette), 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/scobra.cpp b/src/mame/drivers/scobra.cpp
index bdff53af871..3dc34b18c06 100644
--- a/src/mame/drivers/scobra.cpp
+++ b/src/mame/drivers/scobra.cpp
@@ -49,8 +49,9 @@ class scobra_state : public scramble_state
{
public:
scobra_state(const machine_config &mconfig, device_type type, const char *tag)
- : scramble_state(mconfig, type, tag),
- m_soundram(*this, "soundram") { }
+ : scramble_state(mconfig, type, tag)
+ , m_soundram(*this, "soundram")
+ { }
void mimonkey(machine_config &config);
void stratgyx(machine_config &config);
@@ -907,12 +908,11 @@ MACHINE_CONFIG_START(scobra_state::type1)
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(scobra_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scobra)
- MCFG_PALETTE_ADD("palette", 32+64+2+1) /* 32 for characters, 64 for stars, 2 for bullets, 1 for background */
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_scobra);
+ PALETTE(config, m_palette, FUNC(scobra_state::scrambold_palette), 32+64+2+1); // 32 for characters, 64 for stars, 2 for bullets, 1 for background
- MCFG_PALETTE_INIT_OWNER(scobra_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(scobra_state,scrambold)
/* sound hardware */
@@ -938,11 +938,9 @@ MACHINE_CONFIG_START(scobra_state::rescue)
/* basic machine hardware */
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+128) /* 32 for characters, 64 for stars, 2 for bullets, 128 for background */
+ m_palette->set_entries(32+64+2+128); // 32 for characters, 64 for stars, 2 for bullets, 128 for background
+ m_palette->set_init(FUNC(scobra_state::rescue_palette));
- MCFG_PALETTE_INIT_OWNER(scobra_state,rescue)
MCFG_VIDEO_START_OVERRIDE(scobra_state,rescue)
MACHINE_CONFIG_END
@@ -966,11 +964,9 @@ MACHINE_CONFIG_START(scobra_state::minefld)
/* basic machine hardware */
/* video hardware */
- MCFG_SCREEN_MODIFY("screen")
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+256) /* 32 for characters, 64 for stars, 2 for bullets, 256 for background */
+ m_palette->set_entries(32+64+2+256); // 32 for characters, 64 for stars, 2 for bullets, 256 for background
+ m_palette->set_init(FUNC(scobra_state::minefld_palette));
- MCFG_PALETTE_INIT_OWNER(scobra_state,minefld)
MCFG_VIDEO_START_OVERRIDE(scobra_state,minefld)
MACHINE_CONFIG_END
@@ -1020,10 +1016,9 @@ MACHINE_CONFIG_START(scobra_state::stratgyx)
m_ppi8255_1->in_pc_callback().set_ioport("IN3");
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES( 32+64+2+8) /* 32 for characters, 64 for stars, 2 for bullets, 8 for background */
+ m_palette->set_entries(32+64+2+8); // 32 for characters, 64 for stars, 2 for bullets, 8 for background
+ m_palette->set_init(FUNC(scobra_state::stratgyx_palette));
- MCFG_PALETTE_INIT_OWNER(scobra_state,stratgyx)
MCFG_VIDEO_START_OVERRIDE(scobra_state,stratgyx)
MACHINE_CONFIG_END
@@ -1034,10 +1029,9 @@ MACHINE_CONFIG_START(scobra_state::darkplnt)
/* basic machine hardware */
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2) /* 32 for characters, 64 (buffer) for stars, 2 for bullets */
+ m_palette->set_entries(32+64+2); // 32 for characters, 64 (buffer) for stars, 2 for bullets
+ m_palette->set_init(FUNC(scobra_state::darkplnt_palette));
- MCFG_PALETTE_INIT_OWNER(scobra_state,darkplnt)
MCFG_VIDEO_START_OVERRIDE(scobra_state,darkplnt)
MACHINE_CONFIG_END
@@ -1086,10 +1080,9 @@ MACHINE_CONFIG_START(scobra_state::hustler)
MCFG_SCREEN_UPDATE_DRIVER(scobra_state, screen_update_galaxold)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scobra)
- MCFG_PALETTE_ADD("palette", 32+64+2) /* 32 for characters, 64 for stars, 2 for bullets */
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_scobra);
+ PALETTE(config, m_palette, FUNC(scobra_state::galaxold_palette), 32+64+2); // 32 for characters, 64 for stars, 2 for bullets
- MCFG_PALETTE_INIT_OWNER(scobra_state,galaxold)
MCFG_VIDEO_START_OVERRIDE(scobra_state,scrambold)
/* sound hardware */
diff --git a/src/mame/drivers/scotrsht.cpp b/src/mame/drivers/scotrsht.cpp
index 36e356362b4..90db90d1fd0 100644
--- a/src/mame/drivers/scotrsht.cpp
+++ b/src/mame/drivers/scotrsht.cpp
@@ -206,13 +206,11 @@ MACHINE_CONFIG_START(scotrsht_state::scotrsht)
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(scotrsht_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, scotrsht_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scotrsht)
- MCFG_PALETTE_ADD("palette", 16*8*16+16*8*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(scotrsht_state, scotrsht)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_scotrsht);
+ PALETTE(config, m_palette, FUNC(scotrsht_state::scotrsht_palette), 16*8*16+16*8*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/scramble.cpp b/src/mame/drivers/scramble.cpp
index 353c5a3a179..ef27e13b754 100644
--- a/src/mame/drivers/scramble.cpp
+++ b/src/mame/drivers/scramble.cpp
@@ -1346,10 +1346,9 @@ MACHINE_CONFIG_START(scramble_state::scramble)
MCFG_SCREEN_UPDATE_DRIVER(scramble_state, screen_update_galaxold)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scramble)
- MCFG_PALETTE_ADD("palette", 32+64+2+1) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_scramble);
+ PALETTE(config, m_palette, FUNC(scramble_state::scrambold_palette), 32+64+2+1); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
- MCFG_PALETTE_INIT_OWNER(scramble_state,scrambold)
MCFG_VIDEO_START_OVERRIDE(scramble_state,scrambold)
/* sound hardware */
@@ -1377,9 +1376,8 @@ MACHINE_CONFIG_START(scramble_state::mars)
m_ppi8255_1->in_pc_callback().set_ioport("IN3");
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(scramble_state::devilfsh)
@@ -1391,9 +1389,8 @@ MACHINE_CONFIG_START(scramble_state::devilfsh)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_devilfsh)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(scramble_state::newsin7)
@@ -1406,9 +1403,8 @@ MACHINE_CONFIG_START(scramble_state::newsin7)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_newsin7)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MCFG_VIDEO_START_OVERRIDE(scramble_state,newsin7)
MACHINE_CONFIG_END
@@ -1424,9 +1420,8 @@ MACHINE_CONFIG_START(scramble_state::mrkougb)
m_ppi8255_1->in_pc_callback().set_constant(0);
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(scramble_state::mrkougar)
@@ -1444,9 +1439,8 @@ MACHINE_CONFIG_START(scramble_state::ckongs)
MCFG_DEVICE_PROGRAM_MAP(ckongs_map)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MCFG_VIDEO_START_OVERRIDE(scramble_state,ckongs)
MACHINE_CONFIG_END
@@ -1466,9 +1460,8 @@ MACHINE_CONFIG_START(scramble_state::hotshock)
MCFG_MACHINE_RESET_OVERRIDE(scramble_state,galaxold)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MCFG_VIDEO_START_OVERRIDE(scramble_state,pisces)
subdevice<ay8910_device>("8910.1")->reset_routes();
@@ -1485,9 +1478,8 @@ MACHINE_CONFIG_START(scramble_state::cavelon)
/* basic machine hardware */
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets, 0/1 for background */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets, 0/1 for background
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MCFG_VIDEO_START_OVERRIDE(scramble_state,ckongs)
MACHINE_CONFIG_END
@@ -1516,9 +1508,8 @@ MACHINE_CONFIG_START(scramble_state::triplep)
MCFG_DEVICE_REMOVE("konami_7474")
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets */
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
/* sound hardware */
MCFG_DEVICE_MODIFY("8910.1")
@@ -1537,10 +1528,9 @@ MACHINE_CONFIG_START(scramble_state::mariner)
/* basic machine hardware */
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+16) /* 32 for characters, 64 for stars, 2 for bullets, 16 for background */
+ m_palette->set_entries(32+64+2+16); // 32 for characters, 64 for stars, 2 for bullets, 16 for background
+ m_palette->set_init(FUNC(scramble_state::mariner_palette));
- MCFG_PALETTE_INIT_OWNER(scramble_state,mariner)
MCFG_VIDEO_START_OVERRIDE(scramble_state,mariner)
MACHINE_CONFIG_END
@@ -1559,10 +1549,8 @@ MACHINE_CONFIG_START(scramble_state::hunchbks)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(32+64+2+0) /* 32 for characters, 64 for stars, 2 for bullets */
-
- MCFG_PALETTE_INIT_OWNER(scramble_state,galaxold)
+ m_palette->set_entries(32+64+2+0); // 32 for characters, 64 for stars, 2 for bullets
+ m_palette->set_init(FUNC(scramble_state::galaxold_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(scramble_state::hncholms)
@@ -1602,12 +1590,11 @@ MACHINE_CONFIG_START(scramble_state::ad2083)
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(scramble_state, screen_update_galaxold)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ad2083)
- MCFG_PALETTE_ADD("palette", 32+64+2+8) /* 32 for characters, 64 for stars, 2 for bullets, 8 for background */
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_ad2083);
+ PALETTE(config, m_palette, FUNC(scramble_state::turtles_palette), 32+64+2+8); // 32 for characters, 64 for stars, 2 for bullets, 8 for background
- MCFG_PALETTE_INIT_OWNER(scramble_state,turtles)
MCFG_VIDEO_START_OVERRIDE(scramble_state,ad2083)
/* sound hardware */
diff --git a/src/mame/drivers/scregg.cpp b/src/mame/drivers/scregg.cpp
index 71db552c60d..b7a536a629e 100644
--- a/src/mame/drivers/scregg.cpp
+++ b/src/mame/drivers/scregg.cpp
@@ -64,7 +64,8 @@ class scregg_state : public btime_state
{
public:
scregg_state(const machine_config &mconfig, device_type type, const char *tag)
- : btime_state(mconfig, type, tag) { }
+ : btime_state(mconfig, type, tag)
+ { }
void scregg(machine_config &config);
void dommy(machine_config &config);
@@ -282,12 +283,10 @@ MACHINE_CONFIG_START(scregg_state::dommy)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2, 384, 8, 248, 272, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(scregg_state, screen_update_eggs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scregg)
- MCFG_PALETTE_ADD("palette", 8)
-
- MCFG_PALETTE_INIT_OWNER(scregg_state,btime)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_scregg);
+ PALETTE(config, m_palette, FUNC(scregg_state::btime_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -312,12 +311,10 @@ MACHINE_CONFIG_START(scregg_state::scregg)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2, 384, 8, 248, 272, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(scregg_state, screen_update_eggs)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scregg)
- MCFG_PALETTE_ADD("palette", 8)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_INIT_OWNER(scregg_state,btime)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_scregg);
+ PALETTE(config, m_palette, FUNC(scregg_state::btime_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/scv.cpp b/src/mame/drivers/scv.cpp
index 01694bcafd3..265ed7302a6 100644
--- a/src/mame/drivers/scv.cpp
+++ b/src/mame/drivers/scv.cpp
@@ -46,7 +46,7 @@ private:
DECLARE_READ8_MEMBER(portc_r);
DECLARE_WRITE8_MEMBER(portc_w);
DECLARE_WRITE_LINE_MEMBER(upd1771_ack_w);
- DECLARE_PALETTE_INIT(scv);
+ void scv_palette(palette_device &palette) const;
uint32_t screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void plot_sprite_part(bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t pat, uint8_t col, uint8_t screen_sprite_start_line);
@@ -214,10 +214,10 @@ WRITE8_MEMBER( scv_state::portc_w )
}
-PALETTE_INIT_MEMBER(scv_state, scv)
+void scv_state::scv_palette(palette_device &palette) const
{
/*
- SCV Epoch-1A chip RGB voltage readouts from paused Bios color test:
+ SCV Epoch-1A chip RGB voltage readouts from paused BIOS color test:
(values in millivolts)
@@ -244,7 +244,7 @@ PALETTE_INIT_MEMBER(scv_state, scv)
330 ish
520 ish.
- Quamtizing/scaling/rounding between 0 and 255 we thus get:
+ Quantizing/scaling/rounding between 0 and 255 we thus get:
*/
palette.set_pen_color( 0, 0, 0, 155);
@@ -257,12 +257,12 @@ PALETTE_INIT_MEMBER(scv_state, scv)
palette.set_pen_color( 7, 0, 161, 0);
palette.set_pen_color( 8, 255, 0, 0);
palette.set_pen_color( 9, 255, 161, 0);
- palette.set_pen_color( 10, 255, 0, 255);
- palette.set_pen_color( 11, 255, 160, 159);
- palette.set_pen_color( 12, 255, 255, 0);
- palette.set_pen_color( 13, 163, 160, 0);
- palette.set_pen_color( 14, 161, 160, 157);
- palette.set_pen_color( 15, 255, 255, 255);
+ palette.set_pen_color(10, 255, 0, 255);
+ palette.set_pen_color(11, 255, 160, 159);
+ palette.set_pen_color(12, 255, 255, 0);
+ palette.set_pen_color(13, 163, 160, 0);
+ palette.set_pen_color(14, 161, 160, 157);
+ palette.set_pen_color(15, 255, 255, 255);
}
@@ -270,99 +270,85 @@ void scv_state::device_timer(emu_timer &timer, device_timer_id id, int param, vo
{
switch (id)
{
- case TIMER_VB:
- {
- int vpos = m_screen->vpos();
-
- switch( vpos )
- {
- case 240:
- m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
- break;
- case 0:
- m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
- break;
- }
+ case TIMER_VB:
+ {
+ int vpos = m_screen->vpos();
- m_vb_timer->adjust(m_screen->time_until_pos((vpos + 1) % 262, 0));
+ switch( vpos )
+ {
+ case 240:
+ m_maincpu->set_input_line(UPD7810_INTF2, ASSERT_LINE);
+ break;
+ case 0:
+ m_maincpu->set_input_line(UPD7810_INTF2, CLEAR_LINE);
+ break;
}
- break;
- default:
- assert_always(false, "Unknown id in scv_state::device_timer");
+ m_vb_timer->adjust(m_screen->time_until_pos((vpos + 1) % 262, 0));
+ }
+ break;
+
+ default:
+ throw emu_fatalerror("Unknown id in scv_state::device_timer");
}
}
inline void scv_state::plot_sprite_part( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t pat, uint8_t col, uint8_t screen_sprite_start_line )
{
- if ( x < 4 )
+ if ((x >= 4) && ((y + 2) >= screen_sprite_start_line))
{
- return;
- }
+ x -= 4;
- x -= 4;
+ if (pat & 0x08)
+ bitmap.pix16(y + 2, x) = col;
- if ( y + 2 >= screen_sprite_start_line )
- {
- if ( pat & 0x08 )
- {
- bitmap.pix16(y + 2, x ) = col;
- }
- if ( pat & 0x04 && x < 255 )
- {
- bitmap.pix16(y + 2, x + 1 ) = col;
- }
- if ( pat & 0x02 && x < 254 )
- {
- bitmap.pix16(y + 2, x + 2 ) = col;
- }
- if ( pat & 0x01 && x < 253 )
- {
- bitmap.pix16(y + 2, x + 3 ) = col;
- }
+ if (pat & 0x04 && x < 255 )
+ bitmap.pix16(y + 2, x + 1) = col;
+
+ if (pat & 0x02 && x < 254)
+ bitmap.pix16(y + 2, x + 2) = col;
+
+ if (pat & 0x01 && x < 253)
+ bitmap.pix16(y + 2, x + 3) = col;
}
}
inline void scv_state::draw_sprite( bitmap_ind16 &bitmap, uint8_t x, uint8_t y, uint8_t tile_idx, uint8_t col, uint8_t left, uint8_t right, uint8_t top, uint8_t bottom, uint8_t clip_y, uint8_t screen_sprite_start_line )
{
- int j;
-
y += clip_y * 2;
- for ( j = clip_y * 4; j < 32; j += 4 )
+ for (int j = clip_y * 4; j < 32; j += 4, y += 2)
{
- uint8_t pat0 = m_videoram[ tile_idx * 32 + j + 0 ];
- uint8_t pat1 = m_videoram[ tile_idx * 32 + j + 1 ];
- uint8_t pat2 = m_videoram[ tile_idx * 32 + j + 2 ];
- uint8_t pat3 = m_videoram[ tile_idx * 32 + j + 3 ];
+ uint8_t const pat0 = m_videoram[tile_idx * 32 + j + 0];
+ uint8_t const pat1 = m_videoram[tile_idx * 32 + j + 1];
+ uint8_t const pat2 = m_videoram[tile_idx * 32 + j + 2];
+ uint8_t const pat3 = m_videoram[tile_idx * 32 + j + 3];
- if ( ( top && j < 16 ) || ( bottom && j >= 16 ) )
+ if ((top && (j < 16)) || (bottom && (j >= 16)))
{
- if ( left )
+ if (left)
{
- plot_sprite_part( bitmap, x , y, pat0 >> 4, col, screen_sprite_start_line );
- plot_sprite_part( bitmap, x + 4, y, pat1 >> 4, col, screen_sprite_start_line );
+ plot_sprite_part(bitmap, x , y, pat0 >> 4, col, screen_sprite_start_line);
+ plot_sprite_part(bitmap, x + 4, y, pat1 >> 4, col, screen_sprite_start_line);
}
- if ( right )
+ if (right)
{
- plot_sprite_part( bitmap, x + 8, y, pat2 >> 4, col, screen_sprite_start_line );
- plot_sprite_part( bitmap, x + 12, y, pat3 >> 4, col, screen_sprite_start_line );
+ plot_sprite_part(bitmap, x + 8, y, pat2 >> 4, col, screen_sprite_start_line);
+ plot_sprite_part(bitmap, x + 12, y, pat3 >> 4, col, screen_sprite_start_line);
}
- if ( left )
+ if (left)
{
- plot_sprite_part( bitmap, x , y + 1, pat0 & 0x0f, col, screen_sprite_start_line );
- plot_sprite_part( bitmap, x + 4, y + 1, pat1 & 0x0f, col, screen_sprite_start_line );
+ plot_sprite_part(bitmap, x , y + 1, pat0 & 0x0f, col, screen_sprite_start_line);
+ plot_sprite_part(bitmap, x + 4, y + 1, pat1 & 0x0f, col, screen_sprite_start_line);
}
- if ( right )
+ if (right)
{
- plot_sprite_part( bitmap, x + 8, y + 1, pat2 & 0x0f, col, screen_sprite_start_line );
- plot_sprite_part( bitmap, x + 12, y + 1, pat3 & 0x0f, col, screen_sprite_start_line );
+ plot_sprite_part(bitmap, x + 8, y + 1, pat2 & 0x0f, col, screen_sprite_start_line);
+ plot_sprite_part(bitmap, x + 12, y + 1, pat3 & 0x0f, col, screen_sprite_start_line);
}
}
-
- y += 2;
}
}
@@ -679,8 +665,7 @@ MACHINE_CONFIG_START(scv_state::scv)
m_screen->set_palette("palette");
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_scv)
- MCFG_PALETTE_ADD( "palette", 16 )
- MCFG_PALETTE_INIT_OWNER(scv_state, scv)
+ PALETTE(config, "palette", FUNC(scv_state::scv_palette), 16);
/* Sound is generated by UPD1771C clocked at XTAL(6'000'000) */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/scyclone.cpp b/src/mame/drivers/scyclone.cpp
index 4618d0752da..44f69db6679 100644
--- a/src/mame/drivers/scyclone.cpp
+++ b/src/mame/drivers/scyclone.cpp
@@ -637,7 +637,7 @@ void scyclone_state::scyclone(machine_config &config)
screen.set_video_attributes(VIDEO_ALWAYS_UPDATE); // due to hw collisions
GFXDECODE(config, m_gfxdecode, m_palette, gfx_scyclone);
- PALETTE(config, m_palette, 8 + 4*4);
+ PALETTE(config, m_palette).set_entries(8 + 4*4);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/sderby.cpp b/src/mame/drivers/sderby.cpp
index 1c28ae4a10f..4ea8bbb14ef 100644
--- a/src/mame/drivers/sderby.cpp
+++ b/src/mame/drivers/sderby.cpp
@@ -613,11 +613,10 @@ MACHINE_CONFIG_START(sderby_state::sderby)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_sderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 not verified */
@@ -638,11 +637,10 @@ MACHINE_CONFIG_START(sderby_state::sderbya)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_sderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 not verified */
@@ -663,11 +661,10 @@ MACHINE_CONFIG_START(sderby_state::luckboom)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_sderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 not verified */
@@ -688,11 +685,10 @@ MACHINE_CONFIG_START(sderby_state::spacewin)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_pmroulet)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 not verified */
@@ -713,11 +709,10 @@ MACHINE_CONFIG_START(sderby_state::shinygld)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_sderby)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1.056_MHz_XTAL, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 verified */
@@ -738,11 +733,10 @@ MACHINE_CONFIG_START(sderby_state::pmroulet)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(4*8, 44*8-1, 3*8, 33*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sderby_state, screen_update_pmroulet)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(RRRRRGGGGGBBBBBx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 0x1000);
SPEAKER(config, "mono").front_center();
MCFG_DEVICE_ADD("oki", OKIM6295, 1056000, okim6295_device::PIN7_HIGH) /* clock frequency & pin 7 not verified */
diff --git a/src/mame/drivers/sderby2.cpp b/src/mame/drivers/sderby2.cpp
index 69f6ecd5a7e..d8865e53b72 100644
--- a/src/mame/drivers/sderby2.cpp
+++ b/src/mame/drivers/sderby2.cpp
@@ -44,13 +44,14 @@
class sderby2_state : public driver_device
{
public:
- sderby2_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sderby2_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "subcpu"),
m_gfxdecode(*this, "gfxdecode"),
m_proms(*this, "proms"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void sderby2(machine_config &config);
@@ -61,7 +62,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sderby2);
+ void sderby2_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(palette_w);
@@ -96,7 +97,7 @@ private:
*
*************************************/
-PALETTE_INIT_MEMBER(sderby2_state,sderby2)
+void sderby2_state::sderby2_palette(palette_device &palette) const
{
}
@@ -316,11 +317,10 @@ MACHINE_CONFIG_START(sderby2_state::sderby2)
MCFG_SCREEN_VISIBLE_AREA(0, 256 - 1, 0, 256 - 1)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_SCREEN_UPDATE_DRIVER(sderby2_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256+256*3)
- MCFG_PALETTE_INIT_OWNER(sderby2_state,sderby2)
+ MCFG_SCREEN_PALETTE(m_palette)
+ PALETTE(config, m_palette, FUNC(sderby2_state::sderby2_palette), 256+256*3);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sderby2)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sderby2);
// sound hardware
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/seabattl.cpp b/src/mame/drivers/seabattl.cpp
index a8d26b9c2e7..9841b29fac2 100644
--- a/src/mame/drivers/seabattl.cpp
+++ b/src/mame/drivers/seabattl.cpp
@@ -64,6 +64,11 @@ public:
void seabattl(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_WRITE8_MEMBER(seabattl_videoram_w);
@@ -81,15 +86,11 @@ private:
INTERRUPT_GEN_MEMBER(seabattl_interrupt);
- DECLARE_PALETTE_INIT(seabattl);
+ void seabattl_palette(palette_device &palette) const;
uint32_t screen_update_seabattl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void seabattl_data_map(address_map &map);
void seabattl_map(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
required_device<s2650_device> m_maincpu;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
@@ -116,7 +117,7 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(seabattl_state, seabattl)
+void seabattl_state::seabattl_palette(palette_device &palette) const
{
// sprites (m.obj) + s2636
for (int i = 0; i < 8; i++)
@@ -510,7 +511,7 @@ MACHINE_CONFIG_START(seabattl_state::seabattl)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_seabattl);
- PALETTE(config, m_palette, 26).set_init(FUNC(seabattl_state::palette_init_seabattl));
+ PALETTE(config, m_palette, FUNC(seabattl_state::seabattl_palette), 26);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sealy.cpp b/src/mame/drivers/sealy.cpp
index b6a1594ef3b..661ad948358 100644
--- a/src/mame/drivers/sealy.cpp
+++ b/src/mame/drivers/sealy.cpp
@@ -40,8 +40,8 @@ Notes:
class sealy_state : public driver_device
{
public:
- sealy_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sealy_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette")
{ }
@@ -54,16 +54,16 @@ private:
required_device<palette_device> m_palette;
// screen updates
- DECLARE_PALETTE_INIT(sealy);
+ void sealy_palette(palette_device &palette) const;
uint32_t screen_update_sealy(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void sealy_map(address_map &map);
};
-PALETTE_INIT_MEMBER(sealy_state,sealy)
+void sealy_state::sealy_palette(palette_device &palette) const
{
// for (int i = 0; i < 32768; i++)
-// palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
+// palette.set_pen_color(i, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0));
}
uint32_t sealy_state::screen_update_sealy(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
@@ -115,9 +115,8 @@ MACHINE_CONFIG_START(sealy_state::sealy)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(sealy_state, screen_update_sealy)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sealy)
- MCFG_PALETTE_ADD("palette", 32768)
- MCFG_PALETTE_INIT_OWNER(sealy_state, sealy)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_sealy);
+ PALETTE(config, m_palette, FUNC(sealy_state::sealy_palette), 32768);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/segac2.cpp b/src/mame/drivers/segac2.cpp
index ecbff2aae66..0613bb24b40 100644
--- a/src/mame/drivers/segac2.cpp
+++ b/src/mame/drivers/segac2.cpp
@@ -1583,7 +1583,7 @@ void segac2_state::segac(machine_config &config)
screen.set_screen_update(FUNC(segac2_state::screen_update_segac2_new));
screen.screen_vblank().set(FUNC(segac2_state::screen_vblank_megadriv));
- PALETTE(config, m_palette, 2048*3);
+ PALETTE(config, m_palette).set_entries(2048*3);
MCFG_VIDEO_START_OVERRIDE(segac2_state,segac2_new)
diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp
index 5617a7caf93..df33e01f25d 100644
--- a/src/mame/drivers/segag80r.cpp
+++ b/src/mame/drivers/segag80r.cpp
@@ -887,7 +887,7 @@ MACHINE_CONFIG_START(segag80r_state::spaceod)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_spaceod)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(64+64)
/* sound hardware */
@@ -913,7 +913,7 @@ MACHINE_CONFIG_START(segag80r_state::monsterb)
/* background board changes */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_monsterb)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(64+64)
/* sound boards */
@@ -939,7 +939,7 @@ MACHINE_CONFIG_START(segag80r_state::pignewt)
/* background board changes */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_monsterb)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(64+64)
/* sound hardware */
@@ -967,7 +967,7 @@ MACHINE_CONFIG_START(segag80r_state::sindbadm)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_monsterb)
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(64+64)
/* sound hardware */
diff --git a/src/mame/drivers/segahang.cpp b/src/mame/drivers/segahang.cpp
index 6104249fdc6..052a91848f3 100644
--- a/src/mame/drivers/segahang.cpp
+++ b/src/mame/drivers/segahang.cpp
@@ -783,7 +783,7 @@ void segahang_state::shared_base(machine_config &config)
// video hardware
GFXDECODE(config, "gfxdecode", m_palette, gfx_segahang);
- PALETTE(config, m_palette, 2048*3);
+ PALETTE(config, m_palette).set_entries(2048*3);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224);
diff --git a/src/mame/drivers/segajw.cpp b/src/mame/drivers/segajw.cpp
index a56672dcd86..bebaf6cadb3 100644
--- a/src/mame/drivers/segajw.cpp
+++ b/src/mame/drivers/segajw.cpp
@@ -408,7 +408,7 @@ void segajw_state::segajw(machine_config &config)
screen.set_visarea(0, 720-1, 0, 448-1);
screen.set_palette("palette");
- PALETTE(config, "palette", 16);
+ PALETTE(config, "palette").set_entries(16);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, "palette"));
ramdac.set_addrmap(0, &segajw_state::ramdac_map);
diff --git a/src/mame/drivers/segam1.cpp b/src/mame/drivers/segam1.cpp
index 4820baf7263..962d4da5b19 100644
--- a/src/mame/drivers/segam1.cpp
+++ b/src/mame/drivers/segam1.cpp
@@ -390,7 +390,7 @@ void segam1_state::segam1(machine_config &config)
m_screen->set_screen_update(FUNC(segam1_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 8192*2);
+ PALETTE(config, m_palette).set_entries(8192*2);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/segaorun.cpp b/src/mame/drivers/segaorun.cpp
index 031eadbb32f..a09fdd66b4b 100644
--- a/src/mame/drivers/segaorun.cpp
+++ b/src/mame/drivers/segaorun.cpp
@@ -1175,7 +1175,7 @@ void segaorun_state::outrun_base(machine_config &config)
// video hardware
GFXDECODE(config, "gfxdecode", m_palette, gfx_segaorun);
- PALETTE(config, m_palette, 4096*3);
+ PALETTE(config, m_palette).set_entries(4096*3);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224);
diff --git a/src/mame/drivers/segapm.cpp b/src/mame/drivers/segapm.cpp
index bbed1cd5f25..497ca93c5fe 100644
--- a/src/mame/drivers/segapm.cpp
+++ b/src/mame/drivers/segapm.cpp
@@ -73,8 +73,7 @@ MACHINE_CONFIG_START(segapm_state::segapm)
MCFG_SCREEN_UPDATE_DRIVER(segapm_state, screen_update_segapm)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x200);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/segas16a.cpp b/src/mame/drivers/segas16a.cpp
index 406e2e345b6..4392599339c 100644
--- a/src/mame/drivers/segas16a.cpp
+++ b/src/mame/drivers/segas16a.cpp
@@ -2009,7 +2009,7 @@ void segas16a_state::system16a(machine_config &config)
SEGAIC16VID(config, m_segaic16vid, 0, "gfxdecode");
GFXDECODE(config, "gfxdecode", m_palette, gfx_segas16a);
- PALETTE(config, m_palette, 2048*3);
+ PALETTE(config, m_palette).set_entries(2048*3);
// sound hardware
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp
index 947cb7d5548..ae68808f877 100644
--- a/src/mame/drivers/segas16b.cpp
+++ b/src/mame/drivers/segas16b.cpp
@@ -3730,7 +3730,7 @@ void segas16b_state::system16b(machine_config &config)
// video hardware
GFXDECODE(config, m_gfxdecode, "palette", gfx_segas16b);
- PALETTE(config, "palette", 2048*3);
+ PALETTE(config, "palette").set_entries(2048*3);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MASTER_CLOCK_25MHz/4, 400, 0, 320, 262, 0, 224);
diff --git a/src/mame/drivers/segas18.cpp b/src/mame/drivers/segas18.cpp
index 24684a8281c..8ab3a2752e8 100644
--- a/src/mame/drivers/segas18.cpp
+++ b/src/mame/drivers/segas18.cpp
@@ -1357,7 +1357,7 @@ void segas18_state::system18(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_segas18);
- PALETTE(config, m_palette, 2048*3+2048 + 64*3);
+ PALETTE(config, m_palette).set_entries(2048*3+2048 + 64*3);
SEGA_SYS16B_SPRITES(config, m_sprites, 0);
SEGAIC16VID(config, m_segaic16vid, 0, m_gfxdecode);
diff --git a/src/mame/drivers/segas24.cpp b/src/mame/drivers/segas24.cpp
index c64af46d3e2..e0b73147bb8 100644
--- a/src/mame/drivers/segas24.cpp
+++ b/src/mame/drivers/segas24.cpp
@@ -1955,7 +1955,7 @@ void segas24_state::system24(machine_config &config)
m_screen->set_screen_update(FUNC(segas24_state::screen_update));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 8192*2);
+ PALETTE(config, m_palette).set_entries(8192*2);
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
diff --git a/src/mame/drivers/segas32.cpp b/src/mame/drivers/segas32.cpp
index e004f80e263..2741a33d812 100644
--- a/src/mame/drivers/segas32.cpp
+++ b/src/mame/drivers/segas32.cpp
@@ -2339,7 +2339,7 @@ void segas32_state::device_add_mconfig(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_segas32);
- PALETTE(config, m_palette, 0x4000);
+ PALETTE(config, m_palette).set_entries(0x4000);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(60);
@@ -2664,7 +2664,7 @@ void sega_multi32_state::device_add_mconfig(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_segas32);
- PALETTE(config, m_palette, 0x8000);
+ PALETTE(config, m_palette).set_entries(0x8000);
config.set_default_layout(layout_dualhsxs);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
diff --git a/src/mame/drivers/segaxbd.cpp b/src/mame/drivers/segaxbd.cpp
index 10ddc01a405..8287207e302 100644
--- a/src/mame/drivers/segaxbd.cpp
+++ b/src/mame/drivers/segaxbd.cpp
@@ -1716,7 +1716,7 @@ void segaxbd_state::xboard_base_mconfig(machine_config &config)
// video hardware
GFXDECODE(config, "gfxdecode", m_palette, gfx_segaxbd);
- PALETTE(config, m_palette, 8192*3);
+ PALETTE(config, m_palette).set_entries(8192*3);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(MASTER_CLOCK/8, 400, 0, 320, 262, 0, 224);
diff --git a/src/mame/drivers/segaybd.cpp b/src/mame/drivers/segaybd.cpp
index fcd9eadfca3..c56ab281192 100644
--- a/src/mame/drivers/segaybd.cpp
+++ b/src/mame/drivers/segaybd.cpp
@@ -1330,7 +1330,7 @@ void segaybd_state::yboard(machine_config &config)
SEGA_YBOARD_SPRITES(config, m_ysprites, 0);
SEGAIC16VID(config, m_segaic16vid, 0, "gfxdecode");
- PALETTE(config, m_palette, 8192*3);
+ PALETTE(config, m_palette).set_entries(8192*3);
// sound hardware
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/seibucats.cpp b/src/mame/drivers/seibucats.cpp
index cce452ccd33..c6d5d7c8364 100644
--- a/src/mame/drivers/seibucats.cpp
+++ b/src/mame/drivers/seibucats.cpp
@@ -316,7 +316,7 @@ MACHINE_CONFIG_START(seibucats_state::seibucats)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seibucats)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 8192)
+ MCFG_DEVICE_ADD(m_palette, PALETTE, palette_device::BLACK, 8192);
// MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
//MCFG_PALETTE_INIT_OWNER(seibucats_state, seibucats)
diff --git a/src/mame/drivers/seibuspi.cpp b/src/mame/drivers/seibuspi.cpp
index 2c0bfe94242..0f1d32c1816 100644
--- a/src/mame/drivers/seibuspi.cpp
+++ b/src/mame/drivers/seibuspi.cpp
@@ -1893,7 +1893,7 @@ void seibuspi_state::spi(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_spi);
- PALETTE(config, m_palette, 6144).set_init("palette", FUNC(palette_device::palette_init_all_black));
+ PALETTE(config, m_palette, palette_device::BLACK, 6144);
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.decrypt_key_callback().set(FUNC(seibuspi_state::tile_decrypt_key_w));
@@ -2015,7 +2015,7 @@ void seibuspi_state::sys386i(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_spi);
- PALETTE(config, m_palette, 6144).set_init("palette", FUNC(palette_device::palette_init_all_black));
+ PALETTE(config, m_palette, palette_device::BLACK, 6144);
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.decrypt_key_callback().set(FUNC(seibuspi_state::tile_decrypt_key_w));
@@ -2074,7 +2074,7 @@ void seibuspi_state::sys386f(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sys386f);
- PALETTE(config, m_palette, 8192).set_init("palette", FUNC(palette_device::palette_init_all_black));
+ PALETTE(config, m_palette, palette_device::BLACK, 8192);
MCFG_VIDEO_START_OVERRIDE(seibuspi_state, sys386f)
diff --git a/src/mame/drivers/seicross.cpp b/src/mame/drivers/seicross.cpp
index a9a7e599ccc..a848fa0edc5 100644
--- a/src/mame/drivers/seicross.cpp
+++ b/src/mame/drivers/seicross.cpp
@@ -420,9 +420,8 @@ MACHINE_CONFIG_START(seicross_state::no_nvram)
MCFG_SCREEN_UPDATE_DRIVER(seicross_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seicross)
- MCFG_PALETTE_ADD("palette", 64)
- MCFG_PALETTE_INIT_OWNER(seicross_state, seicross)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_seicross);
+ PALETTE(config, m_palette, FUNC(seicross_state::seicross_palette), 64);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/seicupbl.cpp b/src/mame/drivers/seicupbl.cpp
index aa48617d8f6..f74f53ddce3 100644
--- a/src/mame/drivers/seicupbl.cpp
+++ b/src/mame/drivers/seicupbl.cpp
@@ -578,17 +578,16 @@ MACHINE_CONFIG_START(seicupbl_state::cupsocbl)
MCFG_SCREEN_SIZE(42*8, 36*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(seicupbl_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
//seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
//crtc.layer_en_callback().set(FUNC(seicupbl_state::tilemap_enable_w));
//crtc.layer_scroll_callback().set(FUNC(seicupbl_state::tile_scroll_w));
//crtc.reg_1a_callback().set(FUNC(seicupbl_state::tile_vreg_1a_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seicupbl_csb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_seicupbl_csb);
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 128*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_555, 128*16);
// MCFG_VIDEO_START_OVERRIDE(seicupbl_state,cupsoc)
diff --git a/src/mame/drivers/sengokmj.cpp b/src/mame/drivers/sengokmj.cpp
index 3c575ae739c..f8a97274d73 100644
--- a/src/mame/drivers/sengokmj.cpp
+++ b/src/mame/drivers/sengokmj.cpp
@@ -69,8 +69,8 @@ RSSENGO2.72 chr.
class sengokmj_state : public driver_device, protected seibu_sound_common
{
public:
- sengokmj_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sengokmj_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
@@ -78,7 +78,8 @@ public:
m_sc1_vram(*this, "sc1_vram"),
m_sc2_vram(*this, "sc2_vram"),
m_sc3_vram(*this, "sc3_vram"),
- m_spriteram16(*this, "sprite_ram") { }
+ m_spriteram16(*this, "sprite_ram")
+ { }
void sengokmj(machine_config &config);
@@ -596,16 +597,15 @@ MACHINE_CONFIG_START(sengokmj_state::sengokmj)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1) //TODO: dynamic resolution
MCFG_SCREEN_UPDATE_DRIVER(sengokmj_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sengokmj_state, vblank_irq))
seibu_crtc_device &crtc(SEIBU_CRTC(config, "crtc", 0));
crtc.layer_en_callback().set(FUNC(sengokmj_state::layer_en_w));
crtc.layer_scroll_callback().set(FUNC(sengokmj_state::layer_scroll_w));
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sengokmj)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sengokmj);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/senjyo.cpp b/src/mame/drivers/senjyo.cpp
index 24788b1b487..91184fa8cca 100644
--- a/src/mame/drivers/senjyo.cpp
+++ b/src/mame/drivers/senjyo.cpp
@@ -577,13 +577,10 @@ MACHINE_CONFIG_START(senjyo_state::senjyo)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(senjyo_state, screen_update)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_senjyo)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_senjyo);
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 512)
- MCFG_PALETTE_FORMAT_CLASS(1, senjyo_state, IIBBGGRR)
-
- MCFG_PALETTE_ADD("radar_palette", 2)
- MCFG_PALETTE_INIT_OWNER(senjyo_state, radar)
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(1, &senjyo_state::IIBBGGRR, 512);
+ PALETTE(config, m_radar_palette, FUNC(senjyo_state::radar_palette), 2);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/seta.cpp b/src/mame/drivers/seta.cpp
index 00b107dac0a..10b8e864981 100644
--- a/src/mame/drivers/seta.cpp
+++ b/src/mame/drivers/seta.cpp
@@ -7873,7 +7873,7 @@ void seta_state::tndrcade(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -7928,7 +7928,7 @@ void seta_state::twineagl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_downtown);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,twineagl_1_layer)
@@ -7974,7 +7974,7 @@ void seta_state::downtown(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_downtown);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_1_layer)
@@ -8055,10 +8055,7 @@ void usclssic_state::usclssic(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_usclssic);
-
- PALETTE(config, m_palette, 16*32 + 64*32*2); /* sprites, layer */
- m_palette->set_indirect_entries(0x400);
- m_palette->set_init(FUNC(usclssic_state::palette_init_usclssic)); /* layer is 6 planes deep */
+ PALETTE(config, m_palette, FUNC(usclssic_state::usclssic_palette), 16*32 + 64*32*2, 0x400); // sprites, layer - layer is 6 planes deep
MCFG_VIDEO_START_OVERRIDE(usclssic_state,seta_1_layer)
@@ -8118,7 +8115,7 @@ void seta_state::calibr50(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_downtown);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_1_layer)
@@ -8167,7 +8164,7 @@ void seta_state::metafox(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_downtown);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_1_layer)
@@ -8207,7 +8204,7 @@ void seta_state::atehate(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -8252,10 +8249,7 @@ void seta_state::blandia(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_blandia);
-
- PALETTE(config, m_palette, (16*32+64*32*4)*2); /* sprites, layer1, layer2, palette effect */
- m_palette->set_indirect_entries(0x600*2);
- m_palette->set_init(FUNC(seta_state::palette_init_blandia)); /* layers 1&2 are 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::blandia_palette), (16*32 + 64*32*4)*2, 0x600*2); // sprites, layer1, layer2, palette effect - layers 1&2 are 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8290,10 +8284,7 @@ void seta_state::blandiap(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_blandia);
-
- PALETTE(config, m_palette, (16*32+64*32*4)*2); /* sprites, layer1, layer2, palette effect */
- m_palette->set_indirect_entries(0x600*2);
- m_palette->set_init(FUNC(seta_state::palette_init_blandia)); /* layers 1&2 are 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::blandia_palette), (16*32 + 64*32*4)*2, 0x600*2); // sprites, layer1, layer2, palette effect - layers 1&2 are 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8331,7 +8322,7 @@ void seta_state::blockcar(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -8405,7 +8396,7 @@ void seta_state::daioh(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer1, layer2 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8442,7 +8433,7 @@ void seta_state::daiohp(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_daiohp);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer1, layer2 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8486,7 +8477,7 @@ void seta_state::drgnunit(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_downtown);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_1_layer)
@@ -8522,7 +8513,7 @@ void seta_state::qzkklgy2(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_qzkklgy2);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_1_layer)
@@ -8587,9 +8578,7 @@ void setaroul_state::setaroul(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_setaroul);
-
- PALETTE(config, m_palette, 512);
- m_palette->set_init(FUNC(setaroul_state::palette_init_setaroul));
+ PALETTE(config, m_palette, FUNC(setaroul_state::setaroul_palette), 512);
MCFG_VIDEO_START_OVERRIDE(setaroul_state,setaroul_1_layer)
@@ -8632,7 +8621,7 @@ void seta_state::eightfrc(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer1, layer2 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8676,10 +8665,7 @@ void seta_state::extdwnhl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_zingzip);
-
- PALETTE(config, m_palette, 16*32+16*32+64*32*2); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_zingzip)); /* layer 1 gfx is 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::zingzip_palette), 16*32 + 16*32 + 64*32*2, 0x600); // sprites, layer2, layer1 - layer 1 gfx is 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8744,10 +8730,7 @@ void seta_state::gundhara(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jjsquawk);
-
- PALETTE(config, m_palette, 16*32+64*32*4); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_gundhara)); /* layers are 6 planes deep (seta_state,but have only 4 palettes) */
+ PALETTE(config, m_palette, FUNC(seta_state::gundhara_palette), 16*32 + 64*32*4, 0x600); // sprites, layer2, layer1 - layers are 6 planes deep (seta_state,but have only 4 palettes)
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8816,10 +8799,7 @@ void seta_state::jjsquawk(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jjsquawk);
-
- PALETTE(config, m_palette, 16*32+64*32*4); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_jjsquawk)); /* layers are 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::jjsquawk_palette), 16*32 + 64*32*4, 0x600); // sprites, layer2, layer1 - layers are 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8851,10 +8831,7 @@ void seta_state::jjsquawb(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jjsquawk);
-
- PALETTE(config, m_palette, 16*32+64*32*4); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_jjsquawk)); /* layers are 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::jjsquawk_palette), 16*32 + 64*32*4, 0x600); // sprites, layer2, layer1 - layers are 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8898,7 +8875,7 @@ void seta_state::kamenrid(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -8937,7 +8914,7 @@ void seta_state::orbs(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_orbs);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -8978,7 +8955,7 @@ void seta_state::keroppij(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_orbs);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9031,7 +9008,7 @@ void seta_state::krzybowl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9075,10 +9052,7 @@ void seta_state::madshark(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jjsquawk);
-
- PALETTE(config, m_palette, 16*32+64*32*4); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_jjsquawk)); /* layers are 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::jjsquawk_palette), 16*32 + 64*32*4, 0x600); // sprites, layer2, layer1 - layers are 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9126,7 +9100,7 @@ void seta_state::magspeed(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9170,7 +9144,7 @@ void seta_state::msgundam(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9208,7 +9182,7 @@ void seta_state::oisipuzl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,oisipuzl_2_layers) // flip is inverted for the tilemaps
@@ -9249,7 +9223,7 @@ void seta_state::triplfun(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,oisipuzl_2_layers) // flip is inverted for the tilemaps
@@ -9301,7 +9275,7 @@ void kiwame_state::kiwame(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(kiwame_state,seta_no_layers)
@@ -9344,7 +9318,7 @@ void seta_state::rezon(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer1, layer2 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9383,7 +9357,7 @@ void seta_state::thunderl(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9457,7 +9431,7 @@ void seta_state::wiggie(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_wiggie);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9497,7 +9471,7 @@ void seta_state::wits(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512); /* sprites only */
+ PALETTE(config, m_palette).set_entries(512); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9534,7 +9508,7 @@ void seta_state::umanclub(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tndrcade);
- PALETTE(config, m_palette, 512);
+ PALETTE(config, m_palette).set_entries(512);
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9575,7 +9549,7 @@ void seta_state::utoukond(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer2, layer1 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9633,7 +9607,7 @@ void seta_state::wrofaero(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_msgundam);
- PALETTE(config, m_palette, 512 * 3); /* sprites, layer1, layer2 */
+ PALETTE(config, m_palette).set_entries(512 * 3); // sprites, layer1, layer2
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9677,10 +9651,7 @@ void seta_state::zingzip(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_zingzip);
-
- PALETTE(config, m_palette, 16*32+16*32+64*32*2); /* sprites, layer2, layer1 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_zingzip)); /* layer 1 gfx is 6 planes deep */
+ PALETTE(config, m_palette, FUNC(seta_state::zingzip_palette), 16*32 + 16*32 + 64*32*2, 0x600); // sprites, layer2, layer1 - layer 1 gfx is 6 planes deep
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9732,7 +9703,7 @@ void seta_state::pairlove(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pairlove);
- PALETTE(config, m_palette, 2048); /* sprites only */
+ PALETTE(config, m_palette).set_entries(2048); // sprites only
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_no_layers)
@@ -9780,10 +9751,7 @@ void seta_state::crazyfgt(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_crazyfgt);
-
- PALETTE(config, m_palette, 16*32+64*32*4); /* sprites, layer1, layer2 */
- m_palette->set_indirect_entries(0x600);
- m_palette->set_init(FUNC(seta_state::palette_init_gundhara)); /* layers are 6 planes deep (seta_state,but have only 4 palettes) */
+ PALETTE(config, m_palette, FUNC(seta_state::gundhara_palette), 16*32 + 64*32*4, 0x600); // sprites, layer2, layer1 - layers are 6 planes deep (seta_state,but have only 4 palettes)
MCFG_VIDEO_START_OVERRIDE(seta_state,seta_2_layers)
@@ -9861,9 +9829,7 @@ void jockeyc_state::jockeyc(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_jockeyc);
-
- PALETTE(config, m_palette, 512);
- m_palette->set_init(FUNC(seta_state::palette_init_RRRRRGGGGGBBBBB_proms));
+ PALETTE(config, m_palette, FUNC(seta_state::palette_init_RRRRRGGGGGBBBBB_proms), 512 * 1);
MCFG_VIDEO_START_OVERRIDE(jockeyc_state,jockeyc_1_layer)
@@ -9893,6 +9859,7 @@ MACHINE_START_MEMBER(jockeyc_state, inttoote)
void jockeyc_state::inttoote(machine_config &config)
{
jockeyc(config);
+
M68000(config.replace(), m_maincpu, XTAL(16'000'000)); // TMP68HC000N-16
m_maincpu->set_addrmap(AS_PROGRAM, &jockeyc_state::inttoote_map);
diff --git a/src/mame/drivers/seta2.cpp b/src/mame/drivers/seta2.cpp
index 1262103859f..a1e7523efb5 100644
--- a/src/mame/drivers/seta2.cpp
+++ b/src/mame/drivers/seta2.cpp
@@ -2328,12 +2328,11 @@ MACHINE_CONFIG_START(seta2_state::seta2)
MCFG_SCREEN_VISIBLE_AREA(0x00, 0x180-1, 0x00, 0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(seta2_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, seta2_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
//MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seta2)
- MCFG_PALETTE_ADD("palette", 0x8000+0xf0) // extra 0xf0 because we might draw 256-color object with 16-color granularity
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_seta2);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -2542,11 +2541,10 @@ MACHINE_CONFIG_START(funcube_state::funcube)
MCFG_SCREEN_VISIBLE_AREA(0x0+1, 0x140-1+1, 0x00, 0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(funcube_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, funcube_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seta2)
- MCFG_PALETTE_ADD("palette", 0x8000+0xf0) // extra 0xf0 because we might draw 256-color object with 16-color granularity
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_seta2);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
SPEAKER(config, "lspeaker").front_left();
@@ -2597,11 +2595,10 @@ MACHINE_CONFIG_START(seta2_state::namcostr)
MCFG_SCREEN_VISIBLE_AREA(0x40, 0x1c0-1, 0x00, 0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(seta2_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, seta2_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_seta2)
- MCFG_PALETTE_ADD("palette", 0x8000+0xf0) // extra 0xf0 because we might draw 256-color object with 16-color granularity
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_seta2);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000+0xf0); // extra 0xf0 because we might draw 256-color object with 16-color granularity
// sound hardware
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/sf.cpp b/src/mame/drivers/sf.cpp
index 73df678c5b3..bd8e1ffd660 100644
--- a/src/mame/drivers/sf.cpp
+++ b/src/mame/drivers/sf.cpp
@@ -552,12 +552,11 @@ MACHINE_CONFIG_START(sf_state::sfan)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(sf_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sf)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/shadfrce.cpp b/src/mame/drivers/shadfrce.cpp
index a449ec95a30..f5c29c8274d 100644
--- a/src/mame/drivers/shadfrce.cpp
+++ b/src/mame/drivers/shadfrce.cpp
@@ -550,11 +550,10 @@ MACHINE_CONFIG_START(shadfrce_state::shadfrce)
MCFG_SCREEN_RAW_PARAMS(XTAL(28'000'000) / 4, 448, 0, 320, 272, 8, 248) /* HTOTAL and VTOTAL are guessed */
MCFG_SCREEN_UPDATE_DRIVER(shadfrce_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, shadfrce_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_shadfrce)
- MCFG_PALETTE_ADD("palette", 0x4000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_shadfrce);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x4000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/shangha3.cpp b/src/mame/drivers/shangha3.cpp
index 0a585c60f10..ab7bb858127 100644
--- a/src/mame/drivers/shangha3.cpp
+++ b/src/mame/drivers/shangha3.cpp
@@ -464,9 +464,7 @@ void shangha3_state::shangha3(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_shangha3);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_RRRRRGGGGGBBBBBx);
- m_palette->enable_shadows();
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 2048).enable_shadows();
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -503,9 +501,7 @@ void shangha3_state::heberpop(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_shangha3);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_RRRRRGGGGGBBBBBx);
- m_palette->enable_shadows();
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 2048).enable_shadows();
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -545,9 +541,7 @@ void shangha3_state::blocken(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_shangha3);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_RRRRRGGGGGBBBBBx);
- m_palette->enable_shadows();
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_555, 2048).enable_shadows();
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/shanghai.cpp b/src/mame/drivers/shanghai.cpp
index 73194377012..f60a2c932fd 100644
--- a/src/mame/drivers/shanghai.cpp
+++ b/src/mame/drivers/shanghai.cpp
@@ -34,11 +34,11 @@ displayed.
class shanghai_state : public driver_device
{
public:
- shanghai_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ shanghai_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this,"screen")
- { }
+ { }
void shanghai(machine_config &config);
void shangha2(machine_config &config);
@@ -46,7 +46,7 @@ public:
private:
DECLARE_WRITE8_MEMBER(shanghai_coin_w);
- DECLARE_PALETTE_INIT(shanghai);
+ void shanghai_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(half_vblank_irq);
void hd63484_map(address_map &map);
@@ -62,31 +62,31 @@ private:
};
-PALETTE_INIT_MEMBER(shanghai_state,shanghai)
+void shanghai_state::shanghai_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (i >> 2) & 0x01;
- bit1 = (i >> 3) & 0x01;
- bit2 = (i >> 4) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (i >> 5) & 0x01;
- bit1 = (i >> 6) & 0x01;
- bit2 = (i >> 7) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(i, 2);
+ bit1 = BIT(i, 3);
+ bit2 = BIT(i, 4);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(i, 5);
+ bit1 = BIT(i, 6);
+ bit2 = BIT(i, 7);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
bit0 = 0;
- bit1 = (i >> 0) & 0x01;
- bit2 = (i >> 1) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(i, 0);
+ bit2 = BIT(i, 1);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -415,9 +415,7 @@ MACHINE_CONFIG_START(shanghai_state::shanghai)
MCFG_SCREEN_UPDATE_DEVICE("hd63484", hd63484_device, update_screen)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
- MCFG_PALETTE_INIT_OWNER(shanghai_state,shanghai)
+ PALETTE(config, "palette", FUNC(shanghai_state::shanghai_palette)).set_format(palette_device::xBGR_444, 256);
MCFG_HD63484_ADD("hd63484", 0, hd63484_map)
@@ -451,8 +449,7 @@ MACHINE_CONFIG_START(shanghai_state::shangha2)
MCFG_SCREEN_UPDATE_DEVICE("hd63484", hd63484_device, update_screen)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 256);
MCFG_HD63484_ADD("hd63484", 0, hd63484_map)
@@ -491,8 +488,7 @@ MACHINE_CONFIG_START(shanghai_state::kothello)
MCFG_SCREEN_UPDATE_DEVICE("hd63484", hd63484_device, update_screen)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 256);
MCFG_HD63484_ADD("hd63484", 0, hd63484_map)
MCFG_HD63484_EXTERNAL_SKEW(2)
diff --git a/src/mame/drivers/shangkid.cpp b/src/mame/drivers/shangkid.cpp
index 7f6a3b5aab3..8cbb3abc4cc 100644
--- a/src/mame/drivers/shangkid.cpp
+++ b/src/mame/drivers/shangkid.cpp
@@ -413,8 +413,8 @@ MACHINE_CONFIG_START(shangkid_state::chinhero)
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)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_chinhero);
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(shangkid_state,shangkid)
/* sound hardware */
@@ -501,10 +501,8 @@ MACHINE_CONFIG_START(shangkid_state::dynamski)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, shangkid_state, irq_1_w))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dynamski)
- MCFG_PALETTE_ADD("palette", 16*4+16*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(shangkid_state,dynamski)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dynamski);
+ PALETTE(config, m_palette, FUNC(shangkid_state::dynamski_palette), 16*4 + 16*4, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/shaolins.cpp b/src/mame/drivers/shaolins.cpp
index a7852f669cb..a5ef43474c1 100644
--- a/src/mame/drivers/shaolins.cpp
+++ b/src/mame/drivers/shaolins.cpp
@@ -208,12 +208,10 @@ MACHINE_CONFIG_START(shaolins_state::shaolins)
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(shaolins_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_shaolins)
- MCFG_PALETTE_ADD("palette", 16*8*16+16*8*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(shaolins_state, shaolins)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_shaolins);
+ PALETTE(config, m_palette, FUNC(shaolins_state::shaolins_palette), 16*8*16+16*8*16, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/shootout.cpp b/src/mame/drivers/shootout.cpp
index f35e9984056..63f4cd949b9 100644
--- a/src/mame/drivers/shootout.cpp
+++ b/src/mame/drivers/shootout.cpp
@@ -292,11 +292,10 @@ MACHINE_CONFIG_START(shootout_state::shootout)
MCFG_SCREEN_RAW_PARAMS (XTAL(12'000'000) / 2, 384, 0, 256, 262, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootout)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_shootout)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(shootout_state, shootout)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_shootout)
+ PALETTE(config, m_palette, FUNC(shootout_state::shootout_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -322,11 +321,10 @@ MACHINE_CONFIG_START(shootout_state::shootouj)
MCFG_SCREEN_RAW_PARAMS (XTAL(12'000'000) / 2, 384, 0, 256, 262, 8, 248)
MCFG_SCREEN_UPDATE_DRIVER(shootout_state, screen_update_shootouj)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_shootout)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(shootout_state, shootout)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_shootout)
+ PALETTE(config, m_palette, FUNC(shootout_state::shootout_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp
index dd38e1395d4..d6717f9ec28 100644
--- a/src/mame/drivers/shougi.cpp
+++ b/src/mame/drivers/shougi.cpp
@@ -106,7 +106,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(nmi_enable_w);
DECLARE_READ8_MEMBER(semaphore_r);
- DECLARE_PALETTE_INIT(shougi);
+ void shougi_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_nmi);
@@ -162,7 +162,7 @@ void shougi_state::machine_start()
***************************************************************************/
-PALETTE_INIT_MEMBER(shougi_state, shougi)
+void shougi_state::shougi_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
static const int resistances_b[2] = { 470, 220 };
@@ -176,24 +176,24 @@ PALETTE_INIT_MEMBER(shougi_state, shougi)
for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0,bit1,bit2;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
/* blue component */
bit0 = (color_prom[i] >> 6) & 0x01;
bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i,rgb_t(r,g,b));
}
@@ -404,8 +404,7 @@ MACHINE_CONFIG_START(shougi_state::shougi)
MCFG_SCREEN_UPDATE_DRIVER(shougi_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(shougi_state, shougi)
+ PALETTE(config, "palette", FUNC(shougi_state::shougi_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/shuuz.cpp b/src/mame/drivers/shuuz.cpp
index 79ec00cf1c4..ab5126a7880 100644
--- a/src/mame/drivers/shuuz.cpp
+++ b/src/mame/drivers/shuuz.cpp
@@ -245,8 +245,7 @@ MACHINE_CONFIG_START(shuuz_state::shuuz)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_shuuz)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 1024);
ATARI_VAD(config, m_vad, 0, m_screen);
m_vad->scanline_int_cb().set(FUNC(shuuz_state::scanline_int_write_line));
diff --git a/src/mame/drivers/sidearms.cpp b/src/mame/drivers/sidearms.cpp
index bebc05c6871..cf30f9fd529 100644
--- a/src/mame/drivers/sidearms.cpp
+++ b/src/mame/drivers/sidearms.cpp
@@ -621,12 +621,11 @@ MACHINE_CONFIG_START(sidearms_state::sidearms)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(sidearms_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sidearms)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -670,12 +669,11 @@ MACHINE_CONFIG_START(sidearms_state::turtship)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
MCFG_SCREEN_UPDATE_DRIVER(sidearms_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turtship)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -722,12 +720,11 @@ MACHINE_CONFIG_START(sidearms_state::whizz)
MCFG_SCREEN_VISIBLE_AREA(8*8, (64-8)*8-1, 2*8, 30*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(sidearms_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turtship)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sidepckt.cpp b/src/mame/drivers/sidepckt.cpp
index beb7d7d5e12..ae05ffd5cb7 100644
--- a/src/mame/drivers/sidepckt.cpp
+++ b/src/mame/drivers/sidepckt.cpp
@@ -385,12 +385,11 @@ MACHINE_CONFIG_START(sidepckt_state::sidepckt)
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(sidepckt_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sidepckt)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(sidepckt_state, sidepckt)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sidepckt)
+ PALETTE(config, m_palette, FUNC(sidepckt_state::sidepckt_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sigmab98.cpp b/src/mame/drivers/sigmab98.cpp
index c0239ce68f9..f752e4e9c1b 100644
--- a/src/mame/drivers/sigmab98.cpp
+++ b/src/mame/drivers/sigmab98.cpp
@@ -2861,14 +2861,13 @@ MACHINE_CONFIG_START(sigmab98_state::sigmab98)
MCFG_SCREEN_SIZE(0x140, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0,0x140-1, 0,0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(sigmab98_state, screen_update_sigmab98)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sigmab98)
- MCFG_PALETTE_ADD("palette", 0x1000 + 1)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sigmab98);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000 + 1);
+ m_palette->set_endianness(ENDIANNESS_BIG);
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8)
+ BUFFERED_SPRITERAM8(config, m_buffered_spriteram);
// sound hardware
SPEAKER(config, "lspeaker").front_left();
@@ -2955,14 +2954,13 @@ MACHINE_CONFIG_START(lufykzku_state::lufykzku)
MCFG_SCREEN_SIZE(0x140, 0x100)
MCFG_SCREEN_VISIBLE_AREA(0,0x140-1, 0,0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(sigmab98_state, screen_update_sigmab98)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_lufykzku)
- MCFG_PALETTE_ADD("palette", 0x1000 + 1)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_lufykzku);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000 + 1);
+ m_palette->set_endianness(ENDIANNESS_BIG);
-// MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) // same as sammymdl?
+ //BUFFERED_SPRITERAM8(config, m_buffered_spriteram); // same as sammymdl?
// sound hardware
SPEAKER(config, "lspeaker").front_left();
@@ -3019,14 +3017,13 @@ MACHINE_CONFIG_START(sigmab98_state::sammymdl)
MCFG_SCREEN_VISIBLE_AREA(0, 0x140-1, 0, 0xf0-1)
MCFG_SCREEN_UPDATE_DRIVER(sigmab98_state, screen_update_sigmab98)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sigmab98_state, screen_vblank_sammymdl))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sigmab98)
- MCFG_PALETTE_ADD("palette", 0x1000 + 1)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sigmab98);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x1000 + 1);
+ m_palette->set_endianness(ENDIANNESS_BIG);
-// MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM8) // not on sammymdl?
+ //BUFFERED_SPRITERAM8(config, m_buffered_spriteram); // not on sammymdl?
// sound hardware
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/silkroad.cpp b/src/mame/drivers/silkroad.cpp
index 2fd5f31fb9f..7b5979491d5 100644
--- a/src/mame/drivers/silkroad.cpp
+++ b/src/mame/drivers/silkroad.cpp
@@ -294,12 +294,10 @@ MACHINE_CONFIG_START(silkroad_state::silkroad)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(6*8+2, 64*8-1-(10*8)-2, 2*8, 32*8-1-(2*8))
MCFG_SCREEN_UPDATE_DRIVER(silkroad_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_silkroad)
- MCFG_PALETTE_ADD("palette", 0x2000)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(16)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_silkroad);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x2000).set_membits(16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/silvmil.cpp b/src/mame/drivers/silvmil.cpp
index 0cef70c6401..ed75b00ef21 100644
--- a/src/mame/drivers/silvmil.cpp
+++ b/src/mame/drivers/silvmil.cpp
@@ -39,14 +39,15 @@ class silvmil_state : public driver_device
{
public:
silvmil_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
- m_sprgen(*this, "spritegen"),
- m_soundlatch(*this, "soundlatch"),
- m_bg_videoram(*this, "bg_videoram"),
- m_fg_videoram(*this, "fg_videoram"),
- m_spriteram(*this, "spriteram") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_sprgen(*this, "spritegen")
+ , m_soundlatch(*this, "soundlatch")
+ , m_bg_videoram(*this, "bg_videoram")
+ , m_fg_videoram(*this, "fg_videoram")
+ , m_spriteram(*this, "spriteram")
+ { }
void puzzlovek(machine_config &config);
void puzzlove(machine_config &config);
@@ -426,8 +427,7 @@ MACHINE_CONFIG_START(silvmil_state::silvmil)
MCFG_SCREEN_UPDATE_DRIVER(silvmil_state, screen_update_silvmil)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x300)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x300);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_silvmil)
DECO_SPRITE(config, m_sprgen, 0);
diff --git a/src/mame/drivers/simpl156.cpp b/src/mame/drivers/simpl156.cpp
index 101687cc24a..ab25c3fcab1 100644
--- a/src/mame/drivers/simpl156.cpp
+++ b/src/mame/drivers/simpl156.cpp
@@ -417,13 +417,13 @@ MACHINE_CONFIG_START(simpl156_state::chainrec)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(simpl156_state, screen_update_simpl156)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_MEMBITS(16)
+ PALETTE(config, m_palette);
+ m_palette->set_format(palette_device::xBGR_555, 4096);
+ m_palette->set_membits(16);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_simpl156)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_simpl156)
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
diff --git a/src/mame/drivers/simpsons.cpp b/src/mame/drivers/simpsons.cpp
index 14f8c2656b8..2ae19559e14 100644
--- a/src/mame/drivers/simpsons.cpp
+++ b/src/mame/drivers/simpsons.cpp
@@ -348,10 +348,7 @@ void simpsons_state::simpsons(machine_config &config)
screen.set_screen_update(FUNC(simpsons_state::screen_update_simpsons));
screen.set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 2048));
- palette.enable_shadows();
- palette.enable_hilights();
- palette.set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows().enable_hilights();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp
index bd0bf72b522..5beefdc72d3 100644
--- a/src/mame/drivers/skimaxx.cpp
+++ b/src/mame/drivers/skimaxx.cpp
@@ -534,7 +534,7 @@ MACHINE_CONFIG_START(skimaxx_state::skimaxx)
// MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skimaxx)
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/skullxbo.cpp b/src/mame/drivers/skullxbo.cpp
index 0eb17d5dedb..9a7ffb11a17 100644
--- a/src/mame/drivers/skullxbo.cpp
+++ b/src/mame/drivers/skullxbo.cpp
@@ -240,8 +240,7 @@ MACHINE_CONFIG_START(skullxbo_state::skullxbo)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skullxbo)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, skullxbo_state, get_playfield_tile_info, 16,8, SCAN_COLS, 64,64)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, skullxbo_state, get_alpha_tile_info, 16,8, SCAN_ROWS, 64,32, 0)
diff --git a/src/mame/drivers/skyarmy.cpp b/src/mame/drivers/skyarmy.cpp
index 3f86596e7b8..c16ee02e5f4 100644
--- a/src/mame/drivers/skyarmy.cpp
+++ b/src/mame/drivers/skyarmy.cpp
@@ -36,18 +36,23 @@
class skyarmy_state : public driver_device
{
public:
- skyarmy_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ skyarmy_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
- m_scrollram(*this, "scrollram") { }
+ m_scrollram(*this, "scrollram")
+ { }
void skyarmy(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
@@ -70,9 +75,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_start() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(skyarmy);
+ void skyarmy_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -99,7 +102,7 @@ WRITE_LINE_MEMBER(skyarmy_state::flip_screen_y_w)
TILE_GET_INFO_MEMBER(skyarmy_state::get_tile_info)
{
int code = m_videoram[tile_index];
- int attr = bitswap<8>(m_colorram[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
+ int attr = bitswap<3>(m_colorram[tile_index], 0, 1, 2);
SET_TILE_INFO_MEMBER(0, code, attr, 0);
}
@@ -116,32 +119,29 @@ WRITE8_MEMBER(skyarmy_state::colorram_w)
m_tilemap->mark_tile_dirty(offset);
}
-PALETTE_INIT_MEMBER(skyarmy_state, skyarmy)
+void skyarmy_state::skyarmy_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0;i < 32;i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 32; i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0, bit1, bit2;
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0=0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = 0;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -154,22 +154,19 @@ void skyarmy_state::video_start()
uint32_t skyarmy_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int sx, sy, flipx, flipy, offs,pal;
- int i;
-
- for(i=0;i<0x20;i++)
- m_tilemap->set_scrolly(i,m_scrollram[i]);
+ for (int i = 0; i < 0x20; i++)
+ m_tilemap->set_scrolly(i, m_scrollram[i]);
- m_tilemap->draw(screen, bitmap, cliprect, 0,0);
+ m_tilemap->draw(screen, bitmap, cliprect, 0, 0);
- for (offs = 0 ; offs < 0x40; offs+=4)
+ for (int offs = 0; offs < 0x40; offs += 4)
{
- pal = bitswap<8>(m_spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
+ int const pal = bitswap<3>(m_spriteram[offs + 2], 0, 1, 2);
- sx = m_spriteram[offs+3];
- sy = 240-(m_spriteram[offs]+1);
- flipy = (m_spriteram[offs+1]&0x80)>>7;
- flipx = (m_spriteram[offs+1]&0x40)>>6;
+ int sx = m_spriteram[offs + 3];
+ int sy = 240 - (m_spriteram[offs] + 1);
+ int flipy = BIT(m_spriteram[offs + 1], 7);
+ int flipx = BIT(m_spriteram[offs + 1], 6);
if (flip_screen_x())
{
@@ -183,10 +180,10 @@ uint32_t skyarmy_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- m_spriteram[offs+1]&0x3f,
- pal,
- flipx,flipy,
- sx,sy,0);
+ m_spriteram[offs + 1] & 0x3f,
+ pal,
+ flipx, flipy,
+ sx, sy, 0);
}
return 0;
@@ -345,11 +342,10 @@ MACHINE_CONFIG_START(skyarmy_state::skyarmy)
MCFG_SCREEN_SIZE(32*8,32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8,32*8-1,1*8,31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(skyarmy_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skyarmy)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(skyarmy_state, skyarmy)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_skyarmy);
+ PALETTE(config, m_palette, FUNC(skyarmy_state::skyarmy_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/skydiver.cpp b/src/mame/drivers/skydiver.cpp
index d0833cbbc10..3838ca1096a 100644
--- a/src/mame/drivers/skydiver.cpp
+++ b/src/mame/drivers/skydiver.cpp
@@ -107,7 +107,7 @@
*
*************************************/
-static const int colortable_source[] =
+static constexpr unsigned colortable_source[] =
{
0x02, 0x00,
0x02, 0x01,
@@ -115,22 +115,13 @@ static const int colortable_source[] =
0x01, 0x02
};
-PALETTE_INIT_MEMBER(skydiver_state, skydiver)
+void skydiver_state::skydiver_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
+ constexpr rgb_t colors[]{ rgb_t::black(), rgb_t::white(), rgb_t(0xa0, 0xa0, 0xa0) }; // black, white, grey
+ for (unsigned i = 0; i < ARRAY_LENGTH(colortable_source); i++)
{
- rgb_t color;
-
- switch (colortable_source[i])
- {
- case 0: color = rgb_t::black(); break;
- case 1: color = rgb_t::white(); break;
- default: color = rgb_t(0xa0, 0xa0, 0xa0); break; /* grey */
- }
-
- palette.set_pen_color(i, color);
+ assert(colortable_source[i] < ARRAY_LENGTH(colors));
+ palette.set_pen_color(i, colors[colortable_source[i]]);
}
}
@@ -384,18 +375,15 @@ MACHINE_CONFIG_START(skydiver_state::skydiver)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(12.096_MHz_XTAL / 2, 384, 0, 256, 262, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(skydiver_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skydiver)
- MCFG_PALETTE_ADD("palette", ARRAY_LENGTH(colortable_source))
- MCFG_PALETTE_INIT_OWNER(skydiver_state, skydiver)
+ MCFG_SCREEN_PALETTE(m_palette)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_skydiver)
+ PALETTE(config, m_palette, FUNC(skydiver_state::skydiver_palette), ARRAY_LENGTH(colortable_source));
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("discrete", DISCRETE, skydiver_discrete)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ DISCRETE(config, m_discrete, skydiver_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/skyfox.cpp b/src/mame/drivers/skyfox.cpp
index 02812022799..d54509276fb 100644
--- a/src/mame/drivers/skyfox.cpp
+++ b/src/mame/drivers/skyfox.cpp
@@ -37,16 +37,16 @@ WRITE8_MEMBER(skyfox_state::skyfox_vregs_w)
{
switch (offset)
{
- case 0:
- m_bg_ctrl = data;
- break;
+ case 0:
+ m_bg_ctrl = data;
+ break;
- case 1:
- m_soundlatch->write(space, 0, data);
- break;
+ case 1:
+ m_soundlatch->write(space, 0, data);
+ break;
- default:
- break;
+ default:
+ break;
}
}
@@ -239,11 +239,10 @@ MACHINE_CONFIG_START(skyfox_state::skyfox)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0+0x60, 320-1+0x60, 0+16, 256-1-16) // from $30*2 to $CC*2+8
MCFG_SCREEN_UPDATE_DRIVER(skyfox_state, screen_update_skyfox)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skyfox)
- MCFG_PALETTE_ADD("palette", 256+256) /* 256 static colors (+256 for the background??) */
- MCFG_PALETTE_INIT_OWNER(skyfox_state, skyfox)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_skyfox);
+ PALETTE(config, m_palette, FUNC(skyfox_state::skyfox_palette), 256+256); // 256 static colors (+256 for the background??)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/skykid.cpp b/src/mame/drivers/skykid.cpp
index 8bac913537d..85f79d17059 100644
--- a/src/mame/drivers/skykid.cpp
+++ b/src/mame/drivers/skykid.cpp
@@ -449,9 +449,7 @@ void skykid_state::skykid(machine_config &config)
screen.screen_vblank().set(FUNC(skykid_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_skykid);
- PALETTE(config, m_palette, 64*4+128*4+64*8);
- m_palette->set_indirect_entries(256);
- m_palette->set_init(FUNC(skykid_state::palette_init_skykid));
+ PALETTE(config, m_palette, FUNC(skykid_state::skykid_palette), 64*4 + 128*4 + 64*8, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/skyraid.cpp b/src/mame/drivers/skyraid.cpp
index 4d9fccefcaf..8d5940354dc 100644
--- a/src/mame/drivers/skyraid.cpp
+++ b/src/mame/drivers/skyraid.cpp
@@ -19,28 +19,28 @@ void skyraid_state::machine_start()
m_led.resolve();
}
-PALETTE_INIT_MEMBER(skyraid_state, skyraid)
+void skyraid_state::skyraid_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* terrain */
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // terrain
palette.set_pen_color(1, rgb_t(0x18, 0x18, 0x18));
palette.set_pen_color(2, rgb_t(0x30, 0x30, 0x30));
palette.set_pen_color(3, rgb_t(0x48, 0x48, 0x48));
palette.set_pen_color(4, rgb_t(0x60, 0x60, 0x60));
palette.set_pen_color(5, rgb_t(0x78, 0x78, 0x78));
palette.set_pen_color(6, rgb_t(0x90, 0x90, 0x90));
- palette.set_pen_color(7, rgb_t(0xA8, 0xA8, 0xA8));
- palette.set_pen_color(8, rgb_t(0x10, 0x10, 0x10)); /* sprites */
- palette.set_pen_color(9, rgb_t(0xE0, 0xE0, 0xE0));
- palette.set_pen_color(10, rgb_t(0xA0, 0xA0, 0xA0));
+ palette.set_pen_color(7, rgb_t(0xa8, 0xa8, 0xa8));
+ palette.set_pen_color(8, rgb_t(0x10, 0x10, 0x10)); // sprites
+ palette.set_pen_color(9, rgb_t(0xe0, 0xe0, 0xe0));
+ palette.set_pen_color(10, rgb_t(0xa0, 0xa0, 0xa0));
palette.set_pen_color(11, rgb_t(0x48, 0x48, 0x48));
palette.set_pen_color(12, rgb_t(0x10, 0x10, 0x10));
palette.set_pen_color(13, rgb_t(0x48, 0x48, 0x48));
- palette.set_pen_color(14, rgb_t(0xA0, 0xA0, 0xA0));
- palette.set_pen_color(15, rgb_t(0xE0, 0xE0, 0xE0));
- palette.set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); /* missiles */
- palette.set_pen_color(17, rgb_t(0xFF, 0xFF, 0xFF));
- palette.set_pen_color(18, rgb_t(0x00, 0x00, 0x00)); /* text */
- palette.set_pen_color(19, rgb_t(0xE0, 0xE0, 0xE0));
+ palette.set_pen_color(14, rgb_t(0xa0, 0xa0, 0xa0));
+ palette.set_pen_color(15, rgb_t(0xe0, 0xe0, 0xe0));
+ palette.set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); // missiles
+ palette.set_pen_color(17, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(18, rgb_t(0x00, 0x00, 0x00)); // text
+ palette.set_pen_color(19, rgb_t(0xe0, 0xe0, 0xe0));
}
READ8_MEMBER(skyraid_state::skyraid_port_0_r)
@@ -238,18 +238,16 @@ MACHINE_CONFIG_START(skyraid_state::skyraid)
MCFG_SCREEN_SIZE(512, 240)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 239)
MCFG_SCREEN_UPDATE_DRIVER(skyraid_state, screen_update_skyraid)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_skyraid)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_skyraid)
- MCFG_PALETTE_ADD("palette", 20)
- MCFG_PALETTE_INIT_OWNER(skyraid_state, skyraid)
+ PALETTE(config, m_palette, FUNC(skyraid_state::skyraid_palette), 20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("discrete", DISCRETE, skyraid_discrete)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ DISCRETE(config, m_discrete, skyraid_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/slapfght.cpp b/src/mame/drivers/slapfght.cpp
index aab7578d42f..2aae8d40ba2 100644
--- a/src/mame/drivers/slapfght.cpp
+++ b/src/mame/drivers/slapfght.cpp
@@ -922,7 +922,7 @@ MACHINE_CONFIG_START(slapfght_state::perfrman)
m_screen->set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_perfrman)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(slapfght_state, perfrman)
/* sound hardware */
@@ -974,7 +974,7 @@ MACHINE_CONFIG_START(slapfght_state::tigerh)
m_screen->set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapfght)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(slapfght_state, slapfight)
/* sound hardware */
@@ -1047,7 +1047,7 @@ MACHINE_CONFIG_START(slapfght_state::slapfigh)
m_screen->set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapfght)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(slapfght_state, slapfight)
/* sound hardware */
diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp
index 2b78bd64e31..f374fecff89 100644
--- a/src/mame/drivers/slapshot.cpp
+++ b/src/mame/drivers/slapshot.cpp
@@ -468,11 +468,10 @@ MACHINE_CONFIG_START(slapshot_state::slapshot)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(slapshot_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, slapshot_state, screen_vblank_taito_no_buffer))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapshot)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_slapshot);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 8192);
TC0480SCP(config, m_tc0480scp, 0);
m_tc0480scp->set_gfx_region(1);
@@ -537,11 +536,10 @@ MACHINE_CONFIG_START(slapshot_state::opwolf3)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(slapshot_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, slapshot_state, screen_vblank_taito_no_buffer))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_slapshot)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_slapshot);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 8192);
TC0480SCP(config, m_tc0480scp, 0);
m_tc0480scp->set_gfx_region(1);
diff --git a/src/mame/drivers/sm1800.cpp b/src/mame/drivers/sm1800.cpp
index 6d8cc7187d6..28c674285d3 100644
--- a/src/mame/drivers/sm1800.cpp
+++ b/src/mame/drivers/sm1800.cpp
@@ -50,7 +50,7 @@ private:
DECLARE_READ8_MEMBER(sm1800_8255_portc_r);
uint8_t m_irq_state;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(sm1800);
+ void sm1800_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(sm1800_vblank_interrupt);
IRQ_CALLBACK_MEMBER(sm1800_irq_callback);
I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels );
@@ -133,7 +133,7 @@ READ8_MEMBER( sm1800_state::sm1800_8255_portc_r )
return 0;
}
-PALETTE_INIT_MEMBER(sm1800_state, sm1800)
+void sm1800_state::sm1800_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black()); // black
palette.set_pen_color(1, 0xa0, 0xa0, 0xa0); // white
@@ -175,10 +175,9 @@ MACHINE_CONFIG_START(sm1800_state::sm1800)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(sm1800_state, sm1800)
+ PALETTE(config, m_palette, FUNC(sm1800_state::sm1800_palette), 3);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sm1800)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sm1800)
/* Devices */
I8255(config, m_ppi);
diff --git a/src/mame/drivers/sm7238.cpp b/src/mame/drivers/sm7238.cpp
index c103a7a16a0..ab77077b35f 100644
--- a/src/mame/drivers/sm7238.cpp
+++ b/src/mame/drivers/sm7238.cpp
@@ -82,7 +82,7 @@ public:
void sm7238(machine_config &config);
private:
- DECLARE_PALETTE_INIT(sm7238);
+ void sm7238_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(write_keyboard_clock);
DECLARE_WRITE_LINE_MEMBER(write_printer_clock);
@@ -353,7 +353,7 @@ static GFXDECODE_START( gfx_sm7238 )
GFXDECODE_ENTRY("chargen", 0x0000, sm7238_charlayout, 0, 1)
GFXDECODE_END
-PALETTE_INIT_MEMBER(sm7238_state, sm7238)
+void sm7238_state::sm7238_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green
@@ -376,8 +376,7 @@ MACHINE_CONFIG_START(sm7238_state::sm7238)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(m_pic8259, pic8259_device, ir2_w))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(sm7238_state, sm7238)
+ PALETTE(config, "palette", FUNC(sm7238_state::sm7238_palette), 3);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sm7238)
PIC8259(config, m_pic8259, 0);
diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp
index 3bc8655453c..f1849557425 100644
--- a/src/mame/drivers/smc777.cpp
+++ b/src/mame/drivers/smc777.cpp
@@ -71,6 +71,11 @@ public:
void smc777(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(mc6845_w);
DECLARE_READ8_MEMBER(vram_r);
@@ -94,7 +99,7 @@ private:
DECLARE_WRITE8_MEMBER(smc777_mem_w);
DECLARE_READ8_MEMBER(irq_mask_r);
DECLARE_WRITE8_MEMBER(irq_mask_w);
- DECLARE_PALETTE_INIT(smc777);
+ void smc777_palette(palette_device &palette) const;
uint32_t screen_update_smc777(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
TIMER_DEVICE_CALLBACK_MEMBER(keyboard_callback);
@@ -111,10 +116,6 @@ private:
void smc777_io(address_map &map);
void smc777_mem(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
-
required_device<cpu_device> m_maincpu;
required_device<screen_device> m_screen;
required_device<mc6845_device> m_crtc;
@@ -993,20 +994,16 @@ void smc777_state::machine_reset()
/* set-up SMC-70 mode colors */
-PALETTE_INIT_MEMBER(smc777_state, smc777)
+void smc777_state::smc777_palette(palette_device &palette) const
{
- int i;
-
- for(i=0x10;i<0x18;i++)
+ for(int i = 0x10; i < 0x18; i++)
{
- uint8_t r,g,b;
-
- r = (i & 4) >> 2;
- g = (i & 2) >> 1;
- b = (i & 1) >> 0;
+ uint8_t const r = BIT(i, 2);
+ uint8_t const g = BIT(i, 1);
+ uint8_t const b = BIT(i, 0);
- palette.set_pen_color(i, pal1bit(r),pal1bit(g),pal1bit(b));
- palette.set_pen_color(i+8, pal1bit(0),pal1bit(0),pal1bit(0));
+ palette.set_pen_color(i, pal1bit(r), pal1bit(g), pal1bit(b));
+ palette.set_pen_color(i+8, rgb_t::black());
}
}
@@ -1038,12 +1035,11 @@ MACHINE_CONFIG_START(smc777_state::smc777)
MCFG_SCREEN_SIZE(0x400, 400)
MCFG_SCREEN_VISIBLE_AREA(0, 660-1, 0, 220-1) //normal 640 x 200 + 20 pixels for border color
MCFG_SCREEN_UPDATE_DRIVER(smc777_state, screen_update_smc777)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x20) // 16 + 8 colors (SMC-777 + SMC-70) + 8 empty entries (SMC-70)
- MCFG_PALETTE_INIT_OWNER(smc777_state, smc777)
+ PALETTE(config, m_palette, FUNC(smc777_state::smc777_palette), 0x20); // 16 + 8 colors (SMC-777 + SMC-70) + 8 empty entries (SMC-70)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfxdecode_device::empty)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
H46505(config, m_crtc, MASTER_CLOCK/2); /* unknown clock, hand tuned to get ~60 fps */
m_crtc->set_screen(m_screen);
@@ -1068,8 +1064,8 @@ MACHINE_CONFIG_START(smc777_state::smc777)
MCFG_DEVICE_ADD("sn1", SN76489A, MASTER_CLOCK) // unknown clock / divider
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
- MCFG_DEVICE_ADD("beeper", BEEP, 300) // TODO: correct frequency
- MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.50)
+ BEEP(config, m_beeper, 300); // TODO: correct frequency
+ m_beeper->add_route(ALL_OUTPUTS, "mono", 0.50);
MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard_timer", smc777_state, keyboard_callback, attotime::from_hz(240/32))
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/smsmcorp.cpp b/src/mame/drivers/smsmcorp.cpp
index 53575df0789..3ee0d75c1ba 100644
--- a/src/mame/drivers/smsmcorp.cpp
+++ b/src/mame/drivers/smsmcorp.cpp
@@ -581,7 +581,7 @@ MACHINE_CONFIG_START(smsmfg_state::sms)
MCFG_SCREEN_UPDATE_DRIVER(smsmfg_state, screen_update_sms)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, "palette", palette_device::BGR_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/snk.cpp b/src/mame/drivers/snk.cpp
index c1646f14099..20d356abcb0 100644
--- a/src/mame/drivers/snk.cpp
+++ b/src/mame/drivers/snk.cpp
@@ -3639,9 +3639,8 @@ void snk_state::marvins(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_marvins);
- PALETTE(config, m_palette, 0x400);
+ PALETTE(config, m_palette, FUNC(snk_state::tnk3_palette), 0x400);
m_palette->enable_shadows();
- m_palette->set_init(FUNC(snk_state::palette_init_tnk3));
MCFG_VIDEO_START_OVERRIDE(snk_state,marvins)
@@ -3702,9 +3701,8 @@ void snk_state::jcross(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tnk3);
- PALETTE(config, m_palette, 0x400);
+ PALETTE(config, m_palette, FUNC(snk_state::tnk3_palette), 0x400);
m_palette->enable_shadows();
- m_palette->set_init(FUNC(snk_state::palette_init_tnk3));
MCFG_VIDEO_START_OVERRIDE(snk_state,jcross)
@@ -3774,9 +3772,8 @@ void snk_state::tnk3(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tnk3);
- PALETTE(config, m_palette, 0x400);
+ PALETTE(config, m_palette, FUNC(snk_state::tnk3_palette), 0x400);
m_palette->enable_shadows();
- m_palette->set_init(FUNC(snk_state::palette_init_tnk3));
MCFG_VIDEO_START_OVERRIDE(snk_state,tnk3)
@@ -3867,9 +3864,7 @@ void snk_state::ikari(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ikari);
- PALETTE(config, m_palette, 0x400);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x400);
m_palette->enable_shadows();
MCFG_VIDEO_START_OVERRIDE(snk_state,ikari)
@@ -3927,9 +3922,7 @@ void snk_state::bermudat(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_gwar);
- PALETTE(config, m_palette, 0x400);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x400);
MCFG_VIDEO_START_OVERRIDE(snk_state,gwar)
@@ -4011,10 +4004,7 @@ void snk_state::tdfever(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tdfever);
- PALETTE(config, m_palette, 0x400);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
- m_palette->enable_shadows();
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 0x400).enable_shadows();
MCFG_VIDEO_START_OVERRIDE(snk_state,tdfever)
diff --git a/src/mame/drivers/snk6502.cpp b/src/mame/drivers/snk6502.cpp
index c95724ff39f..cb6d6b296d2 100644
--- a/src/mame/drivers/snk6502.cpp
+++ b/src/mame/drivers/snk6502.cpp
@@ -819,12 +819,10 @@ MACHINE_CONFIG_START(snk6502_state::sasuke)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(snk6502_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sasuke)
- MCFG_PALETTE_ADD("palette", 32)
-
- MCFG_PALETTE_INIT_OWNER(snk6502_state,satansat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sasuke);
+ PALETTE(config, m_palette, FUNC(snk6502_state::satansat_palette), 32);
MCFG_VIDEO_START_OVERRIDE(snk6502_state,satansat)
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK / 16));
@@ -840,6 +838,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(snk6502_state::satansat)
sasuke(config);
+
// basic machine hardware
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(satansat_map)
@@ -866,12 +865,10 @@ MACHINE_CONFIG_START(snk6502_state::vanguard)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(snk6502_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vanguard)
- MCFG_PALETTE_ADD("palette", 64)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_INIT_OWNER(snk6502_state,snk6502)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_vanguard);
+ PALETTE(config, m_palette, FUNC(snk6502_state::snk6502_palette), 64);
MCFG_VIDEO_START_OVERRIDE(snk6502_state,snk6502)
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK / 16));
diff --git a/src/mame/drivers/snookr10.cpp b/src/mame/drivers/snookr10.cpp
index 76bc0052afe..dcd1516d651 100644
--- a/src/mame/drivers/snookr10.cpp
+++ b/src/mame/drivers/snookr10.cpp
@@ -1060,8 +1060,7 @@ MACHINE_CONFIG_START(snookr10_state::snookr10)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_snookr10)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(snookr10_state, snookr10)
+ PALETTE(config, "palette", FUNC(snookr10_state::snookr10_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1077,8 +1076,7 @@ MACHINE_CONFIG_START(snookr10_state::apple10)
MCFG_DEVICE_MODIFY("maincpu")
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(snookr10_state, apple10)
+ subdevice<palette_device>("palette")->set_init(FUNC(snookr10_state::apple10_palette));
MCFG_VIDEO_START_OVERRIDE(snookr10_state, apple10)
MACHINE_CONFIG_END
@@ -1099,8 +1097,7 @@ MACHINE_CONFIG_START(snookr10_state::crystalc)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(crystalc_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(snookr10_state, crystalc)
+ subdevice<palette_device>("palette")->set_init(FUNC(snookr10_state::crystalc_palette));
MCFG_VIDEO_START_OVERRIDE(snookr10_state, crystalc)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp
index 8fe6757691a..fb950b66082 100644
--- a/src/mame/drivers/snowbros.cpp
+++ b/src/mame/drivers/snowbros.cpp
@@ -1770,7 +1770,7 @@ void snowbros_state::snowbros(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_snowbros);
- PALETTE(config, m_palette, 256).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 256);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_gfxdecode_tag(m_gfxdecode);
@@ -1873,7 +1873,7 @@ void snowbros_state::honeydol(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_honeydol);
- PALETTE(config, m_palette, 0x800/2).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800/2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1912,7 +1912,7 @@ void snowbros_state::twinadv(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_twinadv);
- PALETTE(config, m_palette, 0x100).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1992,7 +1992,7 @@ void snowbros_state::snowbro3(machine_config &config) /* PCB has 16MHz & 12MHz O
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sb3);
- PALETTE(config, m_palette, 512).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -2021,7 +2021,7 @@ void snowbros_state::yutnori(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hyperpac);
- PALETTE(config, m_palette, 256).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 256);
KANEKO_PANDORA(config, m_pandora, 0);
m_pandora->set_gfxdecode_tag(m_gfxdecode);
diff --git a/src/mame/drivers/socrates.cpp b/src/mame/drivers/socrates.cpp
index 9d8be77ed30..dcbc94adf65 100644
--- a/src/mame/drivers/socrates.cpp
+++ b/src/mame/drivers/socrates.cpp
@@ -97,8 +97,8 @@ TODO:
class socrates_state : public driver_device
{
public:
- socrates_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ socrates_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_sound(*this, "soc_snd"),
m_screen(*this, "screen"),
@@ -110,7 +110,7 @@ public:
m_rambank1(*this, "rambank1"),
m_rambank2(*this, "rambank2"),
m_kbdrow(*this, "IN%u", 0)
- { }
+ { }
void socrates_pal(machine_config &config);
void socrates(machine_config &config);
@@ -118,8 +118,6 @@ public:
void init_socrates();
void init_iqunlimz();
- DECLARE_PALETTE_INIT(socrates);
-
protected:
enum
{
@@ -141,8 +139,6 @@ protected:
required_device<address_map_bank_device> m_rambank2;
optional_ioport_array<0xC> m_kbdrow;
- rgb_t m_palette_val[256];
-
uint8_t m_rom_bank[2];
uint8_t m_ram_bank;
uint16_t m_scroll_offset;
@@ -158,6 +154,21 @@ protected:
uint8_t m_speech_dummy_read; // have we done a dummy read yet?
uint8_t m_speech_load_address_count; // number of times load address has happened
uint8_t m_speech_load_settings_count; // number of times load settings has happened
+
+ emu_timer *m_kbmcu_sim_timer;
+ emu_timer *m_clear_speech_timer;
+ emu_timer *m_clear_irq_timer;
+
+ struct
+ {
+ uint16_t buffer[8];
+ uint8_t head;
+ uint8_t tail;
+ uint8_t count;
+ } m_kb_queue;
+
+ void socrates_palette(palette_device &palete) const;
+
DECLARE_READ8_MEMBER(common_rom_bank_r);
DECLARE_WRITE8_MEMBER(common_rom_bank_w);
DECLARE_READ8_MEMBER(common_ram_bank_r);
@@ -189,18 +200,7 @@ protected:
TIMER_CALLBACK_MEMBER(clear_irq_cb);
void socrates_update_kb();
void socrates_check_kb_latch();
- rgb_t socrates_create_color(uint8_t color);
- emu_timer *m_kbmcu_sim_timer;
- emu_timer *m_clear_speech_timer;
- emu_timer *m_clear_irq_timer;
-
- struct
- {
- uint16_t buffer[8];
- uint8_t head;
- uint8_t tail;
- uint8_t count;
- } m_kb_queue;
+ static rgb_t socrates_create_color(uint8_t color);
void socrates_rambank_map(address_map &map);
void socrates_rombank_map(address_map &map);
@@ -214,14 +214,17 @@ protected:
class iqunlimz_state : public socrates_state
{
public:
- iqunlimz_state(const machine_config &mconfig, device_type type, const char *tag)
- : socrates_state(mconfig, type, tag)
- { }
+ iqunlimz_state(const machine_config &mconfig, device_type type, const char *tag) :
+ socrates_state(mconfig, type, tag)
+ { }
void iqunlimz(machine_config &config);
DECLARE_INPUT_CHANGED_MEMBER( send_input );
+protected:
+ virtual void machine_reset() override;
+
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER( colors_w );
@@ -234,7 +237,6 @@ private:
void iqunlimz_rambank_map(address_map &map);
void iqunlimz_rombank_map(address_map &map);
- virtual void machine_reset() override;
int get_color(int index, int y);
uint8_t m_colors[8];
@@ -697,43 +699,40 @@ WRITE8_MEMBER(socrates_state::socrates_scroll_w)
rgb_t socrates_state::socrates_create_color(uint8_t color)
{
- rgb_t composedcolor;
- static const double lumatable[256] = {
- LUMA_COL_0
- LUMA_COL_COMMON
- LUMA_COL_2
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_5
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_COMMON
- LUMA_COL_F
- };
- static const double chromaintensity[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- CHROMA_COL_COMMON
- CHROMA_COL_2
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_5
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- CHROMA_COL_COMMON
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
- };
+ static constexpr double lumatable[256] = {
+ LUMA_COL_0
+ LUMA_COL_COMMON
+ LUMA_COL_2
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_5
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_COMMON
+ LUMA_COL_F };
+ static constexpr double chromaintensity[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ CHROMA_COL_COMMON
+ CHROMA_COL_2
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_5
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ CHROMA_COL_COMMON
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
/* chroma colors and phases:
0: black-through-grey (0 assumed chroma)
1: purple (90 chroma seems correct)
@@ -752,19 +751,18 @@ rgb_t socrates_state::socrates_create_color(uint8_t color)
E: blue-purple (more blue than color 1, 120 is closest)
F: grey-through-white (0 assumed chroma)
*/
- static const double phaseangle[16] = { 0, 90, 220, 150, 270, 40, 0, 315, 180, 210, 240, 300, 330, 60, 120, 0 }; // note: these are guessed, not measured yet!
- int chromaindex = color&0x0F;
- int swappedcolor = ((color&0xf0)>>4)|((color&0x0f)<<4);
- double finalY, finalI, finalQ, finalR, finalG, finalB;
- finalY = (1/LUMAMAX) * lumatable[swappedcolor];
- finalI = (M_I * (cos((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]);
- finalQ = (M_Q * (sin((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]);
+ static constexpr double phaseangle[16] = { 0, 90, 220, 150, 270, 40, 0, 315, 180, 210, 240, 300, 330, 60, 120, 0 }; // note: these are guessed, not measured yet!
+ int const chromaindex = color&0x0F;
+ int const swappedcolor = ((color&0xf0)>>4)|((color&0x0f)<<4);
+ double finalY = (1/LUMAMAX) * lumatable[swappedcolor];
+ double const finalI = (M_I * (cos((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]);
+ double const finalQ = (M_Q * (sin((phaseangle[chromaindex]/180)*3.141592653589793)))* ((1/CHROMAMAX)*chromaintensity[swappedcolor]);
if (finalY > 1) finalY = 1; // clamp luma
- /* calculate the R, G and B values here, neato matrix math */
- finalR = (finalY*1)+(finalI*0.9563)+(finalQ*0.6210);
- finalG = (finalY*1)+(finalI*-0.2721)+(finalQ*-0.6474);
- finalB = (finalY*1)+(finalI*-1.1070)+(finalQ*1.7046);
- /* scale/clamp to 0-255 range */
+ // calculate the R, G and B values here, neato matrix math
+ double finalR = (finalY*1)+(finalI*0.9563)+(finalQ*0.6210);
+ double finalG = (finalY*1)+(finalI*-0.2721)+(finalQ*-0.6474);
+ double finalB = (finalY*1)+(finalI*-1.1070)+(finalQ*1.7046);
+ // scale/clamp to 0-255 range
if (finalR<0) finalR = 0;
if (finalR>1) finalR = 1;
if (finalG<0) finalG = 0;
@@ -775,19 +773,14 @@ rgb_t socrates_state::socrates_create_color(uint8_t color)
finalR = pow(finalR, 1/GAMMA)*255;
finalG = pow(finalG, 1/GAMMA)*255;
finalB = pow(finalB, 1/GAMMA)*255;
-composedcolor = rgb_t((int)finalR,(int)finalG,(int)finalB);
-return composedcolor;
+ return rgb_t((int)finalR,(int)finalG,(int)finalB);
}
-PALETTE_INIT_MEMBER(socrates_state, socrates)
+void socrates_state::socrates_palette(palette_device &palette) const
{
- int i; // iterator
- for (i = 0; i < 256; i++)
- {
- m_palette_val[i] = socrates_create_color(i);
- }
- palette.set_pen_colors(0, m_palette_val, ARRAY_LENGTH(m_palette_val));
+ for (int i = 0; i < 256; i++)
+ palette.set_pen_color(i, socrates_create_color(i));
}
void socrates_state::video_start()
@@ -1493,8 +1486,7 @@ MACHINE_CONFIG_START(socrates_state::socrates)
MCFG_SCREEN_UPDATE_DRIVER(socrates_state, screen_update_socrates)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(socrates_state, socrates)
+ PALETTE(config, "palette", FUNC(socrates_state::socrates_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1509,6 +1501,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(socrates_state::socrates_pal)
socrates(config);
+
MCFG_DEVICE_REPLACE("maincpu", Z80, XTAL(26'601'712)/8)
MCFG_DEVICE_PROGRAM_MAP(z80_mem)
MCFG_DEVICE_IO_MAP(z80_io)
@@ -1547,8 +1540,7 @@ MACHINE_CONFIG_START(iqunlimz_state::iqunlimz)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 224-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(socrates_state, socrates)
+ PALETTE(config, "palette", FUNC(iqunlimz_state::socrates_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/solomon.cpp b/src/mame/drivers/solomon.cpp
index 742d4bfaa35..1a2b20f3eec 100644
--- a/src/mame/drivers/solomon.cpp
+++ b/src/mame/drivers/solomon.cpp
@@ -229,11 +229,10 @@ MACHINE_CONFIG_START(solomon_state::solomon)
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(solomon_state, screen_update_solomon)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_solomon)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_solomon);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -241,9 +240,7 @@ MACHINE_CONFIG_START(solomon_state::solomon)
GENERIC_LATCH_8(config, m_soundlatch);
AY8910(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12);
-
AY8910(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12);
-
AY8910(config, "ay3", 1500000).add_route(ALL_OUTPUTS, "mono", 0.12);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/sonson.cpp b/src/mame/drivers/sonson.cpp
index 6cad8d16ba4..b7127053fdc 100644
--- a/src/mame/drivers/sonson.cpp
+++ b/src/mame/drivers/sonson.cpp
@@ -248,13 +248,11 @@ MACHINE_CONFIG_START(sonson_state::sonson)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(sonson_state, screen_update_sonson)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sonson)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sonson)
- MCFG_PALETTE_ADD("palette", 64*4+32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(sonson_state, sonson)
+ PALETTE(config, m_palette, FUNC(sonson_state::sonson_palette), 64*4 + 32*8, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sorcerer.cpp b/src/mame/drivers/sorcerer.cpp
index 0d611f2e7e9..f76ddad5d35 100644
--- a/src/mame/drivers/sorcerer.cpp
+++ b/src/mame/drivers/sorcerer.cpp
@@ -422,7 +422,7 @@ MACHINE_CONFIG_START(sorcerer_state::sorcerer)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sorcerer)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spaceg.cpp b/src/mame/drivers/spaceg.cpp
index fe1a48426c2..6ae5771ac79 100644
--- a/src/mame/drivers/spaceg.cpp
+++ b/src/mame/drivers/spaceg.cpp
@@ -221,7 +221,7 @@ private:
DECLARE_WRITE8_MEMBER(sound2_w);
DECLARE_WRITE8_MEMBER(sound3_w);
- DECLARE_PALETTE_INIT(spaceg);
+ void spaceg_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void spaceg_map(address_map &map);
@@ -240,31 +240,29 @@ void spaceg_state::driver_start()
*
*************************************/
-PALETTE_INIT_MEMBER(spaceg_state, spaceg)
+void spaceg_state::spaceg_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 128; i++)
- palette.set_pen_color (i, rgb_t(0x00,0x00,0x00));
+ for (int i = 0; i < 128; i++)
+ palette.set_pen_color(i, rgb_t(0x00, 0x00, 0x00));
// proms are currently undumped...
- palette.set_pen_color (0, rgb_t(0x00,0x00,0x00)); //ok czarny
- palette.set_pen_color (1, rgb_t(0x7f,0x00,0x00));//???
- palette.set_pen_color (2, rgb_t(0xff,0xff,0xff)); //ok+ bialy
- palette.set_pen_color (3, rgb_t(0xff,0x00,0x00)); //ok j.czerw.
- palette.set_pen_color (4, rgb_t(0x3f,0x3f,0xff)); //ok j.niebieski
- palette.set_pen_color (5, rgb_t(0x3f,0xff,0x3f)); //ok j.zielony
- palette.set_pen_color (6, rgb_t(0xff,0xbf,0xbf)); //ok+ 'majtki'
- palette.set_pen_color (7, rgb_t(0xff,0xff,0x00)); //ok+ zolty
-
- palette.set_pen_color (8, rgb_t(0xff,0x7f,0x00)); //ok+ pomaranczowy
- palette.set_pen_color (9, rgb_t(0x3f,0xbf,0xff)); //ok j.niebieski (ciemniejszy od 13)
- palette.set_pen_color (10, rgb_t(0x3f,0xbf,0x3f)); //ok+ c.zielony
- palette.set_pen_color (11, rgb_t(0x00,0xff,0x00)); //ok j.zielony
- palette.set_pen_color (12, rgb_t(0x7f,0x00,0x00)); //ok brazowy (c.czerw)
- palette.set_pen_color (13, rgb_t(0x7f,0xbf,0xff)); //ok j.niebieski (jasniejszy od 9)
- palette.set_pen_color (14, rgb_t(0x00,0xff,0xff));//???
- palette.set_pen_color (15, rgb_t(0x7f,0x7f,0x7f));//???
+ palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00)); //ok czarny
+ palette.set_pen_color( 1, rgb_t(0x7f, 0x00, 0x00));//???
+ palette.set_pen_color( 2, rgb_t(0xff, 0xff, 0xff)); //ok+ bialy
+ palette.set_pen_color( 3, rgb_t(0xff, 0x00, 0x00)); //ok j.czerw.
+ palette.set_pen_color( 4, rgb_t(0x3f, 0x3f, 0xff)); //ok j.niebieski
+ palette.set_pen_color( 5, rgb_t(0x3f, 0xff, 0x3f)); //ok j.zielony
+ palette.set_pen_color( 6, rgb_t(0xff, 0xbf, 0xbf)); //ok+ 'majtki'
+ palette.set_pen_color( 7, rgb_t(0xff, 0xff, 0x00)); //ok+ zolty
+
+ palette.set_pen_color( 8, rgb_t(0xff, 0x7f, 0x00)); //ok+ pomaranczowy
+ palette.set_pen_color( 9, rgb_t(0x3f, 0xbf, 0xff)); //ok j.niebieski (ciemniejszy od 13)
+ palette.set_pen_color(10, rgb_t(0x3f, 0xbf, 0x3f)); //ok+ c.zielony
+ palette.set_pen_color(11, rgb_t(0x00, 0xff, 0x00)); //ok j.zielony
+ palette.set_pen_color(12, rgb_t(0x7f, 0x00, 0x00)); //ok brazowy (c.czerw)
+ palette.set_pen_color(13, rgb_t(0x7f, 0xbf, 0xff)); //ok j.niebieski (jasniejszy od 9)
+ palette.set_pen_color(14, rgb_t(0x00, 0xff, 0xff));//???
+ palette.set_pen_color(15, rgb_t(0x7f, 0x7f, 0x7f));//???
}
WRITE8_MEMBER(spaceg_state::zvideoram_w)
@@ -523,7 +521,7 @@ void spaceg_state::spaceg(machine_config &config)
screen.set_palette(m_palette);
screen.screen_vblank().set_inputline("maincpu", INPUT_LINE_NMI); // 60 Hz NMIs (verified)
- PALETTE(config, m_palette, 16+128-16).set_init(FUNC(spaceg_state::palette_init_spaceg));
+ PALETTE(config, m_palette, FUNC(spaceg_state::spaceg_palette), 16+128-16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spartanxtec.cpp b/src/mame/drivers/spartanxtec.cpp
index b6656318b0a..ba840dfc246 100644
--- a/src/mame/drivers/spartanxtec.cpp
+++ b/src/mame/drivers/spartanxtec.cpp
@@ -54,7 +54,7 @@ private:
virtual void video_start() override;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spartanxtec(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(spartanxtec);
+ void spartanxtec_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(kungfum_tileram_w);
TILE_GET_INFO_MEMBER(get_kungfum_bg_tile_info);
@@ -343,19 +343,17 @@ void spartanxtec_state::machine_reset()
{
}
-PALETTE_INIT_MEMBER(spartanxtec_state, spartanxtec)
+void spartanxtec_state::spartanxtec_palette(palette_device &palette) const
{
- // todo, proper weights for this bootleg PCB
- const uint8_t *color_prom = memregion("cprom")->base();
+ // TODO proper weights for this bootleg PCB
+ uint8_t const *const color_prom = memregion("cprom")->base();
for (int i = 0; i < 0x200; i++)
{
- int r, g, b;
+ int const b = pal4bit(color_prom[i + 0x000] & 0x0f);
+ int const g = pal4bit(color_prom[i + 0x200] & 0x0f);
+ int const r = pal4bit(color_prom[i + 0x400] & 0x0f);
- b = (color_prom[i+0x000]&0x0f)<<4;
- g = (color_prom[i+0x200]&0x0f)<<4;
- r = (color_prom[i+0x400]&0x0f)<<4;
-
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -382,12 +380,11 @@ MACHINE_CONFIG_START(spartanxtec_state::spartanxtec)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA((64*8-256)/2, 64*8-(64*8-256)/2-1, 0*8, 32*8-1-16)
MCFG_SCREEN_UPDATE_DRIVER(spartanxtec_state, screen_update_spartanxtec)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(spartanxtec_state,spartanxtec)
+ PALETTE(config, m_palette, FUNC(spartanxtec_state::spartanxtec_palette), 0x200);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_news)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_news)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spbactn.cpp b/src/mame/drivers/spbactn.cpp
index bbfbc8eb8f0..14d38b1a0bb 100644
--- a/src/mame/drivers/spbactn.cpp
+++ b/src/mame/drivers/spbactn.cpp
@@ -431,9 +431,8 @@ MACHINE_CONFIG_START(spbactn_state::spbactn)
MCFG_VIDEO_START_OVERRIDE(spbactn_state,spbactn)
MCFG_SCREEN_UPDATE_DRIVER(spbactn_state, screen_update_spbactn)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spbactn)
- MCFG_PALETTE_ADD("palette", 0x2800/2)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_spbactn);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 0x2800/2);
TECMO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(2);
@@ -486,9 +485,8 @@ MACHINE_CONFIG_START(spbactn_state::spbactnp)
MCFG_VIDEO_START_OVERRIDE(spbactn_state,spbactnp)
MCFG_SCREEN_UPDATE_DRIVER(spbactn_state, screen_update_spbactnp)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spbactnp)
- MCFG_PALETTE_ADD("palette", 0x2800/2)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_spbactnp);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 0x2800/2);
TECMO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(2);
diff --git a/src/mame/drivers/spc1500.cpp b/src/mame/drivers/spc1500.cpp
index 552787c84ad..c7860f951c6 100644
--- a/src/mame/drivers/spc1500.cpp
+++ b/src/mame/drivers/spc1500.cpp
@@ -261,7 +261,7 @@ public:
, m_sound(*this, "ay8910")
, m_palette(*this, "palette")
, m_timer(nullptr)
- {}
+ { }
void spc1500(machine_config &config);
@@ -291,7 +291,7 @@ private:
DECLARE_READ8_MEMBER(portb_r);
DECLARE_WRITE8_MEMBER(double_w);
DECLARE_READ8_MEMBER(io_r);
- DECLARE_PALETTE_INIT(spc);
+ void spc_palette(palette_device &palette) const;
DECLARE_VIDEO_START(spc);
MC6845_UPDATE_ROW(crtc_update_row);
MC6845_RECONFIGURE(crtc_reconfig);
@@ -507,7 +507,7 @@ WRITE8_MEMBER( spc1500_state::palet_w)
}
}
-PALETTE_INIT_MEMBER(spc1500_state,spc)
+void spc1500_state::spc_palette(palette_device &palette) const
{
palette.set_pen_color(0,rgb_t(0x00,0x00,0x00));
palette.set_pen_color(1,rgb_t(0x00,0x00,0xff));
@@ -893,8 +893,9 @@ MACHINE_CONFIG_START(spc1500_state::spc1500)
MCFG_SCREEN_SIZE(640, 400)
MCFG_SCREEN_VISIBLE_AREA(0,640-1,0,400-1)
MCFG_SCREEN_UPDATE_DEVICE("mc6845", mc6845_device, screen_update )
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(spc1500_state, spc)
+
+ PALETTE(config, m_palette, FUNC(spc1500_state::spc_palette), 8);
+
MC6845(config, m_vdg, (VDP_CLOCK/48)); //unknown divider
m_vdg->set_screen("screen");
m_vdg->set_show_border_area(false);
diff --git a/src/mame/drivers/spcforce.cpp b/src/mame/drivers/spcforce.cpp
index c2bd8871b2b..0be994998a5 100644
--- a/src/mame/drivers/spcforce.cpp
+++ b/src/mame/drivers/spcforce.cpp
@@ -249,27 +249,25 @@ static GFXDECODE_START( gfx_spcforce )
GFXDECODE_END
-/* 1-bit RGB palette */
-static const int colortable_source[] =
+// 1-bit RGB palette
+static constexpr int COLORTABLE_SOURCE[] =
{
0, 1, 2, 3, 4, 5, 6, 7,
- 0, 0, 1, 2, 3, 4, 5, 6, /* not sure about these, but they are only used */
- 0, 7, 0, 1, 2, 3, 4, 5, /* to change the text color. During the game, */
- 0, 6, 7, 0, 1, 2, 3, 4, /* only color 0 is used, which is correct. */
+ 0, 0, 1, 2, 3, 4, 5, 6, // not sure about these, but they are only used
+ 0, 7, 0, 1, 2, 3, 4, 5, // to change the text color. During the game,
+ 0, 6, 7, 0, 1, 2, 3, 4, // only color 0 is used, which is correct.
0, 5, 6, 7, 0, 1, 2, 3,
0, 4, 5, 6, 7, 0, 1, 2,
0, 3, 4, 5, 6, 7, 0, 1,
0, 2, 3, 4, 5, 6, 7, 0
};
-PALETTE_INIT_MEMBER(spcforce_state, spcforce)
+void spcforce_state::spcforce_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
+ for (int i = 0; i < ARRAY_LENGTH(COLORTABLE_SOURCE); i++)
{
- int data = colortable_source[i];
- rgb_t color = rgb_t(pal1bit(data >> 0), pal1bit(data >> 1), pal1bit(data >> 2));
+ int const data = COLORTABLE_SOURCE[i];
+ rgb_t const color = rgb_t(pal1bit(data >> 0), pal1bit(data >> 1), pal1bit(data >> 2));
palette.set_pen_color(i, color);
}
@@ -313,8 +311,7 @@ void spcforce_state::spcforce(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_spcforce);
- PALETTE(config, m_palette, ARRAY_LENGTH(colortable_source));
- m_palette->set_init(FUNC(spcforce_state::palette_init_spcforce));
+ PALETTE(config, m_palette, FUNC(spcforce_state::spcforce_palette), ARRAY_LENGTH(COLORTABLE_SOURCE));
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spdodgeb.cpp b/src/mame/drivers/spdodgeb.cpp
index 77e8890962b..37fc3191929 100644
--- a/src/mame/drivers/spdodgeb.cpp
+++ b/src/mame/drivers/spdodgeb.cpp
@@ -419,11 +419,10 @@ MACHINE_CONFIG_START(spdodgeb_state::spdodgeb)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2, 384, 0, 256, 272, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(spdodgeb_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spdodgeb)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INIT_OWNER(spdodgeb_state, spdodgeb)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_spdodgeb);
+ PALETTE(config, m_palette, FUNC(spdodgeb_state::spdodgeb_palette), 1024);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/special.cpp b/src/mame/drivers/special.cpp
index 677f90c8703..60378882403 100644
--- a/src/mame/drivers/special.cpp
+++ b/src/mame/drivers/special.cpp
@@ -376,11 +376,10 @@ MACHINE_CONFIG_START(special_state::special)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(384, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1)
- MCFG_VIDEO_START_OVERRIDE(special_state,special)
MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_special)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 2)
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* audio hardware */
SPEAKER(config, "speaker").front_center();
@@ -417,7 +416,6 @@ MACHINE_CONFIG_START(special_state::specialp)
MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specialp)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
- MCFG_VIDEO_START_OVERRIDE(special_state,specialp)
MACHINE_CONFIG_END
void special_state::specialm(machine_config &config)
@@ -444,13 +442,11 @@ MACHINE_CONFIG_START(special_state::specimx)
MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_specimx)
MCFG_VIDEO_START_OVERRIDE(special_state,specimx)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(special_state, specimx )
+ m_palette->set_init(FUNC(special_state::specimx_palette));
+ m_palette->set_entries(16);
/* audio hardware */
- MCFG_DEVICE_ADD("custom", SPECIMX_SND, 0)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
+ SPECIMX_SND(config, "custom", 0).add_route(ALL_OUTPUTS, "speaker", 1.0);
/* Devices */
PIT8253(config, m_pit, 0);
@@ -491,12 +487,10 @@ MACHINE_CONFIG_START(special_state::erik)
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
MCFG_SCREEN_SIZE(384, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 256-1)
- MCFG_VIDEO_START_OVERRIDE(special_state,erik)
MCFG_SCREEN_UPDATE_DRIVER(special_state, screen_update_erik)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(special_state,erik)
+ PALETTE(config, m_palette, FUNC(special_state::erik_palette), 8);
/* audio hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/spectrum.cpp b/src/mame/drivers/spectrum.cpp
index 1b7c4c2653b..445b4ae16f5 100644
--- a/src/mame/drivers/spectrum.cpp
+++ b/src/mame/drivers/spectrum.cpp
@@ -687,11 +687,10 @@ MACHINE_CONFIG_START(spectrum_state::spectrum_common)
m_screen->screen_vblank().set(FUNC(spectrum_state::screen_vblank_spectrum));
m_screen->set_palette("palette");
- palette_device &palette(PALETTE(config, "palette", 16));
- palette.set_init(palette_init_delegate(FUNC(spectrum_state::palette_init_spectrum), this));
-
+ PALETTE(config, "palette", FUNC(spectrum_state::spectrum_palette), 16);
GFXDECODE(config, "gfxdecode", "palette", gfx_spectrum);
- MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum )
+
+ MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/speedatk.cpp b/src/mame/drivers/speedatk.cpp
index 59d8bb2d202..989c5471d8d 100644
--- a/src/mame/drivers/speedatk.cpp
+++ b/src/mame/drivers/speedatk.cpp
@@ -322,17 +322,15 @@ MACHINE_CONFIG_START(speedatk_state::speedatk)
MCFG_SCREEN_SIZE(320, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(speedatk_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
H46505(config, m_crtc, MASTER_CLOCK/16); /* hand tuned to get ~60 fps */
m_crtc->set_screen("screen");
m_crtc->set_show_border_area(false);
m_crtc->set_char_width(8);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_speedatk)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(speedatk_state, speedatk)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_speedatk);
+ PALETTE(config, m_palette, FUNC(speedatk_state::speedatk_palette), 0x100, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/speedbal.cpp b/src/mame/drivers/speedbal.cpp
index 368740bc60d..6f849385d04 100644
--- a/src/mame/drivers/speedbal.cpp
+++ b/src/mame/drivers/speedbal.cpp
@@ -283,12 +283,10 @@ MACHINE_CONFIG_START(speedbal_state::speedbal)
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(speedbal_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_speedbal)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_speedbal);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 768).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/speedspn.cpp b/src/mame/drivers/speedspn.cpp
index 4ba3f285ba6..3dd654b07e2 100644
--- a/src/mame/drivers/speedspn.cpp
+++ b/src/mame/drivers/speedspn.cpp
@@ -299,11 +299,10 @@ MACHINE_CONFIG_START(speedspn_state::speedspn)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, 56*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(speedspn_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_speedspn)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_speedspn);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spiders.cpp b/src/mame/drivers/spiders.cpp
index cc36fd8b7aa..423e95dd834 100644
--- a/src/mame/drivers/spiders.cpp
+++ b/src/mame/drivers/spiders.cpp
@@ -521,7 +521,7 @@ MACHINE_CONFIG_START(spiders_state::spiders)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 256, 0, 256, 256, 0, 256) /* temporary, CRTC will configure screen */
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_3BIT_RGB("palette")
+ PALETTE(config, m_palette, palette_device::RGB_3BIT);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/spinb.cpp b/src/mame/drivers/spinb.cpp
index b4233cadbd0..022c4f13c90 100644
--- a/src/mame/drivers/spinb.cpp
+++ b/src/mame/drivers/spinb.cpp
@@ -71,6 +71,10 @@ public:
void init_game1();
void init_game2();
+protected:
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
private:
DECLARE_WRITE8_MEMBER(p1_w);
DECLARE_READ8_MEMBER(p3_r);
@@ -99,7 +103,7 @@ private:
DECLARE_WRITE8_MEMBER(disp_w);
DECLARE_WRITE_LINE_MEMBER(ic5a_w);
DECLARE_WRITE_LINE_MEMBER(ic5m_w);
- DECLARE_PALETTE_INIT(spinb);
+ void spinb_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -130,8 +134,6 @@ private:
uint8_t *m_p_audio;
uint8_t *m_p_music;
uint8_t *m_p_dmdcpu;
- virtual void machine_reset() override;
- virtual void machine_start() override;
void update_sound_a();
void update_sound_m();
required_device<cpu_device> m_maincpu;
@@ -577,7 +579,7 @@ void spinb_state::init_game2()
m_game = 2;
}
-PALETTE_INIT_MEMBER( spinb_state, spinb )
+void spinb_state::spinb_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00));
palette.set_pen_color(1, rgb_t(0xf7, 0xaa, 0x00));
@@ -586,8 +588,7 @@ PALETTE_INIT_MEMBER( spinb_state, spinb )
uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t y,gfx,gfx1;
- uint16_t sy=0,ma,x;
+ uint16_t sy=0,ma;
address_space &internal = m_dmdcpu->space(AS_DATA);
ma = internal.read_byte(0x05) << 8; // find where display memory is
@@ -596,13 +597,13 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
ma = ((ma - 0x200) & 0x1c00) + 0x200;
if (ma > 0x1c00) return 1; // not initialised yet
- for(y=0; y<32; y++)
+ for (uint8_t y = 0; y < 32; y++)
{
uint16_t *p = &bitmap.pix16(sy++);
- for(x = 0; x < 16; x++)
+ for (uint16_t x = 0; x < 16; x++)
{
- gfx = m_dmdram[ma+0x200];
- gfx1 = m_dmdram[ma++];
+ uint8_t const gfx = m_dmdram[ma+0x200];
+ uint8_t const gfx1 = m_dmdram[ma++];
*p++ = BIT(gfx1, 0) ? 1 : BIT(gfx, 0) ? 2 : 0;
*p++ = BIT(gfx1, 1) ? 1 : BIT(gfx, 1) ? 2 : 0;
@@ -619,12 +620,12 @@ uint32_t spinb_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
{
ma &= 0x1e00;
- for(y=0; y<32; y++)
+ for (uint8_t y = 0; y < 32; y++)
{
uint16_t *p = &bitmap.pix16(sy++);
- for(x = 0; x < 16; x++)
+ for (uint16_t x = 0; x < 16; x++)
{
- gfx = m_dmdram[ma++];
+ uint8_t const gfx = m_dmdram[ma++];
*p++ = BIT(gfx, 0);
*p++ = BIT(gfx, 1);
@@ -671,7 +672,7 @@ void spinb_state::spinb(machine_config &config)
screen.set_visarea(0, 127, 0, 31);
screen.set_palette("palette");
- PALETTE(config, "palette", 3).set_init(FUNC(spinb_state::palette_init_spinb));
+ PALETTE(config, "palette", FUNC(spinb_state::spinb_palette), 3);
/* Sound */
genpin_audio(config);
diff --git a/src/mame/drivers/splash.cpp b/src/mame/drivers/splash.cpp
index 7381b8f8faa..a0b4dc908a1 100644
--- a/src/mame/drivers/splash.cpp
+++ b/src/mame/drivers/splash.cpp
@@ -509,11 +509,10 @@ MACHINE_CONFIG_START(splash_state::splash)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 48*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_splash)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_splash)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_MACHINE_START_OVERRIDE(splash_state, splash )
MCFG_MACHINE_RESET_OVERRIDE(splash_state, splash )
@@ -572,11 +571,10 @@ MACHINE_CONFIG_START(splash_state::roldfrog)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(2*8, 48*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(splash_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_splash)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_splash)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_MACHINE_START_OVERRIDE(splash_state, roldfrog )
MCFG_MACHINE_RESET_OVERRIDE(splash_state, splash )
@@ -661,11 +659,10 @@ MACHINE_CONFIG_START(funystrp_state::funystrp)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(funystrp_state, screen_update_funystrp)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_splash)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_splash)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/splus.cpp b/src/mame/drivers/splus.cpp
index 2266caac22a..8942e711733 100644
--- a/src/mame/drivers/splus.cpp
+++ b/src/mame/drivers/splus.cpp
@@ -690,7 +690,7 @@ void splus_state::splus(machine_config &config) // basic machine hardware
NVRAM(config, "cmosh", nvram_device::DEFAULT_ALL_0);
// video hardware (ALL FAKE, NO VIDEO)
- PALETTE(config, "palette", 16*16);
+ PALETTE(config, "palette").set_entries(16*16);
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
diff --git a/src/mame/drivers/spoker.cpp b/src/mame/drivers/spoker.cpp
index 0d27f125e2d..db4fe210f9c 100644
--- a/src/mame/drivers/spoker.cpp
+++ b/src/mame/drivers/spoker.cpp
@@ -42,8 +42,8 @@
class spoker_state : public driver_device
{
public:
- spoker_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ spoker_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
@@ -638,7 +638,7 @@ void spoker_state::spoker(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_spoker);
- PALETTE(config, m_palette, 0x400).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x400);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/spool99.cpp b/src/mame/drivers/spool99.cpp
index 7def914dbef..14b5f4639be 100644
--- a/src/mame/drivers/spool99.cpp
+++ b/src/mame/drivers/spool99.cpp
@@ -103,21 +103,25 @@ Note
class spool99_state : public driver_device
{
public:
- spool99_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ spool99_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_eeprom(*this, "eeprom"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_main(*this, "mainram"),
m_vram(*this, "vram"),
- m_cram(*this, "cram") { }
+ m_cram(*this, "cram")
+ { }
void vcarn(machine_config &config);
void spool99(machine_config &config);
void init_spool99();
+protected:
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
@@ -138,8 +142,6 @@ private:
DECLARE_WRITE8_MEMBER(eeprom_clockline_w);
DECLARE_WRITE8_MEMBER(eeprom_dataline_w);
- virtual void video_start() override;
-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TILE_GET_INFO_MEMBER(get_tile_info);
void spool99_map(address_map &map);
@@ -371,7 +373,7 @@ MACHINE_CONFIG_START(spool99_state::spool99)
MCFG_DEVICE_PROGRAM_MAP(spool99_map)
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", spool99_state, irq0_line_hold)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spool99)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_spool99);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -381,8 +383,7 @@ MACHINE_CONFIG_START(spool99_state::spool99)
MCFG_SCREEN_UPDATE_DRIVER(spool99_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 0x200);
EEPROM_93C46_16BIT(config, "eeprom");
diff --git a/src/mame/drivers/sprcros2.cpp b/src/mame/drivers/sprcros2.cpp
index f4b1c2f6fce..1f10dc36802 100644
--- a/src/mame/drivers/sprcros2.cpp
+++ b/src/mame/drivers/sprcros2.cpp
@@ -79,6 +79,13 @@ public:
void sprcros2(machine_config &config);
+protected:
+ // driver_device overrides
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ virtual void video_start() override;
+
private:
// devices
required_device<cpu_device> m_master_cpu;
@@ -91,10 +98,15 @@ private:
required_shared_ptr<uint8_t> m_bgattr;
required_shared_ptr<uint8_t> m_sprram;
+ bool m_master_nmi_enable;
+ bool m_master_irq_enable;
+ bool m_slave_nmi_enable;
+ bool m_screen_enable;
+ uint8_t m_bg_scrollx, m_bg_scrolly;
// screen updates
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(sprcros2);
+ void sprcros2_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(master_output_w);
DECLARE_WRITE8_MEMBER(slave_output_w);
DECLARE_WRITE8_MEMBER(bg_scrollx_w);
@@ -103,22 +115,11 @@ private:
INTERRUPT_GEN_MEMBER(slave_vblank_irq);
TIMER_DEVICE_CALLBACK_MEMBER(master_scanline);
- bool m_master_nmi_enable;
- bool m_master_irq_enable;
- bool m_slave_nmi_enable;
- bool m_screen_enable;
- uint8_t m_bg_scrollx, m_bg_scrolly;
void master_io(address_map &map);
void master_map(address_map &map);
void slave_io(address_map &map);
void slave_map(address_map &map);
- // driver_device overrides
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void video_start() override;
-
void legacy_bg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
void legacy_fg_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
void legacy_obj_draw(bitmap_ind16 &bitmap,const rectangle &cliprect);
@@ -382,50 +383,48 @@ void sprcros2_state::machine_reset()
}
-PALETTE_INIT_MEMBER(sprcros2_state, sprcros2)
+void sprcros2_state::sprcros2_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = 0x47 * bit0 + 0xb8 * bit1;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x47 * bit0 + 0xb8 * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* bg */
- for (i = 0; i < 0x100; i++)
+ // bg
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | ((color_prom[i + 0x100] & 0x0f) << 4);
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | ((color_prom[i + 0x100] & 0x0f) << 4);
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites & fg */
- for (i = 0x100; i < 0x300; i++)
+ // sprites & fg
+ for (int i = 0x100; i < 0x300; i++)
{
uint8_t ctabentry = color_prom[i + 0x100];
palette.set_pen_indirect(i, ctabentry);
@@ -475,22 +474,15 @@ MACHINE_CONFIG_START(sprcros2_state::sprcros2)
MCFG_SCREEN_RAW_PARAMS(MAIN_CLOCK/2, 343, 8, 256-8, 262, 16, 240) // TODO: Wrong screen parameters
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sprcros2)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sprcros2);
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(sprcros2_state, sprcros2)
+ PALETTE(config, "palette", FUNC(sprcros2_state::sprcros2_palette), 768, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("sn1", SN76489, 10000000/4)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
-
- MCFG_DEVICE_ADD("sn2", SN76489, 10000000/4)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
-
- MCFG_DEVICE_ADD("sn3", SN76489, 10000000/4)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ SN76489(config, "sn1", 10000000/4).add_route(ALL_OUTPUTS, "mono", 0.50);
+ SN76489(config, "sn2", 10000000/4).add_route(ALL_OUTPUTS, "mono", 0.50);
+ SN76489(config, "sn3", 10000000/4).add_route(ALL_OUTPUTS, "mono", 0.50);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/sprint2.cpp b/src/mame/drivers/sprint2.cpp
index 530e32c1ef5..c10ed7f9300 100644
--- a/src/mame/drivers/sprint2.cpp
+++ b/src/mame/drivers/sprint2.cpp
@@ -503,12 +503,10 @@ MACHINE_CONFIG_START(sprint2_state::sprint2)
MCFG_SCREEN_RAW_PARAMS(12.096_MHz_XTAL, 768, 0, 512, 262, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(sprint2_state, screen_update_sprint2)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sprint2_state, screen_vblank_sprint2))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sprint2)
- MCFG_PALETTE_ADD("palette", 12)
- MCFG_PALETTE_INDIRECT_ENTRIES(4)
- MCFG_PALETTE_INIT_OWNER(sprint2_state, sprint2)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sprint2)
+ PALETTE(config, m_palette, FUNC(sprint2_state::sprint2_palette), 12, 4);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/sprint4.cpp b/src/mame/drivers/sprint4.cpp
index 46925130e4a..e87350c727c 100644
--- a/src/mame/drivers/sprint4.cpp
+++ b/src/mame/drivers/sprint4.cpp
@@ -392,12 +392,10 @@ MACHINE_CONFIG_START(sprint4_state::sprint4)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, 0, 256, VTOTAL, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(sprint4_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sprint4_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sprint4)
- MCFG_PALETTE_ADD("palette", 10)
- MCFG_PALETTE_INDIRECT_ENTRIES(6)
- MCFG_PALETTE_INIT_OWNER(sprint4_state, sprint4)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sprint4)
+ PALETTE(config, m_palette, FUNC(sprint4_state::sprint4_palette), 10, 6);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/sprint8.cpp b/src/mame/drivers/sprint8.cpp
index 3aefa11b504..c952722d2e2 100644
--- a/src/mame/drivers/sprint8.cpp
+++ b/src/mame/drivers/sprint8.cpp
@@ -472,12 +472,10 @@ MACHINE_CONFIG_START(sprint8_state::sprint8)
MCFG_SCREEN_VISIBLE_AREA(0, 495, 0, 231)
MCFG_SCREEN_UPDATE_DRIVER(sprint8_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sprint8_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sprint8)
- MCFG_PALETTE_ADD("palette", 36)
- MCFG_PALETTE_INDIRECT_ENTRIES(18)
- MCFG_PALETTE_INIT_OWNER(sprint8_state, sprint8)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_sprint8)
+ PALETTE(config, m_palette, FUNC(sprint8_state::sprint8_palette), 36, 18);
sprint8_audio(config);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/spy.cpp b/src/mame/drivers/spy.cpp
index 34968819679..434b002b8ff 100644
--- a/src/mame/drivers/spy.cpp
+++ b/src/mame/drivers/spy.cpp
@@ -515,9 +515,8 @@ void spy_state::spy(machine_config &config)
screen.set_screen_update(FUNC(spy_state::screen_update_spy));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/srmp2.cpp b/src/mame/drivers/srmp2.cpp
index 6ac877fd30e..d68744cda27 100644
--- a/src/mame/drivers/srmp2.cpp
+++ b/src/mame/drivers/srmp2.cpp
@@ -1158,11 +1158,8 @@ MACHINE_CONFIG_START(srmp2_state::srmp2)
MCFG_SCREEN_UPDATE_DRIVER(srmp2_state, screen_update_srmp2)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_srmp2)
- MCFG_PALETTE_ADD("palette", 1024) /* sprites only */
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
- MCFG_PALETTE_INIT_OWNER(srmp2_state,srmp2)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_srmp2);
+ PALETTE(config, "palette", FUNC(srmp2_state::srmp2_palette)).set_format(palette_device::xRGB_555, 1024); // sprites only
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1205,11 +1202,8 @@ MACHINE_CONFIG_START(srmp2_state::srmp3)
MCFG_SCREEN_UPDATE_DRIVER(srmp2_state, screen_update_srmp3)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_srmp3)
- MCFG_PALETTE_ADD("palette", 512) /* sprites only */
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
-
- MCFG_PALETTE_INIT_OWNER(srmp2_state,srmp3)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_srmp3);
+ PALETTE(config, "palette", FUNC(srmp2_state::srmp3_palette)).set_format(palette_device::xRGB_555, 512); // sprites only
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1260,9 +1254,8 @@ MACHINE_CONFIG_START(srmp2_state::mjyuugi)
MCFG_SCREEN_UPDATE_DRIVER(srmp2_state, screen_update_mjyuugi)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_srmp3)
- MCFG_PALETTE_ADD("palette", 512) /* sprites only */
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_srmp3);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 512); // sprites only
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/srmp5.cpp b/src/mame/drivers/srmp5.cpp
index 8f9eb11ebdc..40096beda47 100644
--- a/src/mame/drivers/srmp5.cpp
+++ b/src/mame/drivers/srmp5.cpp
@@ -588,12 +588,11 @@ MACHINE_CONFIG_START(srmp5_state::srmp5)
MCFG_SCREEN_VISIBLE_AREA(0*8, 42*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(srmp5_state, screen_update_srmp5)
- MCFG_PALETTE_ADD("palette", 0x10000) // 0x20000? only first 0x1800 entries seem to be used outside memory test
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_MEMBITS(16)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x10000); // 0x20000? only first 0x1800 entries seem to be used outside memory test
+ m_palette->set_membits(16);
#ifdef DEBUG_CHAR
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_srmp5)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_srmp5);
#endif
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/srmp6.cpp b/src/mame/drivers/srmp6.cpp
index 55dc0da0fdb..08154034d1c 100644
--- a/src/mame/drivers/srmp6.cpp
+++ b/src/mame/drivers/srmp6.cpp
@@ -79,15 +79,16 @@ Dumped 06/15/2000
class srmp6_state : public driver_device
{
public:
- srmp6_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ srmp6_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_sprram(*this, "sprram"),
m_chrram(*this, "chrram"),
m_dmaram(*this, "dmaram"),
m_video_regs(*this, "video_regs"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void srmp6(machine_config &config);
private:
@@ -696,8 +697,7 @@ void srmp6_state::srmp6(machine_config &config)
screen.set_visarea(0*8, 42*8-1, 0*8, 30*8-1);
screen.set_screen_update(FUNC(srmp6_state::screen_update_srmp6));
- PALETTE(config, m_palette, 0x800);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
diff --git a/src/mame/drivers/srumbler.cpp b/src/mame/drivers/srumbler.cpp
index 7a1d6041c19..1eb3d4490a0 100644
--- a/src/mame/drivers/srumbler.cpp
+++ b/src/mame/drivers/srumbler.cpp
@@ -267,12 +267,11 @@ MACHINE_CONFIG_START(srumbler_state::srumbler)
MCFG_SCREEN_VISIBLE_AREA(10*8, (64-10)*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(srumbler_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram8_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_srumbler)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ssem.cpp b/src/mame/drivers/ssem.cpp
index 297b9927e87..8a1ac6410e1 100644
--- a/src/mame/drivers/ssem.cpp
+++ b/src/mame/drivers/ssem.cpp
@@ -16,8 +16,8 @@
class ssem_state : public driver_device
{
public:
- ssem_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ssem_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_store(*this, "store"),
m_screen(*this, "screen")
@@ -644,7 +644,7 @@ MACHINE_CONFIG_START(ssem_state::ssem)
MCFG_SCREEN_SIZE(256, 280)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 279)
MCFG_SCREEN_UPDATE_DRIVER(ssem_state, screen_update_ssem)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* quickload */
MCFG_QUICKLOAD_ADD("quickload", ssem_state, ssem_store, "snp,asm", 1)
diff --git a/src/mame/drivers/sshangha.cpp b/src/mame/drivers/sshangha.cpp
index 0cfc1e26e2d..1200d740f49 100644
--- a/src/mame/drivers/sshangha.cpp
+++ b/src/mame/drivers/sshangha.cpp
@@ -431,7 +431,7 @@ void sshangha_state::sshangha(machine_config &config)
GFXDECODE(config, "gfxdecode", m_palette, gfx_sshangha);
- PALETTE(config, m_palette, 0x4000).set_format(PALETTE_FORMAT_XBGR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_888, 0x4000);
DECO16IC(config, m_tilegen, 0);
m_tilegen->set_split(0);
diff --git a/src/mame/drivers/sshot.cpp b/src/mame/drivers/sshot.cpp
index 94fd7b58000..207fcd43a67 100644
--- a/src/mame/drivers/sshot.cpp
+++ b/src/mame/drivers/sshot.cpp
@@ -173,11 +173,12 @@ Given CS numbers this is released after the other GunChamp
class supershot_state : public driver_device
{
public:
- supershot_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ supershot_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void supershot(machine_config &config);
@@ -359,7 +360,7 @@ MACHINE_CONFIG_START(supershot_state::supershot)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supershot)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
//...
diff --git a/src/mame/drivers/sslam.cpp b/src/mame/drivers/sslam.cpp
index 239e3cc4945..d9a2dbe60db 100644
--- a/src/mame/drivers/sslam.cpp
+++ b/src/mame/drivers/sslam.cpp
@@ -733,8 +733,7 @@ void sslam_state::sslam(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sslam);
-
- PALETTE(config, m_palette, 0x800).set_format(PALETTE_FORMAT_RRRRGGGGBBBBRGBx);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -765,8 +764,7 @@ void powerbls_state::powerbls(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_powerbls);
-
- PALETTE(config, m_palette, 0x200).set_format(PALETTE_FORMAT_RRRRGGGGBBBBRGBx);
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 0x200);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ssozumo.cpp b/src/mame/drivers/ssozumo.cpp
index 6da526e86cf..efab2602a00 100644
--- a/src/mame/drivers/ssozumo.cpp
+++ b/src/mame/drivers/ssozumo.cpp
@@ -214,11 +214,10 @@ MACHINE_CONFIG_START(ssozumo_state::ssozumo)
// DECO video CRTC, unverified
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000)/2,384,0,256,272,8,248)
MCFG_SCREEN_UPDATE_DRIVER(ssozumo_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ssozumo)
- MCFG_PALETTE_ADD("palette", 64 + 16)
- MCFG_PALETTE_INIT_OWNER(ssozumo_state, ssozumo)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssozumo);
+ PALETTE(config, m_palette, FUNC(ssozumo_state::ssozumo_palette), 64 + 16);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -226,7 +225,6 @@ MACHINE_CONFIG_START(ssozumo_state::ssozumo)
GENERIC_LATCH_8(config, "soundlatch").data_pending_callback().set_inputline(m_audiocpu, m6502_device::IRQ_LINE);
YM2149(config, "ay1", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
-
YM2149(config, "ay2", 1500000).add_route(ALL_OUTPUTS, "speaker", 0.3);
MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.3) // unknown DAC
diff --git a/src/mame/drivers/sspeedr.cpp b/src/mame/drivers/sspeedr.cpp
index 77519edc5d4..199fce035cb 100644
--- a/src/mame/drivers/sspeedr.cpp
+++ b/src/mame/drivers/sspeedr.cpp
@@ -17,17 +17,15 @@ Taito Super Speed Race driver
-PALETTE_INIT_MEMBER(sspeedr_state, sspeedr)
+void sspeedr_state::sspeedr_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
- int r = (i & 1) ? 0xb0 : 0x20;
- int g = (i & 2) ? 0xb0 : 0x20;
- int b = (i & 4) ? 0xb0 : 0x20;
+ int r = BIT(i, 0) ? 0xb0 : 0x20;
+ int g = BIT(i, 1) ? 0xb0 : 0x20;
+ int b = BIT(i, 2) ? 0xb0 : 0x20;
- if (i & 8)
+ if (BIT(i, 3))
{
r += 0x4f;
g += 0x4f;
@@ -208,11 +206,10 @@ MACHINE_CONFIG_START(sspeedr_state::sspeedr)
MCFG_SCREEN_VISIBLE_AREA(0, 375, 0, 247)
MCFG_SCREEN_UPDATE_DRIVER(sspeedr_state, screen_update_sspeedr)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sspeedr_state, screen_vblank_sspeedr))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sspeedr)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(sspeedr_state, sspeedr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sspeedr);
+ PALETTE(config, m_palette, FUNC(sspeedr_state::sspeedr_palette), 16);
/* sound hardware */
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ssrj.cpp b/src/mame/drivers/ssrj.cpp
index 25dd63536c9..c9525374917 100644
--- a/src/mame/drivers/ssrj.cpp
+++ b/src/mame/drivers/ssrj.cpp
@@ -155,12 +155,10 @@ MACHINE_CONFIG_START(ssrj_state::ssrj)
MCFG_SCREEN_VISIBLE_AREA(0*8, 34*8-1, 1*8, 31*8-1) // unknown res
MCFG_SCREEN_UPDATE_DRIVER(ssrj_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ssrj_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ssrj)
- MCFG_PALETTE_ADD("palette", 128)
- MCFG_PALETTE_INIT_OWNER(ssrj_state, ssrj)
+ MCFG_SCREEN_PALETTE(m_palette)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssrj);
+ PALETTE(config, m_palette, FUNC(ssrj_state::ssrj_palette), 128);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/sstrangr.cpp b/src/mame/drivers/sstrangr.cpp
index e5dd90b0c26..472f4a49740 100644
--- a/src/mame/drivers/sstrangr.cpp
+++ b/src/mame/drivers/sstrangr.cpp
@@ -18,11 +18,12 @@
class sstrangr_state : public driver_device
{
public:
- sstrangr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ sstrangr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_palette(*this, "palette"),
- m_ram(*this, "ram") { }
+ m_ram(*this, "ram")
+ { }
void sstrngr2(machine_config &config);
void sstrangr(machine_config &config);
@@ -272,7 +273,7 @@ MACHINE_CONFIG_START(sstrangr_state::sstrngr2)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(sstrangr_state, screen_update_sstrngr2)
- MCFG_PALETTE_ADD_3BIT_RBG("palette")
+ PALETTE(config, m_palette, palette_device::RBG_3BIT);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/ssv.cpp b/src/mame/drivers/ssv.cpp
index 2e2af256b81..1f6e65e7c1c 100644
--- a/src/mame/drivers/ssv.cpp
+++ b/src/mame/drivers/ssv.cpp
@@ -2598,7 +2598,7 @@ void ssv_state::ssv(machine_config &config)
//m_screen->set_video_attributes(VIDEO_UPDATE_SCANLINE);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_ssv);
- PALETTE(config, m_palette, 0x8000).set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 0x8000);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/ssystem3.cpp b/src/mame/drivers/ssystem3.cpp
index ddc5efd84ac..b9cf3fe3cdb 100644
--- a/src/mame/drivers/ssystem3.cpp
+++ b/src/mame/drivers/ssystem3.cpp
@@ -298,8 +298,7 @@ void ssystem3_state::ssystem3(machine_config &config)
screen.set_screen_update(FUNC(ssystem3_state::screen_update_ssystem3));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 242 + 32768);
- m_palette->set_init(FUNC(ssystem3_state::palette_init));
+ PALETTE(config, m_palette, FUNC(ssystem3_state::palette_init), 242 + 32768);
/* via */
VIA6522(config, m_via6522_0, 1000000);
diff --git a/src/mame/drivers/stadhero.cpp b/src/mame/drivers/stadhero.cpp
index 7810bb18e8a..c3e242b3131 100644
--- a/src/mame/drivers/stadhero.cpp
+++ b/src/mame/drivers/stadhero.cpp
@@ -206,8 +206,7 @@ MACHINE_CONFIG_START(stadhero_state::stadhero)
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_stadhero);
-
- PALETTE(config, "palette", 1024).set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 1024);
DECO_BAC06(config, m_tilegen, 0);
m_tilegen->set_gfx_region_wide(1, 1, 2);
diff --git a/src/mame/drivers/starcrus.cpp b/src/mame/drivers/starcrus.cpp
index 92fbcc08d20..eb304d53549 100644
--- a/src/mame/drivers/starcrus.cpp
+++ b/src/mame/drivers/starcrus.cpp
@@ -158,8 +158,7 @@ void starcrus_state::starcrus(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_starcrus);
-
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/starshp1.cpp b/src/mame/drivers/starshp1.cpp
index 9649ce9baa5..c54b83ef210 100644
--- a/src/mame/drivers/starshp1.cpp
+++ b/src/mame/drivers/starshp1.cpp
@@ -319,12 +319,10 @@ MACHINE_CONFIG_START(starshp1_state::starshp1)
MCFG_SCREEN_RAW_PARAMS(STARSHP1_PIXEL_CLOCK, STARSHP1_HTOTAL, STARSHP1_HBEND, STARSHP1_HBSTART, STARSHP1_VTOTAL, STARSHP1_VBEND, STARSHP1_VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(starshp1_state, screen_update_starshp1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, starshp1_state, screen_vblank_starshp1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_starshp1)
- MCFG_PALETTE_ADD("palette", 19)
- MCFG_PALETTE_INDIRECT_ENTRIES(8)
- MCFG_PALETTE_INIT_OWNER(starshp1_state, starshp1)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_starshp1)
+ PALETTE(config, m_palette, FUNC(starshp1_state::starshp1_palette), 19, 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/statriv2.cpp b/src/mame/drivers/statriv2.cpp
index a858a1a15da..286765200a4 100644
--- a/src/mame/drivers/statriv2.cpp
+++ b/src/mame/drivers/statriv2.cpp
@@ -94,7 +94,6 @@ public:
, m_palette(*this, "palette")
{ }
-
void statriv2(machine_config &config);
void funcsino(machine_config &config);
void statriv2v(machine_config &config);
@@ -121,6 +120,7 @@ private:
uint8_t m_question_offset_high;
uint8_t m_latched_coin;
uint8_t m_last_coin;
+
DECLARE_WRITE8_MEMBER(statriv2_videoram_w);
DECLARE_READ8_MEMBER(question_data_r);
DECLARE_WRITE8_MEMBER(ppi_portc_hi_w);
@@ -128,7 +128,7 @@ private:
TILE_GET_INFO_MEMBER(horizontal_tile_info);
TILE_GET_INFO_MEMBER(vertical_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(statriv2);
+ void statriv2_palette(palette_device &palette) const;
DECLARE_VIDEO_START(vertical);
uint32_t screen_update_statriv2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(statriv2_interrupt);
@@ -171,12 +171,12 @@ TILE_GET_INFO_MEMBER(statriv2_state::vertical_tile_info)
*
*************************************/
-PALETTE_INIT_MEMBER(statriv2_state, statriv2)
+void statriv2_state::statriv2_palette(palette_device &palette) const
{
for (int i = 0; i < 64; i++)
{
- palette.set_pen_color(2*i+0, pal1bit(i >> 2), pal1bit(i >> 0), pal1bit(i >> 1));
- palette.set_pen_color(2*i+1, pal1bit(i >> 5), pal1bit(i >> 3), pal1bit(i >> 4));
+ palette.set_pen_color(2*i + 0, pal1bit(i >> 2), pal1bit(i >> 0), pal1bit(i >> 1));
+ palette.set_pen_color(2*i + 1, pal1bit(i >> 5), pal1bit(i >> 3), pal1bit(i >> 4));
}
}
@@ -628,13 +628,12 @@ MACHINE_CONFIG_START(statriv2_state::statriv2)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 384, 0, 320, 270, 0, 240)
MCFG_SCREEN_UPDATE_DRIVER(statriv2_state, screen_update_statriv2)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
TMS9927(config, m_tms, MASTER_CLOCK/2/8).set_char_width(8);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_horizontal)
- MCFG_PALETTE_ADD("palette", 2*64)
- MCFG_PALETTE_INIT_OWNER(statriv2_state, statriv2)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_horizontal);
+ PALETTE(config, m_palette, FUNC(statriv2_state::statriv2_palette), 2*64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/stfight.cpp b/src/mame/drivers/stfight.cpp
index c3d5cc50f16..13518046e1a 100644
--- a/src/mame/drivers/stfight.cpp
+++ b/src/mame/drivers/stfight.cpp
@@ -471,7 +471,7 @@ void stfight_state::stfight_base(machine_config &config)
config.m_minimum_quantum = attotime::from_hz(600);
- PALETTE(config, "palette", 256).set_format(PALETTE_FORMAT_xxxxBBBBRRRRGGGG);
+ PALETTE(config, "palette").set_format(palette_device::xBRG_444, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/stlforce.cpp b/src/mame/drivers/stlforce.cpp
index 4f4fe0717ff..6de179c48d5 100644
--- a/src/mame/drivers/stlforce.cpp
+++ b/src/mame/drivers/stlforce.cpp
@@ -212,11 +212,10 @@ MACHINE_CONFIG_START(stlforce_state::stlforce)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8, 48*8-1-8-2, 0, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(stlforce_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_stlforce)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
EDEVICES_SFORCE_VID(config, m_video, 0);
m_video->set_bg_videoram_tag("bg_videoram");
diff --git a/src/mame/drivers/stuntair.cpp b/src/mame/drivers/stuntair.cpp
index 4df4d4c6f79..5457f0cf70f 100644
--- a/src/mame/drivers/stuntair.cpp
+++ b/src/mame/drivers/stuntair.cpp
@@ -94,8 +94,8 @@ Bprom dump by f205v
class stuntair_state : public driver_device
{
public:
- stuntair_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ stuntair_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_fgram(*this, "fgram"),
@@ -109,6 +109,11 @@ public:
void stuntair(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -141,12 +146,9 @@ private:
DECLARE_WRITE8_MEMBER(stuntair_sound_w);
DECLARE_WRITE8_MEMBER(ay8910_portb_w);
DECLARE_WRITE_LINE_MEMBER(stuntair_irq);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_stuntair(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(stuntair);
+ void stuntair_palette(palette_device &palette) const;
void stuntair_map(address_map &map);
void stuntair_sound_map(address_map &map);
void stuntair_sound_portmap(address_map &map);
@@ -160,36 +162,36 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(stuntair_state, stuntair)
+void stuntair_state::stuntair_palette(palette_device &palette) const
{
- /* need resistor weights etc. */
- const uint8_t *color_prom = machine().root_device().memregion("proms")->base();
+ // need resistor weights etc
+ uint8_t const *const color_prom = machine().root_device().memregion("proms")->base();
for (int i = 0; i < 0x100; i++)
{
- uint8_t data = color_prom[i];
+ uint8_t const data = color_prom[i];
- int b = (data&0xc0)>>6;
- int g = (data&0x38)>>3;
- int r = (data&0x07)>>0;
+ int const b = (data >> 6) & 0x03;
+ int const g = (data >> 3) & 0x07;
+ int const r = (data >> 0) & 0x07;
- palette.set_pen_color(i,rgb_t(r<<5,g<<5,b<<6));
+ palette.set_pen_color(i, rgb_t(pal3bit(r), pal3bit(g), pal2bit(b)));
}
// just set the FG layer to black and white
- palette.set_pen_color(0x100,rgb_t(0x00,0x00,0x00));
- palette.set_pen_color(0x101,rgb_t(0xff,0xff,0xff));
+ palette.set_pen_color(0x100, rgb_t::black());
+ palette.set_pen_color(0x101, rgb_t::white());
}
TILE_GET_INFO_MEMBER(stuntair_state::get_stuntair_fg_tile_info)
{
- int tileno = m_fgram[tile_index];
- int opaque = tileno & 0x80;
+ int const tileno = m_fgram[tile_index];
+ int const opaque = tileno & 0x80;
// where does the FG palette come from? it's a 1bpp layer..
- SET_TILE_INFO_MEMBER(0, tileno&0x7f, 0, opaque?TILE_FORCE_LAYER0 : TILE_FORCE_LAYER1);
+ SET_TILE_INFO_MEMBER(0, tileno & 0x7f, 0, opaque ? TILE_FORCE_LAYER0 : TILE_FORCE_LAYER1);
}
TILE_GET_INFO_MEMBER(stuntair_state::get_stuntair_bg_tile_info)
@@ -216,7 +218,7 @@ void stuntair_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
gfx_element *gfx = m_gfxdecode->gfx(2);
/* there seem to be 2 spritelists with something else (fixed values) between them.. is that significant? */
- for (int i=0;i<0x400;i+=16)
+ for (int i = 0; i < 0x400; i += 16)
{
// +2, +3, +4(high bits): always 00
// +6 to +15: unused
@@ -548,13 +550,11 @@ MACHINE_CONFIG_START(stuntair_state::stuntair)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(stuntair_state, screen_update_stuntair)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, stuntair_state, stuntair_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_stuntair)
- MCFG_PALETTE_ADD("palette", 0x100+2)
-
- MCFG_PALETTE_INIT_OWNER(stuntair_state, stuntair)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_stuntair);
+ PALETTE(config, m_palette, FUNC(stuntair_state::stuntair_palette), 0x100 + 2);
/* sound hardware */
SPEAKER(config, "mono").front_center(); // stereo?
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index 7c141b0e4c1..d5e621ec88c 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -1167,7 +1167,7 @@ void stv_state::stv(machine_config &config)
m_screen->set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK);
m_screen->set_raw(MASTER_CLOCK_320/8, 427, 0, 352, 263, 0, 224);
m_screen->set_screen_update(FUNC(stv_state::screen_update_stv_vdp2));
- PALETTE(config, m_palette, 2048+(2048*2)); //standard palette + extra memory for rgb brightness.
+ PALETTE(config, m_palette).set_entries(2048+(2048*2)); //standard palette + extra memory for rgb brightness.
GFXDECODE(config, m_gfxdecode, m_palette, gfx_stv);
diff --git a/src/mame/drivers/sub.cpp b/src/mame/drivers/sub.cpp
index a030fb5ecc3..d75efae046e 100644
--- a/src/mame/drivers/sub.cpp
+++ b/src/mame/drivers/sub.cpp
@@ -331,13 +331,11 @@ MACHINE_CONFIG_START(sub_state::sub)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(sub_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, sub_state, main_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sub)
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x100)
- MCFG_PALETTE_INIT_OWNER(sub_state, sub)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_sub);
+ PALETTE(config, m_palette, FUNC(sub_state::sub_palette), 0x400, 0x100);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/subhuntr.cpp b/src/mame/drivers/subhuntr.cpp
index 671a4387a17..d6ed2fa74ba 100644
--- a/src/mame/drivers/subhuntr.cpp
+++ b/src/mame/drivers/subhuntr.cpp
@@ -37,13 +37,15 @@ public:
void subhuntr(machine_config &config);
-private:
- INTERRUPT_GEN_MEMBER(subhuntr_interrupt);
-
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(subhuntr);
+
+private:
+ INTERRUPT_GEN_MEMBER(subhuntr_interrupt);
+
+ void subhuntr_palette(palette_device &palette) const;
uint32_t screen_update_subhuntr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void subhuntr_data_map(address_map &map);
@@ -60,7 +62,7 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(subhuntr_state, subhuntr)
+void subhuntr_state::subhuntr_palette(palette_device &palette) const
{
}
@@ -166,8 +168,7 @@ void subhuntr_state::subhuntr(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_subhuntr);
-
- PALETTE(config, "palette", 26).set_init(FUNC(subhuntr_state::palette_init_subhuntr));
+ PALETTE(config, "palette", FUNC(subhuntr_state::subhuntr_palette), 26);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/subs.cpp b/src/mame/drivers/subs.cpp
index 1b1033ec4b8..aeecb9e28c0 100644
--- a/src/mame/drivers/subs.cpp
+++ b/src/mame/drivers/subs.cpp
@@ -35,12 +35,12 @@
*
*************************************/
-PALETTE_INIT_MEMBER(subs_state, subs)
+void subs_state::subs_palette(palette_device &palette) const
{
- palette.set_pen_color(0,rgb_t(0x00,0x00,0x00)); /* BLACK - modified on video invert */
- palette.set_pen_color(1,rgb_t(0xff,0xff,0xff)); /* WHITE - modified on video invert */
- palette.set_pen_color(2,rgb_t(0x00,0x00,0x00)); /* BLACK - modified on video invert */
- palette.set_pen_color(3,rgb_t(0xff,0xff,0xff)); /* WHITE - modified on video invert*/
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); // BLACK - modified on video invert
+ palette.set_pen_color(1, rgb_t(0xff, 0xff, 0xff)); // WHITE - modified on video invert
+ palette.set_pen_color(2, rgb_t(0x00, 0x00, 0x00)); // BLACK - modified on video invert
+ palette.set_pen_color(3, rgb_t(0xff, 0xff, 0xff)); // WHITE - modified on video invert
}
@@ -182,10 +182,9 @@ MACHINE_CONFIG_START(subs_state::subs)
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_subs)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_subs)
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(subs_state, subs)
+ PALETTE(config, m_palette, FUNC(subs_state::subs_palette), 4);
config.set_default_layout(layout_dualhsxs);
@@ -195,7 +194,7 @@ MACHINE_CONFIG_START(subs_state::subs)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(57)
@@ -203,7 +202,7 @@ MACHINE_CONFIG_START(subs_state::subs)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(subs_state, screen_update_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* sound hardware */
diff --git a/src/mame/drivers/subsino.cpp b/src/mame/drivers/subsino.cpp
index d1a87d1d4ac..2cb58db406c 100644
--- a/src/mame/drivers/subsino.cpp
+++ b/src/mame/drivers/subsino.cpp
@@ -242,8 +242,8 @@ To Do:
class subsino_state : public driver_device
{
public:
- subsino_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ subsino_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_colorram(*this, "colorram"),
m_videoram(*this, "videoram"),
m_reel_scroll(*this, "reel_scroll.%u", 0U),
@@ -322,8 +322,8 @@ private:
template<uint8_t Reel> TILE_GET_INFO_MEMBER(get_reel_tile_info);
template<uint8_t Reel> TILE_GET_INFO_MEMBER(get_stbsub_reel_tile_info);
DECLARE_VIDEO_START(subsino);
- DECLARE_PALETTE_INIT(_2proms);
- DECLARE_PALETTE_INIT(_3proms);
+ void _2proms_palette(palette_device &palette) const;
+ void _3proms_palette(palette_device &palette) const;
DECLARE_VIDEO_START(reels);
DECLARE_VIDEO_START(stbsub);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -534,55 +534,55 @@ uint32_t subsino_state::screen_update_stbsub_reels(screen_device &screen, bitmap
-PALETTE_INIT_MEMBER(subsino_state, _2proms)
+void subsino_state::_2proms_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b,val;
- int bit0,bit1,bit2;
-
- for (i = 0; i < 256; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 256; i++)
{
- val = (color_prom[i+0x100]) | (color_prom[i+0x000]<<4);
+ int bit0, bit1, bit2;
+ int const val = color_prom[i | 0x100] | (color_prom[i | 0x000] << 4);
bit0 = 0;
- bit1 = (val >> 6) & 0x01;
- bit2 = (val >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 3) & 0x01;
- bit1 = (val >> 4) & 0x01;
- bit2 = (val >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 0) & 0x01;
- bit1 = (val >> 1) & 0x01;
- bit2 = (val >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(val, 6);
+ bit2 = BIT(val, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 3);
+ bit1 = BIT(val, 4);
+ bit2 = BIT(val, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 0);
+ bit1 = BIT(val, 1);
+ bit2 = BIT(val, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(subsino_state, _3proms)
+void subsino_state::_3proms_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b,val;
- int bit0,bit1,bit2;
-
- for (i = 0; i < 256; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 256; i++)
{
- val = (color_prom[i+0x000]) | (color_prom[i+0x100]<<3) | (color_prom[i+0x200]<<6);
+ int bit0, bit1, bit2;
+ int const val = color_prom[i | 0x000] | (color_prom[i | 0x100] << 3) | (color_prom[i | 0x200] << 6);
bit0 = 0;
- bit1 = (val >> 7) & 0x01;
- bit2 = (val >> 6) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 5) & 0x01;
- bit1 = (val >> 4) & 0x01;
- bit2 = (val >> 3) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (val >> 2) & 0x01;
- bit1 = (val >> 1) & 0x01;
- bit2 = (val >> 0) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(val, 7);
+ bit2 = BIT(val, 6);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 5);
+ bit1 = BIT(val, 4);
+ bit2 = BIT(val, 3);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(val, 2);
+ bit1 = BIT(val, 1);
+ bit2 = BIT(val, 0);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -2726,12 +2726,11 @@ MACHINE_CONFIG_START(subsino_state::victor21)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(subsino_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", subsino_depth3)
+ GFXDECODE(config, m_gfxdecode, m_palette, subsino_depth3);
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(subsino_state, _2proms)
+ PALETTE(config, m_palette, FUNC(subsino_state::_2proms_palette), 0x100);
MCFG_VIDEO_START_OVERRIDE(subsino_state,subsino)
@@ -2770,12 +2769,11 @@ MACHINE_CONFIG_START(subsino_state::crsbingo)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(subsino_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", subsino_depth4)
+ GFXDECODE(config, m_gfxdecode, m_palette, subsino_depth4);
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(subsino_state, _2proms)
+ PALETTE(config, m_palette, FUNC(subsino_state::_2proms_palette), 0x100);
MCFG_VIDEO_START_OVERRIDE(subsino_state,subsino)
@@ -2812,12 +2810,11 @@ MACHINE_CONFIG_START(subsino_state::srider)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(subsino_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", subsino_depth4)
+ GFXDECODE(config, m_gfxdecode, m_palette, subsino_depth4);
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(subsino_state, _3proms)
+ PALETTE(config, m_palette, FUNC(subsino_state::_3proms_palette), 0x100);
MCFG_VIDEO_START_OVERRIDE(subsino_state,subsino)
@@ -2865,12 +2862,11 @@ MACHINE_CONFIG_START(subsino_state::tisub)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(subsino_state, screen_update_reels)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", subsino_depth4_reels)
+ GFXDECODE(config, m_gfxdecode, m_palette, subsino_depth4_reels);
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(subsino_state, _3proms)
+ PALETTE(config, m_palette, FUNC(subsino_state::_3proms_palette), 0x100);
MCFG_VIDEO_START_OVERRIDE(subsino_state, reels)
@@ -2907,12 +2903,12 @@ MACHINE_CONFIG_START(subsino_state::stbsub)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0+16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(subsino_state, screen_update_stbsub_reels)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", subsino_stbsub)
+ GFXDECODE(config, m_gfxdecode, m_palette, subsino_stbsub);
- MCFG_PALETTE_ADD("palette", 0x100)
- //MCFG_PALETTE_INIT_OWNER(subsino_state, _3proms)
+ PALETTE(config, m_palette).set_entries(0x100);
+ //PALETTE(config, m_palette, FUNC(subsino_state::_3proms_palette), 0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, m_palette)); // HMC HM86171 VGA 256 colour RAMDAC
ramdac.set_addrmap(0, &subsino_state::ramdac_map);
diff --git a/src/mame/drivers/summit.cpp b/src/mame/drivers/summit.cpp
index d326e85a98b..d2a7f4e0c06 100644
--- a/src/mame/drivers/summit.cpp
+++ b/src/mame/drivers/summit.cpp
@@ -26,26 +26,30 @@ needs inputs, prom decode, sound, artwork (lamps), probably some irq masking and
class summit_state : public driver_device
{
public:
- summit_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ summit_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_attr(*this, "attr"),
m_vram(*this, "vram"),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void summit(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_attr;
required_shared_ptr<uint8_t> m_vram;
- DECLARE_WRITE8_MEMBER(out_w);
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(summit);
- uint32_t screen_update_summit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
+
+ DECLARE_WRITE8_MEMBER(out_w);
+ void summit_palette(palette_device &palette) const;
+ uint32_t screen_update_summit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mainmap(address_map &map);
};
@@ -306,7 +310,7 @@ static GFXDECODE_START( gfx_summit )
GFXDECODE_ENTRY( "gfx1", 0, tiles8x8_layout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(summit_state, summit)
+void summit_state::summit_palette(palette_device &palette) const
{
}
@@ -323,12 +327,10 @@ MACHINE_CONFIG_START(summit_state::summit)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 16, 256-16-1)
MCFG_SCREEN_UPDATE_DRIVER(summit_state, screen_update_summit)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_summit)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(summit_state, summit)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_summit);
+ PALETTE(config, m_palette, FUNC(summit_state::summit_palette), 256);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/suna8.cpp b/src/mame/drivers/suna8.cpp
index cee556043a0..cf0abc02232 100644
--- a/src/mame/drivers/suna8.cpp
+++ b/src/mame/drivers/suna8.cpp
@@ -240,7 +240,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
8?, 9n?,an, bn y,y,?,? (player anims)
cn, dy, en, fn y,y,n,n
*/
- static const uint8_t swaptable[0x50] =
+ static constexpr uint8_t swaptable[0x50] =
{
1,1,1,1,0,0,1,1, 0,0,0,0,0,0,0,0, // 8000-ffff not used
1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,0,
@@ -259,12 +259,12 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
/* Opcodes */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[32] =
+ static constexpr uint8_t swaptable[32] =
{
1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,
1,1,0,1,1,1,1,1,1,1,1,1,0,1,0,0
};
- static const uint8_t xortable[32] =
+ static constexpr uint8_t xortable[32] =
{
0x04,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x04,0x45,0x00,0x04,0x00,0x04,0x00,0x00,
0x04,0x45,0x00,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x04,0x00,0x00
@@ -283,7 +283,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
/* Data */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
+ static constexpr uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
if (swaptable[(i & 0x7000) >> 12])
RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
@@ -318,7 +318,7 @@ void suna8_state::init_starfigh()
memcpy(decrypt, RAM, size);
for (int i = 0; i < 0x50000; i++)
{
- static const uint8_t swaptable[0x50] =
+ static constexpr uint8_t swaptable[0x50] =
{
1,1,1,1, 1,1,0,0, 0,0,0,0, 0,0,0,0, // 8000-ffff not used
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
@@ -337,12 +337,12 @@ void suna8_state::init_starfigh()
/* Opcodes */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[32] =
+ static constexpr uint8_t swaptable[32] =
{
0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,
0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
- static const uint8_t xortable[32] =
+ static constexpr uint8_t xortable[32] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x41,0x01,0x00,0x00,0x00,0x00,
0x01,0x01,0x41,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
@@ -361,7 +361,7 @@ void suna8_state::init_starfigh()
/* Data */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
+ static constexpr uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
if (swaptable[(i & 0x7000) >> 12])
RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45;
@@ -401,7 +401,7 @@ void suna8_state::init_sparkman()
memcpy(decrypt, RAM, size);
for (int i = 0; i < 0x50000; i++)
{
- static const uint8_t swaptable[0x50] =
+ static constexpr uint8_t swaptable[0x50] =
{
1,1,1,1, 0,0,1,1, 0,0,0,0, 0,0,0,0, // 8000-ffff not used
0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0,
@@ -420,12 +420,12 @@ void suna8_state::init_sparkman()
/* Opcodes */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[32] =
+ static constexpr uint8_t swaptable[32] =
{
0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,
0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0
};
- static const uint8_t xortable[32] =
+ static constexpr uint8_t xortable[32] =
{
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x00,0x00
@@ -444,7 +444,7 @@ void suna8_state::init_sparkman()
/* Data */
for (int i = 0; i < 0x8000; i++)
{
- static const uint8_t swaptable[8] = { 1,1,1,0,1,1,0,1 };
+ static constexpr uint8_t swaptable[8] = { 1,1,1,0,1,1,0,1 };
if (swaptable[(i & 0x7000) >> 12])
RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44;
@@ -1900,8 +1900,7 @@ void suna8_state::hardhead(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suna8);
- PALETTE(config, m_palette, 256);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256);
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_text)
@@ -1957,8 +1956,7 @@ void suna8_state::rranger(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suna8);
- PALETTE(config, m_palette, 256);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256);
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_text)
@@ -2025,8 +2023,7 @@ void suna8_state::brickzn11(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suna8);
- PALETTE(config, m_palette, 256 * 2); // 2 x Palette RAM
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256 * 2); // 2 x palette RAM
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_brickzn)
@@ -2099,8 +2096,8 @@ void suna8_state::hardhea2(machine_config &config)
TIMER(config, "scantimer").configure_scanline(FUNC(suna8_state::hardhea2_interrupt), "screen", 0, 1);
MCFG_MACHINE_RESET_OVERRIDE(suna8_state,hardhea2)
- m_palette->set_entries(256);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+
+ m_palette->set_format(palette_device::RGBx_444, 256);
m_palette->set_endianness(ENDIANNESS_BIG);
}
@@ -2140,8 +2137,7 @@ void suna8_state::starfigh(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suna8);
- PALETTE(config, m_palette, 256);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 256);
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_starfigh)
@@ -2193,8 +2189,7 @@ void suna8_state::sparkman(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suna8_x2); // 2 sprite "chips"
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_RRRRGGGGBBBBxxxx);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 512);
m_palette->set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(suna8_state,suna8_sparkman)
diff --git a/src/mame/drivers/supbtime.cpp b/src/mame/drivers/supbtime.cpp
index efd1befcb21..4e63f2bf75b 100644
--- a/src/mame/drivers/supbtime.cpp
+++ b/src/mame/drivers/supbtime.cpp
@@ -353,8 +353,7 @@ MACHINE_CONFIG_START(supbtime_state::supbtime)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supbtime)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_444, 1024);
DECO16IC(config, m_deco_tilegen, 0);
m_deco_tilegen->set_split(0);
diff --git a/src/mame/drivers/supdrapo.cpp b/src/mame/drivers/supdrapo.cpp
index e3f1bf12962..26335c0787b 100644
--- a/src/mame/drivers/supdrapo.cpp
+++ b/src/mame/drivers/supdrapo.cpp
@@ -74,15 +74,16 @@
class supdrapo_state : public driver_device
{
public:
- supdrapo_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ supdrapo_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_col_line(*this, "col_line"),
m_videoram(*this, "videoram"),
- m_char_bank(*this, "char_bank") { }
+ m_char_bank(*this, "char_bank")
+ { }
void supdrapo(machine_config &config);
@@ -110,7 +111,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(supdrapo);
+ void supdrapo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void sdpoker_mem(address_map &map);
@@ -128,19 +129,14 @@ void supdrapo_state::video_start()
uint32_t supdrapo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int x, y;
- int count;
- int color;
-
- count = 0;
-
- for(y = 0; y < 32; y++)
+ int count = 0;
+ for (int y = 0; y < 32; y++)
{
- for(x = 0; x < 32; x++)
+ for (int x = 0; x < 32; x++)
{
- int tile = m_videoram[count] + m_char_bank[count] * 0x100;
- /* Global Column Coloring, GUESS! */
- color = m_col_line[(x*2) + 1] ? (m_col_line[(x*2) + 1] - 1) & 7 : 0;
+ int const tile = m_videoram[count] + m_char_bank[count] * 0x100;
+ // Global Column Coloring, GUESS!
+ int const color = m_col_line[(x*2) + 1] ? (m_col_line[(x*2) + 1] - 1) & 7 : 0;
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile,color, 0, 0, x*8, y*8);
@@ -152,29 +148,29 @@ uint32_t supdrapo_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
}
-/*Maybe bit 2 & 3 of the second color prom are intensity bits? */
-PALETTE_INIT_MEMBER(supdrapo_state, supdrapo)
+// Maybe bit 2 & 3 of the second color prom are intensity bits?
+void supdrapo_state::supdrapo_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2 , r, g, b;
- int i;
- for (i = 0; i < 0x100; ++i)
+ for (int i = 0; i < 0x100; ++i)
{
- bit0 = 0;//(color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 0) & 0x01;
- bit2 = (color_prom[0] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = 0; // BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 0);
+ bit2 = BIT(color_prom[0], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = 0;//(color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[0] >> 2) & 0x01;
- bit2 = (color_prom[0] >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = 0; // BIT(color_prom[0], 3);
+ bit1 = BIT(color_prom[0], 2);
+ bit2 = BIT(color_prom[0], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = 0;//(color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0x100] >> 0) & 0x01;
- bit2 = (color_prom[0x100] >> 1) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = 0; // BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0x100], 0);
+ bit2 = BIT(color_prom[0x100], 1);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
@@ -472,11 +468,10 @@ MACHINE_CONFIG_START(supdrapo_state::supdrapo)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(supdrapo_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supdrapo)
- MCFG_PALETTE_ADD("palette", 0x100)
- MCFG_PALETTE_INIT_OWNER(supdrapo_state, supdrapo)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_supdrapo);
+ PALETTE(config, m_palette, FUNC(supdrapo_state::supdrapo_palette), 0x100);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/super80.cpp b/src/mame/drivers/super80.cpp
index 3ea65b8d3f4..cc1d59c7fa9 100644
--- a/src/mame/drivers/super80.cpp
+++ b/src/mame/drivers/super80.cpp
@@ -726,9 +726,9 @@ void super80_state::super80(machine_config &config)
m_screen->set_screen_update(FUNC(super80_state::screen_update_super80));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 32).set_init(FUNC(super80_state::palette_init_super80m));
-
+ PALETTE(config, m_palette, FUNC(super80_state::super80m_palette), 32);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_super80);
+
config.set_default_layout(layout_super80);
MCFG_VIDEO_START_OVERRIDE(super80_state,super80)
@@ -815,7 +815,8 @@ void super80_state::super80v(machine_config &config)
m_screen->set_screen_update(FUNC(super80_state::screen_update_super80v));
m_screen->screen_vblank().set(FUNC(super80_state::screen_vblank_super80m));
- PALETTE(config, m_palette, 32).set_init(FUNC(super80_state::palette_init_super80m));
+ PALETTE(config, m_palette, FUNC(super80_state::super80m_palette), 32);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_super80v);
MC6845(config, m_crtc, MASTER_CLOCK / SUPER80V_DOTS);
m_crtc->set_screen("screen");
@@ -823,7 +824,6 @@ void super80_state::super80v(machine_config &config)
m_crtc->set_char_width(SUPER80V_DOTS);
m_crtc->set_update_row_callback(FUNC(super80_state::crtc_update_row), this);
- GFXDECODE(config, m_gfxdecode, m_palette, gfx_super80v);
config.set_default_layout(layout_super80);
/* sound hardware */
diff --git a/src/mame/drivers/superchs.cpp b/src/mame/drivers/superchs.cpp
index cc5bbe8b6d1..932d8b66fb8 100644
--- a/src/mame/drivers/superchs.cpp
+++ b/src/mame/drivers/superchs.cpp
@@ -261,11 +261,10 @@ MACHINE_CONFIG_START(superchs_state::superchs)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(superchs_state, screen_update_superchs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superchs)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superchs);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 8192);
TC0480SCP(config, m_tc0480scp, 0);
m_tc0480scp->set_gfx_region(1);
diff --git a/src/mame/drivers/supercrd.cpp b/src/mame/drivers/supercrd.cpp
index 98d14f2d0c5..ff3e1dd79d2 100644
--- a/src/mame/drivers/supercrd.cpp
+++ b/src/mame/drivers/supercrd.cpp
@@ -177,27 +177,31 @@
class supercrd_state : public driver_device
{
public:
- supercrd_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ supercrd_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void supercrd(machine_config &config);
+protected:
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(supercrd_videoram_w);
DECLARE_WRITE8_MEMBER(supercrd_colorram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(supercrd);
- DECLARE_VIDEO_START(supercrd);
+ void supercrd_palette(palette_device &palette) const;
uint32_t screen_update_supercrd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
void supercrd_map(address_map &map);
};
@@ -206,40 +210,40 @@ private:
* Video Hardware *
*************************/
-PALETTE_INIT_MEMBER(supercrd_state, supercrd)
+void supercrd_state::supercrd_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rb[3] = { 1000, 470, 220 };
- static const int resistances_g [2] = { 470, 220 };
- double weights_r[3], weights_b[3], weights_g[2];
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rb[3] = { 1000, 470, 220 };
+ static constexpr int resistances_g [2] = { 470, 220 };
+ double weights_r[3], weights_b[3], weights_g[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rb, weights_r, 100, 0,
3, resistances_rb, weights_b, 100, 0,
2, resistances_g, weights_g, 100, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = combine_3_weights(weights_b, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- g = combine_2_weights(weights_g, bit0, bit1);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ // blue component */
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = combine_3_weights(weights_b, bit0, bit1, bit2);
+
+ // green component */
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const g = combine_2_weights(weights_g, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -273,7 +277,7 @@ TILE_GET_INFO_MEMBER(supercrd_state::get_bg_tile_info)
}
-VIDEO_START_MEMBER(supercrd_state, supercrd)
+void supercrd_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(supercrd_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 96, 29);
}
@@ -438,11 +442,8 @@ MACHINE_CONFIG_START(supercrd_state::supercrd)
MCFG_SCREEN_UPDATE_DRIVER(supercrd_state, screen_update_supercrd)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supercrd)
-
- MCFG_PALETTE_ADD("palette", 0x200)
- MCFG_PALETTE_INIT_OWNER(supercrd_state, supercrd)
- MCFG_VIDEO_START_OVERRIDE(supercrd_state, supercrd)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_supercrd);
+ PALETTE(config, "palette", FUNC(supercrd_state::supercrd_palette), 0x200);
// mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/8));
// crtc.set_screen("screen");
diff --git a/src/mame/drivers/superdq.cpp b/src/mame/drivers/superdq.cpp
index 77c65bf0e94..46fa1572638 100644
--- a/src/mame/drivers/superdq.cpp
+++ b/src/mame/drivers/superdq.cpp
@@ -34,8 +34,8 @@
class superdq_state : public driver_device
{
public:
- superdq_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ superdq_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_laserdisc(*this, "laserdisc"),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
@@ -45,6 +45,11 @@ public:
void superdq(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<pioneer_ldv1000_device> m_laserdisc;
uint8_t m_ld_in_latch;
@@ -53,20 +58,19 @@ private:
required_shared_ptr<uint8_t> m_videoram;
tilemap_t *m_tilemap;
int m_color_bank;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+ required_device<palette_device> m_palette;
+
DECLARE_WRITE8_MEMBER(superdq_videoram_w);
DECLARE_WRITE8_MEMBER(superdq_io_w);
DECLARE_READ8_MEMBER(superdq_ld_r);
DECLARE_WRITE8_MEMBER(superdq_ld_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(superdq);
+ void superdq_palette(palette_device &palette) const;
uint32_t screen_update_superdq(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(superdq_vblank);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
- required_device<palette_device> m_palette;
void superdq_io(address_map &map);
void superdq_map(address_map &map);
};
@@ -98,41 +102,39 @@ uint32_t superdq_state::screen_update_superdq(screen_device &screen, bitmap_rgb3
*
*************************************/
-PALETTE_INIT_MEMBER(superdq_state, superdq)
+void superdq_state::superdq_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
static const int resistances[3] = { 820, 390, 200 };
double rweights[3], gweights[3], bweights[2];
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 220, 0,
3, &resistances[0], gweights, 220, 0,
2, &resistances[1], bweights, 220, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < palette.entries(); i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 7) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- r = combine_3_weights(rweights, bit2, bit1, bit0);
+ // red component
+ bit0 = BIT(color_prom[i], 7);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 5);
+ int const r = combine_3_weights(rweights, bit2, bit1, bit0);
- /* green component */
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 3) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- g = combine_3_weights(gweights, bit2, bit1, bit0);
+ // green component
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 2);
+ int const g = combine_3_weights(gweights, bit2, bit1, bit0);
- /* blue component */
- bit0 = (color_prom[i] >> 1) & 0x01;
- bit1 = (color_prom[i] >> 0) & 0x01;
- b = combine_2_weights(bweights, bit1, bit0);
+ // blue component
+ bit0 = BIT(color_prom[i], 1);
+ bit1 = BIT(color_prom[i], 0);
+ int const b = combine_2_weights(bweights, bit1, bit0);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -345,21 +347,19 @@ MACHINE_CONFIG_START(superdq_state::superdq)
MCFG_LASERDISC_LDV1000_ADD("laserdisc")
MCFG_LASERDISC_OVERLAY_DRIVER(256, 256, superdq_state, screen_update_superdq)
- MCFG_LASERDISC_OVERLAY_PALETTE("palette")
+ MCFG_LASERDISC_OVERLAY_PALETTE(m_palette);
/* video hardware */
MCFG_LASERDISC_SCREEN_ADD_NTSC("screen", "laserdisc")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superdq)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(superdq_state, superdq)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superdq);
+ PALETTE(config, m_palette, FUNC(superdq_state::superdq_palette), 32);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- MCFG_DEVICE_ADD("snsnd", SN76496, MASTER_CLOCK/8)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "lspeaker", 0.8)
+ SN76496(config, "snsnd", MASTER_CLOCK/8).add_route(ALL_OUTPUTS, "lspeaker", 0.8);
MCFG_DEVICE_MODIFY("laserdisc")
MCFG_SOUND_ROUTE(0, "lspeaker", 1.0)
diff --git a/src/mame/drivers/superqix.cpp b/src/mame/drivers/superqix.cpp
index 15cf0ed8c9a..91b648c49be 100644
--- a/src/mame/drivers/superqix.cpp
+++ b/src/mame/drivers/superqix.cpp
@@ -1371,9 +1371,7 @@ void hotsmash_state::pbillian(machine_config &config)
screen.screen_vblank().set(FUNC(hotsmash_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_pbillian);
-
- PALETTE(config, m_palette, 512);
- m_palette->set_format(raw_to_rgb_converter(1, &hotsmash_state::BBGGRRII_decoder));
+ PALETTE(config, m_palette).set_format(1, &hotsmash_state::BBGGRRII, 512);
SPEAKER(config, "mono").front_center();
@@ -1413,9 +1411,7 @@ void superqix_state::sqix(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_sqix);
-
- PALETTE(config, m_palette, 256);
- m_palette->set_format(raw_to_rgb_converter(1, &superqix_state_base::BBGGRRII_decoder));
+ PALETTE(config, m_palette).set_format(1, &superqix_state::BBGGRRII, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/superwng.cpp b/src/mame/drivers/superwng.cpp
index b75e6189071..b5e4d5f66e2 100644
--- a/src/mame/drivers/superwng.cpp
+++ b/src/mame/drivers/superwng.cpp
@@ -45,8 +45,8 @@ TODO:
class superwng_state : public driver_device
{
public:
- superwng_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ superwng_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_videoram_bg(*this, "videorabg"),
@@ -59,6 +59,11 @@ public:
void superwng(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_audiocpu;
@@ -94,10 +99,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(superwng);
+ void superwng_palette(palette_device &palette) const;
uint32_t screen_update_superwng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(superwng_nmi_interrupt);
INTERRUPT_GEN_MEMBER(superwng_sound_nmi_assert);
@@ -202,7 +204,7 @@ uint32_t superwng_state::screen_update_superwng(screen_device &screen, bitmap_in
}
-static const uint8_t superwng_colors[]= /* temporary */
+static constexpr uint8_t superwng_colors[]= /* temporary */
{
0x00, 0xc4, 0xff, 0x87, 0x00, 0xb0, 0xff, 0x2f, 0x00, 0x07, 0xff, 0xe0, 0x00, 0x86, 0xff, 0xc6,
0x00, 0x07, 0x3f, 0xff, 0x00, 0xb0, 0x38, 0x27, 0x00, 0x20, 0xff, 0x27, 0x00, 0xa4, 0xff, 0x87,
@@ -210,31 +212,27 @@ static const uint8_t superwng_colors[]= /* temporary */
0x00, 0xc0, 0x07, 0x3f, 0x00, 0x1f, 0x3f, 0xff, 0x00, 0x86, 0x05, 0xff, 0x00, 0xc0, 0xe8, 0xff
};
-PALETTE_INIT_MEMBER(superwng_state, superwng)
+void superwng_state::superwng_palette(palette_device &palette) const
{
- int i;
- const uint8_t * ptr=superwng_colors;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- bit0 = BIT(*ptr, 0);
- bit1 = BIT(*ptr, 1);
- bit2 = BIT(*ptr, 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(superwng_colors[i], 0);
+ bit1 = BIT(superwng_colors[i], 1);
+ bit2 = BIT(superwng_colors[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = BIT(*ptr, 3);
- bit1 = BIT(*ptr, 4);
- bit2 = BIT(*ptr, 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(superwng_colors[i], 3);
+ bit1 = BIT(superwng_colors[i], 4);
+ bit2 = BIT(superwng_colors[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = BIT(*ptr, 6);
- bit1 = BIT(*ptr, 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ bit0 = BIT(superwng_colors[i], 6);
+ bit1 = BIT(superwng_colors[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
- palette.set_pen_color(i,rgb_t(r,g,b));
- ++ptr;
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -498,12 +496,11 @@ MACHINE_CONFIG_START(superwng_state::superwng)
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(superwng_state, screen_update_superwng)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superwng)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superwng);
- MCFG_PALETTE_ADD("palette", 0x40)
- MCFG_PALETTE_INIT_OWNER(superwng_state, superwng)
+ PALETTE(config, m_palette, FUNC(superwng_state::superwng_palette), 0x40);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp
index 06d3e732fa4..df00616a2ce 100644
--- a/src/mame/drivers/supracan.cpp
+++ b/src/mame/drivers/supracan.cpp
@@ -119,16 +119,15 @@ class supracan_state : public driver_device
{
public:
supracan_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_soundcpu(*this, "soundcpu"),
- m_cart(*this, "cartslot"),
- m_vram(*this, "vram"),
- m_soundram(*this, "soundram"),
- m_gfxdecode(*this, "gfxdecode"),
- m_screen(*this, "screen")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_soundcpu(*this, "soundcpu")
+ , m_cart(*this, "cartslot")
+ , m_vram(*this, "vram")
+ , m_soundram(*this, "soundram")
+ , m_gfxdecode(*this, "gfxdecode")
+ , m_screen(*this, "screen")
{
- m_m6502_reset = 0;
}
void supracan(machine_config &config);
@@ -162,25 +161,25 @@ private:
acan_dma_regs_t m_acan_dma_regs;
acan_sprdma_regs_t m_acan_sprdma_regs;
- uint16_t m_m6502_reset;
- uint8_t m_sound_irq_enable_reg;
- uint8_t m_sound_irq_source_reg;
- uint8_t m_sound_cpu_68k_irq_reg;
+ uint16_t m_m6502_reset = 0;
+ uint8_t m_sound_irq_enable_reg = 0;
+ uint8_t m_sound_irq_source_reg = 0;
+ uint8_t m_sound_cpu_68k_irq_reg = 0;
- emu_timer *m_video_timer;
- emu_timer *m_hbl_timer;
- emu_timer *m_line_on_timer;
- emu_timer *m_line_off_timer;
+ emu_timer *m_video_timer = nullptr;
+ emu_timer *m_hbl_timer = nullptr;
+ emu_timer *m_line_on_timer = nullptr;
+ emu_timer *m_line_off_timer = nullptr;
std::vector<uint8_t> m_vram_addr_swapped;
#if 0
- uint16_t *m_pram;
+ uint16_t *m_pram = nullptr;
#endif
- uint16_t m_sprite_count;
- uint32_t m_sprite_base_addr;
- uint8_t m_sprite_flags;
+ uint16_t m_sprite_count = 0;
+ uint32_t m_sprite_base_addr = 0;
+ uint8_t m_sprite_flags = 0;
uint32_t m_tilemap_base_addr[3];
int m_tilemap_scrollx[3];
@@ -220,7 +219,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(supracan);
+ void supracan_palette(palette_device &palette) const;
uint32_t screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(supracan_irq);
INTERRUPT_GEN_MEMBER(supracan_sound_irq);
@@ -1352,20 +1351,18 @@ static INPUT_PORTS_START( supracan )
PORT_BIT(0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(4) PORT_NAME("P4 Button A")
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(supracan_state, supracan)
+void supracan_state::supracan_palette(palette_device &palette) const
{
// Used for debugging purposes for now
- //#if 0
- int i, r, g, b;
-
- for( i = 0; i < 32768; i++ )
+//#if 0
+ for (int i = 0; i < 32768; i++)
{
- r = (i & 0x1f) << 3;
- g = ((i >> 5) & 0x1f) << 3;
- b = ((i >> 10) & 0x1f) << 3;
- palette.set_pen_color( i, r, g, b );
+ int const r = (i & 0x1f) << 3;
+ int const g = ((i >> 5) & 0x1f) << 3;
+ int const b = ((i >> 10) & 0x1f) << 3;
+ palette.set_pen_color(i, r, g, b);
}
- //#endif
+//#endif
}
WRITE16_MEMBER( supracan_state::_68k_soundram_w )
@@ -1904,9 +1901,7 @@ MACHINE_CONFIG_START(supracan_state::supracan)
MCFG_SCREEN_UPDATE_DRIVER(supracan_state, screen_update_supracan)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD( "palette", 32768 )
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
- MCFG_PALETTE_INIT_OWNER(supracan_state, supracan)
+ PALETTE(config, "palette", FUNC(supracan_state::supracan_palette)).set_format(palette_device::xBGR_555, 32768);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_supracan)
diff --git a/src/mame/drivers/suprloco.cpp b/src/mame/drivers/suprloco.cpp
index 8692c71ac66..9d0428c4996 100644
--- a/src/mame/drivers/suprloco.cpp
+++ b/src/mame/drivers/suprloco.cpp
@@ -191,9 +191,8 @@ MACHINE_CONFIG_START(suprloco_state::suprloco)
MCFG_SCREEN_UPDATE_DRIVER(suprloco_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_suprloco)
- MCFG_PALETTE_ADD("palette", 512+256)
- MCFG_PALETTE_INIT_OWNER(suprloco_state, suprloco)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_suprloco);
+ PALETTE(config, "palette", FUNC(suprloco_state::suprloco_palette), 512+256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/suprridr.cpp b/src/mame/drivers/suprridr.cpp
index 1706c1e3ef2..c04ea685c0b 100644
--- a/src/mame/drivers/suprridr.cpp
+++ b/src/mame/drivers/suprridr.cpp
@@ -342,11 +342,10 @@ MACHINE_CONFIG_START(suprridr_state::suprridr)
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(suprridr_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_suprridr)
- MCFG_PALETTE_ADD("palette", 96)
- MCFG_PALETTE_INIT_OWNER(suprridr_state, suprridr)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_suprridr);
+ PALETTE(config, m_palette, FUNC(suprridr_state::suprridr_palette), 96);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/suprslam.cpp b/src/mame/drivers/suprslam.cpp
index 3b1395c6615..d1ba49b18dd 100644
--- a/src/mame/drivers/suprslam.cpp
+++ b/src/mame/drivers/suprslam.cpp
@@ -286,7 +286,7 @@ MACHINE_CONFIG_START(suprslam_state::suprslam)
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)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_suprslam);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
@@ -295,10 +295,9 @@ MACHINE_CONFIG_START(suprslam_state::suprslam)
MCFG_SCREEN_SIZE(64*8, 64*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(suprslam_state, screen_update_suprslam)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xGGGGGBBBBBRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xGBR_555, 0x800);
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_tile_indirect_cb(FUNC(suprslam_state::suprslam_tile_callback), this);
diff --git a/src/mame/drivers/surpratk.cpp b/src/mame/drivers/surpratk.cpp
index 0ed23af3a40..99a13015cdc 100644
--- a/src/mame/drivers/surpratk.cpp
+++ b/src/mame/drivers/surpratk.cpp
@@ -30,9 +30,9 @@ WRITE8_MEMBER(surpratk_state::surpratk_videobank_w)
if (data & 0xf8)
logerror("%s: videobank = %02x\n", machine().describe_context(), data);
- /* bit 0 = select 053245 at 0000-07ff */
- /* bit 1 = select palette at 0000-07ff */
- /* bit 2 = select palette bank 0 or 1 */
+ // bit 0 = select 053245 at 0000-07ff
+ // bit 1 = select palette at 0000-07ff
+ // bit 2 = select palette bank 0 or 1
if (BIT(data, 1))
m_bank0000->set_bank(2 + BIT(data, 2));
else
@@ -44,14 +44,14 @@ WRITE8_MEMBER(surpratk_state::surpratk_5fc0_w)
if ((data & 0xf4) != 0x10)
logerror("%04x: 3fc0 = %02x\n",m_maincpu->pc(),data);
- /* bit 0/1 = coin counters */
+ // bit 0/1 = coin counters
machine().bookkeeping().coin_counter_w(0, data & 0x01);
machine().bookkeeping().coin_counter_w(1, data & 0x02);
- /* bit 3 = enable char ROM reading through the video RAM */
+ // bit 3 = enable char ROM reading through the video RAM
m_k052109->set_rmrd_line((data & 0x08) ? ASSERT_LINE : CLEAR_LINE);
- /* other bits unknown */
+ // other bits unknown
}
@@ -188,9 +188,8 @@ void surpratk_state::surpratk(machine_config &config)
screen.set_screen_update(FUNC(surpratk_state::screen_update_surpratk));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/svision.cpp b/src/mame/drivers/svision.cpp
index f1a0f0472c7..f58246bd9b0 100644
--- a/src/mame/drivers/svision.cpp
+++ b/src/mame/drivers/svision.cpp
@@ -301,62 +301,56 @@ static INPUT_PORTS_START( svisions )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_START) PORT_NAME("2nd Start/Pause") PORT_PLAYER(2)
INPUT_PORTS_END
-/* most games contain their graphics in roms, and have hardware to
- draw complete rectangular objects */
+// most games contain their graphics in roms, and have hardware to draw complete rectangular objects
-/* palette in red, green, blue triples */
-static const unsigned char svision_palette[] =
+// palette in red, green, blue triples
+static constexpr rgb_t svision_pens[] =
{
#if 0
- /* greens grabbed from a scan of a handheld
- * in its best adjustment for contrast
- */
- 86, 121, 86,
- 81, 115, 90,
- 74, 107, 101,
- 54, 78, 85
+ // greens grabbed from a scan of a handheld in its best adjustment for contrast
+ { 86, 121, 86 },
+ { 81, 115, 90 },
+ { 74, 107, 101 },
+ { 54, 78, 85 }
#else
- /* grabbed from chris covell's black white pics */
- 0xe0, 0xe0, 0xe0,
- 0xb9, 0xb9, 0xb9,
- 0x54, 0x54, 0x54,
- 0x12, 0x12, 0x12
+ // grabbed from chris covell's black white pics
+ { 0xe0, 0xe0, 0xe0 },
+ { 0xb9, 0xb9, 0xb9 },
+ { 0x54, 0x54, 0x54 },
+ { 0x12, 0x12, 0x12 }
#endif
};
-/* palette in RGB triplets */
-static const unsigned char svisionp_palette[] =
+// palette in RGB triplets
+static constexpr rgb_t svisionp_pens[] =
{
// pal
- 1, 1, 3,
- 5, 18, 9,
- 48, 76, 100,
- 190, 190, 190
+ { 1, 1, 3 },
+ { 5, 18, 9 },
+ { 48, 76, 100 },
+ { 190, 190, 190 }
};
-/* palette in RGB triplets */
-static const unsigned char svisionn_palette[] =
+// palette in RGB triplets
+static constexpr rgb_t svisionn_pens[] =
{
- 0, 0, 0,
- 188, 242, 244, // darker
- 129, 204, 255,
- 245, 249, 248
+ { 0, 0, 0 },
+ { 188, 242, 244 }, // darker
+ { 129, 204, 255 },
+ { 245, 249, 248 }
};
-PALETTE_INIT_MEMBER(svision_state, svision)
+void svision_state::svision_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(svision_palette) / 3; i++)
- palette.set_pen_color(i, svision_palette[i*3], svision_palette[i*3+1], svision_palette[i*3+2]);
+ palette.set_pen_colors(0, svision_pens);
}
-PALETTE_INIT_MEMBER(svision_state,svisionn)
+void svision_state::svisionn_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(svisionn_palette) / 3; i++)
- palette.set_pen_color(i, svisionn_palette[i*3], svisionn_palette[i*3+1], svisionn_palette[i*3+2]);
+ palette.set_pen_colors(0, svisionn_pens);
}
-PALETTE_INIT_MEMBER(svision_state,svisionp)
+void svision_state::svisionp_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(svisionn_palette) / 3; i++)
- palette.set_pen_color(i, svisionp_palette[i*3], svisionp_palette[i*3+1], svisionp_palette[i*3+2]);
+ palette.set_pen_colors(0, svisionp_pens);
}
uint32_t svision_state::screen_update_svision(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -494,10 +488,10 @@ MACHINE_RESET_MEMBER(svision_state,tvlink)
memset(m_reg + 0x800, 0xff, 0x40); // normally done from m_tvlink microcontroller
m_reg[0x82a] = 0xdf;
- m_tvlink.palette[0] = MAKE24_RGB32(svisionp_palette[ 0], svisionp_palette[ 1], svisionp_palette[ 2]);
- m_tvlink.palette[1] = MAKE24_RGB32(svisionp_palette[ 3], svisionp_palette[ 4], svisionp_palette[ 5]);
- m_tvlink.palette[2] = MAKE24_RGB32(svisionp_palette[ 6], svisionp_palette[ 7], svisionp_palette[ 8]);
- m_tvlink.palette[3] = MAKE24_RGB32(svisionp_palette[ 9], svisionp_palette[10], svisionp_palette[11]);
+ m_tvlink.palette[0] = MAKE24_RGB32(svisionp_pens[0].r(), svisionp_pens[0].g(), svisionp_pens[0].b());
+ m_tvlink.palette[1] = MAKE24_RGB32(svisionp_pens[1].r(), svisionp_pens[1].g(), svisionp_pens[1].b());
+ m_tvlink.palette[2] = MAKE24_RGB32(svisionp_pens[2].r(), svisionp_pens[2].g(), svisionp_pens[2].b());
+ m_tvlink.palette[3] = MAKE24_RGB32(svisionp_pens[3].r(), svisionp_pens[3].g(), svisionp_pens[3].b());
}
MACHINE_CONFIG_START(svision_state::svision_base)
@@ -532,8 +526,7 @@ MACHINE_CONFIG_START(svision_state::svision)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, svision_state, frame_int_w))
- MCFG_PALETTE_ADD(m_palette, ARRAY_LENGTH(svision_palette) * 3)
- MCFG_PALETTE_INIT_OWNER(svision_state, svision )
+ PALETTE(config, m_palette, FUNC(svision_state::svision_palette), ARRAY_LENGTH(svision_pens));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(svision_state::svisions)
@@ -546,14 +539,14 @@ MACHINE_CONFIG_START(svision_state::svisionp)
m_maincpu->set_clock(4430000);
m_screen->set_refresh(HZ_TO_ATTOSECONDS(50));
- m_palette->set_init(palette_init_delegate(&svision_state::palette_init_svisionp, "svision_state::palette_init_svisionp", this));
+ m_palette->set_init(FUNC(svision_state::svisionp_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(svision_state::svisionn)
svision(config);
m_maincpu->set_clock(3560000/*?*/);
m_screen->set_refresh(HZ_TO_ATTOSECONDS(60));
- m_palette->set_init(palette_init_delegate(&svision_state::palette_init_svisionn, "svision_state::palette_init_svisionn", this));
+ m_palette->set_init(FUNC(svision_state::svisionn_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(svision_state::tvlinkp)
diff --git a/src/mame/drivers/svmu.cpp b/src/mame/drivers/svmu.cpp
index dd204070b74..c1e3b142858 100644
--- a/src/mame/drivers/svmu.cpp
+++ b/src/mame/drivers/svmu.cpp
@@ -32,25 +32,21 @@ class svmu_state : public driver_device
{
public:
svmu_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_flash(*this, "flash"),
- m_speaker(*this, "speaker"),
- m_bios(*this, "bios")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_flash(*this, "flash")
+ , m_speaker(*this, "speaker")
+ , m_bios(*this, "bios")
+ { }
void svmu(machine_config &config);
-private:
- required_device<lc8670_cpu_device> m_maincpu;
- required_device<intelfsh8_device> m_flash;
- required_device<speaker_sound_device> m_speaker;
- required_region_ptr<uint8_t> m_bios;
-
- LC8670_LCD_UPDATE(svmu_lcd_update);
- DECLARE_PALETTE_INIT(svmu);
+protected:
virtual void machine_reset() override;
+private:
+ LC8670_LCD_UPDATE(svmu_lcd_update);
+ void svmu_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(page_w);
DECLARE_READ8_MEMBER(prog_r);
DECLARE_WRITE8_MEMBER(prog_w);
@@ -62,6 +58,11 @@ private:
void svmu_io_mem(address_map &map);
void svmu_mem(address_map &map);
+ required_device<lc8670_cpu_device> m_maincpu;
+ required_device<intelfsh8_device> m_flash;
+ required_device<speaker_sound_device> m_speaker;
+ required_region_ptr<uint8_t> m_bios;
+
uint8_t m_page;
};
@@ -163,7 +164,7 @@ void svmu_state::machine_reset()
m_page = 0;
}
-PALETTE_INIT_MEMBER(svmu_state, svmu)
+void svmu_state::svmu_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -331,7 +332,7 @@ void svmu_state::svmu(machine_config &config)
screen.set_palette("palette");
config.set_default_layout(layout_svmu);
- PALETTE(config, "palette", 2).set_init(FUNC(svmu_state::palette_init_svmu));
+ PALETTE(config, "palette", FUNC(svmu_state::svmu_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/swyft.cpp b/src/mame/drivers/swyft.cpp
index 0761e59ea93..af132f2be56 100644
--- a/src/mame/drivers/swyft.cpp
+++ b/src/mame/drivers/swyft.cpp
@@ -767,7 +767,7 @@ void swyft_state::swyft(machine_config &config)
screen.set_screen_update(FUNC(swyft_state::screen_update_swyft));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
ACIA6850(config, m_acia6850, 0);
// acia rx and tx clocks come from one of the VIA pins and are tied together, fix this below? acia e clock comes from 68008
diff --git a/src/mame/drivers/sys2900.cpp b/src/mame/drivers/sys2900.cpp
index 0e1b84e7872..3ab265c8496 100644
--- a/src/mame/drivers/sys2900.cpp
+++ b/src/mame/drivers/sys2900.cpp
@@ -156,7 +156,7 @@ MACHINE_CONFIG_START(sys2900_state::sys2900)
MCFG_SCREEN_UPDATE_DRIVER(sys2900_state, screen_update_sys2900)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
Z80CTC(config, "ctc", 0);
Z80PIO(config, "pio", 0);
diff --git a/src/mame/drivers/sys9002.cpp b/src/mame/drivers/sys9002.cpp
index 9c670ef798b..7820b4fc476 100644
--- a/src/mame/drivers/sys9002.cpp
+++ b/src/mame/drivers/sys9002.cpp
@@ -135,7 +135,7 @@ MACHINE_CONFIG_START(sys9002_state::sys9002)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
//MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mx2178)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* Devices */
mc6845_device &crtc(MC6845(config, "crtc", XTAL(2'000'000))); // clk unknown
diff --git a/src/mame/drivers/system1.cpp b/src/mame/drivers/system1.cpp
index 8d259fe88b1..c077f2ceea1 100644
--- a/src/mame/drivers/system1.cpp
+++ b/src/mame/drivers/system1.cpp
@@ -2188,8 +2188,7 @@ void system1_state::sys1ppi(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_system1);
-
- PALETTE(config, m_palette, 2048).set_format(PALETTE_FORMAT_BBGGGRRR);
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 2048);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp
index a6e10486542..009e259719f 100644
--- a/src/mame/drivers/system16.cpp
+++ b/src/mame/drivers/system16.cpp
@@ -2172,8 +2172,8 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::system16_base)
MCFG_SCREEN_UPDATE_DRIVER(segas1x_bootleg_state, screen_update_system16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sys16)
- MCFG_PALETTE_ADD("palette", 2048*SHADOW_COLORS_MULTIPLIER)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sys16);
+ PALETTE(config, "palette").set_entries(2048*SHADOW_COLORS_MULTIPLIER);
MCFG_VIDEO_START_OVERRIDE(segas1x_bootleg_state,system16)
@@ -2269,9 +2269,8 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::goldnaxeb_base)
MCFG_SCREEN_UPDATE_DRIVER(segas1x_bootleg_state, screen_update_system16)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sys16)
-
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 2048*SHADOW_COLORS_MULTIPLIER)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sys16);
+ PALETTE(config, "palette", palette_device::BLACK, 2048*SHADOW_COLORS_MULTIPLIER);
SEGA_SYS16B_SPRITES(config, m_sprites, 0);
m_sprites->set_local_originx(189-121);
@@ -2284,8 +2283,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(segas1x_bootleg_state::goldnaxeb1)
goldnaxeb_base(config);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x2000*SHADOW_COLORS_MULTIPLIER)
+ subdevice<palette_device>("palette")->set_entries(0x2000*SHADOW_COLORS_MULTIPLIER);
z80_ym2151_upd7759(config);
MACHINE_CONFIG_END
@@ -2298,8 +2296,7 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::goldnaxeb2)
MCFG_DEVICE_PROGRAM_MAP(goldnaxeb2_map)
MCFG_DEVICE_REMOVE_ADDRESS_MAP(AS_OPCODES)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(0x2000*SHADOW_COLORS_MULTIPLIER)
+ subdevice<palette_device>("palette")->set_entries(0x2000*SHADOW_COLORS_MULTIPLIER);
datsu_2x_ym2203_msm5205(config);
MACHINE_CONFIG_END
@@ -2439,8 +2436,8 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::system18)
MCFG_SCREEN_UPDATE_DRIVER(segas1x_bootleg_state, screen_update_system18old)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sys16)
- MCFG_PALETTE_ADD("palette", (2048+2048)*SHADOW_COLORS_MULTIPLIER) // 64 extra colours for vdp (but we use 2048 so shadow mask works)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sys16);
+ PALETTE(config, "palette").set_entries((2048+2048)*SHADOW_COLORS_MULTIPLIER); // 64 extra colours for vdp (but we use 2048 so shadow mask works)
MCFG_VIDEO_START_OVERRIDE(segas1x_bootleg_state,system18old)
@@ -2495,8 +2492,8 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::astormb2)
MCFG_SCREEN_UPDATE_DRIVER(segas1x_bootleg_state, screen_update_system18old)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sys16)
- MCFG_PALETTE_ADD("palette", (2048+2048)*SHADOW_COLORS_MULTIPLIER) // 64 extra colours for vdp (but we use 2048 so shadow mask works)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sys16);
+ PALETTE(config, "palette").set_entries((2048+2048)*SHADOW_COLORS_MULTIPLIER); // 64 extra colours for vdp (but we use 2048 so shadow mask works)
MCFG_VIDEO_START_OVERRIDE(segas1x_bootleg_state,system18old)
@@ -2590,8 +2587,8 @@ MACHINE_CONFIG_START(segas1x_bootleg_state::ddcrewbl)
MCFG_SCREEN_UPDATE_DRIVER(segas1x_bootleg_state, screen_update_system18old)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_sys16)
- MCFG_PALETTE_ADD("palette", (2048+2048)*SHADOW_COLORS_MULTIPLIER)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_sys16);
+ PALETTE(config, "palette").set_entries((2048+2048)*SHADOW_COLORS_MULTIPLIER);
MCFG_VIDEO_START_OVERRIDE(segas1x_bootleg_state,system18old)
diff --git a/src/mame/drivers/tagteam.cpp b/src/mame/drivers/tagteam.cpp
index 82d89150c8a..185e8590854 100644
--- a/src/mame/drivers/tagteam.cpp
+++ b/src/mame/drivers/tagteam.cpp
@@ -227,11 +227,10 @@ MACHINE_CONFIG_START(tagteam_state::tagteam)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(tagteam_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tagteam)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(tagteam_state, tagteam)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tagteam);
+ PALETTE(config, m_palette, FUNC(tagteam_state::tagteam_palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -240,7 +239,6 @@ MACHINE_CONFIG_START(tagteam_state::tagteam)
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, M6502_IRQ_LINE);
AY8910(config, "ay1", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "speaker", 0.25);
-
AY8910(config, "ay2", XTAL(12'000'000)/8).add_route(ALL_OUTPUTS, "speaker", 0.25);
MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.25) // unknown DAC
diff --git a/src/mame/drivers/tail2nos.cpp b/src/mame/drivers/tail2nos.cpp
index 56566fef559..8e595e64e54 100644
--- a/src/mame/drivers/tail2nos.cpp
+++ b/src/mame/drivers/tail2nos.cpp
@@ -256,11 +256,10 @@ MACHINE_CONFIG_START(tail2nos_state::tail2nos)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(tail2nos_state, screen_update_tail2nos)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tail2nos)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tail2nos);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
K051316(config, m_k051316, 0);
m_k051316->set_palette(m_palette);
diff --git a/src/mame/drivers/taito_b.cpp b/src/mame/drivers/taito_b.cpp
index 469b22787de..e5856fc65a2 100644
--- a/src/mame/drivers/taito_b.cpp
+++ b/src/mame/drivers/taito_b.cpp
@@ -1755,10 +1755,9 @@ MACHINE_CONFIG_START(taitob_state::rastsag2)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -1812,10 +1811,9 @@ MACHINE_CONFIG_START(taitob_state::masterw)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -1851,8 +1849,7 @@ MACHINE_CONFIG_START(taitob_state::tetrist) /* Nastar conversion kit with slight
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(tetrist_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MACHINE_CONFIG_END
@@ -1890,10 +1887,9 @@ MACHINE_CONFIG_START(taitob_state::ashura)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -1947,10 +1943,9 @@ MACHINE_CONFIG_START(taitob_state::crimec)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2005,10 +2000,9 @@ MACHINE_CONFIG_START(taitob_state::hitice)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,hitice)
MCFG_VIDEO_RESET_OVERRIDE(taitob_state,hitice)
@@ -2068,10 +2062,9 @@ MACHINE_CONFIG_START(taitob_state::rambo3p)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2126,10 +2119,9 @@ MACHINE_CONFIG_START(taitob_state::rambo3)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2189,10 +2181,9 @@ MACHINE_CONFIG_START(taitob_state::pbobble)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2252,10 +2243,9 @@ MACHINE_CONFIG_START(taitob_state::spacedx)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2309,10 +2299,9 @@ MACHINE_CONFIG_START(taitob_state::spacedxo)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2372,10 +2361,9 @@ MACHINE_CONFIG_START(taitob_state::qzshowby)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2429,10 +2417,9 @@ MACHINE_CONFIG_START(taitob_state::viofight)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2491,10 +2478,9 @@ MACHINE_CONFIG_START(taitob_state::silentd)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2548,10 +2534,9 @@ MACHINE_CONFIG_START(taitob_state::selfeena)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2614,10 +2599,9 @@ MACHINE_CONFIG_START(taitob_state::ryujin)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2678,10 +2662,9 @@ MACHINE_CONFIG_START(taitob_state::sbm)
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_taitob)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_state,taitob_core)
@@ -2735,8 +2718,7 @@ MACHINE_CONFIG_START(taitob_c_state::realpunc)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitob_c_state, screen_update_realpunc)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitob_c_state,realpunc)
diff --git a/src/mame/drivers/taito_f2.cpp b/src/mame/drivers/taito_f2.cpp
index 29e7a9c9942..b805a49b80d 100644
--- a/src/mame/drivers/taito_f2.cpp
+++ b/src/mame/drivers/taito_f2.cpp
@@ -2870,11 +2870,10 @@ MACHINE_CONFIG_START(taitof2_state::taito_f2)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, taitof2_state, screen_vblank_no_buffer))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitof2)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_taitof2);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_default)
@@ -2920,8 +2919,8 @@ MACHINE_CONFIG_START(taitof2_state::taito_f2_tc0510nio )
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)
+
+ m_palette->set_format(palette_device::xRGB_555, 4096);
MACHINE_CONFIG_END
void taitof2_state::taito_f2_te7750(machine_config &config)
@@ -3163,8 +3162,7 @@ MACHINE_CONFIG_START(taitof2_state::ssi)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(ssi_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ m_palette->set_format(palette_device::RGBx_444, 4096);
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_ssi)
@@ -3188,8 +3186,7 @@ MACHINE_CONFIG_START(taitof2_state::gunfront)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(gunfront_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ m_palette->set_format(palette_device::RGBx_444, 4096);
/* video hardware */
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_gunfront)
@@ -3220,8 +3217,7 @@ MACHINE_CONFIG_START(taitof2_state::growl)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3325,8 +3321,7 @@ MACHINE_CONFIG_START(taitof2_state::koshien)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3347,8 +3342,7 @@ MACHINE_CONFIG_START(taitof2_state::yuyugogo)
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(yuyugogo_map)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ m_palette->set_format(palette_device::RGBx_444, 4096);
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_yuyugogo)
@@ -3479,9 +3473,7 @@ MACHINE_CONFIG_START(taitof2_state::metalb)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_deadconx)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(8192)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 8192);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_metalb)
MCFG_SCREEN_MODIFY("screen")
@@ -3532,8 +3524,7 @@ MACHINE_CONFIG_START(taitof2_state::yesnoj)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_yuyugogo)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_yesnoj)
MCFG_SCREEN_MODIFY("screen")
@@ -3559,8 +3550,7 @@ MACHINE_CONFIG_START(taitof2_state::deadconx)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_deadconx)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_deadconx)
MCFG_SCREEN_MODIFY("screen")
@@ -3615,8 +3605,7 @@ MACHINE_CONFIG_START(taitof2_state::dinorex)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3641,8 +3630,7 @@ MACHINE_CONFIG_START(taitof2_state::qjinsei)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3667,8 +3655,7 @@ MACHINE_CONFIG_START(taitof2_state::qcrayon)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3693,8 +3680,7 @@ MACHINE_CONFIG_START(taitof2_state::qcrayon2)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DRIVER(taitof2_state, screen_update_taitof2_pri)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBRGBx)
+ m_palette->set_format(palette_device::RRRRGGGGBBBBRGBx, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3766,9 +3752,8 @@ MACHINE_CONFIG_START(taitof2_state::cameltrya)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, taitof2_state, screen_vblank_no_buffer))
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pivot)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pivot);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_dondokod)
@@ -3835,9 +3820,8 @@ MACHINE_CONFIG_START(taitof2_state::driveout)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, taitof2_state, screen_vblank_no_buffer))
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_pivot)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_pivot);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitof2_state,taitof2_driftout)
diff --git a/src/mame/drivers/taito_f3.cpp b/src/mame/drivers/taito_f3.cpp
index 9270c17a389..d77c43d9f47 100644
--- a/src/mame/drivers/taito_f3.cpp
+++ b/src/mame/drivers/taito_f3.cpp
@@ -476,8 +476,8 @@ void taito_f3_state::f3(machine_config &config)
m_screen->set_screen_update(FUNC(taito_f3_state::screen_update_f3));
m_screen->screen_vblank().set(FUNC(taito_f3_state::screen_vblank_f3));
- GFXDECODE(config, m_gfxdecode, "palette", gfx_taito_f3);
- PALETTE(config, m_palette, 0x2000);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_taito_f3);
+ PALETTE(config, m_palette).set_entries(0x2000);
/* sound hardware */
TAITO_EN(config, m_taito_en, 0);
@@ -569,8 +569,8 @@ void taito_f3_state::bubsympb(machine_config &config)
m_screen->set_screen_update(FUNC(taito_f3_state::screen_update_f3));
m_screen->screen_vblank().set(FUNC(taito_f3_state::screen_vblank_f3));
- GFXDECODE(config, m_gfxdecode, "palette", gfx_bubsympb);
- PALETTE(config, m_palette, 0x2000);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_bubsympb);
+ PALETTE(config, m_palette).set_entries(0x2000);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/taito_h.cpp b/src/mame/drivers/taito_h.cpp
index ddbe669cd30..f276e75f095 100644
--- a/src/mame/drivers/taito_h.cpp
+++ b/src/mame/drivers/taito_h.cpp
@@ -672,11 +672,10 @@ MACHINE_CONFIG_START(taitoh_state::syvalion)
MCFG_SCREEN_SIZE(64*16, 64*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 3*16, 28*16-1)
MCFG_SCREEN_UPDATE_DRIVER(taitoh_state, screen_update_syvalion)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_syvalion)
- MCFG_PALETTE_ADD(m_palette, 33*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_syvalion);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 33*16);
TC0080VCO(config, m_tc0080vco, 0);
m_tc0080vco->set_gfx_region(0);
@@ -728,11 +727,10 @@ MACHINE_CONFIG_START(taitoh_state::recordbr)
MCFG_SCREEN_SIZE(64*16, 64*16)
MCFG_SCREEN_VISIBLE_AREA(1*16, 21*16-1, 2*16, 17*16-1)
MCFG_SCREEN_UPDATE_DRIVER(taitoh_state, screen_update_recordbr)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_recordbr)
- MCFG_PALETTE_ADD(m_palette, 32*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_recordbr);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 32*16);
TC0080VCO(config, m_tc0080vco, 0);
m_tc0080vco->set_gfx_region(0);
@@ -795,11 +793,10 @@ MACHINE_CONFIG_START(taitoh_state::dleague)
MCFG_SCREEN_SIZE(64*16, 64*16)
MCFG_SCREEN_VISIBLE_AREA(1*16, 21*16-1, 2*16, 17*16-1)
MCFG_SCREEN_UPDATE_DRIVER(taitoh_state, screen_update_dleague)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_dleague)
- MCFG_PALETTE_ADD(m_palette, 33*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_dleague);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 33*16);
TC0080VCO(config, m_tc0080vco, 0);
m_tc0080vco->set_gfx_region(0);
diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp
index 8693f05170c..f2cce198f88 100644
--- a/src/mame/drivers/taito_l.cpp
+++ b/src/mame/drivers/taito_l.cpp
@@ -1465,11 +1465,10 @@ MACHINE_CONFIG_START(taitol_state::l_system_video)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitol_state, screen_update_taitol)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, taitol_state, screen_vblank_taitol))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", taito_l)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, taito_l);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_444, 256);
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", taitol_state, vbl_interrupt, "screen", 0, 1)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/taito_o.cpp b/src/mame/drivers/taito_o.cpp
index 308ffc471ce..06f1a166ba3 100644
--- a/src/mame/drivers/taito_o.cpp
+++ b/src/mame/drivers/taito_o.cpp
@@ -247,11 +247,10 @@ MACHINE_CONFIG_START(taitoo_state::parentj)
MCFG_SCREEN_SIZE(64*16, 64*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 3*16, 31*16-1)
MCFG_SCREEN_UPDATE_DRIVER(taitoo_state, screen_update_parentj)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_parentj)
- MCFG_PALETTE_ADD("palette", 33*16)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_parentj);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 33*16);
TC0080VCO(config, m_tc0080vco, 0);
m_tc0080vco->set_gfx_region(0);
diff --git a/src/mame/drivers/taito_x.cpp b/src/mame/drivers/taito_x.cpp
index eb3847a1c43..c7b0a82c3d9 100644
--- a/src/mame/drivers/taito_x.cpp
+++ b/src/mame/drivers/taito_x.cpp
@@ -859,11 +859,10 @@ MACHINE_CONFIG_START(taitox_state::superman)
MCFG_SCREEN_SIZE(52*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitox_state, screen_update_seta_no_layers)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superman)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superman);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers)
@@ -907,11 +906,10 @@ MACHINE_CONFIG_START(taitox_state::daisenpu)
MCFG_SCREEN_SIZE(52*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitox_state, screen_update_seta_no_layers)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superman)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superman);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers)
@@ -953,11 +951,10 @@ MACHINE_CONFIG_START(taitox_state::gigandes)
MCFG_SCREEN_SIZE(52*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitox_state, screen_update_seta_no_layers)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_superman)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_superman);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state,seta_no_layers)
@@ -1001,11 +998,10 @@ MACHINE_CONFIG_START(taitox_state::ballbros)
MCFG_SCREEN_SIZE(52*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 48*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taitox_state, screen_update_seta_no_layers)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ballbros)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_ballbros);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 2048);
MCFG_VIDEO_START_OVERRIDE(taitox_state, kyustrkr_no_layers)
diff --git a/src/mame/drivers/taito_z.cpp b/src/mame/drivers/taito_z.cpp
index 5c5381039b6..9ae3fcfac56 100644
--- a/src/mame/drivers/taito_z.cpp
+++ b/src/mame/drivers/taito_z.cpp
@@ -16,7 +16,7 @@ source was very helpful in many areas particularly the sprites.)
The Taito Z system has a number of similarities with the Taito F2 system,
and uses some of the same custom Taito components.
-TaitoZ supports 5 separate layers of graphics - one 64x64 tiled scrolling
+Taito Z supports 5 separate layers of graphics - one 64x64 tiled scrolling
background plane of 8x8 tiles, a similar foreground plane, another optional
plane used for drawing a road (e.g. Chasehq), a sprite plane [with varying
properties], and a text plane with character definitions held in ram.
@@ -57,7 +57,7 @@ Most Z system games have a Z80 as well, which takes over sound duties.
Commands are written to it by the one of the 68000s.
The memory map for the Taito Z games is similar in outline but usually
-shuffled around: some games have different i/o because of analogue
+shuffled around: some games have different I/O because of analogue
sticks, light guns, cockpit hardware etc.
@@ -3213,9 +3213,8 @@ MACHINE_CONFIG_START(taitoz_state::contcirc)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_contcirc)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3287,9 +3286,8 @@ MACHINE_CONFIG_START(taitoz_state::chasehq)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_chasehq)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chasehq)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_chasehq);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3363,9 +3361,8 @@ MACHINE_CONFIG_START(taitoz_state::enforce)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_contcirc)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3434,9 +3431,8 @@ MACHINE_CONFIG_START(taitoz_state::bshark_base)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_bshark)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3522,9 +3518,8 @@ MACHINE_CONFIG_START(taitoz_state::sci)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_sci)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3603,9 +3598,8 @@ MACHINE_CONFIG_START(taitoz_state::nightstr)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_chasehq)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_chasehq)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_chasehq);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3679,9 +3673,8 @@ MACHINE_CONFIG_START(taitoz_state::aquajack)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_aquajack)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3760,9 +3753,8 @@ MACHINE_CONFIG_START(taitoz_state::spacegun)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_spacegun)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taitoz)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taitoz);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
@@ -3830,9 +3822,8 @@ MACHINE_CONFIG_START(taitoz_state::dblaxle)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_dblaxle)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dblaxle)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_dblaxle);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
@@ -3904,9 +3895,9 @@ MACHINE_CONFIG_START(taitoz_state::racingb)
MCFG_SCREEN_UPDATE_DRIVER(taitoz_state, screen_update_racingb)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_dblaxle)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_dblaxle);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 4096);
+
MCFG_VIDEO_START_OVERRIDE(taitoz_state,taitoz)
TC0480SCP(config, m_tc0480scp, 0);
diff --git a/src/mame/drivers/taitoair.cpp b/src/mame/drivers/taitoair.cpp
index 87df37dc19a..43200872428 100644
--- a/src/mame/drivers/taitoair.cpp
+++ b/src/mame/drivers/taitoair.cpp
@@ -739,11 +739,11 @@ MACHINE_CONFIG_START(taitoair_state::airsys)
// Estimated, assume same as mlanding.cpp
MCFG_SCREEN_RAW_PARAMS(16000000, 640, 0, 512, 462, 3*16, 28*16)
MCFG_SCREEN_UPDATE_DRIVER(taitoair_state, screen_update_taitoair)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_airsys)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 512*16+512*16)
+ PALETTE(config, m_palette, palette_device::BLACK, 512*16+512*16);
TC0080VCO(config, m_tc0080vco, 0);
m_tc0080vco->set_gfx_region(0);
diff --git a/src/mame/drivers/taitojc.cpp b/src/mame/drivers/taitojc.cpp
index 600f58cf1fb..43098187073 100644
--- a/src/mame/drivers/taitojc.cpp
+++ b/src/mame/drivers/taitojc.cpp
@@ -1113,7 +1113,7 @@ void taitojc_state::taitojc(machine_config &config)
m_screen->set_screen_update(FUNC(taitojc_state::screen_update_taitojc));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 32768);
+ PALETTE(config, m_palette).set_entries(32768);
TC0780FPA(config, m_tc0780fpa, 0);
diff --git a/src/mame/drivers/taitopjc.cpp b/src/mame/drivers/taitopjc.cpp
index b48c6c0ef12..b456d0220ee 100644
--- a/src/mame/drivers/taitopjc.cpp
+++ b/src/mame/drivers/taitopjc.cpp
@@ -808,7 +808,7 @@ void taitopjc_state::taitopjc(machine_config &config)
screen.set_screen_update(FUNC(taitopjc_state::screen_update_taitopjc));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 32768);
+ PALETTE(config, m_palette).set_entries(32768);
GFXDECODE(config, m_gfxdecode, m_palette, gfxdecode_device::empty);
TC0780FPA(config, m_tc0780fpa, 0);
diff --git a/src/mame/drivers/taitowlf.cpp b/src/mame/drivers/taitowlf.cpp
index b523873d72b..0fa7d7b05f7 100644
--- a/src/mame/drivers/taitowlf.cpp
+++ b/src/mame/drivers/taitowlf.cpp
@@ -30,13 +30,13 @@ TODO:
#include "emu.h"
-#define ENABLE_VGA 0
+#define TAITOWLF_ENABLE_VGA 0
#include "cpu/i386/i386.h"
#include "machine/lpci.h"
#include "machine/pcshare.h"
#include "machine/pckeybrd.h"
-#if ENABLE_VGA
+#if TAITOWLF_ENABLE_VGA
#include "video/pc_vga.h"
#endif
#include "emupal.h"
@@ -45,16 +45,21 @@ TODO:
class taitowlf_state : public pcat_base_state
{
public:
- taitowlf_state(const machine_config &mconfig, device_type type, const char *tag)
- : pcat_base_state(mconfig, type, tag),
+ taitowlf_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pcat_base_state(mconfig, type, tag),
m_bootscreen_rom(*this, "bootscreen"),
m_bank1(*this, "bank1"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void taitowlf(machine_config &config);
void init_taitowlf();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
required_region_ptr<uint8_t> m_bootscreen_rom;
required_memory_bank m_bank1;
@@ -63,11 +68,9 @@ private:
DECLARE_WRITE32_MEMBER(pnp_data_w);
DECLARE_WRITE32_MEMBER(bios_ram_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- #if !ENABLE_VGA
- DECLARE_PALETTE_INIT(taitowlf);
- #endif
+#if !TAITOWLF_ENABLE_VGA
+ void taitowlf_palette(palette_device &palette) const;
+#endif
uint32_t screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void intel82439tx_init();
void taitowlf_io(address_map &map);
@@ -87,7 +90,7 @@ private:
uint8_t m_piix4_config_reg[4][256];
};
-#if !ENABLE_VGA
+#if !TAITOWLF_ENABLE_VGA
uint32_t taitowlf_state::screen_update_taitowlf(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
int x,y,count;
@@ -162,42 +165,33 @@ uint32_t taitowlf_state::intel82439tx_pci_r(int function, int reg, uint32_t mem_
{
uint32_t r = 0;
if (ACCESSING_BITS_24_31)
- {
r |= mtxc_config_r(function, reg + 3) << 24;
- }
+
if (ACCESSING_BITS_16_23)
- {
r |= mtxc_config_r(function, reg + 2) << 16;
- }
+
if (ACCESSING_BITS_8_15)
- {
r |= mtxc_config_r(function, reg + 1) << 8;
- }
+
if (ACCESSING_BITS_0_7)
- {
r |= mtxc_config_r(function, reg + 0) << 0;
- }
+
return r;
}
void taitowlf_state::intel82439tx_pci_w(int function, int reg, uint32_t data, uint32_t mem_mask)
{
if (ACCESSING_BITS_24_31)
- {
mtxc_config_w(function, reg + 3, (data >> 24) & 0xff);
- }
+
if (ACCESSING_BITS_16_23)
- {
mtxc_config_w(function, reg + 2, (data >> 16) & 0xff);
- }
+
if (ACCESSING_BITS_8_15)
- {
mtxc_config_w(function, reg + 1, (data >> 8) & 0xff);
- }
+
if (ACCESSING_BITS_0_7)
- {
mtxc_config_w(function, reg + 0, (data >> 0) & 0xff);
- }
}
// Intel 82371AB PCI-to-ISA / IDE bridge (PIIX4)
@@ -218,42 +212,33 @@ uint32_t taitowlf_state::intel82371ab_pci_r(int function, int reg, uint32_t mem_
{
uint32_t r = 0;
if (ACCESSING_BITS_24_31)
- {
r |= piix4_config_r(function, reg + 3) << 24;
- }
+
if (ACCESSING_BITS_16_23)
- {
r |= piix4_config_r(function, reg + 2) << 16;
- }
+
if (ACCESSING_BITS_8_15)
- {
r |= piix4_config_r(function, reg + 1) << 8;
- }
+
if (ACCESSING_BITS_0_7)
- {
r |= piix4_config_r(function, reg + 0) << 0;
- }
+
return r;
}
void taitowlf_state::intel82371ab_pci_w(int function, int reg, uint32_t data, uint32_t mem_mask)
{
if (ACCESSING_BITS_24_31)
- {
piix4_config_w(function, reg + 3, (data >> 24) & 0xff);
- }
+
if (ACCESSING_BITS_16_23)
- {
piix4_config_w(function, reg + 2, (data >> 16) & 0xff);
- }
+
if (ACCESSING_BITS_8_15)
- {
piix4_config_w(function, reg + 1, (data >> 8) & 0xff);
- }
+
if (ACCESSING_BITS_0_7)
- {
piix4_config_w(function, reg + 0, (data >> 0) & 0xff);
- }
}
// ISA Plug-n-Play
@@ -287,16 +272,16 @@ WRITE32_MEMBER(taitowlf_state::bios_ram_w)
void taitowlf_state::taitowlf_map(address_map &map)
{
map(0x00000000, 0x0009ffff).ram();
- #if ENABLE_VGA
+#if TAITOWLF_ENABLE_VGA
map(0x000a0000, 0x000bffff).rw("vga", FUNC(vga_device::mem_r), FUNC(vga_device::mem_w));
- #else
+#else
map(0x000a0000, 0x000bffff).ram();
- #endif
- #if ENABLE_VGA
+#endif
+#if TAITOWLF_ENABLE_VGA
map(0x000c0000, 0x000c7fff).ram().region("video_bios", 0);
- #else
+#else
map(0x000c0000, 0x000c7fff).noprw();
- #endif
+#endif
map(0x000e0000, 0x000effff).ram();
map(0x000f0000, 0x000fffff).bankr("bank1");
map(0x000f0000, 0x000fffff).w(FUNC(taitowlf_state::bios_ram_w));
@@ -312,13 +297,13 @@ void taitowlf_state::taitowlf_io(address_map &map)
map(0x00e8, 0x00eb).noprw();
map(0x0300, 0x03af).noprw();
map(0x0278, 0x027b).w(FUNC(taitowlf_state::pnp_config_w));
- #if ENABLE_VGA
+#if TAITOWLF_ENABLE_VGA
map(0x03b0, 0x03bf).rw("vga", FUNC(vga_device::port_03b0_r), FUNC(vga_device::port_03b0_w));
map(0x03c0, 0x03cf).rw("vga", FUNC(vga_device::port_03c0_r), FUNC(vga_device::port_03c0_w));
map(0x03d0, 0x03df).rw("vga", FUNC(vga_device::port_03d0_r), FUNC(vga_device::port_03d0_w));
- #else
+#else
map(0x03b0, 0x03df).noprw();
- #endif
+#endif
map(0x0a78, 0x0a7b).w(FUNC(taitowlf_state::pnp_data_w));
map(0x0cf8, 0x0cff).rw("pcibus", FUNC(pci_bus_legacy_device::read), FUNC(pci_bus_legacy_device::write));
}
@@ -372,15 +357,15 @@ void taitowlf_state::machine_reset()
}
-#if !ENABLE_VGA
+#if !TAITOWLF_ENABLE_VGA
/* debug purpose*/
-PALETTE_INIT_MEMBER(taitowlf_state, taitowlf)
+void taitowlf_state::taitowlf_palette(palette_device &palette) const
{
- palette.set_pen_color(0x70,rgb_t(0xff,0xff,0xff));
- palette.set_pen_color(0x71,rgb_t(0xff,0xff,0xff));
- palette.set_pen_color(0x01,rgb_t(0x55,0x00,0x00));
- palette.set_pen_color(0x10,rgb_t(0xaa,0x00,0x00));
- palette.set_pen_color(0x00,rgb_t(0x00,0x00,0x00));
+ palette.set_pen_color(0x70, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(0x71, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(0x01, rgb_t(0x55, 0x00, 0x00));
+ palette.set_pen_color(0x10, rgb_t(0xaa, 0x00, 0x00));
+ palette.set_pen_color(0x00, rgb_t(0x00, 0x00, 0x00));
}
#endif
@@ -400,9 +385,9 @@ MACHINE_CONFIG_START(taitowlf_state::taitowlf)
pcat_common(config);
/* video hardware */
- #if ENABLE_VGA
+#if TAITOWLF_ENABLE_VGA
pcvideo_vga(config);
- #else
+#else
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -410,9 +395,8 @@ MACHINE_CONFIG_START(taitowlf_state::taitowlf)
MCFG_SCREEN_SIZE(512, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 512-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(taitowlf_state, screen_update_taitowlf)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(taitowlf_state, taitowlf)
- #endif
+ PALETTE(config, m_palette, FUNC(taitowlf_state::taitowlf_palette), 256);
+#endif
MACHINE_CONFIG_END
void taitowlf_state::init_taitowlf()
@@ -430,11 +414,11 @@ ROM_START(pf2012)
ROM_REGION32_LE(0x40000, "bios", 0)
ROM_LOAD("p5tx-la.bin", 0x00000, 0x40000, CRC(072e6d51) SHA1(70414349b37e478fc28ecbaba47ad1033ae583b7))
- #if ENABLE_VGA
+#if TAITOWLF_ENABLE_VGA
ROM_REGION( 0x8000, "video_bios", 0 ) // debug
ROM_LOAD16_BYTE( "trident_tgui9680_bios.bin", 0x0000, 0x4000, BAD_DUMP CRC(1eebde64) SHA1(67896a854d43a575037613b3506aea6dae5d6a19) )
ROM_CONTINUE( 0x0001, 0x4000 )
- #endif
+#endif
ROM_REGION(0x400000, "user3", 0) // Program ROM disk
ROM_LOAD("u1.bin", 0x000000, 0x200000, CRC(8f4c09cb) SHA1(0969a92fec819868881683c580f9e01cbedf4ad2))
diff --git a/src/mame/drivers/tamag1.cpp b/src/mame/drivers/tamag1.cpp
index 165d40d9850..7268ab91784 100644
--- a/src/mame/drivers/tamag1.cpp
+++ b/src/mame/drivers/tamag1.cpp
@@ -34,7 +34,7 @@ public:
private:
DECLARE_WRITE8_MEMBER(speaker_w);
- DECLARE_PALETTE_INIT(tama);
+ void tama_palette(palette_device &palette) const;
E0C6S46_PIXEL_UPDATE(pixel_update);
virtual void machine_start() override;
@@ -82,7 +82,7 @@ E0C6S46_PIXEL_UPDATE(tamag1_state::pixel_update)
m_out_x[y][x] = state;
}
-PALETTE_INIT_MEMBER(tamag1_state, tama)
+void tamag1_state::tama_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0xf1, 0xf0, 0xf9)); // background
palette.set_pen_color(1, rgb_t(0x3c, 0x38, 0x38)); // lcd pixel
@@ -152,7 +152,7 @@ void tamag1_state::tama(machine_config &config)
screen.set_palette("palette");
config.set_default_layout(layout_tama);
- PALETTE(config, "palette", 2).set_init(FUNC(tamag1_state::palette_init_tama));
+ PALETTE(config, "palette", FUNC(tamag1_state::tama_palette), 2);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tandy2k.cpp b/src/mame/drivers/tandy2k.cpp
index d1602c001e5..8da3bf03738 100644
--- a/src/mame/drivers/tandy2k.cpp
+++ b/src/mame/drivers/tandy2k.cpp
@@ -786,7 +786,7 @@ void tandy2k_state::tandy2k(machine_config &config)
//screen.set_screen_update(CRT9021B_TAG, FUNC(crt9021_device::screen_update));
screen.set_screen_update(FUNC(tandy2k_state::screen_update));
- PALETTE(config, m_palette, 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
crt9007_device &vpac(CRT9007(config, CRT9007_TAG, 16_MHz_XTAL * 28 / 20 / 8));
vpac.set_addrmap(0, &tandy2k_state::vpac_mem);
diff --git a/src/mame/drivers/tank8.cpp b/src/mame/drivers/tank8.cpp
index f9133c88f36..f49ed135a26 100644
--- a/src/mame/drivers/tank8.cpp
+++ b/src/mame/drivers/tank8.cpp
@@ -8,6 +8,7 @@ Atari Tank 8 driver
#include "emu.h"
#include "includes/tank8.h"
+
#include "cpu/m6800/m6800.h"
#include "sound/discrete.h"
#include "speaker.h"
@@ -343,12 +344,10 @@ MACHINE_CONFIG_START(tank8_state::tank8)
MCFG_SCREEN_VISIBLE_AREA(16, 495, 0, 463)
MCFG_SCREEN_UPDATE_DRIVER(tank8_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tank8_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tank8)
- MCFG_PALETTE_ADD("palette", 20)
- MCFG_PALETTE_INDIRECT_ENTRIES(10)
- MCFG_PALETTE_INIT_OWNER(tank8_state, tank8)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_tank8)
+ PALETTE(config, m_palette, FUNC(tank8_state::tank8_palette), 20, 10);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tankbatt.cpp b/src/mame/drivers/tankbatt.cpp
index 868efbe000e..44ffc6cece5 100644
--- a/src/mame/drivers/tankbatt.cpp
+++ b/src/mame/drivers/tankbatt.cpp
@@ -301,9 +301,7 @@ void tankbatt_state::tankbatt(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tankbatt);
- PALETTE(config, m_palette, 256*2);
- m_palette->set_indirect_entries(256);
- m_palette->set_init(FUNC(tankbatt_state::palette_init_tankbatt));
+ PALETTE(config, m_palette, FUNC(tankbatt_state::tankbatt_palette), 256*2, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tankbust.cpp b/src/mame/drivers/tankbust.cpp
index f10f539a2cf..3c4c097ea47 100644
--- a/src/mame/drivers/tankbust.cpp
+++ b/src/mame/drivers/tankbust.cpp
@@ -128,52 +128,49 @@ READ8_MEMBER(tankbust_state::debug_output_area_r)
-PALETTE_INIT_MEMBER(tankbust_state, tankbust)
+void tankbust_state::tankbust_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < 128; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 128; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
-//7 6 5 4 3 2 1 0
-//bb r r r g g g - bad (for sure - no green for tank)
-//bb g g g r r r - bad (for sure - no yellow, no red)
-//gg r r r b b b - bad
-//gg b b b r r r - bad
-//rr b b b g g g - bad
-
-//rr g g g b b b - very close (green,yellow,red present)
-
-//rr r g g g b b - bad
-//rr r g g b b b - bad
-//rr g g g b b r - bad
-
-//rr g g b b x x - bad (x: unused)
-//rr g g x x b b - bad but still close
-//rr g g r g b b - bad but still close
-//rr g g g r b b - bad but still close
-
-
- /* blue component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* red component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- r = 0x55 * bit0 + 0xaa * bit1;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ //7 6 5 4 3 2 1 0
+ //bb r r r g g g - bad (for sure - no green for tank)
+ //bb g g g r r r - bad (for sure - no yellow, no red)
+ //gg r r r b b b - bad
+ //gg b b b r r r - bad
+ //rr b b b g g g - bad
+
+ //rr g g g b b b - very close (green,yellow,red present)
+
+ //rr r g g g b b - bad
+ //rr r g g b b b - bad
+ //rr g g g b b r - bad
+
+ //rr g g b b x x - bad (x: unused)
+ //rr g g x x b b - bad but still close
+ //rr g g r g b b - bad but still close
+ //rr g g g r b b - bad but still close
+
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const r = 0x55 * bit0 + 0xaa * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -356,12 +353,10 @@ MACHINE_CONFIG_START(tankbust_state::tankbust)
MCFG_SCREEN_VISIBLE_AREA ( 16*8, 56*8-1, 1*8, 31*8-1 )
// MCFG_SCREEN_VISIBLE_AREA ( 0*8, 64*8-1, 1*8, 31*8-1 )
MCFG_SCREEN_UPDATE_DRIVER(tankbust_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tankbust)
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD( "palette", 128 )
- MCFG_PALETTE_INIT_OWNER(tankbust_state, tankbust)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tankbust);
+ PALETTE(config, m_palette, FUNC(tankbust_state::tankbust_palette), 128);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/taotaido.cpp b/src/mame/drivers/taotaido.cpp
index 1742a073660..746f93eac18 100644
--- a/src/mame/drivers/taotaido.cpp
+++ b/src/mame/drivers/taotaido.cpp
@@ -374,7 +374,7 @@ MACHINE_CONFIG_START(taotaido_state::taotaido)
MCFG_DEVICE_ADD("watchdog", MB3773, 0)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taotaido)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_taotaido);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -385,8 +385,7 @@ MACHINE_CONFIG_START(taotaido_state::taotaido)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, taotaido_state, screen_vblank))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 0x800);
VSYSTEM_SPR(config, m_spr, 0);
m_spr->set_tile_indirect_cb(FUNC(taotaido_state::tile_callback), this);
diff --git a/src/mame/drivers/targeth.cpp b/src/mame/drivers/targeth.cpp
index 34f8f08818a..2460c289cd7 100644
--- a/src/mame/drivers/targeth.cpp
+++ b/src/mame/drivers/targeth.cpp
@@ -289,11 +289,10 @@ MACHINE_CONFIG_START(targeth_state::targeth)
MCFG_SCREEN_SIZE(64*16, 16*16)
MCFG_SCREEN_VISIBLE_AREA(3*8, 23*16-8-1, 16, 16*16-8-1)
MCFG_SCREEN_UPDATE_DRIVER(targeth_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_targeth)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_targeth);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tasman.cpp b/src/mame/drivers/tasman.cpp
index 998ecfc511f..9d43ffbc680 100644
--- a/src/mame/drivers/tasman.cpp
+++ b/src/mame/drivers/tasman.cpp
@@ -38,8 +38,8 @@
class kongambl_state : public driver_device
{
public:
- kongambl_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ kongambl_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_k053252(*this, "k053252"),
m_k055673(*this, "k055673"),
@@ -51,7 +51,7 @@ public:
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_vram(*this, "vram")
- { }
+ { }
void kongambl(machine_config &config);
@@ -665,10 +665,9 @@ MACHINE_CONFIG_START(kongambl_state::kongambl)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(25000000, 288+16+32+48, 0, 287, 224+16+8+16, 0, 223) // fake, they'll be changed by CCU anyway, TBD
MCFG_SCREEN_UPDATE_DRIVER(kongambl_state, screen_update_kongambl)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 32768)
- MCFG_PALETTE_FORMAT(XRGB)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 32768);
MCFG_VIDEO_START_OVERRIDE(kongambl_state,kongambl)
@@ -680,7 +679,7 @@ MACHINE_CONFIG_START(kongambl_state::kongambl)
m_k055673->set_palette(m_palette);
#if CUSTOM_DRAW
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tasman)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tasman);
#endif
K056832(config, m_k056832, 0);
diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp
index 9333f1d8b2f..55d45161738 100644
--- a/src/mame/drivers/tatsumi.cpp
+++ b/src/mame/drivers/tatsumi.cpp
@@ -902,9 +902,8 @@ MACHINE_CONFIG_START(apache3_state::apache3)
MCFG_SCREEN_RAW_PARAMS(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240) // TODO: Hook up CRTC
MCFG_SCREEN_UPDATE_DRIVER(apache3_state, screen_update_apache3)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_apache3)
- MCFG_PALETTE_ADD("palette", 1024 + 4096) /* 1024 real colours, and 4096 arranged as series of cluts */
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_apache3);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024 + 4096); // 1024 real colours, and 4096 arranged as series of CLUTs
/* apache 3 schematics state
bit 4: 250
@@ -955,11 +954,9 @@ MACHINE_CONFIG_START(roundup5_state::roundup5)
MCFG_SCREEN_RAW_PARAMS(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240) // TODO: Hook up CRTC
MCFG_SCREEN_UPDATE_DRIVER(roundup5_state, screen_update_roundup5)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_roundup5)
- MCFG_PALETTE_ADD("palette", 1024 + 4096) /* 1024 real colours, and 4096 arranged as series of cluts */
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_MEMBITS(8)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_roundup5);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 1024 + 4096); // 1024 real colours, and 4096 arranged as series of CLUTs
+ m_palette->set_membits(8).set_endianness(ENDIANNESS_BIG);
MCFG_VIDEO_START_OVERRIDE(roundup5_state,roundup5)
@@ -1038,9 +1035,8 @@ MACHINE_CONFIG_START(cyclwarr_state::cyclwarr)
MCFG_SCREEN_RAW_PARAMS(CLOCK_2 / 8, 400, 0, 320, 272, 0, 240) // TODO: Hook up CRTC
MCFG_SCREEN_UPDATE_DRIVER(cyclwarr_state, screen_update_cyclwarr)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cyclwarr)
- MCFG_PALETTE_ADD("palette", 8192 + 8192)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cyclwarr);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192 + 8192);
MCFG_VIDEO_START_OVERRIDE(cyclwarr_state, cyclwarr)
diff --git a/src/mame/drivers/tattack.cpp b/src/mame/drivers/tattack.cpp
index fd03de90f76..13696b3c0b2 100644
--- a/src/mame/drivers/tattack.cpp
+++ b/src/mame/drivers/tattack.cpp
@@ -59,20 +59,23 @@
class tattack_state : public driver_device
{
public:
- tattack_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tattack_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ram(*this, "ram"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_gfxdecode(*this, "gfxdecode"),
m_samples(*this,"samples")
- { }
+ { }
void tattack(machine_config &config);
void init_tattack();
+protected:
+ virtual void video_start() override;
+
private:
DECLARE_WRITE8_MEMBER(paddle_w);
DECLARE_WRITE8_MEMBER(ball_w);
@@ -80,13 +83,11 @@ private:
DECLARE_WRITE8_MEMBER(sound_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(tattack);
+ void tattack_palette(palette_device &palette) const;
uint32_t screen_update_tattack(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void tattack_map(address_map &map);
- virtual void video_start() override;
-
required_device<cpu_device> m_maincpu;
required_shared_ptr<uint8_t> m_ram;
required_shared_ptr<uint8_t> m_videoram;
@@ -103,11 +104,11 @@ private:
void draw_gameplay_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_edge_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect);
- static const uint8_t white_pen = 0xf;
- static const uint8_t green_pen = 0x5;
- static const uint8_t yellow_pen = 0x7;
- static const uint8_t red_pen = 0x3;
- static const int paddle_xpos = 38;
+ static constexpr uint8_t white_pen = 0xf;
+ static constexpr uint8_t green_pen = 0x5;
+ static constexpr uint8_t yellow_pen = 0x7;
+ static constexpr uint8_t red_pen = 0x3;
+ static constexpr int paddle_xpos = 38;
};
@@ -117,15 +118,15 @@ TILE_GET_INFO_MEMBER(tattack_state::get_tile_info)
int code = m_videoram[tile_index];
int color = m_colorram[tile_index];
- if((color&1 ) || (color>15) )
- logerror("COLOR %i\n",color);
+ if((color & 1) || (color > 15))
+ logerror("COLOR %i\n", color);
- color>>=1;
+ color >>= 1;
SET_TILE_INFO_MEMBER(0,
- code,
- color,
- 0);
+ code,
+ color,
+ 0);
}
void tattack_state::draw_edge_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -376,22 +377,22 @@ static GFXDECODE_START( gfx_tattack )
GFXDECODE_ENTRY( "gfx1", 0 , charlayout, 0, 8 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(tattack_state, tattack)
+void tattack_state::tattack_palette(palette_device &palette) const
{
- int i,r,g,b;
- for(i=0;i<8;i++)
+ for (int i = 0; i < 8; i++)
{
- if(i)
+ int r, g, b;
+ if (i)
{
- r=(i&1)?0xff:0;
- g=(i&2)?0xff:0;
- b=(i&4)?0xff:0;
+ r = (i & 1) ? 0xff : 0;
+ g = (i & 2) ? 0xff : 0;
+ b = (i & 4) ? 0xff : 0;
}
else
- r=g=b=128;
+ r = g = b = 128;
- palette.set_pen_color(2*i,rgb_t(0x00,0x00,0xff));
- palette.set_pen_color(2*i+1,rgb_t(r,g,b));
+ palette.set_pen_color(2 * i, rgb_t(0x00, 0x00, 0xff));
+ palette.set_pen_color(2 * i + 1, rgb_t(r, g, b));
}
}
@@ -422,7 +423,7 @@ void tattack_state::tattack(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, "palette", gfx_tattack);
- PALETTE(config, "palette", 16).set_init(FUNC(tattack_state::palette_init_tattack));
+ PALETTE(config, "palette", FUNC(tattack_state::tattack_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tavernie.cpp b/src/mame/drivers/tavernie.cpp
index 1c2e873ccc2..47f4bb58f70 100644
--- a/src/mame/drivers/tavernie.cpp
+++ b/src/mame/drivers/tavernie.cpp
@@ -351,7 +351,7 @@ MACHINE_CONFIG_START(tavernie_state::ivg09)
MCFG_SCREEN_SIZE(80*8, 25*10)
MCFG_SCREEN_VISIBLE_AREA(0, 80*8-1, 0, 25*10-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
config.set_default_layout(layout_tavernie);
/* sound hardware */
diff --git a/src/mame/drivers/taxidriv.cpp b/src/mame/drivers/taxidriv.cpp
index 616ac9ecbea..e7909ed1e83 100644
--- a/src/mame/drivers/taxidriv.cpp
+++ b/src/mame/drivers/taxidriv.cpp
@@ -309,28 +309,26 @@ static GFXDECODE_START( gfx_taxidriv )
GFXDECODE_ENTRY( "gfx5", 0, charlayout2, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(taxidriv_state, taxidriv)
+void taxidriv_state::taxidriv_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, r, g, b;
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* TODO: resistors, 1k & 470*/
-
- for (i = 0; i < 0x10; ++i)
+ // TODO: resistors, 1k & 470
+ for (int i = 0; i < 0x10; ++i)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- r = 0x55 * bit0 + 0xaa * bit1;
- bit0 = (color_prom[0] >> 2) & 0x01;
- bit1 = (color_prom[0] >> 3) & 0x01;
- g = 0x55 * bit0 + 0xaa * bit1;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- b = 0x55 * bit0 + 0xaa * bit1;
+ int bit0, bit1;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const r = 0x55 * bit0 + 0xaa * bit1;
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ int const g = 0x55 * bit0 + 0xaa * bit1;
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ int const b = 0x55 * bit0 + 0xaa * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
- color_prom++;
}
}
@@ -387,11 +385,10 @@ MACHINE_CONFIG_START(taxidriv_state::taxidriv)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 27*8-1)
MCFG_SCREEN_UPDATE_DRIVER(taxidriv_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_taxidriv)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(taxidriv_state, taxidriv)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_taxidriv);
+ PALETTE(config, m_palette, FUNC(taxidriv_state::taxidriv_palette), 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tbowl.cpp b/src/mame/drivers/tbowl.cpp
index e3f381e251e..777d8329cfe 100644
--- a/src/mame/drivers/tbowl.cpp
+++ b/src/mame/drivers/tbowl.cpp
@@ -449,10 +449,8 @@ MACHINE_CONFIG_START(tbowl_state::tbowl)
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tbowl)
- MCFG_PALETTE_ADD("palette", 1024*2)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tbowl);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024*2).set_endianness(ENDIANNESS_BIG);
config.set_default_layout(layout_dualhsxs);
TECMO_SPRITE(config, m_sprgen, 0);
@@ -463,7 +461,7 @@ MACHINE_CONFIG_START(tbowl_state::tbowl)
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(tbowl_state, screen_update_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -471,7 +469,7 @@ MACHINE_CONFIG_START(tbowl_state::tbowl)
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(tbowl_state, screen_update_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* sound hardware */
diff --git a/src/mame/drivers/tceptor.cpp b/src/mame/drivers/tceptor.cpp
index f43e5ae4d42..2318b9b015c 100644
--- a/src/mame/drivers/tceptor.cpp
+++ b/src/mame/drivers/tceptor.cpp
@@ -343,9 +343,7 @@ void tceptor_state::tceptor(machine_config &config)
/* video hardware */
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tceptor);
- PALETTE(config, m_palette, 4096);
- m_palette->set_indirect_entries(1024);
- m_palette->set_init(FUNC(tceptor_state::palette_init_tceptor));
+ PALETTE(config, m_palette, FUNC(tceptor_state::tceptor_palette), 4096, 1024);
NAMCO_C45_ROAD(config, m_c45_road, 0);
m_c45_road->set_palette(m_palette);
diff --git a/src/mame/drivers/tdv2324.cpp b/src/mame/drivers/tdv2324.cpp
index 3864743ee6b..319cae8ef5f 100644
--- a/src/mame/drivers/tdv2324.cpp
+++ b/src/mame/drivers/tdv2324.cpp
@@ -284,7 +284,7 @@ MACHINE_CONFIG_START(tdv2324_state::tdv2324)
MCFG_SCREEN_SIZE(800, 400)
MCFG_SCREEN_VISIBLE_AREA(0, 800-1, 0, 400-1)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
TMS9927(config, m_tms, 25.39836_MHz_XTAL / 8).set_char_width(8);
diff --git a/src/mame/drivers/tecmo.cpp b/src/mame/drivers/tecmo.cpp
index 749e7314790..3c6f48ebc9d 100644
--- a/src/mame/drivers/tecmo.cpp
+++ b/src/mame/drivers/tecmo.cpp
@@ -716,12 +716,10 @@ MACHINE_CONFIG_START(tecmo_state::rygar)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(24'000'000)/4, 384,0,256,264,16,240) // 59.18 Hz
MCFG_SCREEN_UPDATE_DRIVER(tecmo_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tecmo)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tecmo);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024).set_endianness(ENDIANNESS_BIG);
TECMO_SPRITE(config, m_sprgen, 0);
diff --git a/src/mame/drivers/tecmo16.cpp b/src/mame/drivers/tecmo16.cpp
index f8a05d471c2..b836b3371c8 100644
--- a/src/mame/drivers/tecmo16.cpp
+++ b/src/mame/drivers/tecmo16.cpp
@@ -377,9 +377,8 @@ MACHINE_CONFIG_START(tecmo16_state::fstarfrc)
MCFG_SCREEN_UPDATE_DRIVER(tecmo16_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tecmo16)
- MCFG_PALETTE_ADD_INIT_BLACK("palette", 4096)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tecmo16);
+ PALETTE(config, m_palette, palette_device::BLACK).set_format(palette_device::xBGR_444, 4096);
TECMO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(2);
diff --git a/src/mame/drivers/tecmosys.cpp b/src/mame/drivers/tecmosys.cpp
index 27366de2ccb..a97f7fbd61c 100644
--- a/src/mame/drivers/tecmosys.cpp
+++ b/src/mame/drivers/tecmosys.cpp
@@ -477,8 +477,7 @@ void tecmosys_state::tecmosys(machine_config &config)
m_screen->set_visarea(0*8, 40*8-1, 0*8, 30*8-1);
m_screen->set_screen_update(FUNC(tecmosys_state::screen_update));
- PALETTE(config, m_palette, 0x4000+0x800);
- m_palette->set_format(PALETTE_FORMAT_xGGGGGRRRRRBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_555, 0x4000+0x800);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/tehkanwc.cpp b/src/mame/drivers/tehkanwc.cpp
index c2e84ec1857..b6ef48f5862 100644
--- a/src/mame/drivers/tehkanwc.cpp
+++ b/src/mame/drivers/tehkanwc.cpp
@@ -692,12 +692,10 @@ MACHINE_CONFIG_START(tehkanwc_state::tehkanwc)
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(tehkanwc_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tehkanwc)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tehkanwc);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 768).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tek405x.cpp b/src/mame/drivers/tek405x.cpp
index c5fc5403fd7..162aba98841 100644
--- a/src/mame/drivers/tek405x.cpp
+++ b/src/mame/drivers/tek405x.cpp
@@ -1014,7 +1014,7 @@ MACHINE_CONFIG_START(tek4051_state::tek4051)
MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1)
MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
@@ -1119,7 +1119,7 @@ MACHINE_CONFIG_START(tek4052_state::tek4052)
MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 780-1)
MCFG_SCREEN_UPDATE_DEVICE("vector", vector_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tek410x.cpp b/src/mame/drivers/tek410x.cpp
index 9c8fb81594a..17fbbbe9dfd 100644
--- a/src/mame/drivers/tek410x.cpp
+++ b/src/mame/drivers/tek410x.cpp
@@ -116,7 +116,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(tek4107a_state::tek4109a)
tek4107a(config);
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
+ MCFG_DEVICE_MODIFY("palette")
MCFG_PALETTE_ENTRIES(4096)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/tek440x.cpp b/src/mame/drivers/tek440x.cpp
index 187716c028e..82ae82e2174 100644
--- a/src/mame/drivers/tek440x.cpp
+++ b/src/mame/drivers/tek440x.cpp
@@ -59,13 +59,13 @@
class tek440x_state : public driver_device
{
public:
- tek440x_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tek440x_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_fdccpu(*this, "fdccpu"),
m_mainram(*this, "mainram"),
m_vram(*this, "vram")
- {}
+ { }
void tek4404(machine_config &config);
@@ -211,7 +211,7 @@ MACHINE_CONFIG_START(tek440x_state::tek4404)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
MCFG_SCREEN_UPDATE_DRIVER(tek440x_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
mos6551_device &aica(MOS6551(config, "aica", 0));
aica.set_xtal(1.8432_MHz_XTAL);
diff --git a/src/mame/drivers/terak.cpp b/src/mame/drivers/terak.cpp
index 307a9116acd..032ed1a0443 100644
--- a/src/mame/drivers/terak.cpp
+++ b/src/mame/drivers/terak.cpp
@@ -118,7 +118,7 @@ void terak_state::terak(machine_config &config)
screen.set_screen_update(FUNC(terak_state::screen_update_terak));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/terracre.cpp b/src/mame/drivers/terracre.cpp
index e778c30452b..065d931c2c5 100644
--- a/src/mame/drivers/terracre.cpp
+++ b/src/mame/drivers/terracre.cpp
@@ -473,12 +473,10 @@ MACHINE_CONFIG_START(terracre_state::ym3526)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(terracre_state, screen_update_amazon)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_terracre)
- MCFG_PALETTE_ADD("palette", 1*16+16*16+16*256)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(terracre_state, terracre)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_terracre);
+ PALETTE(config, m_palette, FUNC(terracre_state::terracre_palette), 1*16+16*16+16*256, 256);
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/thayers.cpp b/src/mame/drivers/thayers.cpp
index c0acd9ecbc8..ab4d2e55db9 100644
--- a/src/mame/drivers/thayers.cpp
+++ b/src/mame/drivers/thayers.cpp
@@ -824,7 +824,7 @@ void thayers_state::thayers(machine_config &config)
screen.set_raw(XTAL(14'318'181)*2, 910, 0, 704, 525, 44, 524);
screen.set_screen_update("laserdisc", FUNC(laserdisc_device::screen_update));
- PALETTE(config, "palette", 256);
+ PALETTE(config, "palette").set_entries(256);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/thedealr.cpp b/src/mame/drivers/thedealr.cpp
index 162a69351eb..17c6c56ee5f 100644
--- a/src/mame/drivers/thedealr.cpp
+++ b/src/mame/drivers/thedealr.cpp
@@ -71,7 +71,7 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(thedealr_interrupt);
// video
- DECLARE_PALETTE_INIT(thedealr);
+ void thedealr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
@@ -96,13 +96,13 @@ private:
***************************************************************************/
-PALETTE_INIT_MEMBER(thedealr_state,thedealr)
+void thedealr_state::thedealr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); i++)
{
- int col = (color_prom[i] << 8) + color_prom[i + 512];
+ int const col = (color_prom[i] << 8) | color_prom[i + 512];
palette.set_pen_color(i, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
}
}
@@ -568,9 +568,8 @@ MACHINE_CONFIG_START(thedealr_state::thedealr)
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)
- MCFG_PALETTE_INIT_OWNER(thedealr_state,thedealr)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_thedealr);
+ PALETTE(config, m_palette, FUNC(thedealr_state::thedealr_palette), 512);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/thedeep.cpp b/src/mame/drivers/thedeep.cpp
index e610b2e8f7b..aaa1006805c 100644
--- a/src/mame/drivers/thedeep.cpp
+++ b/src/mame/drivers/thedeep.cpp
@@ -432,7 +432,7 @@ void thedeep_state::thedeep(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_thedeep);
- PALETTE(config, m_palette, 512).set_init(FUNC(thedeep_state::palette_init_thedeep));
+ PALETTE(config, m_palette, FUNC(thedeep_state::thedeep_palette), 512);
DECO_MXC06(config, m_spritegen, 0);
m_spritegen->set_gfx_region(0);
diff --git a/src/mame/drivers/thepit.cpp b/src/mame/drivers/thepit.cpp
index abe798a67f4..1b883cf0b78 100644
--- a/src/mame/drivers/thepit.cpp
+++ b/src/mame/drivers/thepit.cpp
@@ -737,14 +737,13 @@ MACHINE_CONFIG_START(thepit_state::thepit)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_thepit)
- MCFG_PALETTE_ADD("palette", 32+8)
- MCFG_PALETTE_INIT_OWNER(thepit_state, thepit)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_thepit);
+ PALETTE(config, m_palette, FUNC(thepit_state::thepit_palette), 32+8);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(thepit_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -798,8 +797,7 @@ MACHINE_CONFIG_START(thepit_state::suprmous)
/* basic machine hardware */
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(thepit_state,suprmous)
+ m_palette->set_init(FUNC(thepit_state::suprmous_palette));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_suprmous)
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/thief.cpp b/src/mame/drivers/thief.cpp
index 0353bbf278b..c78ae5088e3 100644
--- a/src/mame/drivers/thief.cpp
+++ b/src/mame/drivers/thief.cpp
@@ -415,7 +415,7 @@ void thief_state::thief(machine_config &config)
m_tms->set_char_width(8);
m_tms->vsyn_callback().set_inputline("maincpu", 0, ASSERT_LINE);
- PALETTE(config, m_palette, 16);
+ PALETTE(config, m_palette).set_entries(16);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp
index 6b66337e1bd..e80dce1a3b8 100644
--- a/src/mame/drivers/thomson.cpp
+++ b/src/mame/drivers/thomson.cpp
@@ -644,8 +644,7 @@ MACHINE_CONFIG_START(thomson_state::to7_base)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, thomson_state, thom_vblank))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD ( "palette", 4097 ) /* 12-bit color + transparency */
- MCFG_PALETTE_INIT_OWNER(thomson_state, thom)
+ PALETTE(config, "palette", FUNC(thomson_state::thom_palette), 4097); // 12-bit color + transparency
MCFG_VIDEO_START_OVERRIDE( thomson_state, thom )
/* sound */
@@ -1132,8 +1131,7 @@ MACHINE_CONFIG_START(thomson_state::mo5)
MCFG_CASSETTE_FORMATS(mo5_cassette_formats)
MCFG_CASSETTE_INTERFACE("mo_cass")
- MCFG_PALETTE_MODIFY( "palette" )
- MCFG_PALETTE_INIT_OWNER(thomson_state, mo5)
+ subdevice<palette_device>("palette")->set_init(FUNC(thomson_state::mo5_palette));
m_pia_sys->readpa_handler().set(FUNC(thomson_state::mo5_sys_porta_in));
m_pia_sys->readpb_handler().set(FUNC(thomson_state::mo5_sys_portb_in));
diff --git a/src/mame/drivers/thoop2.cpp b/src/mame/drivers/thoop2.cpp
index 8d15d2a055c..8e1c0552dea 100644
--- a/src/mame/drivers/thoop2.cpp
+++ b/src/mame/drivers/thoop2.cpp
@@ -290,11 +290,10 @@ MACHINE_CONFIG_START(thoop2_state::thoop2)
MCFG_SCREEN_SIZE(32*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(0, 320-1, 16, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(thoop2_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_thoop2)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/thunderj.cpp b/src/mame/drivers/thunderj.cpp
index fc4d078ec90..c75c7a9afe1 100644
--- a/src/mame/drivers/thunderj.cpp
+++ b/src/mame/drivers/thunderj.cpp
@@ -259,8 +259,7 @@ MACHINE_CONFIG_START(thunderj_state::thunderj)
/* video hardware */
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_thunderj)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(IRRRRRGGGGGBBBBB)
+ PALETTE(config, "palette").set_format(palette_device::IRGB_1555, 2048);
ATARI_VAD(config, m_vad, 0, m_screen);
m_vad->scanline_int_cb().set(FUNC(thunderj_state::scanline_int_write_line));
diff --git a/src/mame/drivers/thunderx.cpp b/src/mame/drivers/thunderx.cpp
index bb12253afd0..90901aea4ef 100644
--- a/src/mame/drivers/thunderx.cpp
+++ b/src/mame/drivers/thunderx.cpp
@@ -660,9 +660,8 @@ void thunderx_state::scontra(machine_config &config)
screen.set_screen_update(FUNC(thunderx_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/ti630.cpp b/src/mame/drivers/ti630.cpp
index d3e607ea505..1bd7972cb07 100644
--- a/src/mame/drivers/ti630.cpp
+++ b/src/mame/drivers/ti630.cpp
@@ -54,16 +54,18 @@ public:
void init_ti630();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE8_MEMBER(i80c31_p1_w);
DECLARE_WRITE8_MEMBER(i80c31_p3_w);
DECLARE_READ8_MEMBER(i80c31_p1_r);
- DECLARE_PALETTE_INIT(ti630);
+ void ti630_palette(palette_device &palette) const;
void i80c31_io(address_map &map);
void i80c31_prg(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<i80c31_device> m_maincpu;
required_device<hd44780_device> m_lcdc;
};
@@ -116,7 +118,7 @@ WRITE8_MEMBER(ti630_state::i80c31_p3_w)
logerror("Write to P3: %02X\n", data);
}
-PALETTE_INIT_MEMBER(ti630_state, ti630)
+void ti630_state::ti630_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -156,8 +158,7 @@ void ti630_state::ti630(machine_config &config)
screen.set_visarea(0, 6*16-1, 0, 9*2-1);
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init(FUNC(ti630_state::palette_init_ti630));
-
+ PALETTE(config, "palette", FUNC(ti630_state::ti630_palette), 2);
GFXDECODE(config, "gfxdecode", "palette", gfx_ti630);
HD44780(config, m_lcdc, 0);
diff --git a/src/mame/drivers/ti74.cpp b/src/mame/drivers/ti74.cpp
index 8ed43e76aeb..4549c705a43 100644
--- a/src/mame/drivers/ti74.cpp
+++ b/src/mame/drivers/ti74.cpp
@@ -100,6 +100,10 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(battery_status_changed);
+protected:
+ virtual void machine_reset() override;
+ virtual void machine_start() override;
+
private:
void update_lcd_indicator(u8 y, u8 x, int state);
void update_battery_status(int state);
@@ -108,15 +112,12 @@ private:
DECLARE_WRITE8_MEMBER(keyboard_w);
DECLARE_WRITE8_MEMBER(bankswitch_w);
- DECLARE_PALETTE_INIT(ti74);
+ void ti74_palette(palette_device &palette) const;
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(ti74_cartridge);
HD44780_PIXEL_UPDATE(ti74_pixel_update);
HD44780_PIXEL_UPDATE(ti95_pixel_update);
void main_map(address_map &map);
- virtual void machine_reset() override;
- virtual void machine_start() override;
-
required_device<tms70c46_device> m_maincpu;
required_device<generic_slot_device> m_cart;
required_ioport_array<8> m_key_matrix;
@@ -161,11 +162,11 @@ DEVICE_IMAGE_LOAD_MEMBER(ti74_state, ti74_cartridge)
***************************************************************************/
-PALETTE_INIT_MEMBER(ti74_state, ti74)
+void ti74_state::ti74_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
- palette.set_pen_color(1, rgb_t(92, 83, 88)); // lcd pixel on
- palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off
+ palette.set_pen_color(1, rgb_t(92, 83, 88)); // LCD pixel on
+ palette.set_pen_color(2, rgb_t(131, 136, 139)); // LCD pixel off
}
void ti74_state::update_lcd_indicator(u8 y, u8 x, int state)
@@ -538,8 +539,7 @@ MACHINE_CONFIG_START(ti74_state::ti74)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(ti74_state, ti74)
+ PALETTE(config, "palette", FUNC(ti74_state::ti74_palette), 3);
MCFG_HD44780_ADD("hd44780") // 270kHz
MCFG_HD44780_LCD_SIZE(2, 16) // 2*16 internal
@@ -574,8 +574,7 @@ MACHINE_CONFIG_START(ti74_state::ti95)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(ti74_state, ti74)
+ PALETTE(config, "palette", FUNC(ti74_state::ti74_palette), 3);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
diff --git a/src/mame/drivers/ti85.cpp b/src/mame/drivers/ti85.cpp
index 8c9af0dd245..311202be357 100644
--- a/src/mame/drivers/ti85.cpp
+++ b/src/mame/drivers/ti85.cpp
@@ -593,9 +593,7 @@ MACHINE_CONFIG_START(ti85_state::ti81)
MCFG_SCREEN_UPDATE_DRIVER(ti85_state, screen_update_ti85)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 224)
- MCFG_PALETTE_INDIRECT_ENTRIES(224)
- MCFG_PALETTE_INIT_OWNER(ti85_state, ti85)
+ PALETTE(config, "palette", FUNC(ti85_state::ti85_palette), 224, 224);
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
MACHINE_CONFIG_END
@@ -635,9 +633,7 @@ MACHINE_CONFIG_START(ti85_state::ti82)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(2)
- MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 )
+ subdevice<palette_device>("palette")->set_entries(2).set_init(FUNC(ti85_state::ti82_palette));
MCFG_DEVICE_ADD("t6a04", T6A04, 0)
MCFG_T6A04_SIZE(96, 64)
@@ -664,9 +660,7 @@ MACHINE_CONFIG_START(ti85_state::ti83)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(2)
- MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 )
+ subdevice<palette_device>("palette")->set_entries(2).set_init(FUNC(ti85_state::ti82_palette));
MCFG_DEVICE_ADD("t6a04", T6A04, 0)
MCFG_T6A04_SIZE(96, 64)
@@ -697,9 +691,7 @@ MACHINE_CONFIG_START(ti85_state::ti83p)
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_UPDATE_DEVICE("t6a04", t6a04_device, screen_update)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(2)
- MCFG_PALETTE_INIT_OWNER(ti85_state, ti82 )
+ subdevice<palette_device>("palette")->set_entries(2).set_init(FUNC(ti85_state::ti82_palette));
ADDRESS_MAP_BANK(config, "membank1").set_map(&ti85_state::ti83p_banked_mem).set_options(ENDIANNESS_LITTLE, 8, 32, 0x4000);
ADDRESS_MAP_BANK(config, "membank2").set_map(&ti85_state::ti83p_banked_mem).set_options(ENDIANNESS_LITTLE, 8, 32, 0x4000);
diff --git a/src/mame/drivers/ti89.cpp b/src/mame/drivers/ti89.cpp
index 0efc12cc639..da531355256 100644
--- a/src/mame/drivers/ti89.cpp
+++ b/src/mame/drivers/ti89.cpp
@@ -513,7 +513,7 @@ uint32_t ti68k_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
return 0;
}
-PALETTE_INIT_MEMBER(ti68k_state, ti68k)
+void ti68k_state::ti68k_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -535,8 +535,7 @@ MACHINE_CONFIG_START(ti68k_state::ti89)
MCFG_SCREEN_VISIBLE_AREA(0, 160-1, 0, 100-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(ti68k_state, ti68k)
+ PALETTE(config, "palette", FUNC(ti68k_state::ti68k_palette), 2);
SHARP_UNK128MBIT(config, "flash"); //should be LH28F320 for ti89t and v200 and LH28F160S3T for other models
diff --git a/src/mame/drivers/tiamc1.cpp b/src/mame/drivers/tiamc1.cpp
index 46cf544749b..0638e152925 100644
--- a/src/mame/drivers/tiamc1.cpp
+++ b/src/mame/drivers/tiamc1.cpp
@@ -343,11 +343,10 @@ MACHINE_CONFIG_START(tiamc1_state::tiamc1)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 312, 0, 256) // pixel clock and htotal comes from docs/schematics, the rest is guess (determined by undumped PROM)
MCFG_SCREEN_UPDATE_DRIVER(tiamc1_state, screen_update_tiamc1)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tiamc1)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(tiamc1_state, tiamc1)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tiamc1);
+ PALETTE(config, m_palette, FUNC(tiamc1_state::tiamc1_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -358,6 +357,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(tiamc1_state::kot)
tiamc1(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(kotrybolov_map)
MCFG_DEVICE_IO_MAP(kotrybolov_io_map)
diff --git a/src/mame/drivers/tigeroad.cpp b/src/mame/drivers/tigeroad.cpp
index 9cbb2889d75..0b77fcf66e2 100644
--- a/src/mame/drivers/tigeroad.cpp
+++ b/src/mame/drivers/tigeroad.cpp
@@ -677,7 +677,7 @@ void tigeroad_state::tigeroad(machine_config &config)
TIGEROAD_SPRITE(config, m_spritegen, 0);
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_xxxxRRRRGGGGBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -753,7 +753,7 @@ void tigeroad_state::f1dream_comad(machine_config &config)
TIGEROAD_SPRITE(config, m_spritegen, 0);
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_xxxxRRRRGGGGBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tim011.cpp b/src/mame/drivers/tim011.cpp
index 5148f655404..2891f818130 100644
--- a/src/mame/drivers/tim011.cpp
+++ b/src/mame/drivers/tim011.cpp
@@ -21,13 +21,14 @@ class tim011_state : public driver_device
{
public:
tim011_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_fdc(*this, FDC9266_TAG),
- m_floppy0(*this, FDC9266_TAG ":0:35dd"),
- m_floppy1(*this, FDC9266_TAG ":1:35dd"),
- m_floppy2(*this, FDC9266_TAG ":2:35dd"),
- m_floppy3(*this, FDC9266_TAG ":3:35dd") { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_fdc(*this, FDC9266_TAG)
+ , m_floppy0(*this, FDC9266_TAG ":0:35dd")
+ , m_floppy1(*this, FDC9266_TAG ":1:35dd")
+ , m_floppy2(*this, FDC9266_TAG ":2:35dd")
+ , m_floppy3(*this, FDC9266_TAG ":3:35dd")
+ { }
void tim011(machine_config &config);
@@ -159,7 +160,7 @@ MACHINE_CONFIG_START(tim011_state::tim011)
MCFG_SCREEN_UPDATE_DRIVER(tim011_state, screen_update_tim011)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
/* ROM definition */
diff --git a/src/mame/drivers/tim100.cpp b/src/mame/drivers/tim100.cpp
index f62678f26c3..c58bee08df5 100644
--- a/src/mame/drivers/tim100.cpp
+++ b/src/mame/drivers/tim100.cpp
@@ -29,6 +29,7 @@ class tim100_state : public driver_device
public:
tim100_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
+ , m_charmap(*this, "chargen")
, m_p_videoram(*this, "videoram")
, m_maincpu(*this, "maincpu")
, m_palette(*this, "palette")
@@ -46,8 +47,9 @@ private:
void tim100_mem(address_map &map);
virtual void machine_start() override;
- uint8_t *m_charmap;
+
uint16_t m_dma_adr;
+ required_region_ptr<uint8_t> m_charmap;
required_shared_ptr<uint8_t> m_p_videoram;
required_device<cpu_device> m_maincpu;
required_device<palette_device> m_palette;
@@ -93,8 +95,7 @@ static const rgb_t tim100_palette[3] = {
void tim100_state::machine_start()
{
- m_charmap = memregion("chargen")->base();
- m_palette->set_pen_colors(0, tim100_palette, ARRAY_LENGTH(tim100_palette));
+ m_palette->set_pen_colors(0, tim100_palette);
}
const gfx_layout tim100_charlayout =
diff --git a/src/mame/drivers/timelimt.cpp b/src/mame/drivers/timelimt.cpp
index 76fd2e569f3..ba8b3d1e1c6 100644
--- a/src/mame/drivers/timelimt.cpp
+++ b/src/mame/drivers/timelimt.cpp
@@ -253,11 +253,10 @@ MACHINE_CONFIG_START(timelimt_state::timelimt)
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(timelimt_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_timelimt)
- MCFG_PALETTE_ADD("palette", 64+32)
- MCFG_PALETTE_INIT_OWNER(timelimt_state, timelimt)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_timelimt);
+ PALETTE(config, m_palette, FUNC(timelimt_state::timelimt_palette), 64+32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/timeplt.cpp b/src/mame/drivers/timeplt.cpp
index d84c7a909cc..c0b41462709 100644
--- a/src/mame/drivers/timeplt.cpp
+++ b/src/mame/drivers/timeplt.cpp
@@ -454,8 +454,7 @@ void timeplt_state::timeplt(machine_config &config)
m_screen->screen_vblank().set(FUNC(timeplt_state::vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_timeplt);
- PALETTE(config, m_palette, 32*4+64*4);
- m_palette->set_init(FUNC(timeplt_state::palette_init_timeplt));
+ PALETTE(config, m_palette, FUNC(timeplt_state::timeplt_palette), 32*4 + 64*4);
/* sound hardware */
TIMEPLT_AUDIO(config, "timeplt_audio");
diff --git a/src/mame/drivers/tk2000.cpp b/src/mame/drivers/tk2000.cpp
index 0c2d0b1bd40..19727c5a6d8 100644
--- a/src/mame/drivers/tk2000.cpp
+++ b/src/mame/drivers/tk2000.cpp
@@ -41,8 +41,8 @@
class tk2000_state : public driver_device
{
public:
- tk2000_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tk2000_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, A2_CPU_TAG),
m_ram(*this, RAM_TAG),
m_screen(*this, "screen"),
@@ -60,7 +60,7 @@ public:
m_speaker(*this, A2_SPEAKER_TAG),
m_cassette(*this, A2_CASSETTE_TAG),
m_upperbank(*this, A2_UPPERBANK_TAG)
- { }
+ { }
void tk2000(machine_config &config);
@@ -92,7 +92,6 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(apple2_interrupt);
- DECLARE_PALETTE_INIT(tk2000);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(ram_r);
@@ -162,11 +161,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(tk2000_state::apple2_interrupt)
}
}
-PALETTE_INIT_MEMBER(tk2000_state, tk2000)
-{
- m_video->palette_init_apple2(palette);
-}
-
uint32_t tk2000_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_video->hgr_update(screen, bitmap, cliprect, 0, 191);
@@ -579,7 +573,7 @@ MACHINE_CONFIG_START(tk2000_state::tk2000)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", tk2000_state, apple2_interrupt, "screen", 0, 1)
MCFG_QUANTUM_TIME(attotime::from_hz(60))
- MCFG_DEVICE_ADD(A2_VIDEO_TAG, APPLE2_VIDEO, XTAL(14'318'181))
+ APPLE2_VIDEO(config, m_video, XTAL(14'318'181));
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -587,10 +581,7 @@ MACHINE_CONFIG_START(tk2000_state::tk2000)
MCFG_SCREEN_SIZE(280*2, 262)
MCFG_SCREEN_VISIBLE_AREA(0, (280*2)-1,0,192-1)
MCFG_SCREEN_UPDATE_DRIVER(tk2000_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
-
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(tk2000_state, tk2000)
+ MCFG_SCREEN_PALETTE(m_video)
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tk80bs.cpp b/src/mame/drivers/tk80bs.cpp
index fc26f3d365e..a1a71076978 100644
--- a/src/mame/drivers/tk80bs.cpp
+++ b/src/mame/drivers/tk80bs.cpp
@@ -32,8 +32,8 @@ TODO:
class tk80bs_state : public driver_device
{
public:
- tk80bs_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tk80bs_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_p_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
m_ppi(*this, "ppi"),
@@ -184,9 +184,9 @@ MACHINE_CONFIG_START(tk80bs_state::tk80bs)
MCFG_SCREEN_SIZE(256, 128)
MCFG_SCREEN_VISIBLE_AREA(0, 256-1, 0, 128-1)
MCFG_SCREEN_UPDATE_DRIVER(tk80bs_state, screen_update_tk80bs)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tk80bs)
/* Devices */
diff --git a/src/mame/drivers/tmaster.cpp b/src/mame/drivers/tmaster.cpp
index 9d20eefddc8..fdc9a2b1ecc 100644
--- a/src/mame/drivers/tmaster.cpp
+++ b/src/mame/drivers/tmaster.cpp
@@ -113,8 +113,8 @@ Chips:
class tmaster_state : public driver_device
{
public:
- tmaster_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tmaster_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
@@ -386,10 +386,9 @@ MACHINE_CONFIG_START(tmaster_state::tm)
MCFG_SCREEN_SIZE(400, 256)
MCFG_SCREEN_VISIBLE_AREA(0, 400-1, 0, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(tmaster_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD("palette", 0x1000)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x1000);
MCFG_CESBLIT_ADD("blitter", "screen", XTAL(32'000'000))
MCFG_CESBLIT_COMPUTE_ADDR(tmaster_compute_addr)
diff --git a/src/mame/drivers/tmmjprd.cpp b/src/mame/drivers/tmmjprd.cpp
index 3e07201db57..bfcfe5c81af 100644
--- a/src/mame/drivers/tmmjprd.cpp
+++ b/src/mame/drivers/tmmjprd.cpp
@@ -748,9 +748,7 @@ void tmmjprd_state::tmpdoki(machine_config &config)
EEPROM_93C46_16BIT(config, m_eeprom, eeprom_serial_streaming::ENABLE);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tmmjprd);
-
- PALETTE(config, m_palette, 0x1000);
- m_palette->set_format(PALETTE_FORMAT_XGRB);
+ PALETTE(config, m_palette).set_format(palette_device::xGRB_888, 0x1000);
screen_device &lscreen(SCREEN(config, "lscreen", SCREEN_TYPE_RASTER));
lscreen.set_refresh_hz(60);
diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp
index 7615fa86bd9..044c7efa14f 100644
--- a/src/mame/drivers/tmnt.cpp
+++ b/src/mame/drivers/tmnt.cpp
@@ -1936,8 +1936,7 @@ void tmnt_state::cuebrick(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_mia));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->set_membits(8);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -1989,8 +1988,7 @@ void tmnt_state::mia(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_mia));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->set_membits(8);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2049,11 +2047,11 @@ void tmnt_state::tmnt(machine_config &config)
screen.set_size(64*8, 32*8);
screen.set_visarea(12*8, (64-12)*8-1, 2*8, 30*8-1 );
// verified against real hardware
+
screen.set_screen_update(FUNC(tmnt_state::screen_update_tmnt));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->set_membits(8);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2116,8 +2114,7 @@ void tmnt_state::punkshot(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_punkshot));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2166,8 +2163,7 @@ void tmnt_state::lgtnfght(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_lgtnfght));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2223,8 +2219,7 @@ void tmnt_state::blswhstl(machine_config &config)
screen.screen_vblank().set(FUNC(tmnt_state::screen_vblank_blswhstl));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2239,7 +2234,6 @@ void tmnt_state::blswhstl(machine_config &config)
m_k053245->set_sprite_callback(FUNC(tmnt_state::blswhstl_sprite_callback), this);
K053251(config, m_k053251, 0);
-
K054000(config, m_k054000, 0);
/* sound hardware */
@@ -2299,8 +2293,7 @@ void tmnt_state::glfgreat(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_glfgreat);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2366,8 +2359,7 @@ void tmnt_state::prmrsocr(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_glfgreat);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2431,8 +2423,7 @@ void tmnt_state::tmnt2(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_tmnt2));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2487,8 +2478,7 @@ void tmnt_state::ssriders(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_tmnt2));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2537,8 +2527,7 @@ void tmnt_state::sunsetbl(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_tmnt2));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
@@ -2586,8 +2575,7 @@ void tmnt_state::thndrx2(machine_config &config)
screen.set_screen_update(FUNC(tmnt_state::screen_update_thndrx2));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
diff --git a/src/mame/drivers/tmspoker.cpp b/src/mame/drivers/tmspoker.cpp
index a3c13cfd93f..8b89cc18270 100644
--- a/src/mame/drivers/tmspoker.cpp
+++ b/src/mame/drivers/tmspoker.cpp
@@ -219,31 +219,35 @@
class tmspoker_state : public driver_device
{
public:
- tmspoker_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tmspoker_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode") { }
+ m_gfxdecode(*this, "gfxdecode")
+ { }
void tmspoker(machine_config &config);
void init_bus();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_shared_ptr<uint8_t> m_videoram;
tilemap_t *m_bg_tilemap;
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_gfxdecode;
+
DECLARE_WRITE8_MEMBER(tmspoker_videoram_w);
//DECLARE_WRITE8_MEMBER(debug_w);
DECLARE_READ8_MEMBER(unk_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(tmspoker);
+ void tmspoker_palette(palette_device &palette) const;
uint32_t screen_update_tmspoker(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(tmspoker_interrupt);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
void tmspoker_cru_map(address_map &map);
void tmspoker_map(address_map &map);
@@ -285,7 +289,7 @@ uint32_t tmspoker_state::screen_update_tmspoker(screen_device &screen, bitmap_in
return 0;
}
-PALETTE_INIT_MEMBER(tmspoker_state, tmspoker)
+void tmspoker_state::tmspoker_palette(palette_device &palette) const
{
}
@@ -577,10 +581,8 @@ MACHINE_CONFIG_START(tmspoker_state::tmspoker)
MCFG_SCREEN_UPDATE_DRIVER(tmspoker_state, screen_update_tmspoker)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tmspoker)
-
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(tmspoker_state, tmspoker)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_tmspoker);
+ PALETTE(config, "palette", FUNC(tmspoker_state::tmspoker_palette), 256);
mc6845_device &crtc(MC6845(config, "crtc", MASTER_CLOCK/4)); /* guess */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/tnzs.cpp b/src/mame/drivers/tnzs.cpp
index ef83d7674d1..7fe16ec72c8 100644
--- a/src/mame/drivers/tnzs.cpp
+++ b/src/mame/drivers/tnzs.cpp
@@ -1558,7 +1558,7 @@ void tnzs_base_state::tnzs_base(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tnzs);
- PALETTE(config, m_palette, 512).set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 512);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1590,6 +1590,7 @@ void tnzs_mcu_state::tnzs(machine_config &config)
void extrmatn_state::extrmatn(machine_config &config)
{
tnzs(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &extrmatn_state::prompal_main_map);
@@ -1597,12 +1598,13 @@ void extrmatn_state::extrmatn(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(0));
- m_palette->set_init(FUNC(extrmatn_state::palette_init_prompalette));
+ m_palette->set_init(FUNC(extrmatn_state::prompalette));
}
void extrmatn_state::plumppop(machine_config &config)
{
extrmatn(config);
+
UPD4701A(config, m_upd4701);
m_upd4701->set_portx_tag("AN1");
m_upd4701->set_porty_tag("AN2");
@@ -1611,6 +1613,7 @@ void extrmatn_state::plumppop(machine_config &config)
void arknoid2_state::arknoid2(machine_config &config)
{
plumppop(config);
+
/* basic machine hardware */
m_maincpu->set_vblank_int("screen", FUNC(arknoid2_state::mcu_interrupt));
m_subcpu->set_addrmap(AS_PROGRAM, &arknoid2_state::arknoid2_sub_map);
@@ -1621,6 +1624,7 @@ void arknoid2_state::arknoid2(machine_config &config)
void insectx_state::insectx(machine_config &config)
{
tnzs_base(config);
+
/* basic machine hardware */
m_subcpu->set_addrmap(AS_PROGRAM, &insectx_state::insectx_sub_map);
@@ -1637,6 +1641,7 @@ void insectx_state::insectx(machine_config &config)
void kageki_state::kageki(machine_config &config)
{
tnzs_base(config);
+
/* basic machine hardware */
m_subcpu->set_addrmap(AS_PROGRAM, &kageki_state::kageki_sub_map);
@@ -1658,6 +1663,7 @@ void kageki_state::kageki(machine_config &config)
void tnzsb_state::tnzsb(machine_config &config)
{
tnzs_base(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &tnzsb_state::tnzsb_main_map);
m_subcpu->set_addrmap(AS_PROGRAM, &tnzsb_state::tnzsb_sub_map);
@@ -1703,6 +1709,7 @@ void kabukiz_state::kabukiz(machine_config &config)
void jpopnics_state::jpopnics(machine_config &config)
{
tnzs_base(config);
+
/* basic machine hardware */
m_maincpu->set_addrmap(AS_PROGRAM, &jpopnics_state::jpopnics_main_map);
m_subcpu->set_addrmap(AS_PROGRAM, &jpopnics_state::jpopnics_sub_map);
@@ -1712,8 +1719,7 @@ void jpopnics_state::jpopnics(machine_config &config)
m_upd4701->set_porty_tag("AN2");
/* video hardware */
- m_palette->set_entries(1024);
- m_palette->set_format(PALETTE_FORMAT_GGGGBBBBRRRRxxxx); /* wrong, the other 4 bits seem to be used as well */
+ m_palette->set_format(palette_device::GBRx_444, 1024); // wrong, the other 4 bits seem to be used as well
m_palette->set_endianness(ENDIANNESS_BIG);
/* sound hardware */
diff --git a/src/mame/drivers/toaplan1.cpp b/src/mame/drivers/toaplan1.cpp
index b6300b318e1..d58afbec76f 100644
--- a/src/mame/drivers/toaplan1.cpp
+++ b/src/mame/drivers/toaplan1.cpp
@@ -1933,15 +1933,14 @@ MACHINE_CONFIG_START(toaplan1_rallybik_state::rallybik)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL55, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_rallybik_state, screen_update_rallybik)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_rallybik_state, screen_vblank_rallybik))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
TOAPLAN_SCU(config, m_spritegen, 0);
m_spritegen->set_palette(m_palette);
m_spritegen->set_xoffsets(31, 15);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_rallybik)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_rallybik);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_rallybik_state,rallybik)
@@ -1974,11 +1973,10 @@ MACHINE_CONFIG_START(toaplan1_state::truxton)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2011,11 +2009,10 @@ MACHINE_CONFIG_START(toaplan1_state::hellfire)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND+16, VBSTART+16)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2048,11 +2045,10 @@ MACHINE_CONFIG_START(toaplan1_state::zerowing)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND+16, VBSTART+16)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2090,11 +2086,10 @@ MACHINE_CONFIG_START(toaplan1_state::demonwld)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL55, VBEND+16, VBSTART+16)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2127,11 +2122,10 @@ MACHINE_CONFIG_START(toaplan1_state::samesame)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_samesame))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2164,11 +2158,10 @@ MACHINE_CONFIG_START(toaplan1_state::outzone)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL55, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2201,11 +2194,10 @@ MACHINE_CONFIG_START(toaplan1_state::outzonecv)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
@@ -2238,11 +2230,10 @@ MACHINE_CONFIG_START(toaplan1_state::vimana)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
MCFG_SCREEN_UPDATE_DRIVER(toaplan1_state, screen_update_toaplan1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, toaplan1_state, screen_vblank_toaplan1))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toaplan1)
- MCFG_PALETTE_ADD("palette", (64*16)+(64*16))
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toaplan1);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, (64*16)+(64*16));
MCFG_VIDEO_START_OVERRIDE(toaplan1_state,toaplan1)
diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp
index 8f13ff3e719..88b073d29a5 100644
--- a/src/mame/drivers/toaplan2.cpp
+++ b/src/mame/drivers/toaplan2.cpp
@@ -3230,8 +3230,7 @@ MACHINE_CONFIG_START(toaplan2_state::tekipaki)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3273,8 +3272,7 @@ MACHINE_CONFIG_START(toaplan2_state::ghox)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3360,8 +3358,7 @@ MACHINE_CONFIG_START(toaplan2_state::dogyuun)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3408,8 +3405,7 @@ MACHINE_CONFIG_START(toaplan2_state::kbash)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3444,8 +3440,7 @@ MACHINE_CONFIG_START(toaplan2_state::kbash2)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3478,9 +3473,8 @@ MACHINE_CONFIG_START(toaplan2_state::truxton2)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_truxton2)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_truxton2);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3533,8 +3527,7 @@ MACHINE_CONFIG_START(toaplan2_state::pipibibs)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3573,8 +3566,7 @@ MACHINE_CONFIG_START(toaplan2_state::pipibibsbl)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL); // FIXME: bootleg has no VDP
m_vdp[0]->set_palette(m_palette);
@@ -3651,9 +3643,8 @@ MACHINE_CONFIG_START(toaplan2_state::fixeight)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_truxton2)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_truxton2);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3689,9 +3680,8 @@ MACHINE_CONFIG_START(toaplan2_state::fixeightbl)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_textrom);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3730,8 +3720,7 @@ MACHINE_CONFIG_START(toaplan2_state::vfive)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3770,8 +3759,7 @@ MACHINE_CONFIG_START(toaplan2_state::batsugun)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3811,8 +3799,7 @@ MACHINE_CONFIG_START(toaplan2_state::pwrkick)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3844,8 +3831,7 @@ MACHINE_CONFIG_START(toaplan2_state::othldrby)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3874,8 +3860,7 @@ MACHINE_CONFIG_START(toaplan2_state::enmadaio)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3910,8 +3895,7 @@ MACHINE_CONFIG_START(toaplan2_state::snowbro2)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3953,9 +3937,8 @@ MACHINE_CONFIG_START(toaplan2_state::mahoudai)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_textrom);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -3997,9 +3980,8 @@ MACHINE_CONFIG_START(toaplan2_state::shippumd)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_textrom);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -4040,9 +4022,8 @@ MACHINE_CONFIG_START(toaplan2_state::bgaregga)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_textrom)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_textrom);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -4106,9 +4087,8 @@ MACHINE_CONFIG_START(toaplan2_state::batrider)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_batrider)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_batrider);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
@@ -4174,9 +4154,8 @@ MACHINE_CONFIG_START(toaplan2_state::bbakraid)
m_screen->screen_vblank().set(FUNC(toaplan2_state::screen_vblank));
m_screen->set_palette(m_palette);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_batrider)
- MCFG_PALETTE_ADD("palette", T2PALETTE_LENGTH)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_batrider);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, T2PALETTE_LENGTH);
GP9001_VDP(config, m_vdp[0], 27_MHz_XTAL);
m_vdp[0]->set_palette(m_palette);
diff --git a/src/mame/drivers/toki.cpp b/src/mame/drivers/toki.cpp
index bbfa168650a..ea6353805e4 100644
--- a/src/mame/drivers/toki.cpp
+++ b/src/mame/drivers/toki.cpp
@@ -507,7 +507,7 @@ MACHINE_CONFIG_START(toki_state::toki) /* KOYO 20.000MHz near the cpu */
SEI80BU(config, "sei80bu", 0).set_device_rom_tag("audiocpu");
/* video hardware */
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(59.61) /* verified on pcb */
@@ -515,11 +515,10 @@ MACHINE_CONFIG_START(toki_state::toki) /* KOYO 20.000MHz near the cpu */
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) /* verified */
MCFG_SCREEN_UPDATE_DRIVER(toki_state, screen_update_toki)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_toki)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_toki);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -561,7 +560,7 @@ MACHINE_CONFIG_START(toki_state::tokib)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("spriteram", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
@@ -569,11 +568,10 @@ MACHINE_CONFIG_START(toki_state::tokib)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 2*8, 30*8-1) /* verified */
MCFG_SCREEN_UPDATE_DRIVER(toki_state, screen_update_tokib)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE("spriteram", buffered_spriteram16_device, vblank_copy_rising))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tokib)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tokib);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/topspeed.cpp b/src/mame/drivers/topspeed.cpp
index 2867a02b7dd..4644da6a6ca 100644
--- a/src/mame/drivers/topspeed.cpp
+++ b/src/mame/drivers/topspeed.cpp
@@ -616,9 +616,8 @@ MACHINE_CONFIG_START(topspeed_state::topspeed)
MCFG_SCREEN_UPDATE_DRIVER(topspeed_state, screen_update_topspeed)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_topspeed)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_topspeed);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 8192);
// sound hardware
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/toypop.cpp b/src/mame/drivers/toypop.cpp
index 53e3ae99c73..317b35e5264 100644
--- a/src/mame/drivers/toypop.cpp
+++ b/src/mame/drivers/toypop.cpp
@@ -91,7 +91,7 @@ private:
DECLARE_READ8_MEMBER(irq_enable_r);
DECLARE_WRITE8_MEMBER(irq_disable_w);
DECLARE_WRITE8_MEMBER(irq_ctrl_w);
- DECLARE_PALETTE_INIT(toypop);
+ void toypop_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(dipA_l);
DECLARE_READ8_MEMBER(dipA_h);
DECLARE_READ8_MEMBER(dipB_l);
@@ -129,48 +129,48 @@ private:
void legacy_obj_draw(bitmap_ind16 &bitmap,const rectangle &cliprect,bool flip);
};
-PALETTE_INIT_MEMBER(namcos16_state, toypop)
+void namcos16_state::toypop_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (int i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
+ int bit0, bit1, bit2, bit3;
// red component
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
// green component
- bit0 = (color_prom[i+0x100] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 1) & 0x01;
- bit2 = (color_prom[i+0x100] >> 2) & 0x01;
- bit3 = (color_prom[i+0x100] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i + 0x100], 0);
+ bit1 = BIT(color_prom[i + 0x100], 1);
+ bit2 = BIT(color_prom[i + 0x100], 2);
+ bit3 = BIT(color_prom[i + 0x100], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
// blue component
- bit0 = (color_prom[i+0x200] >> 0) & 0x01;
- bit1 = (color_prom[i+0x200] >> 1) & 0x01;
- bit2 = (color_prom[i+0x200] >> 2) & 0x01;
- bit3 = (color_prom[i+0x200] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i + 0x200], 0);
+ bit1 = BIT(color_prom[i + 0x200], 1);
+ bit2 = BIT(color_prom[i + 0x200], 2);
+ bit3 = BIT(color_prom[i + 0x200], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_indirect_color(i, rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (int i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- uint8_t entry;
-
// characters
palette.set_pen_indirect(i + 0*256, (color_prom[i + 0x300] & 0x0f) | 0x70);
palette.set_pen_indirect(i + 1*256, (color_prom[i + 0x300] & 0x0f) | 0xf0);
+
// sprites
- entry = color_prom[i + 0x500];
+ uint8_t const entry = color_prom[i + 0x500];
palette.set_pen_indirect(i + 2*256, entry);
}
- for (int i = 0;i < 16;i++)
+
+ for (int i = 0; i < 16; i++)
{
// background
palette.set_pen_indirect(i + 3*256 + 0*16, 0x60 + i);
@@ -729,9 +729,7 @@ void namcos16_state::liblrabl(machine_config &config)
screen.screen_vblank().set(FUNC(namcos16_state::slave_vblank_irq));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_toypop);
- PALETTE(config, m_palette, 128*4+64*4+16*2);
- m_palette->set_indirect_entries(256);
- m_palette->set_init(FUNC(namcos16_state::palette_init_toypop));
+ PALETTE(config, m_palette, FUNC(namcos16_state::toypop_palette), 128*4 + 64*4 + 16*2, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tp84.cpp b/src/mame/drivers/tp84.cpp
index cd94eff3be6..a3cc77483b4 100644
--- a/src/mame/drivers/tp84.cpp
+++ b/src/mame/drivers/tp84.cpp
@@ -360,13 +360,11 @@ MACHINE_CONFIG_START(tp84_state::tp84)
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(tp84_state, screen_update_tp84)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tp84_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tp84)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(tp84_state, tp84)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tp84);
+ PALETTE(config, m_palette, FUNC(tp84_state::tp84_palette), 4096, 256);
/* audio hardware */
SPEAKER(config, "mono").front_center();
@@ -382,12 +380,8 @@ MACHINE_CONFIG_START(tp84_state::tp84)
MCFG_DEVICE_ADD("y2404_3", Y2404, XTAL(14'318'181)/8) /* verified on pcb */
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "filter3", 0.75)
- MCFG_DEVICE_ADD("filter1", FILTER_RC)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MCFG_DEVICE_ADD("filter2", FILTER_RC)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
- MCFG_DEVICE_ADD("filter3", FILTER_RC)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ for (auto &filter : m_filter)
+ FILTER_RC(config, filter).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(tp84_state::tp84b)
diff --git a/src/mame/drivers/tr175.cpp b/src/mame/drivers/tr175.cpp
index a70aad110ff..4a7cf07ed6d 100644
--- a/src/mame/drivers/tr175.cpp
+++ b/src/mame/drivers/tr175.cpp
@@ -105,7 +105,7 @@ void tr175_state::tr175(machine_config &config)
scn2681_device &duart(SCN2681(config, "duart", 11.0592_MHz_XTAL / 3)); // is this the right clock?
duart.irq_cb().set_inputline("maincpu", M68K_IRQ_1);
- PALETTE(config, "palette", 0x100);
+ PALETTE(config, "palette").set_entries(0x100);
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, "palette"));
ramdac.set_addrmap(0, &tr175_state::ramdac_map);
}
diff --git a/src/mame/drivers/trackfld.cpp b/src/mame/drivers/trackfld.cpp
index 41578b7fb85..18441d3ee70 100644
--- a/src/mame/drivers/trackfld.cpp
+++ b/src/mame/drivers/trackfld.cpp
@@ -931,11 +931,8 @@ MACHINE_CONFIG_START(trackfld_state::trackfld)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, trackfld_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trackfld)
- MCFG_PALETTE_ADD(m_palette, 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(trackfld_state,trackfld)
- MCFG_VIDEO_START_OVERRIDE(trackfld_state,trackfld)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_trackfld);
+ PALETTE(config, m_palette, FUNC(trackfld_state::trackfld_palette), 16*16+16*16, 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1007,10 +1004,8 @@ MACHINE_CONFIG_START(trackfld_state::yieartf)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, trackfld_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trackfld)
- MCFG_PALETTE_ADD(m_palette, 16*16+16*16)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(trackfld_state,trackfld)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_trackfld);
+ PALETTE(config, m_palette, FUNC(trackfld_state::trackfld_palette), 16*16+16*16, 32);
MCFG_VIDEO_START_OVERRIDE(trackfld_state,trackfld)
/* sound hardware */
diff --git a/src/mame/drivers/travrusa.cpp b/src/mame/drivers/travrusa.cpp
index e1d20b131ac..2e45691afa2 100644
--- a/src/mame/drivers/travrusa.cpp
+++ b/src/mame/drivers/travrusa.cpp
@@ -321,13 +321,11 @@ MACHINE_CONFIG_START(travrusa_state::travrusa)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8, 31*8-1, 0*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(travrusa_state, screen_update_travrusa)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_travrusa)
+ MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_travrusa)
- MCFG_PALETTE_ADD("palette", 16*8+16*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(128+16)
- MCFG_PALETTE_INIT_OWNER(travrusa_state, travrusa)
+ PALETTE(config, m_palette, FUNC(travrusa_state::travrusa_palette), 16*8+16*8, 128+16);
/* sound hardware */
//m52_sound_c_audio(config);
@@ -340,8 +338,7 @@ MACHINE_CONFIG_START(travrusa_state::shtrider)
/* video hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_shtrider)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(travrusa_state,shtrider)
+ m_palette->set_init(FUNC(travrusa_state::shtrider_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(travrusa_state::shtriderb)
diff --git a/src/mame/drivers/triplhnt.cpp b/src/mame/drivers/triplhnt.cpp
index 495a4083bdf..a3f7f9cf314 100644
--- a/src/mame/drivers/triplhnt.cpp
+++ b/src/mame/drivers/triplhnt.cpp
@@ -258,16 +258,16 @@ static GFXDECODE_START( gfx_triplhnt )
GFXDECODE_END
-PALETTE_INIT_MEMBER(triplhnt_state, triplhnt)
+void triplhnt_state::triplhnt_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0xAF, 0xAF, 0xAF)); /* sprites */
+ palette.set_pen_color(0, rgb_t(0xaf, 0xaf, 0xaf)); // sprites
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(2, rgb_t(0xFF, 0xFF, 0xFF));
+ palette.set_pen_color(2, rgb_t(0xff, 0xff, 0xff));
palette.set_pen_color(3, rgb_t(0x50, 0x50, 0x50));
- palette.set_pen_color(4, rgb_t(0x00, 0x00, 0x00)); /* tiles */
- palette.set_pen_color(5, rgb_t(0x3F, 0x3F, 0x3F));
+ palette.set_pen_color(4, rgb_t(0x00, 0x00, 0x00)); // tiles
+ palette.set_pen_color(5, rgb_t(0x3f, 0x3f, 0x3f));
palette.set_pen_color(6, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(7, rgb_t(0x3F, 0x3F, 0x3F));
+ palette.set_pen_color(7, rgb_t(0x3f, 0x3f, 0x3f));
}
@@ -303,7 +303,7 @@ void triplhnt_state::triplhnt(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_triplhnt);
- PALETTE(config, m_palette, 8).set_init(FUNC(triplhnt_state::palette_init_triplhnt));
+ PALETTE(config, m_palette, FUNC(triplhnt_state::triplhnt_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/trs80.cpp b/src/mame/drivers/trs80.cpp
index f08f4a5bdef..c3362b9414e 100644
--- a/src/mame/drivers/trs80.cpp
+++ b/src/mame/drivers/trs80.cpp
@@ -510,8 +510,8 @@ MACHINE_CONFIG_START(trs80_state::trs80) // the original model I, level I,
MCFG_SCREEN_UPDATE_DRIVER(trs80_state, screen_update_trs80)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trs80)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ GFXDECODE(config, "gfxdecode", "palette", gfx_trs80);
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -524,6 +524,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(trs80_state::model1) // model I, level II
trs80(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(m1_mem)
MCFG_DEVICE_IO_MAP(m1_io)
@@ -609,9 +610,7 @@ MACHINE_CONFIG_START(trs80_state::lnw80)
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_lnw80)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(8)
- MCFG_PALETTE_INIT_OWNER(trs80_state,lnw80)
+ subdevice<palette_device>("palette")->set_entries(8).set_init(FUNC(trs80_state::lnw80_palette));
MCFG_SCREEN_MODIFY("screen")
MCFG_SCREEN_RAW_PARAMS(3.579545_MHz_XTAL * 3, 682, 0, 480, 264, 0, 192) // 10.738MHz generated by tank circuit (top left of page 2 of schematics)
// LNW80 Theory of Operations gives H and V periods as 15.750kHz and 59.66Hz, probably due to rounding the calculated ~15.7468kHz to 4 figures
diff --git a/src/mame/drivers/trs80dt1.cpp b/src/mame/drivers/trs80dt1.cpp
index d8c787c1efa..36c390c1556 100644
--- a/src/mame/drivers/trs80dt1.cpp
+++ b/src/mame/drivers/trs80dt1.cpp
@@ -338,7 +338,7 @@ void trs80dt1_state::trs80dt1(machine_config &config)
m_crtc->vrtc_wr_callback().set(m_7474, FUNC(ttl7474_device::clock_w));
m_crtc->set_screen("screen");
- PALETTE(config, "palette", 3);
+ PALETTE(config, "palette").set_entries(3);
X2210(config, "nvram");
diff --git a/src/mame/drivers/trs80m2.cpp b/src/mame/drivers/trs80m2.cpp
index 177b235dfab..f65f965be68 100644
--- a/src/mame/drivers/trs80m2.cpp
+++ b/src/mame/drivers/trs80m2.cpp
@@ -722,7 +722,7 @@ MACHINE_CONFIG_START(trs80m2_state::trs80m2)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, 12.48_MHz_XTAL / 8);
m_crtc->set_screen(SCREEN_TAG);
@@ -811,7 +811,7 @@ MACHINE_CONFIG_START(trs80m16_state::trs80m16)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 479)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MC6845(config, m_crtc, 12.48_MHz_XTAL / 8);
m_crtc->set_screen(SCREEN_TAG);
diff --git a/src/mame/drivers/trs80m3.cpp b/src/mame/drivers/trs80m3.cpp
index 2d10aad5d9d..b5140197b72 100644
--- a/src/mame/drivers/trs80m3.cpp
+++ b/src/mame/drivers/trs80m3.cpp
@@ -346,8 +346,8 @@ MACHINE_CONFIG_START(trs80m3_state::model3)
MCFG_SCREEN_UPDATE_DRIVER(trs80m3_state, screen_update_trs80m3)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trs80m3)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ GFXDECODE(config, "gfxdecode", "palette", gfx_trs80m3);
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/truco.cpp b/src/mame/drivers/truco.cpp
index 9f468c1c9d8..4d43ed814ce 100644
--- a/src/mame/drivers/truco.cpp
+++ b/src/mame/drivers/truco.cpp
@@ -444,8 +444,7 @@ MACHINE_CONFIG_START(truco_state::truco)
MCFG_SCREEN_UPDATE_DRIVER(truco_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(truco_state, truco)
+ PALETTE(config, "palette", FUNC(truco_state::truco_palette), 16);
mc6845_device &crtc(MC6845(config, "crtc", CRTC_CLOCK)); /* Identified as UM6845 */
crtc.set_screen("screen");
diff --git a/src/mame/drivers/trucocl.cpp b/src/mame/drivers/trucocl.cpp
index 61ff21d60df..8a3b0dcb8a3 100644
--- a/src/mame/drivers/trucocl.cpp
+++ b/src/mame/drivers/trucocl.cpp
@@ -198,9 +198,8 @@ MACHINE_CONFIG_START(trucocl_state::trucocl)
MCFG_SCREEN_UPDATE_DRIVER(trucocl_state, screen_update_trucocl)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_trucocl)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(trucocl_state, trucocl)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_trucocl);
+ PALETTE(config, "palette", FUNC(trucocl_state::trucocl_palette), 32);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/tryout.cpp b/src/mame/drivers/tryout.cpp
index 2faa973a506..1839f9dfb1b 100644
--- a/src/mame/drivers/tryout.cpp
+++ b/src/mame/drivers/tryout.cpp
@@ -207,11 +207,10 @@ MACHINE_CONFIG_START(tryout_state::tryout)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 1*8, 31*8-1)
MCFG_SCREEN_UPDATE_DRIVER(tryout_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tryout)
- MCFG_PALETTE_ADD("palette", 0x20)
- MCFG_PALETTE_INIT_OWNER(tryout_state, tryout)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_tryout)
+ PALETTE(config, m_palette, FUNC(tryout_state::tryout_palette), 0x20);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp
index fc631616ee6..cdc949add4a 100644
--- a/src/mame/drivers/ts803.cpp
+++ b/src/mame/drivers/ts803.cpp
@@ -434,7 +434,7 @@ MACHINE_CONFIG_START(ts803_state::ts803)
MCFG_SCREEN_SIZE(640,240)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 240-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* crtc */
sy6545_1_device &crtc(SY6545_1(config, "crtc", 13608000 / 8));
diff --git a/src/mame/drivers/tsamurai.cpp b/src/mame/drivers/tsamurai.cpp
index 9a47a3c3dc1..bdbae8cbf5e 100644
--- a/src/mame/drivers/tsamurai.cpp
+++ b/src/mame/drivers/tsamurai.cpp
@@ -746,11 +746,11 @@ MACHINE_CONFIG_START(tsamurai_state::tsamurai)
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_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tsamurai_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tsamurai)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(tsamurai_state,tsamurai)
/* sound hardware */
@@ -793,11 +793,11 @@ MACHINE_CONFIG_START(tsamurai_state::vsgongf)
MCFG_SCREEN_SIZE(32*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 255, 16, 255-16)
MCFG_SCREEN_UPDATE_DRIVER(tsamurai_state, screen_update_vsgongf)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tsamurai_state, vblank_irq))
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tsamurai)
- MCFG_PALETTE_ADD_RRRRGGGGBBBB_PROMS("palette", "proms", 256)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(tsamurai_state,vsgongf)
/* sound hardware */
@@ -852,7 +852,7 @@ MACHINE_CONFIG_START(tsamurai_state::m660)
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)
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
MCFG_VIDEO_START_OVERRIDE(tsamurai_state,m660)
/* sound hardware */
diff --git a/src/mame/drivers/tubep.cpp b/src/mame/drivers/tubep.cpp
index 99f1c701c13..c2ace202c4a 100644
--- a/src/mame/drivers/tubep.cpp
+++ b/src/mame/drivers/tubep.cpp
@@ -859,9 +859,7 @@ MACHINE_CONFIG_START(tubep_state::tubep)
MCFG_SCREEN_UPDATE_DRIVER(tubep_state, screen_update_tubep)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 32 + 256*64)
-
- MCFG_PALETTE_INIT_OWNER(tubep_state,tubep)
+ PALETTE(config, "palette", FUNC(tubep_state::tubep_palette), 32 + 256*64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -931,9 +929,7 @@ MACHINE_CONFIG_START(tubep_state::rjammer)
MCFG_SCREEN_UPDATE_DRIVER(tubep_state, screen_update_rjammer)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 64)
-
- MCFG_PALETTE_INIT_OWNER(tubep_state,rjammer)
+ PALETTE(config, "palette", FUNC(tubep_state::rjammer_palette), 64);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tugboat.cpp b/src/mame/drivers/tugboat.cpp
index e5231a3e925..55e3d72b31c 100644
--- a/src/mame/drivers/tugboat.cpp
+++ b/src/mame/drivers/tugboat.cpp
@@ -37,22 +37,30 @@ always false - counter was reloaded and incremented before interrupt occurs
class tugboat_state : public driver_device
{
public:
- tugboat_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tugboat_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
- m_ram(*this, "ram") { }
+ m_ram(*this, "ram")
+ { }
void tugboat(machine_config &config);
-private:
+protected:
enum
{
TIMER_INTERRUPT
};
+ virtual void machine_start() override;
+ virtual void video_start() override;
+ virtual void machine_reset() override;
+
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+private:
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
@@ -73,17 +81,12 @@ private:
DECLARE_READ8_MEMBER(input_r);
DECLARE_WRITE8_MEMBER(ctrl_w);
- virtual void machine_start() override;
- virtual void video_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(tugboat);
+ void tugboat_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, int addr, int gfx0, int gfx1, int transparency);
void main_map(address_map &map);
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
@@ -104,24 +107,19 @@ void tugboat_state::video_start()
m_gfxdecode->gfx(2)->set_granularity(8);
}
-/* there isn't the usual resistor array anywhere near the color prom,
- just four 1k resistors. */
-PALETTE_INIT_MEMBER(tugboat_state, tugboat)
+// there isn't the usual resistor array anywhere near the color PROM, just four 1k resistors.
+void tugboat_state::tugboat_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0;i < palette.entries();i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int r,g,b,brt;
+ int const brt = BIT(color_prom[i], 3) ? 0xff : 0x80;
- brt = ((color_prom[i] >> 3) & 0x01) ? 0xff : 0x80;
+ int const r = brt * BIT(color_prom[i], 0);
+ int const g = brt * BIT(color_prom[i], 1);
+ int const b = brt * BIT(color_prom[i], 2);
- r = brt * ((color_prom[i] >> 0) & 0x01);
- g = brt * ((color_prom[i] >> 1) & 0x01);
- b = brt * ((color_prom[i] >> 2) & 0x01);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -147,20 +145,18 @@ WRITE8_MEMBER(tugboat_state::score_w)
if (offset<0x8 ) m_ram[0x291d + 32*offset + 32*9] = data ^ 0x0f;
}
-void tugboat_state::draw_tilemap(bitmap_ind16 &bitmap,const rectangle &cliprect,
- int addr,int gfx0,int gfx1,int transparency)
+void tugboat_state::draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect,
+ int addr, int gfx0, int gfx1, int transparency)
{
- int x,y;
-
- for (y = 0;y < 32;y++)
+ for (int y = 0; y < 32; y++)
{
- for (x = 0;x < 32;x++)
+ for (int x = 0; x < 32; x++)
{
int attr = m_ram[addr + 0x400];
int code = ((attr & 0x01) << 8) | m_ram[addr];
int color = (attr & 0x3c) >> 2;
- int rgn, transpen;
+ int rgn, transpen;
if (attr & 0x02)
{
rgn = gfx1;
@@ -186,12 +182,12 @@ void tugboat_state::draw_tilemap(bitmap_ind16 &bitmap,const rectangle &cliprect,
uint32_t tugboat_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int startaddr0 = m_hd46505_0_reg[0x0c]*256 + m_hd46505_0_reg[0x0d];
- int startaddr1 = m_hd46505_1_reg[0x0c]*256 + m_hd46505_1_reg[0x0d];
+ int const startaddr0 = m_hd46505_0_reg[0x0c]*256 + m_hd46505_0_reg[0x0d];
+ int const startaddr1 = m_hd46505_1_reg[0x0c]*256 + m_hd46505_1_reg[0x0d];
+ draw_tilemap(bitmap, cliprect, startaddr0, 0, 1, false);
+ draw_tilemap(bitmap, cliprect, startaddr1, 2, 3, true);
- draw_tilemap(bitmap,cliprect,startaddr0,0,1,false);
- draw_tilemap(bitmap,cliprect,startaddr1,2,3,true);
return 0;
}
@@ -379,12 +375,11 @@ MACHINE_CONFIG_START(tugboat_state::tugboat)
MCFG_SCREEN_SIZE(32*8,32*8)
MCFG_SCREEN_VISIBLE_AREA(1*8,31*8-1,2*8,30*8-1)
MCFG_SCREEN_UPDATE_DRIVER(tugboat_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", INPUT_LINE_NMI))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tugboat)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(tugboat_state, tugboat)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tugboat);
+ PALETTE(config, m_palette, FUNC(tugboat_state::tugboat_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tumbleb.cpp b/src/mame/drivers/tumbleb.cpp
index d6f2eb659f2..a802773dcfc 100644
--- a/src/mame/drivers/tumbleb.cpp
+++ b/src/mame/drivers/tumbleb.cpp
@@ -2066,16 +2066,15 @@ MACHINE_CONFIG_START(tumbleb_state::tumblepb)
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(tumbleb_state, screen_update_tumblepb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
m_sprgen->set_is_bootleg(true);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tumbleb)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_tumbleb)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,tumblepb)
@@ -2109,16 +2108,15 @@ MACHINE_CONFIG_START(tumbleb_state::tumbleb2)
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(tumbleb_state, screen_update_tumblepb)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
m_sprgen->set_is_bootleg(true);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tumbleb)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_tumbleb)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,tumblepb)
@@ -2150,16 +2148,15 @@ MACHINE_CONFIG_START(tumbleb_state::jumpkids)
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(tumbleb_state, screen_update_jumpkids)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
m_sprgen->set_is_bootleg(true);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tumbleb)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_tumbleb)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,tumblepb)
@@ -2189,7 +2186,7 @@ MACHINE_CONFIG_START(tumbleb_state::fncywld)
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(tumbleb_state, screen_update_fncywld)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
@@ -2197,9 +2194,8 @@ MACHINE_CONFIG_START(tumbleb_state::fncywld)
m_sprgen->set_transpen(15);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fncywld)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_fncywld)
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x800);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,fncywld)
@@ -2230,7 +2226,7 @@ MACHINE_CONFIG_START(tumbleb_state::magipur)
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(tumbleb_state, screen_update_fncywld)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
DECO_SPRITE(config, m_sprgen, 0);
m_sprgen->set_gfx_region(3);
@@ -2238,9 +2234,8 @@ MACHINE_CONFIG_START(tumbleb_state::magipur)
m_sprgen->set_transpen(15);
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_fncywld)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_fncywld);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 0x800);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,fncywld)
@@ -2297,8 +2292,7 @@ void tumbleb_state::htchctch(machine_config &config)
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tumbleb);
-
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,tumblepb)
@@ -2326,7 +2320,7 @@ void tumbleb_state::cookbib(machine_config &config)
void tumbleb_state::chokchok(machine_config &config)
{
htchctch(config);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ m_palette->set_format(palette_device::xBGR_444, 1024);
// some PCBs have left factory with a 3.57mhz while some have a 4.096 which matches other games, assuming the former are factory errors
m_oki->set_clock(4096000/4);
}
@@ -2369,7 +2363,7 @@ void tumbleb_state::sdfight(machine_config &config)
void tumbleb_state::metlsavr(machine_config &config)
{
cookbib(config);
- m_palette->set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ m_palette->set_format(palette_device::xBGR_444, 1024);
subdevice<ym2151_device>("ymsnd")->set_clock(3427190);
}
@@ -2402,8 +2396,7 @@ void tumbleb_state::suprtrio(machine_config &config)
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_suprtrio);
-
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,suprtrio)
@@ -2441,7 +2434,7 @@ void tumbleb_state::pangpang(machine_config &config)
m_sprgen->set_gfxdecode_tag(m_gfxdecode);
GFXDECODE(config, m_gfxdecode, "palette", gfx_tumbleb);
- PALETTE(config, m_palette, 1024).set_format(PALETTE_FORMAT_xxxxBBBBGGGGRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024);
MCFG_VIDEO_START_OVERRIDE(tumbleb_state,pangpang)
diff --git a/src/mame/drivers/tunhunt.cpp b/src/mame/drivers/tunhunt.cpp
index 906d4ef5576..ce56dbdd969 100644
--- a/src/mame/drivers/tunhunt.cpp
+++ b/src/mame/drivers/tunhunt.cpp
@@ -286,9 +286,7 @@ void tunhunt_state::tunhunt(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tunhunt);
- PALETTE(config, m_palette, 0x1a);
- m_palette->set_indirect_entries(16);
- m_palette->set_init(FUNC(tunhunt_state::palette_init_tunhunt));
+ PALETTE(config, m_palette, FUNC(tunhunt_state::tunhunt_palette), 0x1a, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/turbo.cpp b/src/mame/drivers/turbo.cpp
index a6164e53489..37d450bdf08 100644
--- a/src/mame/drivers/turbo.cpp
+++ b/src/mame/drivers/turbo.cpp
@@ -881,9 +881,8 @@ MACHINE_CONFIG_START(turbo_state::turbo)
outlatch.q_out_cb<3>().set(FUNC(turbo_state::start_lamp_w));
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbo)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(turbo_state,turbo)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_turbo);
+ PALETTE(config, "palette", FUNC(turbo_state::turbo_palette), 256);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
@@ -921,9 +920,8 @@ MACHINE_CONFIG_START(turbo_state::subroc3d)
kbdc.in_rl_callback().set_ioport("DSW1"); // kbd RL lines
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbo)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(turbo_state,subroc3d)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_turbo);
+ PALETTE(config, "palette", FUNC(turbo_state::subroc3d_palette), 256);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
@@ -969,9 +967,8 @@ MACHINE_CONFIG_START(turbo_state::buckrog)
kbdc.in_rl_callback().set_ioport("DSW1"); // kbd RL lines
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_turbo)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_INIT_OWNER(turbo_state,buckrog)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_turbo);
+ PALETTE(config, "palette", FUNC(turbo_state::buckrog_palette), 1024);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
diff --git a/src/mame/drivers/turrett.cpp b/src/mame/drivers/turrett.cpp
index 74aa1dc94a9..de69211ca0e 100644
--- a/src/mame/drivers/turrett.cpp
+++ b/src/mame/drivers/turrett.cpp
@@ -366,7 +366,7 @@ MACHINE_CONFIG_START(turrett_state::turrett)
MCFG_SCREEN_UPDATE_DRIVER(turrett_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_RRRRRGGGGGBBBBB("palette")
+ PALETTE(config, "palette", palette_device::RGB_555);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/tutankhm.cpp b/src/mame/drivers/tutankhm.cpp
index 3bb852c263b..99acaf88b9d 100644
--- a/src/mame/drivers/tutankhm.cpp
+++ b/src/mame/drivers/tutankhm.cpp
@@ -253,12 +253,10 @@ MACHINE_CONFIG_START(tutankhm_state::tutankhm)
MCFG_SCREEN_UPDATE_DRIVER(tutankhm_state, screen_update_tutankhm)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tutankhm_state, vblank_irq))
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 16);
/* sound hardware */
-
- MCFG_DEVICE_ADD("timeplt_audio", TIMEPLT_AUDIO)
+ TIMEPLT_AUDIO(config, "timeplt_audio");
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/tv990.cpp b/src/mame/drivers/tv990.cpp
index d6a89515dc4..3e562931bed 100644
--- a/src/mame/drivers/tv990.cpp
+++ b/src/mame/drivers/tv990.cpp
@@ -49,8 +49,8 @@
class tv990_state : public driver_device
{
public:
- tv990_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ tv990_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_vram(*this, "vram"),
m_fontram(*this, "fontram"),
@@ -388,8 +388,7 @@ void tv990_state::tv990(machine_config &config)
m_screen->set_refresh_hz(60);
m_screen->screen_vblank().set(FUNC(tv990_state::vblank_irq));
- palette_device &palette(PALETTE(config, "palette", 3));
- palette.set_init("palette", FUNC(palette_device::palette_init_monochrome_highlight));
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
NS16450(config, m_uart[0], 3.6864_MHz_XTAL);
m_uart[0]->out_dtr_callback().set(RS232A_TAG, FUNC(rs232_port_device::write_dtr));
diff --git a/src/mame/drivers/tvc.cpp b/src/mame/drivers/tvc.cpp
index bebe32faa9f..d089d76a57d 100644
--- a/src/mame/drivers/tvc.cpp
+++ b/src/mame/drivers/tvc.cpp
@@ -58,6 +58,10 @@ public:
void tvc(machine_config &config);
+protected:
+ void machine_start() override;
+ void machine_reset() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<ram_device> m_ram;
@@ -74,8 +78,16 @@ private:
memory_region *m_ext;
memory_region *m_vram;
- void machine_start() override;
- void machine_reset() override;
+ uint8_t m_video_mode;
+ uint8_t m_keyline;
+ uint8_t m_active_slot;
+ uint8_t m_int_flipflop;
+ uint8_t m_col[4];
+ uint8_t m_bank_type[4];
+ uint8_t m_bank;
+ uint8_t m_vram_bank;
+ uint8_t m_cassette_ff;
+ uint8_t m_centronics_ff;
void set_mem_page(uint8_t data);
DECLARE_WRITE8_MEMBER(bank_w);
@@ -102,17 +114,7 @@ private:
MC6845_UPDATE_ROW(crtc_update_row);
- uint8_t m_video_mode;
- uint8_t m_keyline;
- uint8_t m_active_slot;
- uint8_t m_int_flipflop;
- uint8_t m_col[4];
- uint8_t m_bank_type[4];
- uint8_t m_bank;
- uint8_t m_vram_bank;
- uint8_t m_cassette_ff;
- uint8_t m_centronics_ff;
- DECLARE_PALETTE_INIT(tvc);
+ void tvc_palette(palette_device &palette) const;
void tvc_io(address_map &map);
void tvc_mem(address_map &map);
@@ -700,31 +702,29 @@ MC6845_UPDATE_ROW( tvc_state::crtc_update_row )
}
}
-PALETTE_INIT_MEMBER(tvc_state, tvc)
+void tvc_state::tvc_palette(palette_device &palette) const
{
- const static unsigned char tvc_palette[16][3] =
+ static constexpr rgb_t tvc_pens[16] =
{
- { 0x00,0x00,0x00 },
- { 0x00,0x00,0x7f },
- { 0x7f,0x00,0x00 },
- { 0x7f,0x00,0x7f },
- { 0x00,0x7f,0x00 },
- { 0x00,0x7f,0x7f },
- { 0x7f,0x7f,0x00 },
- { 0x7f,0x7f,0x7f },
- { 0x00,0x00,0x00 },
- { 0x00,0x00,0xff },
- { 0xff,0x00,0x00 },
- { 0xff,0x00,0xff },
- { 0x00,0xff,0x00 },
- { 0x00,0xff,0xff },
- { 0xff,0xff,0x00 },
- { 0xff,0xff,0xff }
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0x7f },
+ { 0x7f, 0x00, 0x00 },
+ { 0x7f, 0x00, 0x7f },
+ { 0x00, 0x7f, 0x00 },
+ { 0x00, 0x7f, 0x7f },
+ { 0x7f, 0x7f, 0x00 },
+ { 0x7f, 0x7f, 0x7f },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0xff },
+ { 0xff, 0x00, 0x00 },
+ { 0xff, 0x00, 0xff },
+ { 0x00, 0xff, 0x00 },
+ { 0x00, 0xff, 0xff },
+ { 0xff, 0xff, 0x00 },
+ { 0xff, 0xff, 0xff }
};
- int i;
- for(i = 0; i < 16; i++)
- palette.set_pen_color(i, tvc_palette[i][0], tvc_palette[i][1], tvc_palette[i][2]);
+ palette.set_pen_colors(0, tvc_pens);
}
WRITE_LINE_MEMBER(tvc_state::int_ff_set)
@@ -780,8 +780,7 @@ MACHINE_CONFIG_START(tvc_state::tvc)
MCFG_SCREEN_VISIBLE_AREA(0, 512 - 1, 0, 240 - 1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", mc6845_device, screen_update)
- MCFG_PALETTE_ADD( "palette", 16 )
- MCFG_PALETTE_INIT_OWNER(tvc_state, tvc)
+ PALETTE(config, m_palette, FUNC(tvc_state::tvc_palette), 16);
mc6845_device &crtc(MC6845(config, "crtc", 3125000/2)); // clk taken from schematics
crtc.set_screen("screen");
diff --git a/src/mame/drivers/tvgame.cpp b/src/mame/drivers/tvgame.cpp
index 4998d1a3110..24f911a9a3c 100644
--- a/src/mame/drivers/tvgame.cpp
+++ b/src/mame/drivers/tvgame.cpp
@@ -115,7 +115,7 @@ MACHINE_CONFIG_START(tvgame_state::tvgame)
MCFG_SCREEN_SIZE(216, 213)
MCFG_SCREEN_VISIBLE_AREA(0, 215, 0, 212)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/twin16.cpp b/src/mame/drivers/twin16.cpp
index e1b406c8241..e880cee9d86 100644
--- a/src/mame/drivers/twin16.cpp
+++ b/src/mame/drivers/twin16.cpp
@@ -60,7 +60,7 @@ Known Issues:
-int twin16_state::spriteram_process_enable( )
+int twin16_state::spriteram_process_enable()
{
return (m_CPUA_register & 0x40) == 0;
}
@@ -676,8 +676,7 @@ void twin16_state::twin16(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_twin16);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->set_membits(8);
m_palette->enable_shadows();
@@ -731,8 +730,7 @@ void fround_state::fround(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_fround);
- PALETTE(config, m_palette, 1024);
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1024);
m_palette->set_membits(8);
m_palette->enable_shadows();
diff --git a/src/mame/drivers/twincobr.cpp b/src/mame/drivers/twincobr.cpp
index 4c9fd9a51e4..2c0ddbe0a52 100644
--- a/src/mame/drivers/twincobr.cpp
+++ b/src/mame/drivers/twincobr.cpp
@@ -693,7 +693,7 @@ MACHINE_CONFIG_START(twincobr_state::twincobr)
m_spritegen->set_palette(m_palette);
m_spritegen->set_xoffsets(31, 15);
- MCFG_DEVICE_ADD("spriteram16", BUFFERED_SPRITERAM16)
+ BUFFERED_SPRITERAM16(config, m_spriteram16);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
@@ -703,9 +703,8 @@ MACHINE_CONFIG_START(twincobr_state::twincobr)
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)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_twincobr);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 1792);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/tx0.cpp b/src/mame/drivers/tx0.cpp
index 2cf0317154a..0a905600d53 100644
--- a/src/mame/drivers/tx0.cpp
+++ b/src/mame/drivers/tx0.cpp
@@ -216,7 +216,7 @@ static const uint8_t tx0_colors[] =
0x80,0x80,0x80 /* light gray */
};
-static const uint8_t tx0_palette[] =
+static const uint8_t tx0_pens[] =
{
pen_panel_bg, pen_panel_caption, /* captions */
pen_typewriter_bg, pen_black, /* black typing in typewriter */
@@ -230,7 +230,7 @@ static GFXDECODE_START( gfx_tx0 )
GFXDECODE_END
/* Initialise the palette */
-PALETTE_INIT_MEMBER(tx0_state, tx0)
+void tx0_state::tx0_palette(palette_device &palette) const
{
/* rgb components for the two color emissions */
const double r1 = .1, g1 = .1, b1 = .924, r2 = .7, g2 = .7, b2 = .076;
@@ -298,7 +298,7 @@ PALETTE_INIT_MEMBER(tx0_state, tx0)
/* set up palette for text */
for( i = 0; i < 6; i++ )
- palette.set_pen_indirect(total_colors_needed + i, tx0_palette[i]);
+ palette.set_pen_indirect(total_colors_needed + i, tx0_pens[i]);
}
@@ -1563,22 +1563,20 @@ MACHINE_CONFIG_START(tx0_state::tx0_64kw)
MCFG_SCREEN_VISIBLE_AREA(0, virtual_width-1, 0, virtual_height-1)
MCFG_SCREEN_UPDATE_DRIVER(tx0_state, screen_update_tx0)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tx0_state, screen_vblank_tx0))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
CRT(config, m_crt, 0);
m_crt->set_num_levels(pen_crt_num_levels);
m_crt->set_offsets(crt_window_offset_x, crt_window_offset_y);
m_crt->set_size(crt_window_width, crt_window_height);
- MCFG_DEVICE_ADD("readt", TX0_READTAPE, 0)
- MCFG_DEVICE_ADD("punch", TX0_PUNCHTAPE, 0)
- MCFG_DEVICE_ADD("typewriter", TX0_PRINTER, 0)
- MCFG_DEVICE_ADD("magtape", TX0_MAGTAPE, 0)
+ TX0_READTAPE(config, "readt", 0);
+ TX0_PUNCHTAPE(config, "punch", 0);
+ TX0_PRINTER(config, "typewriter", 0);
+ TX0_MAGTAPE(config, "magtape", 0);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_tx0)
- MCFG_PALETTE_ADD("palette", total_colors_needed + sizeof(tx0_palette))
- MCFG_PALETTE_INDIRECT_ENTRIES(total_colors_needed)
- MCFG_PALETTE_INIT_OWNER(tx0_state, tx0)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tx0);
+ PALETTE(config, m_palette, FUNC(tx0_state::tx0_palette), total_colors_needed + sizeof(tx0_pens), total_colors_needed);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(tx0_state::tx0_8kw)
diff --git a/src/mame/drivers/tx1.cpp b/src/mame/drivers/tx1.cpp
index 4eb0c97dfce..a9fde4d80b8 100644
--- a/src/mame/drivers/tx1.cpp
+++ b/src/mame/drivers/tx1.cpp
@@ -180,8 +180,7 @@ MACHINE_CONFIG_START(tx1_state::tx1)
MCFG_MACHINE_RESET_OVERRIDE(tx1_state,tx1)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0);
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(tx1_state,tx1)
+ PALETTE(config, "palette", FUNC(tx1_state::tx1_palette), 256);
config.set_default_layout(layout_triphsxs);
@@ -245,8 +244,7 @@ MACHINE_CONFIG_START(tx1_state::buggyboy)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tx1_state, screen_vblank_buggyboy))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(tx1_state,buggyboy)
+ PALETTE(config, "palette", FUNC(tx1_state::buggyboy_palette), 256);
MCFG_VIDEO_START_OVERRIDE(tx1_state,buggyboy)
MCFG_DEVICE_ADD("soundbrd", BUGGYBOY_SOUND, BUGGYBOY_ZCLK)
@@ -272,8 +270,7 @@ MACHINE_CONFIG_START(tx1_state::buggybjr)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, tx1_state, screen_vblank_buggyboy))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(tx1_state,buggyboy)
+ PALETTE(config, "palette", FUNC(tx1_state::buggyboy_palette), 256);
MCFG_VIDEO_START_OVERRIDE(tx1_state,buggybjr)
MCFG_DEVICE_ADD("soundbrd", BUGGYBOYJR_SOUND, BUGGYBOY_ZCLK)
diff --git a/src/mame/drivers/uknc.cpp b/src/mame/drivers/uknc.cpp
index ec65f19cc8f..3a5bfaed28d 100644
--- a/src/mame/drivers/uknc.cpp
+++ b/src/mame/drivers/uknc.cpp
@@ -87,7 +87,7 @@ void uknc_state::uknc(machine_config &config)
screen.set_screen_update(FUNC(uknc_state::screen_update_uknc));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
}
/* ROM definition */
diff --git a/src/mame/drivers/ultraman.cpp b/src/mame/drivers/ultraman.cpp
index 75820ca4a12..3f6dce57925 100644
--- a/src/mame/drivers/ultraman.cpp
+++ b/src/mame/drivers/ultraman.cpp
@@ -200,9 +200,9 @@ MACHINE_CONFIG_START(ultraman_state::ultraman)
MCFG_SCREEN_UPDATE_DRIVER(ultraman_state, screen_update_ultraman)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
- MCFG_PALETTE_ENABLE_SHADOWS()
+ auto &palette(PALETTE(config, "palette"));
+ palette.set_format(palette_device::xRGB_555, 8192);
+ palette.enable_shadows();
K051960(config, m_k051960, 0);
m_k051960->set_palette("palette");
diff --git a/src/mame/drivers/ultratnk.cpp b/src/mame/drivers/ultratnk.cpp
index 066a2fe668e..e3a6499bf28 100644
--- a/src/mame/drivers/ultratnk.cpp
+++ b/src/mame/drivers/ultratnk.cpp
@@ -8,6 +8,7 @@ Atari Ultra Tank driver
#include "emu.h"
#include "includes/ultratnk.h"
+
#include "audio/sprint4.h"
#include "cpu/m6502/m6502.h"
#include "machine/74259.h"
@@ -309,12 +310,10 @@ MACHINE_CONFIG_START(ultratnk_state::ultratnk)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, 0, 256, VTOTAL, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(ultratnk_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, ultratnk_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ultratnk)
- MCFG_PALETTE_ADD("palette", 10)
- MCFG_PALETTE_INDIRECT_ENTRIES(4)
- MCFG_PALETTE_INIT_OWNER(ultratnk_state, ultratnk)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_ultratnk)
+ PALETTE(config, m_palette, FUNC(ultratnk_state::ultratnk_palette), 10, 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/ultrsprt.cpp b/src/mame/drivers/ultrsprt.cpp
index 9dd1cfed0fc..b71530f9bd7 100644
--- a/src/mame/drivers/ultrsprt.cpp
+++ b/src/mame/drivers/ultrsprt.cpp
@@ -21,8 +21,8 @@
class ultrsprt_state : public driver_device
{
public:
- ultrsprt_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ ultrsprt_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_k056800(*this, "k056800"),
@@ -30,7 +30,8 @@ public:
m_palette(*this, "palette"),
m_eeprom(*this, "eeprom"),
m_upd(*this, "upd%u", 1),
- m_service(*this, "SERVICE") { }
+ m_service(*this, "SERVICE")
+ { }
void ultrsprt(machine_config &config);
@@ -264,8 +265,7 @@ void ultrsprt_state::ultrsprt(machine_config &config)
screen.set_screen_update(FUNC(ultrsprt_state::screen_update_ultrsprt));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 8192);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
/* sound hardware */
K056800(config, m_k056800, XTAL(18'432'000));
diff --git a/src/mame/drivers/umipoker.cpp b/src/mame/drivers/umipoker.cpp
index 88d1eae5aaa..78a0960fbb6 100644
--- a/src/mame/drivers/umipoker.cpp
+++ b/src/mame/drivers/umipoker.cpp
@@ -100,12 +100,13 @@ public:
void saiyukip(machine_config &config);
+protected:
+ virtual void machine_start() override;
+
private:
DECLARE_WRITE16_MEMBER(lamps_w);
DECLARE_WRITE16_MEMBER(saiyu_counters_w);
- virtual void machine_start() override;
-
void saiyukip_map(address_map &map);
output_finder<6> m_lamps;
@@ -689,6 +690,8 @@ GFXDECODE_END
void saiyukip_state::machine_start()
{
+ umipoker_state::machine_start();
+
m_lamps.resolve();
}
@@ -713,13 +716,11 @@ MACHINE_CONFIG_START(umipoker_state::umipoker)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(8*8, 48*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(umipoker_state, screen_update_umipoker)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(ASSERTLINE("maincpu", 6))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_umipoker)
-
- MCFG_PALETTE_ADD("palette", 0x400)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_umipoker);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x400);
/* sound hardware */
diff --git a/src/mame/drivers/undrfire.cpp b/src/mame/drivers/undrfire.cpp
index 081d0e15eb1..3f168d90b3c 100644
--- a/src/mame/drivers/undrfire.cpp
+++ b/src/mame/drivers/undrfire.cpp
@@ -592,11 +592,10 @@ MACHINE_CONFIG_START(undrfire_state::undrfire)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 3*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(undrfire_state, screen_update_undrfire)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_undrfire)
- MCFG_PALETTE_ADD("palette", 16384)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_undrfire);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 16384);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(2);
@@ -655,11 +654,10 @@ MACHINE_CONFIG_START(undrfire_state::cbombers)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0, 40*8-1, 3*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(undrfire_state, screen_update_cbombers)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cbombers)
- MCFG_PALETTE_ADD("palette", 16384)
- MCFG_PALETTE_FORMAT(XRGB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_cbombers);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 16384);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(2);
diff --git a/src/mame/drivers/unichamp.cpp b/src/mame/drivers/unichamp.cpp
index 2906b9f3d19..ba5d15766f6 100644
--- a/src/mame/drivers/unichamp.cpp
+++ b/src/mame/drivers/unichamp.cpp
@@ -53,26 +53,34 @@
class unichamp_state : public driver_device
{
public:
- unichamp_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ unichamp_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gic(*this, "gic"),
m_cart(*this, "cartslot"),
- m_ctrls(*this, "CTRLS"){}
+ m_ctrls(*this, "CTRLS")
+ { }
void unichamp(machine_config &config);
void init_unichamp();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
required_device<cp1610_cpu_device> m_maincpu;
required_device<gic_device> m_gic;
required_device<generic_slot_device> m_cart;
+ required_ioport m_ctrls;
+
uint8_t m_ram[256];
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(unichamp);
+
+ void unichamp_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(bext_r);
@@ -87,26 +95,23 @@ private:
uint32_t screen_update_unichamp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void unichamp_mem(address_map &map);
-
- required_ioport m_ctrls;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
-PALETTE_INIT_MEMBER(unichamp_state, unichamp)
+void unichamp_state::unichamp_palette(palette_device &palette) const
{
/*
palette.set_pen_color(GIC_BLACK, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(GIC_RED, rgb_t(0xAE, 0x49, 0x41));//(from box shot)
+ palette.set_pen_color(GIC_RED, rgb_t(0xae, 0x49, 0x41));//(from box shot)
palette.set_pen_color(GIC_GREEN, rgb_t(0x62, 0x95, 0x88));//(from box shot)
- palette.set_pen_color(GIC_WHITE, rgb_t(0xFF, 0xFF, 0xFF));
+ palette.set_pen_color(GIC_WHITE, rgb_t(0xff, 0xff, 0xff));
*/
//using from intv.c instead as suggested by RB
palette.set_pen_color(GIC_BLACK, rgb_t(0x00, 0x00, 0x00));
- palette.set_pen_color(GIC_RED, rgb_t(0xFF, 0x3D, 0x10));
- //palette.set_pen_color(GIC_GREEN, rgb_t(0x38, 0x6B, 0x3F)); //intv's DARK GREEN
- palette.set_pen_color(GIC_GREEN, rgb_t(0x00, 0xA7, 0x56)); //intv's GREEN
- palette.set_pen_color(GIC_WHITE, rgb_t(0xFF, 0xFC, 0xFF));
+ palette.set_pen_color(GIC_RED, rgb_t(0xff, 0x3d, 0x10));
+ //palette.set_pen_color(GIC_GREEN, rgb_t(0x38, 0x6b, 0x3f)); //intv's DARK GREEN
+ palette.set_pen_color(GIC_GREEN, rgb_t(0x00, 0xa7, 0x56)); //intv's GREEN
+ palette.set_pen_color(GIC_WHITE, rgb_t(0xff, 0xfc, 0xff));
}
@@ -260,7 +265,7 @@ void unichamp_state::unichamp(machine_config &config)
screen.set_screen_update(FUNC(unichamp_state::screen_update_unichamp));
screen.set_palette("palette");
- PALETTE(config, "palette", 4).set_init(FUNC(unichamp_state::palette_init_unichamp));
+ PALETTE(config, "palette", FUNC(unichamp_state::unichamp_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/unico.cpp b/src/mame/drivers/unico.cpp
index 68800feee9e..f8606d34925 100644
--- a/src/mame/drivers/unico.cpp
+++ b/src/mame/drivers/unico.cpp
@@ -576,11 +576,10 @@ MACHINE_CONFIG_START(unico_state::burglarx)
MCFG_SCREEN_SIZE(384, 224)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(unico_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unico)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT_CLASS(4, unico_state, unico_R6G6B6X)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_unico);
+ PALETTE(config, m_palette).set_format(4, &unico_state::unico_R6G6B6X, 8192);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -621,11 +620,10 @@ MACHINE_CONFIG_START(zeropnt_state::zeropnt)
MCFG_SCREEN_SIZE(384, 224)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(zeropnt_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unico)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT_CLASS(4, zeropnt_state, unico_R6G6B6X)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_unico);
+ PALETTE(config, m_palette).set_format(4, &zeropnt_state::unico_R6G6B6X, 8192);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -669,11 +667,10 @@ MACHINE_CONFIG_START(zeropnt2_state::zeropnt2)
MCFG_SCREEN_SIZE(384, 224)
MCFG_SCREEN_VISIBLE_AREA(0, 384-1, 0, 224-1)
MCFG_SCREEN_UPDATE_DRIVER(zeropnt2_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unico)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT_CLASS(4, zeropnt2_state, unico_R6G6B6X)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_unico);
+ PALETTE(config, m_palette).set_format(4, &zeropnt2_state::unico_R6G6B6X, 8192);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/unior.cpp b/src/mame/drivers/unior.cpp
index bcfc520f54c..acf837a0149 100644
--- a/src/mame/drivers/unior.cpp
+++ b/src/mame/drivers/unior.cpp
@@ -75,7 +75,7 @@ private:
DECLARE_WRITE8_MEMBER(ppi1_a_w);
DECLARE_WRITE8_MEMBER(ppi1_c_w);
DECLARE_WRITE_LINE_MEMBER(hrq_w);
- DECLARE_PALETTE_INIT(unior);
+ void unior_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(dma_r);
I8275_DRAW_CHARACTER_MEMBER(display_pixels);
@@ -281,16 +281,16 @@ I8275_DRAW_CHARACTER_MEMBER(unior_state::display_pixels)
bitmap.pix32(y, x + i) = palette[BIT(gfx, 5-i) ? (hlgt ? 2 : 1) : 0];
}
-static const rgb_t unior_palette[3] =
+static constexpr rgb_t unior_pens[3] =
{
- rgb_t(0x00, 0x00, 0x00), // black
- rgb_t(0xa0, 0xa0, 0xa0), // white
- rgb_t(0xff, 0xff, 0xff) // highlight
+ { 0x00, 0x00, 0x00 }, // black
+ { 0xa0, 0xa0, 0xa0 }, // white
+ { 0xff, 0xff, 0xff } // highlight
};
-PALETTE_INIT_MEMBER(unior_state,unior)
+void unior_state::unior_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, unior_palette, ARRAY_LENGTH(unior_palette));
+ palette.set_pen_colors(0, unior_pens);
}
@@ -389,9 +389,8 @@ MACHINE_CONFIG_START(unior_state::unior)
MCFG_SCREEN_SIZE(640, 200)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 200-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_unior)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(unior_state,unior)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_unior)
+ PALETTE(config, m_palette, FUNC(unior_state::unior_palette), 3);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/unistar.cpp b/src/mame/drivers/unistar.cpp
index 5f75c99aa0c..c5f8360489d 100644
--- a/src/mame/drivers/unistar.cpp
+++ b/src/mame/drivers/unistar.cpp
@@ -31,17 +31,20 @@ public:
{ }
void unistar(machine_config &config);
+
+protected:
+ virtual void machine_reset() override;
+
private:
u8 dma_mem_r(offs_t offset);
void dma_mem_w(offs_t offset, u8 data);
- DECLARE_PALETTE_INIT(unistar);
+ void unistar_palette(palette_device &palette) const;
I8275_DRAW_CHARACTER_MEMBER(draw_character);
void unistar_io(address_map &map);
void unistar_mem(address_map &map);
- virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_region_ptr<u8> m_p_chargen;
};
@@ -90,11 +93,11 @@ void unistar_state::machine_reset()
{
}
-PALETTE_INIT_MEMBER( unistar_state, unistar )
+void unistar_state::unistar_palette(palette_device &palette) const
{
- palette.set_pen_color(0, 0, 0, 0 ); /* Black */
- palette.set_pen_color(1, 0, 255, 0 ); /* Full */
- palette.set_pen_color(2, 0, 128, 0 ); /* Dimmed */
+ palette.set_pen_color(0, 0, 0, 0); // Black
+ palette.set_pen_color(1, 0, 255, 0); // Full
+ palette.set_pen_color(2, 0, 128, 0); // Dimmed
}
I8275_DRAW_CHARACTER_MEMBER(unistar_state::draw_character)
@@ -156,7 +159,7 @@ void unistar_state::unistar(machine_config &config)
crtc.irq_wr_callback().set("rst75", FUNC(input_merger_device::in_w<0>));
GFXDECODE(config, "gfxdecode", "palette", gfx_unistar);
- PALETTE(config, "palette", 3).set_init(FUNC(unistar_state::palette_init_unistar));
+ PALETTE(config, "palette", FUNC(unistar_state::unistar_palette), 3);
}
/* ROM definition */
diff --git a/src/mame/drivers/univac.cpp b/src/mame/drivers/univac.cpp
index b78664dbdeb..f7845584db5 100644
--- a/src/mame/drivers/univac.cpp
+++ b/src/mame/drivers/univac.cpp
@@ -403,8 +403,8 @@ MACHINE_CONFIG_START(univac_state::uts20)
MCFG_SCREEN_ADD_MONOCHROME("screen", RASTER, rgb_t::green())
MCFG_SCREEN_UPDATE_DRIVER(univac_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_uts)
+ PALETTE(config, "palette", palette_device::MONOCHROME);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_uts);
dp835x_device &crtc(DP835X_A(config, "crtc", 19'980'000));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/unixpc.cpp b/src/mame/drivers/unixpc.cpp
index aae3cc50cde..56bad603b5d 100644
--- a/src/mame/drivers/unixpc.cpp
+++ b/src/mame/drivers/unixpc.cpp
@@ -372,7 +372,7 @@ MACHINE_CONFIG_START(unixpc_state::unixpc)
config.set_default_layout(layout_unixpc);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// internal ram
RAM(config, RAM_TAG).set_default_size("1M").set_extra_options("2M");
diff --git a/src/mame/drivers/unkhorse.cpp b/src/mame/drivers/unkhorse.cpp
index becbcfb60ee..cb7067d6d73 100644
--- a/src/mame/drivers/unkhorse.cpp
+++ b/src/mame/drivers/unkhorse.cpp
@@ -31,8 +31,8 @@ TODO:
class horse_state : public driver_device
{
public:
- horse_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ horse_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_speaker(*this, "speaker"),
m_inp_matrix(*this, "IN.%u", 0),
@@ -213,7 +213,7 @@ MACHINE_CONFIG_START(horse_state::horse)
MCFG_SCREEN_UPDATE_DRIVER(horse_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(INPUTLINE("maincpu", I8085_RST75_LINE))
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_3BIT_BGR("palette")
+ PALETTE(config, "palette", palette_device::BGR_3BIT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/upscope.cpp b/src/mame/drivers/upscope.cpp
index 2aa91007875..0553e1cb805 100644
--- a/src/mame/drivers/upscope.cpp
+++ b/src/mame/drivers/upscope.cpp
@@ -37,11 +37,11 @@
class upscope_state : public amiga_state
{
public:
- upscope_state(const machine_config &mconfig, device_type type, const char *tag)
- : amiga_state(mconfig, type, tag),
- m_prev_cia1_porta(0xff),
- m_parallel_data(0xff),
- m_ppi(*this, "ppi")
+ upscope_state(const machine_config &mconfig, device_type type, const char *tag) :
+ amiga_state(mconfig, type, tag),
+ m_prev_cia1_porta(0xff),
+ m_parallel_data(0xff),
+ m_ppi(*this, "ppi")
{ }
void upscope(machine_config &config);
@@ -278,8 +278,7 @@ MACHINE_CONFIG_START(upscope_state::upscope)
/* video hardware */
ntsc_video(config);
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_INIT_OWNER(upscope_state,amiga)
+ PALETTE(config, m_palette, FUNC(upscope_state::amiga_palette), 4096);
MCFG_VIDEO_START_OVERRIDE(upscope_state,amiga)
diff --git a/src/mame/drivers/usgames.cpp b/src/mame/drivers/usgames.cpp
index 21d6ce91b62..3e2e6645fd1 100644
--- a/src/mame/drivers/usgames.cpp
+++ b/src/mame/drivers/usgames.cpp
@@ -236,9 +236,8 @@ MACHINE_CONFIG_START(usgames_state::usg32)
MCFG_SCREEN_UPDATE_DRIVER(usgames_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_usgames)
- MCFG_PALETTE_ADD("palette", 2*256)
- MCFG_PALETTE_INIT_OWNER(usgames_state, usgames)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_usgames);
+ PALETTE(config, "palette", FUNC(usgames_state::usgames_palette), 2*256);
mc6845_device &crtc(MC6845(config, "crtc", 18_MHz_XTAL / 16));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/ut88.cpp b/src/mame/drivers/ut88.cpp
index 2b0aa80695a..3e03cdf4a33 100644
--- a/src/mame/drivers/ut88.cpp
+++ b/src/mame/drivers/ut88.cpp
@@ -202,9 +202,9 @@ MACHINE_CONFIG_START(ut88_state::ut88)
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 28*8-1)
MCFG_VIDEO_START_OVERRIDE(ut88_state,ut88)
MCFG_SCREEN_UPDATE_DRIVER(ut88_state, screen_update_ut88)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_ut88)
/* audio hardware */
diff --git a/src/mame/drivers/v6809.cpp b/src/mame/drivers/v6809.cpp
index d4122dea7e3..07ae3ed8a78 100644
--- a/src/mame/drivers/v6809.cpp
+++ b/src/mame/drivers/v6809.cpp
@@ -295,7 +295,7 @@ MACHINE_CONFIG_START(v6809_state::v6809)
MCFG_SCREEN_SIZE(640, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 640-1, 0, 480-1)
MCFG_SCREEN_UPDATE_DEVICE("crtc", sy6545_1_device, screen_update)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_v6809)
/* sound hardware */
diff --git a/src/mame/drivers/vamphalf.cpp b/src/mame/drivers/vamphalf.cpp
index 1123561e7e5..a4366848760 100644
--- a/src/mame/drivers/vamphalf.cpp
+++ b/src/mame/drivers/vamphalf.cpp
@@ -146,6 +146,8 @@ public:
void common_32bit_map(address_map &map);
protected:
+ virtual void video_start() override;
+
int m_flip_bit;
int m_palshift;
@@ -210,8 +212,6 @@ private:
DECLARE_WRITE16_MEMBER(mrkicker_oki_bank_w);
DECLARE_WRITE8_MEMBER(qs1000_p3_w);
- virtual void video_start() override;
-
uint32_t screen_update_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_aoh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap);
@@ -308,9 +308,7 @@ private:
READ16_MEMBER(vamphalf_state::eeprom_r)
{
if(offset)
- {
return m_eeprom->do_read();
- }
else
return 0;
}
@@ -386,12 +384,12 @@ READ32_MEMBER(vamphalf_nvram_state::finalgdr_prot_r)
WRITE32_MEMBER(vamphalf_nvram_state::finalgdr_prot_w)
{
-/*
-41C6
-967E
-446B
-F94B
-*/
+ /*
+ 41C6
+ 967E
+ 446B
+ F94B
+ */
if(data == 0x41c6 || data == 0x446b)
m_semicom_prot_which = 0;
else
@@ -1124,8 +1122,7 @@ void vamphalf_state::common(machine_config &config)
screen.set_screen_update(FUNC(vamphalf_state::screen_update_common));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 0x8000);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_vamphalf);
}
@@ -1312,8 +1309,7 @@ void vamphalf_state::aoh(machine_config &config)
screen.set_screen_update(FUNC(vamphalf_state::screen_update_aoh));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 0x8000);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 0x8000);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_vamphalf);
/* sound hardware */
diff --git a/src/mame/drivers/vastar.cpp b/src/mame/drivers/vastar.cpp
index 8a872e9bf13..373516e7bbf 100644
--- a/src/mame/drivers/vastar.cpp
+++ b/src/mame/drivers/vastar.cpp
@@ -473,12 +473,10 @@ void vastar_state::vastar(machine_config &config)
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(vastar_state::screen_update));
- screen.set_palette("palette");
+ screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_vastar);
- PALETTE(config, m_palette, 256);
- m_palette->set_prom_region("proms");
- m_palette->set_init("palette", FUNC(palette_device::palette_init_RRRRGGGGBBBB_proms));
+ PALETTE(config, m_palette, palette_device::RGB_444_PROMS, "proms", 256);
}
void dogfightp_state::dogfightp(machine_config &config)
diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp
index b7914b9ed28..76d8d9df2b7 100644
--- a/src/mame/drivers/vboy.cpp
+++ b/src/mame/drivers/vboy.cpp
@@ -70,106 +70,84 @@
m_font[((woffs) + 0x1c000) ^ 7] = dat; /* flip x+y */
-/* FIXME: most if not all of these must be uint8_t */
-struct vboy_regs_t
-{
- uint32_t lpc, lpc2, lpt, lpr;
- uint32_t khb, klb;
- uint8_t thb, tlb;
- uint32_t tcr, wcr, kcr;
-};
-
-struct vip_regs_t
-{
- uint16_t INTPND;
- uint16_t INTENB;
- uint16_t DPSTTS;
- uint16_t DPCTRL;
- uint16_t BRTA;
- uint16_t BRTB;
- uint16_t BRTC;
- uint16_t REST;
- uint16_t FRMCYC;
- uint16_t CTA;
- uint16_t XPSTTS;
- uint16_t XPCTRL;
- uint16_t VER;
- uint16_t SPT[4];
- uint16_t GPLT[4];
- uint16_t JPLT[4];
- uint16_t BKCOL;
-};
-
-struct vboy_timer_t
-{
- uint16_t count;
- uint16_t latch;
-};
-
-struct vboy_timer_t;
-
class vboy_state : public driver_device
{
public:
vboy_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_cart(*this, "cartslot"),
- m_maintimer(*this, "timer_main"),
- m_palette(*this, "palette")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_cart(*this, "cartslot")
+ , m_maintimer(*this, "timer_main")
+ , m_palette(*this, "palette")
{
- m_vip_regs.INTPND = 0;
- m_vip_regs.INTENB = 0;
- m_vip_regs.DPSTTS = 0;
- m_vip_regs.DPCTRL = 0;
- m_vip_regs.BRTA = 0;
- m_vip_regs.BRTB = 0;
- m_vip_regs.BRTC = 0;
- m_vip_regs.REST = 0;
- m_vip_regs.FRMCYC = 0;
- m_vip_regs.CTA = 0;
- m_vip_regs.XPSTTS = 0;
- m_vip_regs.XPCTRL = 0;
- m_vip_regs.VER = 0;
- m_vip_regs.SPT[0] = 0;
- m_vip_regs.SPT[1] = 0;
- m_vip_regs.SPT[2] = 0;
- m_vip_regs.SPT[3] = 0;
- m_vip_regs.GPLT[0] = 0;
- m_vip_regs.GPLT[1] = 0;
- m_vip_regs.GPLT[2] = 0;
- m_vip_regs.GPLT[3] = 0;
- m_vip_regs.JPLT[0] = 0;
- m_vip_regs.JPLT[1] = 0;
- m_vip_regs.JPLT[2] = 0;
- m_vip_regs.JPLT[3] = 0;
- m_vip_regs.BKCOL = 0;
-
- m_vboy_regs.lpc = 0;
- m_vboy_regs.lpc2 = 0;
- m_vboy_regs.lpt = 0;
- m_vboy_regs.lpr = 0;
- m_vboy_regs.khb = 0;
- m_vboy_regs.klb = 0;
- m_vboy_regs.thb = 0;
- m_vboy_regs.tlb = 0;
- m_vboy_regs.tcr = 0;
- m_vboy_regs.wcr = 0;
- m_vboy_regs.kcr = 0x80;
-
- m_vboy_timer.count = 0;
- m_vboy_timer.latch = 0;
}
void vboy(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
+ // FIXME: most if not all of these must be uint8_t
+ struct vboy_regs_t
+ {
+ uint32_t lpc = 0, lpc2 = 0, lpt = 0, lpr = 0;
+ uint32_t khb = 0, klb = 0;
+ uint8_t thb = 0, tlb = 0;
+ uint32_t tcr = 0, wcr = 0, kcr = 0x80;
+ };
+
+ struct vip_regs_t
+ {
+ uint16_t INTPND = 0;
+ uint16_t INTENB = 0;
+ uint16_t DPSTTS = 0;
+ uint16_t DPCTRL = 0;
+ uint16_t BRTA = 0;
+ uint16_t BRTB = 0;
+ uint16_t BRTC = 0;
+ uint16_t REST = 0;
+ uint16_t FRMCYC = 0;
+ uint16_t CTA = 0;
+ uint16_t XPSTTS = 0;
+ uint16_t XPCTRL = 0;
+ uint16_t VER = 0;
+ uint16_t SPT[4] = { 0, 0, 0, 0 };
+ uint16_t GPLT[4] = { 0, 0, 0, 0 };
+ uint16_t JPLT[4] = { 0, 0, 0, 0 };
+ uint16_t BKCOL = 0;
+ };
+
+ struct vboy_timer_t
+ {
+ uint16_t count = 0;
+ uint16_t latch = 0;
+ };
+
required_device<cpu_device> m_maincpu;
required_device<vboy_cart_slot_device> m_cart;
required_device<timer_device> m_maintimer;
required_device<palette_device> m_palette;
memory_region *m_cart_rom;
+ std::unique_ptr<uint16_t[]> m_font;
+ std::unique_ptr<uint16_t[]> m_bgmap;
+ std::unique_ptr<uint8_t[]> m_l_frame_0;
+ std::unique_ptr<uint8_t[]> m_l_frame_1;
+ std::unique_ptr<uint8_t[]> m_r_frame_0;
+ std::unique_ptr<uint8_t[]> m_r_frame_1;
+ vboy_regs_t m_vboy_regs;
+ vip_regs_t m_vip_regs;
+ vboy_timer_t m_vboy_timer;
+ std::unique_ptr<int32_t[]> m_ovr_tempdraw_map;
+ uint16_t m_frame_count;
+ uint8_t m_displayfb;
+ uint8_t m_drawfb;
+ uint8_t m_row_num;
+ attotime m_input_latch_time;
+
DECLARE_READ32_MEMBER(io_r);
DECLARE_WRITE32_MEMBER(io_w);
DECLARE_READ16_MEMBER(vip_r);
@@ -192,22 +170,8 @@ private:
DECLARE_WRITE8_MEMBER(lfb1_w);
DECLARE_WRITE8_MEMBER(rfb0_w);
DECLARE_WRITE8_MEMBER(rfb1_w);
- std::unique_ptr<uint16_t[]> m_font;
- std::unique_ptr<uint16_t[]> m_bgmap;
- std::unique_ptr<uint8_t[]> m_l_frame_0;
- std::unique_ptr<uint8_t[]> m_l_frame_1;
- std::unique_ptr<uint8_t[]> m_r_frame_0;
- std::unique_ptr<uint8_t[]> m_r_frame_1;
- vboy_regs_t m_vboy_regs;
- vip_regs_t m_vip_regs;
- vboy_timer_t m_vboy_timer;
- std::unique_ptr<int32_t[]> m_ovr_tempdraw_map;
- uint16_t m_frame_count;
- uint8_t m_displayfb;
- uint8_t m_drawfb;
- uint8_t m_row_num;
- attotime m_input_latch_time;
- void m_timer_tick(void);
+
+ void m_timer_tick();
void m_scanline_tick(int scanline, uint8_t screen_type);
void m_set_irq(uint16_t irq_vector);
@@ -219,11 +183,8 @@ private:
void draw_affine_map(bitmap_ind16 &bitmap, const rectangle &cliprect, uint16_t param_base, int gx, int gp, int gy, int h, int w,
uint16_t x_mask, uint16_t y_mask, uint8_t ovr, bool right, int bg_map_num);
uint8_t display_world(int num, bitmap_ind16 &bitmap, const rectangle &cliprect, bool right, int &cur_spt);
- void m_set_brightness(void);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(vboy);
+ void m_set_brightness();
+ void vboy_palette(palette_device &palette) const;
uint32_t screen_update_vboy_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_vboy_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(timer_main_tick);
@@ -252,28 +213,25 @@ void vboy_state::video_start()
void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y, uint16_t code, uint8_t pal)
{
- uint16_t data;
- uint8_t yi, xi, dat, col;
-
- for (yi = 0; yi < 8; yi++)
+ for (uint8_t yi = 0; yi < 8; yi++)
{
- data = READ_FONT(code * 8 + yi);
+ uint16_t const data = READ_FONT(code * 8 + yi);
- for (xi = 0; xi < 8; xi++)
+ for (uint8_t xi = 0; xi < 8; xi++)
{
- int res_x,res_y;
-
- dat = ((data >> (xi << 1)) & 0x03);
-
- res_x = x + xi;
- res_y = y + yi;
-
- col = (pal >> (dat*2)) & 3;
+ uint8_t const dat = ((data >> (xi << 1)) & 0x03);
if (dat)
{
+ uint8_t const res_x = x + xi;
+ uint8_t const res_y = y + yi;
+
if (cliprect.contains(res_x, res_y))
+ {
+ uint8_t const col = (pal >> (dat * 2)) & 3;
+
bitmap.pix16((res_y), (res_x)) = m_palette->pen(col);
+ }
}
}
}
@@ -283,23 +241,16 @@ void vboy_state::put_obj(bitmap_ind16 &bitmap, const rectangle &cliprect, int x,
void vboy_state::fill_ovr_char(uint16_t code, uint8_t pal)
{
- uint16_t data;
- uint8_t yi, xi, dat;
- int col;
-
- for (yi = 0; yi < 8; yi++)
+ for (uint8_t yi = 0; yi < 8; yi++)
{
- data = READ_FONT(code * 8 + yi);
+ uint16_t const data = READ_FONT(code * 8 + yi);
- for (xi = 0; xi < 8; xi++)
+ for (uint8_t xi = 0; xi < 8; xi++)
{
- dat = ((data >> (xi << 1)) & 0x03);
- col = (pal >> (dat*2)) & 3;
-
- if(dat == 0)
- col = -1;
+ uint8_t const dat = ((data >> (xi << 1)) & 0x03);
+ int const col = (dat == 0) ? -1 : ((pal >> (dat * 2)) & 3);
- WRITE_OVR_TEMPDRAW_MAP(yi*8+xi, col);
+ WRITE_OVR_TEMPDRAW_MAP(yi * 8 + xi, col);
}
}
}
@@ -747,9 +698,9 @@ WRITE32_MEMBER( vboy_state::io_w )
*
*********************************/
/*
-TODO: brightness presumably isn't a linear algorythm, also REST needs to be taken into account (needs a working example)
+TODO: brightness presumably isn't a linear algorithm, also REST needs to be taken into account (needs a working example)
*/
-void vboy_state::m_set_brightness(void)
+void vboy_state::m_set_brightness()
{
int a,b,c;
@@ -1262,7 +1213,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(vboy_state::timer_pad_tick)
m_maincpu->set_input_line(0, HOLD_LINE);
}
-PALETTE_INIT_MEMBER(vboy_state, vboy)
+void vboy_state::vboy_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t::black());
@@ -1371,20 +1322,19 @@ MACHINE_CONFIG_START(vboy_state::vboy)
/* video hardware */
config.set_default_layout(layout_vboy);
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(vboy_state, vboy)
+ PALETTE(config, m_palette, FUNC(vboy_state::vboy_palette), 4);
/* Left screen */
MCFG_SCREEN_ADD("3dleft", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(20'000'000)/2,757,0,384,264,0,224)
MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_left)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* Right screen */
MCFG_SCREEN_ADD("3dright", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(20'000'000)/2,757,0,384,264,0,224)
MCFG_SCREEN_UPDATE_DRIVER(vboy_state, screen_update_vboy_right)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
/* cartridge */
MCFG_VBOY_CARTRIDGE_ADD("cartslot", vboy_cart, nullptr)
diff --git a/src/mame/drivers/vc4000.cpp b/src/mame/drivers/vc4000.cpp
index 23278f2a022..21a3bf17294 100644
--- a/src/mame/drivers/vc4000.cpp
+++ b/src/mame/drivers/vc4000.cpp
@@ -340,7 +340,7 @@ PORT_BIT(0xff,0x70,IPT_AD_STICK_Y) PORT_SENSITIVITY(70) PORT_KEYDELTA(5) PORT_CE
#endif
INPUT_PORTS_END
-static const rgb_t vc4000_palette[] =
+static constexpr rgb_t vc4000_pens[] =
{
// background colors
rgb_t(0, 0, 0), // black
@@ -356,9 +356,9 @@ static const rgb_t vc4000_palette[] =
We can do that in the code with ^7 */
};
-PALETTE_INIT_MEMBER(vc4000_state, vc4000)
+void vc4000_state::vc4000_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, vc4000_palette, ARRAY_LENGTH(vc4000_palette));
+ palette.set_pen_colors(0, vc4000_pens);
}
@@ -543,7 +543,7 @@ void vc4000_state::vc4000(machine_config &config)
m_screen->set_screen_update(FUNC(vc4000_state::screen_update_vc4000));
m_screen->set_palette("palette");
- PALETTE(config, "palette", 8).set_init(FUNC(vc4000_state::palette_init_vc4000));
+ PALETTE(config, "palette", FUNC(vc4000_state::vc4000_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/vector06.cpp b/src/mame/drivers/vector06.cpp
index 8e82a61b033..4a63e427f33 100644
--- a/src/mame/drivers/vector06.cpp
+++ b/src/mame/drivers/vector06.cpp
@@ -178,7 +178,7 @@ void vector06_state::vector06(machine_config &config)
m_screen->set_screen_update(FUNC(vector06_state::screen_update_vector06));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 16).set_init(FUNC(vector06_state::palette_init_vector06));
+ PALETTE(config, m_palette, palette_device::BLACK, 16);
SPEAKER(config, "mono").front_center();
WAVE(config, "wave", m_cassette).add_route(ALL_OUTPUTS, "mono", 0.25);
diff --git a/src/mame/drivers/vega.cpp b/src/mame/drivers/vega.cpp
index 8307949947a..e4ad27d5dd4 100644
--- a/src/mame/drivers/vega.cpp
+++ b/src/mame/drivers/vega.cpp
@@ -74,7 +74,6 @@ TODO:
***************************************************************************/
-
#include "emu.h"
#include "cpu/mcs48/mcs48.h"
#include "machine/i8255.h"
@@ -86,25 +85,9 @@ TODO:
#include "speaker.h"
-struct vega_obj
-{
- int m_x, m_y, m_enable, m_type;
-};
-
-enum
-{
- OBJ_0,
- OBJ_1,
- OBJ_2,
- OBJ_PLAYER,
-
- NUM_OBJ
-};
-
class vega_state : public driver_device
{
public:
-
vega_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_maincpu(*this, "maincpu")
@@ -121,7 +104,26 @@ public:
void init_vega();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
+ struct vega_obj
+ {
+ int m_x, m_y, m_enable, m_type;
+ };
+
+ enum
+ {
+ OBJ_0,
+ OBJ_1,
+ OBJ_2,
+ OBJ_PLAYER,
+
+ NUM_OBJ
+ };
+
required_device<i8035_device> m_maincpu;
required_device<i8255_device> m_i8255;
required_device<ins8154_device> m_ins8154;
@@ -169,9 +171,7 @@ private:
DECLARE_READ8_MEMBER(ay8910_pb_r);
DECLARE_WRITE8_MEMBER(ay8910_pb_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(vega);
+ void vega_palette(palette_device &palette) const;
void draw_tilemap(screen_device& screen, bitmap_ind16& bitmap, const rectangle& cliprect);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void vega_io_map(address_map &map);
@@ -482,10 +482,9 @@ INPUT_PORTS_END
-PALETTE_INIT_MEMBER(vega_state, vega)
+void vega_state::vega_palette(palette_device &palette) const
{
- int i;
- for(i=0;i<8;++i)
+ for(int i=0;i<8;++i)
{
palette.set_pen_color( 2*i, rgb_t(0x00, 0x00, 0x00) );
palette.set_pen_color( 2*i+1, rgb_t( (i&1)?0xff:0x00, (i&2)?0xff:0x00, (i&4)?0xff:0x00) );
@@ -495,7 +494,6 @@ PALETTE_INIT_MEMBER(vega_state, vega)
void vega_state::draw_tilemap(screen_device& screen, bitmap_ind16& bitmap, const rectangle& cliprect)
{
- {
uint8_t *map_lookup = memregion("tilemaps")->base();
int offset_y=m_tilemap_offset_y;
@@ -539,13 +537,6 @@ void vega_state::draw_tilemap(screen_device& screen, bitmap_ind16& bitmap, const
}
}
}
-
-
- }
-
-
-
-
}
uint32_t vega_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -558,12 +549,11 @@ uint32_t vega_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
{
- int x,y;
int idx=0;
uint8_t *color_lookup = memregion("proms")->base() + 0x200;
- for(y=0;y<25;++y)
- for(x=0;x<40;++x)
+ for(int y=0;y<25;++y)
+ for(int x=0;x<40;++x)
{
int character=m_txt_ram[idx];
//int color=bitswap<8>(color_lookup[character],7,6,5,4,0,1,2,3)>>1;
@@ -588,25 +578,20 @@ uint32_t vega_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
}
+ for(int i=OBJ_0;i<OBJ_PLAYER;++i)
{
- for(int i=OBJ_0;i<OBJ_PLAYER;++i)
- {
- int x0=255-m_obj[i].m_x;
- int y0=255-m_obj[i].m_y;
- int num=m_obj[i].m_type&7;
- int flip=m_obj[i].m_type&8;
+ int x0=255-m_obj[i].m_x;
+ int y0=255-m_obj[i].m_y;
+ int num=m_obj[i].m_type&7;
+ int flip=m_obj[i].m_type&8;
- num*=4*8;
- for(int x=0;x<8;++x)
+ num*=4*8;
+ for(int x=0;x<8;++x)
for(int y=0;y<4;++y)
{
- //for(int x=0;x<4;++x)
- {
- m_gfxdecode->gfx(2)->zoom_transpen(bitmap,cliprect, num, 0, 1, flip?1:0, (x*4+x0)*2, (flip?(3-y):y)*8+y0, 0x20000, 0x10000, 0);
- ++num;
- }
+ m_gfxdecode->gfx(2)->zoom_transpen(bitmap,cliprect, num, 0, 1, flip?1:0, (x*4+x0)*2, (flip?(3-y):y)*8+y0, 0x20000, 0x10000, 0);
+ ++num;
}
- }
}
/*
@@ -620,31 +605,29 @@ uint32_t vega_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap,
*/
+ if(BIT(m_obj[OBJ_PLAYER].m_type,5))
{
- if(BIT(m_obj[OBJ_PLAYER].m_type,5))
- {
- int x0=m_obj[OBJ_PLAYER].m_x;
- int y0=255-m_obj[OBJ_PLAYER].m_y-32;
+ int x0=m_obj[OBJ_PLAYER].m_x;
+ int y0=255-m_obj[OBJ_PLAYER].m_y-32;
- uint8_t *sprite_lookup = memregion("proms")->base();
+ uint8_t *sprite_lookup = memregion("proms")->base();
- for(int x=0;x<16;++x)
- {
- int prom_data=sprite_lookup[ ((m_obj[OBJ_PLAYER].m_type&0xf)<<2)|((x>>2)&3)|(((m_frame_counter>>1)&3)<<6) ];
+ for(int x=0;x<16;++x)
+ {
+ int prom_data=sprite_lookup[ ((m_obj[OBJ_PLAYER].m_type&0xf)<<2)|((x>>2)&3)|(((m_frame_counter>>1)&3)<<6) ];
- int xor_line=( ! (( ! ((BIT(prom_data,1))&(BIT(prom_data,2))&(BIT(prom_data,3))&(BIT(x,2)) ) ) &
- ( (BIT(prom_data,2)) | (BIT(prom_data,3)) | ( BIT(m_obj[OBJ_PLAYER].m_type,4)) ) ));
+ int xor_line=( ! (( ! ((BIT(prom_data,1))&(BIT(prom_data,2))&(BIT(prom_data,3))&(BIT(x,2)) ) ) &
+ ( (BIT(prom_data,2)) | (BIT(prom_data,3)) | ( BIT(m_obj[OBJ_PLAYER].m_type,4)) ) ));
- int strip_num=((prom_data)&0x7)|( ((x&3)^(xor_line?0x3:0)) <<3)|((BIT(prom_data,3))<<5);
+ int strip_num=((prom_data)&0x7)|( ((x&3)^(xor_line?0x3:0)) <<3)|((BIT(prom_data,3))<<5);
- strip_num<<=2;
+ strip_num<<=2;
- for(int y=0;y<4;++y)
- {
- m_gfxdecode->gfx(3)->zoom_transpen(bitmap,cliprect, strip_num, 0, !xor_line, 0, (x*4+x0)*2, y*8+y0, 0x20000, 0x10000, 0);
- ++strip_num;
- }
+ for(int y=0;y<4;++y)
+ {
+ m_gfxdecode->gfx(3)->zoom_transpen(bitmap,cliprect, strip_num, 0, !xor_line, 0, (x*4+x0)*2, y*8+y0, 0x20000, 0x10000, 0);
+ ++strip_num;
}
}
}
@@ -835,9 +818,8 @@ void vega_state::vega(machine_config &config)
m_crtc->refresh_control(0);
m_crtc->vblank_callback().set_inputline(m_maincpu, MCS48_INPUT_IRQ); // inverse of pin 2?
- PALETTE(config, m_palette, 0x100).set_init(FUNC(vega_state::palette_init_vega));
-
- GFXDECODE(config, "gfxdecode", "palette", gfx_test_decode);
+ PALETTE(config, m_palette, FUNC(vega_state::vega_palette), 0x100);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_test_decode);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/vegaeo.cpp b/src/mame/drivers/vegaeo.cpp
index e835a3c5604..13bcacd1e07 100644
--- a/src/mame/drivers/vegaeo.cpp
+++ b/src/mame/drivers/vegaeo.cpp
@@ -189,8 +189,7 @@ void vegaeo_state::vega(machine_config &config)
m_screen->set_screen_update(FUNC(vegaeo_state::screen_update_vega));
m_screen->set_palette(m_palette);
- PALETTE(config, m_palette, 256);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRGGGGGBBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 256);
m_palette->set_membits(16);
MCFG_VIDEO_START_OVERRIDE(vegaeo_state,vega)
diff --git a/src/mame/drivers/vendetta.cpp b/src/mame/drivers/vendetta.cpp
index 558a86e23da..abeecc5c06b 100644
--- a/src/mame/drivers/vendetta.cpp
+++ b/src/mame/drivers/vendetta.cpp
@@ -453,9 +453,8 @@ void vendetta_state::vendetta(machine_config &config)
screen.set_screen_update(FUNC(vendetta_state::screen_update));
screen.set_palette(m_palette);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 2048);
m_palette->enable_shadows();
- m_palette->set_format(PALETTE_FORMAT_xBBBBBGGGGGRRRRR);
K052109(config, m_k052109, 0);
m_k052109->set_palette(m_palette);
diff --git a/src/mame/drivers/vgmplay.cpp b/src/mame/drivers/vgmplay.cpp
index 65632f1e41f..e115040bc53 100644
--- a/src/mame/drivers/vgmplay.cpp
+++ b/src/mame/drivers/vgmplay.cpp
@@ -3606,7 +3606,7 @@ MACHINE_CONFIG_START(vgmplay_state::vgmplay)
TIMER(config, "sega32x_scanline_timer", 0);
- PALETTE(config, "sega32x_palette", 0xc0 * 2);
+ PALETTE(config, "sega32x_palette").set_entries(0xc0 * 2);
m_sega32x->subdevice<cpu_device>("32x_master_sh2")->set_disable();
m_sega32x->subdevice<cpu_device>("32x_slave_sh2")->set_disable();
diff --git a/src/mame/drivers/victor9k.cpp b/src/mame/drivers/victor9k.cpp
index 8b460e58e8f..596d018e23f 100644
--- a/src/mame/drivers/victor9k.cpp
+++ b/src/mame/drivers/victor9k.cpp
@@ -152,7 +152,7 @@ private:
DECLARE_WRITE_LINE_MEMBER( mux_serial_b_w );
DECLARE_WRITE_LINE_MEMBER( mux_serial_a_w );
- void palette_init(palette_device &palette);
+ void victor9k_palette(palette_device &palette) const;
// video state
int m_brt;
@@ -608,7 +608,7 @@ WRITE_LINE_MEMBER( victor9k_state::fdc_irq_w )
// MACHINE INITIALIZATION
//**************************************************************************
-void victor9k_state::palette_init(palette_device &palette)
+void victor9k_state::victor9k_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00));
@@ -695,8 +695,7 @@ void victor9k_state::victor9k(machine_config &config)
screen.set_size(640, 480);
screen.set_visarea(0, 640-1, 0, 480-1);
- PALETTE(config, m_palette, 16);
- m_palette->set_init(FUNC(victor9k_state::palette_init));
+ PALETTE(config, m_palette, FUNC(victor9k_state::victor9k_palette), 16);
HD6845(config, m_crtc, XTAL(30'000'000)/10); // HD6845 == HD46505S
m_crtc->set_screen(SCREEN_TAG);
diff --git a/src/mame/drivers/video21.cpp b/src/mame/drivers/video21.cpp
index 2f350bbfdb1..1c9481d5ed6 100644
--- a/src/mame/drivers/video21.cpp
+++ b/src/mame/drivers/video21.cpp
@@ -274,7 +274,7 @@ void video21_state::video21(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, "gfxdecode", "palette", gfx_video21);
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/videopin.cpp b/src/mame/drivers/videopin.cpp
index 740f6e029dd..6affc24db4a 100644
--- a/src/mame/drivers/videopin.cpp
+++ b/src/mame/drivers/videopin.cpp
@@ -368,22 +368,21 @@ MACHINE_CONFIG_START(videopin_state::videopin)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_SCREEN_ADD("screen", RASTER)
- MCFG_SCREEN_REFRESH_RATE(60)
- MCFG_SCREEN_SIZE(304, 263)
- MCFG_SCREEN_VISIBLE_AREA(0, 303, 0, 255)
- MCFG_SCREEN_UPDATE_DRIVER(videopin_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
+ m_screen->set_refresh_hz(60);
+ m_screen->set_size(304, 263);
+ m_screen->set_visarea(0, 303, 0, 255);
+ m_screen->set_screen_update(FUNC(videopin_state::screen_update));
+ m_screen->set_palette(m_palette);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_videopin)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("discrete", DISCRETE, videopin_discrete)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ DISCRETE(config, m_discrete, videopin_discrete).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/videopkr.cpp b/src/mame/drivers/videopkr.cpp
index ab574b917b6..6b5730338b9 100644
--- a/src/mame/drivers/videopkr.cpp
+++ b/src/mame/drivers/videopkr.cpp
@@ -313,7 +313,7 @@ public:
, m_aysnd(*this, "aysnd")
, m_digits(*this, "digit%u", 0U)
, m_lamps(*this, "lamp%u", 0U)
- { }
+ { }
void babypkr(machine_config &config);
void videodad(machine_config &config);
@@ -340,10 +340,10 @@ private:
DECLARE_READ8_MEMBER(baby_sound_p1_r);
DECLARE_WRITE8_MEMBER(baby_sound_p3_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(videopkr);
+ void videopkr_palette(palette_device &palette) const;
DECLARE_VIDEO_START(vidadcba);
- DECLARE_PALETTE_INIT(babypkr);
- DECLARE_PALETTE_INIT(fortune1);
+ void babypkr_palette(palette_device &palette) const;
+ void fortune1_palette(palette_device &palette) const;
uint32_t screen_update_videopkr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(sound_t1_callback);
void count_7dig(unsigned long data, uint8_t index);
@@ -436,97 +436,80 @@ void videopkr_state::count_7dig(unsigned long data, uint8_t index)
sprintf(strn,"%7lu",data);
for (i = 0; i < 7; i++)
- {
m_digits[index+i] = dec_7seg((strn[6 - i] | 0x10) - 0x30);
- }
}
-PALETTE_INIT_MEMBER(videopkr_state, videopkr)
+void videopkr_state::videopkr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int j;
-
- for (j = 0; j < palette.entries(); j++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int j = 0; j < palette.entries(); j++)
{
- int r, g, b, tr, tg, tb, i;
+ int const i = BIT(color_prom[j], 3);
- i = (color_prom[j] >> 3) & 0x01;
+ // red component
+ int const tr = 0xf0 - (0xf0 * BIT(color_prom[j], 0));
+ int const r = tr - (i * (tr / 5));
- /* red component */
- tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
- r = tr - (i * (tr / 5));
+ // green component
+ int const tg = 0xf0 - (0xf0 * BIT(color_prom[j], 1));
+ int const g = tg - (i * (tg / 5));
- /* green component */
- tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
- g = tg - (i * (tg / 5));
-
- /* blue component */
- tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
- b = tb - (i * (tb / 5));
+ // blue component
+ int const tb = 0xf0 - (0xf0 * BIT(color_prom[j], 2));
+ int const b = tb - (i * (tb / 5));
palette.set_pen_color(j, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(videopkr_state,babypkr)
+void videopkr_state::babypkr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int j;
-
- for (j = 0; j < palette.entries(); j++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int j = 0; j < palette.entries(); j++)
{
- int r, g, b, tr, tg, tb, i, top;
+ // intensity component
+ int const i = 0x2f * BIT(color_prom[j], 3);
+ int const top = 0xff - i;
- top = 0xff;
+ // red component
+ int const tr = 0xdf * BIT(color_prom[j], 0);
+ int const r = top - ((tr * top) / 0x100 );
- /* intense component */
- i = 0x2f * ((color_prom[j] >> 3) & 0x01);
- top = top - i;
+ // green component
+ int const tg = 0xdf * BIT(color_prom[j], 1);
+ int const g = top - ((tg * top) / 0x100 );
- /* red component */
- tr = 0xdf * ((color_prom[j] >> 0) & 0x01);
- r = top - ((tr * top) / 0x100 );
-
- /* green component */
- tg = 0xdf * ((color_prom[j] >> 1) & 0x01);
- g = top - ((tg * top) / 0x100 );
-
- /* blue component */
- tb = 0xdf * ((color_prom[j] >> 2) & 0x01);
- b = top - ((tb * top) / 0x100);
+ // blue component
+ int const tb = 0xdf * BIT(color_prom[j], 2);
+ int const b = top - ((tb * top) / 0x100);
palette.set_pen_color(j, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(videopkr_state,fortune1)
+void videopkr_state::fortune1_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int j;
-
- for (j = 0; j < palette.entries(); j++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int j = 0; j < palette.entries(); j++)
{
- int r, g, b, tr, tg, tb, i, c;
-
- i = (color_prom[j] >> 3) & 0x01;
-
- /* red component */
- tr = 0xf0 - (0xf0 * ((color_prom[j] >> 0) & 0x01));
- r = tr - (i * (tr / 5));
+ int const i = BIT(color_prom[j], 3);
- /* green component */
- tg = 0xf0 - (0xf0 * ((color_prom[j] >> 1) & 0x01));
- g = tg - (i * (tg / 5));
+ // red component
+ int const tr = 0xf0 - (0xf0 * BIT(color_prom[j], 0));
+ int const r = tr - (i * (tr / 5));
- /* blue component */
- tb = 0xf0 - (0xf0 * ((color_prom[j] >> 2) & 0x01));
- b = tb - (i * (tb / 5));
+ // green component
+ int const tg = 0xf0 - (0xf0 * BIT(color_prom[j], 1));
+ int const g = tg - (i * (tg / 5));
- c = j;
+ // blue component
+ int const tb = 0xf0 - (0xf0 * BIT(color_prom[j], 2));
+ int const b = tb - (i * (tb / 5));
- // Swap Position of Inner-most Colors on Each 4 Color Palette
+ // Swap position of Inner-most colors on each 4 color palette
+ int c = j;
if ((c % 4) == 1 || (c % 4) == 2)
- c = ((int)(c / 4) * 4) + (3 - (c % 4));
+ c = (int(c / 4) * 4) + (3 - (c % 4));
palette.set_pen_color(c, rgb_t(r, g, b));
}
@@ -1272,8 +1255,7 @@ MACHINE_CONFIG_START(videopkr_state::videopkr)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_videopkr)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(videopkr_state, videopkr)
+ PALETTE(config, "palette", FUNC(videopkr_state::videopkr_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1332,8 +1314,7 @@ MACHINE_CONFIG_START(videopkr_state::babypkr)
MCFG_SCREEN_SIZE(32*16, 32*8)
MCFG_SCREEN_VISIBLE_AREA(5*16, 31*16-1, 3*8, 29*8-1)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(videopkr_state,babypkr)
+ subdevice<palette_device>("palette")->set_init(FUNC(videopkr_state::babypkr_palette));
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_videodad)
MCFG_VIDEO_START_OVERRIDE(videopkr_state,vidadcba)
@@ -1346,8 +1327,7 @@ MACHINE_CONFIG_START(videopkr_state::fortune1)
/* basic machine hardware */
m_maincpu->set_clock(CPU_CLOCK_ALT);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(videopkr_state,fortune1)
+ subdevice<palette_device>("palette")->set_init(FUNC(videopkr_state::fortune1_palette));
MACHINE_CONFIG_END
MACHINE_CONFIG_START(videopkr_state::bpoker)
diff --git a/src/mame/drivers/videosaa.cpp b/src/mame/drivers/videosaa.cpp
index 8f975ff0cd1..829e652026a 100644
--- a/src/mame/drivers/videosaa.cpp
+++ b/src/mame/drivers/videosaa.cpp
@@ -30,8 +30,8 @@ class videosaa_state : public driver_device
{
public:
videosaa_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu")
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
{ }
void videosaa(machine_config &config);
@@ -100,8 +100,7 @@ void videosaa_state::videosaa(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx);
- palette_device& palette(PALETTE(config, "palette", 8));
- palette.set_init("palette", FUNC(palette_device::palette_init_3bit_rgb));
+ PALETTE(config, "palette", palette_device::RGB_3BIT);
/* sound hardware */
UPD7759(config, "upd");
diff --git a/src/mame/drivers/viper.cpp b/src/mame/drivers/viper.cpp
index 7ec7ac072ee..a7449ea872d 100644
--- a/src/mame/drivers/viper.cpp
+++ b/src/mame/drivers/viper.cpp
@@ -2422,7 +2422,7 @@ MACHINE_CONFIG_START(viper_state::viper)
screen.set_visarea(0, 1024 - 1, 0, 768 - 1);
screen.set_screen_update(FUNC(viper_state::screen_update_viper));
- PALETTE(config, "palette", 65536);
+ PALETTE(config, "palette").set_entries(65536);
TIMER(config, "ds2430_timer2", 0);
//MCFG_TIMER_ADD_NONE("ds2430_timer2")
diff --git a/src/mame/drivers/vixen.cpp b/src/mame/drivers/vixen.cpp
index bd89bb5f6c2..91ac5b72c39 100644
--- a/src/mame/drivers/vixen.cpp
+++ b/src/mame/drivers/vixen.cpp
@@ -755,7 +755,7 @@ MACHINE_CONFIG_START(vixen_state::vixen)
MCFG_TIMER_DRIVER_ADD_SCANLINE("vsync", vixen_state, vsync_tick, SCREEN_TAG, 26*10, 27*10)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/vlc.cpp b/src/mame/drivers/vlc.cpp
index 092502544e4..ef8934c87b0 100644
--- a/src/mame/drivers/vlc.cpp
+++ b/src/mame/drivers/vlc.cpp
@@ -155,8 +155,8 @@ nevada TYPE2 : 64 45 51 06 32 02 31 31
class nevada_state : public driver_device
{
public:
- nevada_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ nevada_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_duart(*this, {"duart18", "duart40", "duart39"}),
m_rtc(*this, "rtc"),
m_maincpu(*this, "maincpu"),
@@ -166,12 +166,15 @@ public:
m_backup(*this, "backup"),
m_vram(*this, "vram"),
m_gfxdecode(*this, "gfxdecode")
- { }
+ { }
void nevada(machine_config &config);
void init_nevada();
+protected:
+ virtual void video_start() override;
+
private:
required_device_array<mc68681_device, 3> m_duart;
required_device<msm6242_device> m_rtc;
@@ -185,17 +188,16 @@ private:
required_shared_ptr<uint16_t> m_vram;
required_device<gfxdecode_device> m_gfxdecode;
- void nvram_init(nvram_device &nvram, void *data, size_t size);
-
- uint16_t m_datA40000;
- //uint8_t* m_videoram;
- //uint8_t* m_colorram;
+ //uint8_t* m_videoram;
+ //uint8_t* m_colorram;
tilemap_t *m_tilemap;
- virtual void video_start() override;
+ uint16_t m_datA40000;
+
+ void nvram_init(nvram_device &nvram, void *data, size_t size);
uint32_t screen_update_nevada(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(nevada);
+ void nevada_palette(palette_device &palette) const;
template<int N> uint8_t duart_r(offs_t offset);
template<int N> void duart_w(offs_t offset, uint8_t data);
@@ -228,23 +230,22 @@ funny thing , the DOOR ACCESS Switch is connected on the CLEAR PIN of this 4bit
so when D3..D0 are LOW , DOOR is OPEN
*/
static const uint8_t pal35[256] = {
-0x11, 0x42, 0x5B, 0xCA, 0x19, 0x42, 0x5B, 0xCA, 0x38, 0x63, 0x3A, 0x63, 0x3A, 0x63, 0x3A, 0x63,
-0xD3, 0x08, 0x5B, 0xCA, 0x19, 0xCA, 0x19, 0xCA, 0x18, 0xEB, 0x18, 0xEB, 0x18, 0xEB, 0x18, 0xEB,
-0xD3, 0xCA, 0x5B, 0xCC, 0x5B, 0xCC, 0x5B, 0xCC, 0xBA, 0x63, 0x38, 0x65, 0x38, 0x65, 0x38, 0x65,
-0xD1, 0xCA, 0x5B, 0xC8, 0x5B, 0xC8, 0x5B, 0xC8, 0x9A, 0xEB, 0x1A, 0xED, 0x1A, 0xED, 0x1A, 0xED,
-0x0C, 0x65, 0xF0, 0x00, 0x64, 0xF5, 0x04, 0x65, 0xB8, 0x25, 0x20, 0x20, 0x24, 0x24, 0x24, 0x24,
-0xF0, 0x00, 0xF8, 0x00, 0xFC, 0x00, 0xFC, 0x00, 0xB8, 0x3D, 0xFC, 0x19, 0xFC, 0x19, 0xFC, 0x19,
-0x44, 0xF9, 0xC4, 0xF9, 0xC4, 0xFD, 0xC4, 0xFD, 0xFC, 0xFD, 0xFC, 0xFD, 0xFC, 0xFD, 0xFC, 0xFD,
-0xC0, 0xD9, 0xC8, 0xD9, 0xC8, 0xD9, 0xC8, 0xD9, 0xD8, 0xD9, 0xD8, 0xD9, 0xD8, 0xD9, 0xD8, 0xD9,
-0x0C, 0x44, 0xFB, 0x04, 0x67, 0xD4, 0x0C, 0x44, 0xBA, 0x24, 0x22, 0x02, 0x26, 0x06, 0x26, 0x06,
-0xFB, 0x00, 0xFB, 0x00, 0xEF, 0x10, 0xCE, 0x18, 0xEF, 0x18, 0xEF, 0x18, 0xFF, 0x18, 0xFF, 0x18,
-0x44, 0xF8, 0xC6, 0xD8, 0xCE, 0xDC, 0xCE, 0xDC, 0xEF, 0x9E, 0x67, 0xB8, 0x67, 0xBC, 0x67, 0xBC,
-0xC6, 0xD8, 0xCA, 0xD8, 0xCA, 0xD8, 0xCA, 0xD8, 0xCB, 0x9A, 0xEF, 0x9A, 0xFF, 0xD8, 0xDB, 0xD8,
-0x66, 0xF4, 0x00, 0x64, 0xBA, 0x25, 0x22, 0x22, 0x26, 0x26, 0x26, 0x26, 0xF2, 0x00, 0xFA, 0x00,
-0xFA, 0x00, 0xFA, 0x00, 0xBA, 0x3D, 0xFA, 0x19, 0xFA, 0x19, 0xFA, 0x19, 0x44, 0xF9, 0xC2, 0xF0,
-0xC2, 0xF4, 0xC2, 0xF4, 0xFA, 0xF4, 0xFA, 0xF4, 0xFA, 0xF4, 0xFA, 0xF4, 0xC2, 0xD0, 0xCA, 0xD0,
-0xCA, 0xD0, 0xCA, 0xD0, 0xDA, 0xD0, 0xDA, 0xD0, 0xDA, 0xD0, 0xDA, 0xD0, 0x08, 0x63, 0xD3, 0x08
-};
+ 0x11, 0x42, 0x5b, 0xca, 0x19, 0x42, 0x5b, 0xca, 0x38, 0x63, 0x3a, 0x63, 0x3a, 0x63, 0x3a, 0x63,
+ 0xd3, 0x08, 0x5b, 0xca, 0x19, 0xca, 0x19, 0xca, 0x18, 0xeb, 0x18, 0xeb, 0x18, 0xeb, 0x18, 0xeb,
+ 0xd3, 0xca, 0x5b, 0xcc, 0x5b, 0xcc, 0x5b, 0xcc, 0xba, 0x63, 0x38, 0x65, 0x38, 0x65, 0x38, 0x65,
+ 0xd1, 0xca, 0x5b, 0xc8, 0x5b, 0xc8, 0x5b, 0xc8, 0x9a, 0xeb, 0x1a, 0xed, 0x1a, 0xed, 0x1a, 0xed,
+ 0x0c, 0x65, 0xf0, 0x00, 0x64, 0xf5, 0x04, 0x65, 0xb8, 0x25, 0x20, 0x20, 0x24, 0x24, 0x24, 0x24,
+ 0xf0, 0x00, 0xf8, 0x00, 0xfc, 0x00, 0xfc, 0x00, 0xb8, 0x3d, 0xfc, 0x19, 0xfc, 0x19, 0xfc, 0x19,
+ 0x44, 0xf9, 0xc4, 0xf9, 0xc4, 0xfd, 0xc4, 0xfd, 0xfc, 0xfd, 0xfc, 0xfd, 0xfc, 0xfd, 0xfc, 0xfd,
+ 0xc0, 0xd9, 0xc8, 0xd9, 0xc8, 0xd9, 0xc8, 0xd9, 0xd8, 0xd9, 0xd8, 0xd9, 0xd8, 0xd9, 0xd8, 0xd9,
+ 0x0c, 0x44, 0xfb, 0x04, 0x67, 0xd4, 0x0c, 0x44, 0xba, 0x24, 0x22, 0x02, 0x26, 0x06, 0x26, 0x06,
+ 0xfb, 0x00, 0xfb, 0x00, 0xef, 0x10, 0xce, 0x18, 0xef, 0x18, 0xef, 0x18, 0xff, 0x18, 0xff, 0x18,
+ 0x44, 0xf8, 0xc6, 0xd8, 0xce, 0xdc, 0xce, 0xdc, 0xef, 0x9e, 0x67, 0xb8, 0x67, 0xbc, 0x67, 0xbc,
+ 0xc6, 0xd8, 0xca, 0xd8, 0xca, 0xd8, 0xca, 0xd8, 0xcb, 0x9a, 0xef, 0x9a, 0xff, 0xd8, 0xdb, 0xd8,
+ 0x66, 0xf4, 0x00, 0x64, 0xba, 0x25, 0x22, 0x22, 0x26, 0x26, 0x26, 0x26, 0xf2, 0x00, 0xfa, 0x00,
+ 0xfa, 0x00, 0xfa, 0x00, 0xba, 0x3d, 0xfa, 0x19, 0xfa, 0x19, 0xfa, 0x19, 0x44, 0xf9, 0xc2, 0xf0,
+ 0xc2, 0xf4, 0xc2, 0xf4, 0xfa, 0xf4, 0xfa, 0xf4, 0xfa, 0xf4, 0xfa, 0xf4, 0xc2, 0xd0, 0xca, 0xd0,
+ 0xca, 0xd0, 0xca, 0xd0, 0xda, 0xd0, 0xda, 0xd0, 0xda, 0xd0, 0xda, 0xd0, 0x08, 0x63, 0xd3, 0x08 };
/***************************************************************************/
@@ -310,7 +311,7 @@ uint32_t nevada_state::screen_update_nevada(screen_device &screen, bitmap_ind16
}
/***************************************************************************/
-PALETTE_INIT_MEMBER(nevada_state, nevada)
+void nevada_state::nevada_palette(palette_device &palette) const
{
// Palette init
}
@@ -589,9 +590,8 @@ MACHINE_CONFIG_START(nevada_state::nevada)
MCFG_SCREEN_UPDATE_DRIVER(nevada_state, screen_update_nevada)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_nevada)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(nevada_state, nevada)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_nevada);
+ PALETTE(config, "palette", FUNC(nevada_state::nevada_palette), 256);
mc6845_device &crtc(MC6845(config, "crtc", MC6845_CLOCK));
crtc.set_screen("screen");
diff --git a/src/mame/drivers/volfied.cpp b/src/mame/drivers/volfied.cpp
index 13ca04608be..47b4f066e11 100644
--- a/src/mame/drivers/volfied.cpp
+++ b/src/mame/drivers/volfied.cpp
@@ -269,9 +269,8 @@ MACHINE_CONFIG_START(volfied_state::volfied)
MCFG_SCREEN_UPDATE_DRIVER(volfied_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_volfied)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_volfied);
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 8192);
PC090OJ(config, m_pc090oj, 0);
m_pc090oj->set_gfxdecode_tag("gfxdecode");
diff --git a/src/mame/drivers/vpoker.cpp b/src/mame/drivers/vpoker.cpp
index 1a2686458fe..5f5e6cc83ec 100644
--- a/src/mame/drivers/vpoker.cpp
+++ b/src/mame/drivers/vpoker.cpp
@@ -109,11 +109,12 @@
class vpoker_state : public driver_device
{
public:
- vpoker_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ vpoker_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void vpoker(machine_config &config);
@@ -648,11 +649,11 @@ MACHINE_CONFIG_START(vpoker_state::vpoker)
MCFG_SCREEN_VISIBLE_AREA(0*8, 480-1, 0*8, 240-1)
// MCFG_SCREEN_VISIBLE_AREA(0*8, 512-1, 0*8, 256-1)
MCFG_SCREEN_UPDATE_DRIVER(vpoker_state, screen_update_vpoker)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vpoker)
- MCFG_PALETTE_ADD_3BIT_GBR("palette")
+ PALETTE(config, m_palette, palette_device::GBR_3BIT);
/* 6840 PTM */
ptm6840_device &ptm(PTM6840(config, "6840ptm", XTAL(4'000'000) / 4));
diff --git a/src/mame/drivers/vt220.cpp b/src/mame/drivers/vt220.cpp
index a1060367aa7..60a8766d649 100644
--- a/src/mame/drivers/vt220.cpp
+++ b/src/mame/drivers/vt220.cpp
@@ -45,10 +45,11 @@
class vt220_state : public driver_device
{
public:
- vt220_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
+ vt220_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_ram(*this, RAM_TAG)
+ { }
void vt220(machine_config &config);
void vt220a(machine_config &config);
@@ -127,7 +128,7 @@ void vt220_state::vt220(machine_config &config)
screen.set_screen_update(FUNC(vt220_state::screen_update_vt220));
screen.set_palette("palette");
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("16K");
diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp
index 6f2eade1ec4..acb5a0b7141 100644
--- a/src/mame/drivers/vt240.cpp
+++ b/src/mame/drivers/vt240.cpp
@@ -673,7 +673,7 @@ void vt240_state::vt240(machine_config &config)
screen.set_raw(XTAL(16'097'280), 1024, 0, 800, 629, 0, 480);
screen.set_screen_update("upd7220", FUNC(upd7220_device::screen_update));
- PALETTE(config, m_palette, 32);
+ PALETTE(config, m_palette).set_entries(32);
GFXDECODE(config, "gfxdecode", m_palette, gfx_vt240);
UPD7220(config, m_hgdc, XTAL(16'097'280) / 16); // actually /8?
diff --git a/src/mame/drivers/vt320.cpp b/src/mame/drivers/vt320.cpp
index 7e12bda94ad..c4edac1793b 100644
--- a/src/mame/drivers/vt320.cpp
+++ b/src/mame/drivers/vt320.cpp
@@ -108,7 +108,7 @@ MACHINE_CONFIG_START(vt320_state::vt320)
MCFG_SCREEN_UPDATE_DRIVER(vt320_state, screen_update_vt320)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* internal ram */
RAM(config, RAM_TAG).set_default_size("16K");
diff --git a/src/mame/drivers/vt520.cpp b/src/mame/drivers/vt520.cpp
index 742b26efce0..ff8e6d3df22 100644
--- a/src/mame/drivers/vt520.cpp
+++ b/src/mame/drivers/vt520.cpp
@@ -19,10 +19,11 @@
class vt520_state : public driver_device
{
public:
- vt520_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) ,
+ vt520_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu"),
- m_rom(*this, "maincpu") { }
+ m_rom(*this, "maincpu")
+ { }
void vt520(machine_config &config);
void vt420(machine_config &config);
@@ -99,7 +100,7 @@ MACHINE_CONFIG_START(vt520_state::vt420)
MCFG_SCREEN_UPDATE_DRIVER(vt520_state, screen_update_vt520)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(vt520_state::vt520)
@@ -117,7 +118,7 @@ MACHINE_CONFIG_START(vt520_state::vt520)
MCFG_SCREEN_UPDATE_DRIVER(vt520_state, screen_update_vt520)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
// On the board there are two M5M44256BJ-7 chips
// Which are DRAM 256K x 4bit
diff --git a/src/mame/drivers/vta2000.cpp b/src/mame/drivers/vta2000.cpp
index 5329285bbba..1dc60d4816e 100644
--- a/src/mame/drivers/vta2000.cpp
+++ b/src/mame/drivers/vta2000.cpp
@@ -47,7 +47,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(speaker_w);
uint32_t screen_update_vta2000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(vta2000);
+ void vta2000_palette(palette_device &palette) const;
void mem_map(address_map &map);
void io_map(address_map &map);
@@ -181,7 +181,7 @@ static GFXDECODE_START( gfx_vta2000 )
GFXDECODE_ENTRY( "chargen", 0x0000, vta2000_charlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(vta2000_state, vta2000)
+void vta2000_state::vta2000_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, 0x00, 0xc0, 0x00); // green
@@ -221,13 +221,11 @@ MACHINE_CONFIG_START(vta2000_state::vta2000)
MCFG_SCREEN_UPDATE_DRIVER(vta2000_state, screen_update_vta2000)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(vta2000_state, vta2000)
+ PALETTE(config, "palette", FUNC(vta2000_state::vta2000_palette), 3);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vta2000)
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("speaker", SPEAKER_SOUND)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
+ SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.5);
MACHINE_CONFIG_END
@@ -244,5 +242,5 @@ ROM_END
/* Driver */
-/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
+// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
COMP( 19??, vta2000, 0, 0, vta2000, vta2000, vta2000_state, empty_init, "<unknown>", "VTA2000-15m", MACHINE_NOT_WORKING )
diff --git a/src/mame/drivers/vtech2.cpp b/src/mame/drivers/vtech2.cpp
index bbc00bca30c..4c27fdaa769 100644
--- a/src/mame/drivers/vtech2.cpp
+++ b/src/mame/drivers/vtech2.cpp
@@ -435,43 +435,41 @@ static GFXDECODE_START( gfx_vtech2 )
GFXDECODE_END
-static const rgb_t vt_colors[] =
+static constexpr rgb_t vt_colors[] =
{
rgb_t::black(),
- rgb_t(0x00, 0x00, 0x7f), /* blue */
- rgb_t(0x00, 0x7f, 0x00), /* green */
- rgb_t(0x00, 0x7f, 0x7f), /* cyan */
- rgb_t(0x7f, 0x00, 0x00), /* red */
- rgb_t(0x7f, 0x00, 0x7f), /* magenta */
- rgb_t(0x7f, 0x7f, 0x00), /* yellow */
- rgb_t(0xa0, 0xa0, 0xa0), /* bright grey */
- rgb_t(0x7f, 0x7f, 0x7f), /* dark grey */
- rgb_t(0x00, 0x00, 0xff), /* bright blue */
- rgb_t(0x00, 0xff, 0x00), /* bright green */
- rgb_t(0x00, 0xff, 0xff), /* bright cyan */
- rgb_t(0xff, 0x00, 0x00), /* bright red */
- rgb_t(0xff, 0x00, 0xff), /* bright magenta */
- rgb_t(0xff, 0xff, 0x00), /* bright yellow */
+ { 0x00, 0x00, 0x7f }, // blue
+ { 0x00, 0x7f, 0x00 }, // green
+ { 0x00, 0x7f, 0x7f }, // cyan
+ { 0x7f, 0x00, 0x00 }, // red
+ { 0x7f, 0x00, 0x7f }, // magenta
+ { 0x7f, 0x7f, 0x00 }, // yellow
+ { 0xa0, 0xa0, 0xa0 }, // bright grey
+ { 0x7f, 0x7f, 0x7f }, // dark grey
+ { 0x00, 0x00, 0xff }, // bright blue
+ { 0x00, 0xff, 0x00 }, // bright green
+ { 0x00, 0xff, 0xff }, // bright cyan
+ { 0xff, 0x00, 0x00 }, // bright red
+ { 0xff, 0x00, 0xff }, // bright magenta
+ { 0xff, 0xff, 0x00 }, // bright yellow
rgb_t::white()
};
-/* Initialise the palette */
-PALETTE_INIT_MEMBER(vtech2_state, vtech2)
+// Initialise the palette
+void vtech2_state::vtech2_palette(palette_device &palette) const
{
- int i;
-
- for ( i = 0; i < 16; i++ )
+ for (int i = 0; i < 16; i++)
palette.set_indirect_color(i, vt_colors[i]);
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- palette.set_pen_indirect(2*i, i&15);
- palette.set_pen_indirect(2*i+1, i>>4);
+ palette.set_pen_indirect(2*i, i & 15);
+ palette.set_pen_indirect(2*i + 1, i >> 4);
}
- for (i = 0; i < 16; i++)
- palette.set_pen_indirect(512+i, i);
+ for (int i = 0; i < 16; i++)
+ palette.set_pen_indirect(512 + i, i);
}
INTERRUPT_GEN_MEMBER(vtech2_state::vtech2_interrupt)
@@ -506,12 +504,10 @@ MACHINE_CONFIG_START(vtech2_state::laser350)
MCFG_SCREEN_SIZE(88*8, 24*8+32)
MCFG_SCREEN_VISIBLE_AREA(0*8, 88*8-1, 0*8, 24*8+32-1)
MCFG_SCREEN_UPDATE_DRIVER(vtech2_state, screen_update_laser)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vtech2)
- MCFG_PALETTE_ADD("palette", 512+16)
- MCFG_PALETTE_INDIRECT_ENTRIES(16)
- MCFG_PALETTE_INIT_OWNER(vtech2_state, vtech2)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_vtech2);
+ PALETTE(config, m_palette, FUNC(vtech2_state::vtech2_palette), 512 + 16, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -534,31 +530,24 @@ MACHINE_CONFIG_START(vtech2_state::laser350)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(vtech2_state::laser500)
+void vtech2_state::laser500(machine_config &config)
+{
laser350(config);
- config.device_remove("banka");
- config.device_remove("bankb");
- config.device_remove("bankc");
- config.device_remove("bankd");
- ADDRESS_MAP_BANK(config, "banka").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankb").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankc").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankd").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
-MACHINE_CONFIG_END
+ ADDRESS_MAP_BANK(config.replace(), "banka").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankb").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankc").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankd").set_map(&vtech2_state::m_map500).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+}
MACHINE_CONFIG_START(vtech2_state::laser700)
laser350(config);
- config.device_remove("banka");
- config.device_remove("bankb");
- config.device_remove("bankc");
- config.device_remove("bankd");
- ADDRESS_MAP_BANK(config, "banka").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankb").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankc").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
- ADDRESS_MAP_BANK(config, "bankd").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "banka").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankb").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankc").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
+ ADDRESS_MAP_BANK(config.replace(), "bankd").set_map(&vtech2_state::m_map700).set_options(ENDIANNESS_LITTLE, 8, 18, 0x4000);
/* Second 5.25" floppy drive */
MCFG_LEGACY_FLOPPY_DRIVE_ADD( FLOPPY_1, vtech2_floppy_interface )
diff --git a/src/mame/drivers/vulgus.cpp b/src/mame/drivers/vulgus.cpp
index 66877b57cc5..eca7adde124 100644
--- a/src/mame/drivers/vulgus.cpp
+++ b/src/mame/drivers/vulgus.cpp
@@ -234,13 +234,11 @@ MACHINE_CONFIG_START(vulgus_state::vulgus)
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(vulgus_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_vulgus)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_vulgus)
- MCFG_PALETTE_ADD("palette", 64*4+16*16+4*32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(256)
- MCFG_PALETTE_INIT_OWNER(vulgus_state, vulgus)
+ PALETTE(config, m_palette, FUNC(vulgus_state::vulgus_palette), 64*4+16*16+4*32*8, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/wallc.cpp b/src/mame/drivers/wallc.cpp
index 5dbfa2c663f..50ae92b81cb 100644
--- a/src/mame/drivers/wallc.cpp
+++ b/src/mame/drivers/wallc.cpp
@@ -61,11 +61,12 @@ Thanks to HIGHWAYMAN for providing info on how to get to these epoxies
class wallc_state : public driver_device
{
public:
- wallc_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ wallc_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_videoram(*this, "videoram") { }
+ m_videoram(*this, "videoram")
+ { }
void sidampkr(machine_config &config);
void unkitpkr(machine_config &config);
@@ -104,8 +105,8 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info_sidampkr);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(wallc);
- DECLARE_PALETTE_INIT(unkitpkr);
+ void wallc_palette(palette_device &palette) const;
+ void unkitpkr_palette(palette_device &palette) const;
DECLARE_VIDEO_START(unkitpkr);
DECLARE_VIDEO_START(sidampkr);
};
@@ -114,102 +115,100 @@ private:
/***************************************************************************
- Convert the color PROMs into a more useable format.
+ Convert the color PROMs into a more usable format.
Wall Crash has one 32 bytes palette PROM, connected to the RGB output this
way:
- bit 6 -- 330 ohm resistor --+-- 330 ohm pulldown resistor -- RED
- bit 5 -- 220 ohm resistor --/
+ bit 6 -- 330 Ohm resistor --+-- 330 Ohm pulldown resistor -- RED
+ bit 5 -- 220 Ohm resistor --/
bit 4 -- NC
- bit 3 -- 330 ohm resistor --+-- 330 ohm pulldown resistor -- GREEN
- bit 2 -- 220 ohm resistor --/
+ bit 3 -- 330 Ohm resistor --+-- 330 Ohm pulldown resistor -- GREEN
+ bit 2 -- 220 Ohm resistor --/
- bit 1 -- 330 ohm resistor --+--+-- 330 ohm pulldown resistor -- BLUE
- bit 0 -- 220 ohm resistor --/ |
+ bit 1 -- 330 Ohm resistor --+--+-- 330 Ohm pulldown resistor -- BLUE
+ bit 0 -- 220 Ohm resistor --/ |
|
bit 7 -+- diode(~655 Ohm)------/
- \------220 ohm pullup (+5V) resistor
+ \------220 Ohm pullup (+5V) resistor
***************************************************************************/
-PALETTE_INIT_MEMBER(wallc_state, wallc)
+void wallc_state::wallc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- static const int resistances_rg[2] = { 330, 220 };
- static const int resistances_b[3] = { 655, 330, 220 };
- double weights_r[2], weights_g[2], weights_b[3];
+ static constexpr int resistances_rg[2] = { 330, 220 };
+ static constexpr int resistances_b[3] = { 655, 330, 220 };
+ double weights_r[2], weights_g[2], weights_b[3];
compute_resistor_weights(0, 255, -1.0,
2, resistances_rg, weights_r, 330, 0,
2, resistances_rg, weights_g, 330, 0,
3, resistances_b, weights_b, 330, 655+220);
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit7,r,g,b;
+ int bit0, bit1, bit7;
- /* red component */
- bit0 = (color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- r = combine_2_weights(weights_r, bit1, bit0);
+ // red component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ int const r = combine_2_weights(weights_r, bit1, bit0);
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i] >> 3) & 0x01;
- g = combine_2_weights(weights_g, bit1, bit0);
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ int const g = combine_2_weights(weights_g, bit1, bit0);
- /* blue component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit7 = (color_prom[i] >> 7) & 0x01;
- b = combine_3_weights(weights_b, bit7, bit1, bit0);
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit7 = BIT(color_prom[i], 7);
+ int const b = combine_3_weights(weights_b, bit7, bit1, bit0);
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(wallc_state, unkitpkr)
+void wallc_state::unkitpkr_palette(palette_device &palette) const
{
-// this pcb has 470 ohms resistors instead of the expected 330 ohms.
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ // this pcb has 470 Ohm resistors instead of the expected 330 Ohms.
+ uint8_t const *const color_prom = memregion("proms")->base();
- static const int resistances_rg[2] = { 470, 220 };
- static const int resistances_b[3] = { 655, 470, 220 };
- double weights_r[2], weights_g[2], weights_b[3];
+ static constexpr int resistances_rg[2] = { 470, 220 };
+ static constexpr int resistances_b[3] = { 655, 470, 220 };
+ double weights_r[2], weights_g[2], weights_b[3];
compute_resistor_weights(0, 255, -1.0,
2, resistances_rg, weights_r, 470, 0,
2, resistances_rg, weights_g, 470, 0,
3, resistances_b, weights_b, 470, 655+220);
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit7,r,g,b;
+ int bit0, bit1, bit7;
- /* red component */
- bit0 = (color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- r = combine_2_weights(weights_r, bit1, bit0);
+ // red component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ int const r = combine_2_weights(weights_r, bit1, bit0);
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i] >> 3) & 0x01;
- g = combine_2_weights(weights_g, bit1, bit0);
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ int const g = combine_2_weights(weights_g, bit1, bit0);
- /* blue component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit7 = (color_prom[i] >> 7) & 0x01;
- b = combine_3_weights(weights_b, bit7, bit1, bit0);
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit7 = BIT(color_prom[i], 7);
+ int const b = combine_3_weights(weights_b, bit7, bit1, bit0);
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -530,9 +529,8 @@ MACHINE_CONFIG_START(wallc_state::wallc)
MCFG_SCREEN_UPDATE_DRIVER(wallc_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wallc)
- MCFG_PALETTE_ADD("palette", 32)
- MCFG_PALETTE_INIT_OWNER(wallc_state, wallc)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_wallc);
+ PALETTE(config, "palette", FUNC(wallc_state::wallc_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -552,8 +550,7 @@ MACHINE_CONFIG_START(wallc_state::unkitpkr)
MCFG_DEVICE_PROGRAM_MAP(unkitpkr_map)
MCFG_VIDEO_START_OVERRIDE(wallc_state, unkitpkr)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_INIT_OWNER(wallc_state, unkitpkr)
+ subdevice<palette_device>("palette")->set_init(FUNC(wallc_state::unkitpkr_palette));
/* sound hardware */
subdevice<ay8912_device>("aysnd")->port_a_read_callback().set_ioport("DSW2");
diff --git a/src/mame/drivers/wardner.cpp b/src/mame/drivers/wardner.cpp
index ff852bb61ba..36ce464bfc5 100644
--- a/src/mame/drivers/wardner.cpp
+++ b/src/mame/drivers/wardner.cpp
@@ -424,7 +424,7 @@ MACHINE_CONFIG_START(wardner_state::wardner)
m_spritegen->set_palette(m_palette);
m_spritegen->set_xoffsets(32, 14);
- MCFG_DEVICE_ADD("spriteram8", BUFFERED_SPRITERAM8)
+ BUFFERED_SPRITERAM8(config, m_spriteram8);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_video_attributes(VIDEO_UPDATE_BEFORE_VBLANK);
@@ -434,9 +434,8 @@ MACHINE_CONFIG_START(wardner_state::wardner)
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", 4096)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wardner);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 4096);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/warpsped.cpp b/src/mame/drivers/warpsped.cpp
index 85e584710fd..410bfe1f5eb 100644
--- a/src/mame/drivers/warpsped.cpp
+++ b/src/mame/drivers/warpsped.cpp
@@ -93,12 +93,13 @@ L10, L15, L18 and G18 all read the same
class warpspeed_state : public driver_device
{
public:
- warpspeed_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ warpspeed_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_gfxdecode(*this, "gfxdecode"),
m_videoram(*this, "videoram"),
- m_workram(*this, "workram") { }
+ m_workram(*this, "workram")
+ { }
void warpspeed(machine_config &config);
@@ -120,7 +121,7 @@ private:
TILE_GET_INFO_MEMBER(get_starfield_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(warpspeed);
+ void warpsped_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_circles(bitmap_ind16 &bitmap);
@@ -310,17 +311,15 @@ static GFXDECODE_START( gfx_warpspeed )
GFXDECODE_ENTRY( "gfx2", 0, charlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(warpspeed_state, warpspeed)
+void warpspeed_state::warpsped_palette(palette_device &palette) const
{
// tilemaps
- palette.set_pen_color(0,rgb_t::black()); /* black */
- palette.set_pen_color(1,rgb_t::white()); /* white */
+ palette.set_pen_color(0, rgb_t::black()); // black
+ palette.set_pen_color(1, rgb_t::white()); // white
// circles
- for ( int i = 0; i < 8; i++ )
- {
- palette.set_pen_color(2 + i, 0xff*BIT(i,0), 0xff*BIT(i,1), 0xff*BIT(i,2));
- }
+ for (int i = 0; i < 8; i++)
+ palette.set_pen_color(2 + i, 0xff * BIT(i, 0), 0xff * BIT(i, 1), 0xff * BIT(i, 2));
}
MACHINE_CONFIG_START(warpspeed_state::warpspeed)
@@ -340,9 +339,8 @@ MACHINE_CONFIG_START(warpspeed_state::warpspeed)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_UPDATE_DRIVER(warpspeed_state, screen_update)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_warpspeed)
- MCFG_PALETTE_ADD("palette", 2+8)
- MCFG_PALETTE_INIT_OWNER(warpspeed_state, warpspeed)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_warpspeed);
+ PALETTE(config, "palette", FUNC(warpspeed_state::warpsped_palette), 2 + 8);
MACHINE_CONFIG_END
ROM_START( warpsped )
diff --git a/src/mame/drivers/warpwarp.cpp b/src/mame/drivers/warpwarp.cpp
index ad20f333f1c..3434f94315b 100644
--- a/src/mame/drivers/warpwarp.cpp
+++ b/src/mame/drivers/warpwarp.cpp
@@ -733,13 +733,12 @@ MACHINE_CONFIG_START(warpwarp_state::geebee)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, warpwarp_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_1k)
- MCFG_PALETTE_ADD("palette", 4*2)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_1k);
+ PALETTE(config, m_palette, FUNC(warpwarp_state::geebee_palette), 4*2);
- MCFG_PALETTE_INIT_OWNER(warpwarp_state,geebee)
MCFG_VIDEO_START_OVERRIDE(warpwarp_state,geebee)
/* sound hardware */
@@ -760,10 +759,9 @@ MACHINE_CONFIG_START(warpwarp_state::navarone)
/* basic machine hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_2k)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(2*2)
+ m_palette->set_entries(2*2);
+ m_palette->set_init(FUNC(warpwarp_state::navarone_palette));
- MCFG_PALETTE_INIT_OWNER(warpwarp_state,navarone)
MCFG_VIDEO_START_OVERRIDE(warpwarp_state,navarone)
MACHINE_CONFIG_END
@@ -772,8 +770,7 @@ MACHINE_CONFIG_START(warpwarp_state::kaitei)
/* basic machine hardware */
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_1k)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(4*2+1)
+ m_palette->set_entries(4*2+1);
MCFG_MACHINE_RESET_OVERRIDE(warpwarp_state,kaitei)
MACHINE_CONFIG_END
@@ -801,13 +798,12 @@ MACHINE_CONFIG_START(warpwarp_state::bombbee)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(MASTER_CLOCK/3, 384, 0, 272, 264, 0, 224)
MCFG_SCREEN_UPDATE_DRIVER(warpwarp_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, warpwarp_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_color)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_color);
- MCFG_PALETTE_ADD("palette", 2*256+1)
- MCFG_PALETTE_INIT_OWNER(warpwarp_state,warpwarp)
+ PALETTE(config, m_palette, FUNC(warpwarp_state::warpwarp_palette), 2*256+1);
MCFG_VIDEO_START_OVERRIDE(warpwarp_state,warpwarp)
/* sound hardware */
diff --git a/src/mame/drivers/wc90.cpp b/src/mame/drivers/wc90.cpp
index ab46ebe9ddc..d2439ed6db0 100644
--- a/src/mame/drivers/wc90.cpp
+++ b/src/mame/drivers/wc90.cpp
@@ -370,10 +370,8 @@ MACHINE_CONFIG_START(wc90_state::wc90)
MCFG_SCREEN_UPDATE_DRIVER(wc90_state, screen_update)
MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_wc90)
- MCFG_PALETTE_ADD(m_palette, 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wc90);
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024).set_endianness(ENDIANNESS_BIG);
TECMO_SPRITE(config, m_sprgen, 0);
diff --git a/src/mame/drivers/wc90b.cpp b/src/mame/drivers/wc90b.cpp
index e91ad801888..13fefc3fd6e 100644
--- a/src/mame/drivers/wc90b.cpp
+++ b/src/mame/drivers/wc90b.cpp
@@ -375,12 +375,10 @@ MACHINE_CONFIG_START(wc90b_state::wc90b)
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(wc90b_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wc90b)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
- MCFG_PALETTE_ENDIANNESS(ENDIANNESS_BIG)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wc90b);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 1024).set_endianness(ENDIANNESS_BIG);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/wecleman.cpp b/src/mame/drivers/wecleman.cpp
index b6f0cf443fd..75ea4e6dd0b 100644
--- a/src/mame/drivers/wecleman.cpp
+++ b/src/mame/drivers/wecleman.cpp
@@ -1077,7 +1077,7 @@ void wecleman_state::wecleman(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_wecleman);
- PALETTE(config, m_palette, 2048);
+ PALETTE(config, m_palette).set_entries(2048);
MCFG_VIDEO_START_OVERRIDE(wecleman_state,wecleman)
@@ -1153,7 +1153,7 @@ void wecleman_state::hotchase(machine_config &config)
m_screen->set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_hotchase);
- PALETTE(config, m_palette, 8192);
+ PALETTE(config, m_palette).set_entries(8192);
MCFG_VIDEO_START_OVERRIDE(wecleman_state, hotchase)
diff --git a/src/mame/drivers/welltris.cpp b/src/mame/drivers/welltris.cpp
index 4237fde2dde..89012a016b6 100644
--- a/src/mame/drivers/welltris.cpp
+++ b/src/mame/drivers/welltris.cpp
@@ -691,9 +691,8 @@ MACHINE_CONFIG_START(welltris_state::welltris)
MCFG_SCREEN_UPDATE_DRIVER(welltris_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_welltris)
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_welltris);
+ PALETTE(config, "palette").set_format(palette_device::xRGB_555, 2048);
VSYSTEM_GGA(config, "gga", XTAL(14'318'181) / 2); // divider not verified
diff --git a/src/mame/drivers/wgp.cpp b/src/mame/drivers/wgp.cpp
index 5b08c86ab9d..9acf8aaa94c 100644
--- a/src/mame/drivers/wgp.cpp
+++ b/src/mame/drivers/wgp.cpp
@@ -944,11 +944,10 @@ MACHINE_CONFIG_START(wgp_state::wgp)
MCFG_SCREEN_SIZE(40*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 2*8, 32*8-1)
MCFG_SCREEN_UPDATE_DRIVER(wgp_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wgp)
- MCFG_PALETTE_ADD("palette", 4096)
- MCFG_PALETTE_FORMAT(RRRRGGGGBBBBxxxx)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wgp);
+ PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 4096);
TC0100SCN(config, m_tc0100scn, 0);
m_tc0100scn->set_gfx_region(1);
diff --git a/src/mame/drivers/wicat.cpp b/src/mame/drivers/wicat.cpp
index b3ac9aefd98..54faa6c0cd1 100644
--- a/src/mame/drivers/wicat.cpp
+++ b/src/mame/drivers/wicat.cpp
@@ -828,8 +828,7 @@ void wicat_state::wicat(machine_config &config)
screen.set_raw(19.6608_MHz_XTAL, 1020, 0, 800, 324, 0, 300);
screen.set_screen_update("video", FUNC(i8275_device::screen_update));
- PALETTE(config, m_palette, 2);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
I8275(config, m_crtc, 19.6608_MHz_XTAL/10);
m_crtc->set_character_width(10);
diff --git a/src/mame/drivers/wildpkr.cpp b/src/mame/drivers/wildpkr.cpp
index 90a6456c511..ae85b9f34b2 100644
--- a/src/mame/drivers/wildpkr.cpp
+++ b/src/mame/drivers/wildpkr.cpp
@@ -182,8 +182,8 @@
class wildpkr_state : public driver_device
{
public:
- wildpkr_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ wildpkr_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_duart(*this, "duart"),
m_id(*this, "id"),
@@ -197,6 +197,10 @@ public:
void init_wildpkr();
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<mc68681_device> m_duart;
@@ -208,9 +212,7 @@ private:
u16 m_clock_rate;
- virtual void machine_start() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(wildpkr);
+ void wildpkr_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(unknown_read8);
DECLARE_WRITE8_MEMBER(unknown_write8);
DECLARE_WRITE16_MEMBER(nvram_w);
@@ -238,7 +240,7 @@ void wildpkr_state::video_start()
{
}
-PALETTE_INIT_MEMBER(wildpkr_state, wildpkr)
+void wildpkr_state::wildpkr_palette(palette_device &palette) const
{
}
@@ -485,8 +487,7 @@ MACHINE_CONFIG_START(wildpkr_state::wildpkr)
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, "palette"));
ramdac.set_addrmap(0, &wildpkr_state::ramdac_map);
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(wildpkr_state, wildpkr)
+ PALETTE(config, "palette", FUNC(wildpkr_state::wildpkr_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -526,8 +527,7 @@ MACHINE_CONFIG_START(wildpkr_state::tabpkr)
ramdac_device &ramdac(RAMDAC(config, "ramdac", 0, "palette"));
ramdac.set_addrmap(0, &wildpkr_state::ramdac_map);
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(wildpkr_state, wildpkr)
+ PALETTE(config, "palette", FUNC(wildpkr_state::wildpkr_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp
index 2ba3b356a38..15cbc10d243 100644
--- a/src/mame/drivers/williams.cpp
+++ b/src/mame/drivers/williams.cpp
@@ -1510,8 +1510,7 @@ MACHINE_CONFIG_START(williams_state::williams)
MCFG_VIDEO_START_OVERRIDE(williams_state,williams)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(williams_state,williams)
+ PALETTE(config, m_palette, FUNC(williams_state::williams_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
@@ -1761,8 +1760,8 @@ MACHINE_CONFIG_START(williams2_state::williams2)
WATCHDOG_TIMER(config, m_watchdog);
/* video hardware */
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_williams2)
+ PALETTE(config, m_palette).set_entries(1024);
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_williams2);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE | VIDEO_ALWAYS_UPDATE)
diff --git a/src/mame/drivers/wink.cpp b/src/mame/drivers/wink.cpp
index 8a1bca08a64..91ada6938e2 100644
--- a/src/mame/drivers/wink.cpp
+++ b/src/mame/drivers/wink.cpp
@@ -26,12 +26,13 @@
class wink_state : public driver_device
{
public:
- wink_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ wink_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_audiocpu(*this, "audiocpu"),
m_gfxdecode(*this, "gfxdecode"),
- m_videoram(*this, "videoram") { }
+ m_videoram(*this, "videoram")
+ { }
void wink(machine_config &config);
@@ -415,10 +416,8 @@ MACHINE_CONFIG_START(wink_state::wink)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, wink_state, nmi_clock_w))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wink)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
-
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_wink);
+ PALETTE(config, "palette").set_format(palette_device::xBRG_444, 16);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/wiping.cpp b/src/mame/drivers/wiping.cpp
index 4ee0b399094..819f68261ba 100644
--- a/src/mame/drivers/wiping.cpp
+++ b/src/mame/drivers/wiping.cpp
@@ -311,12 +311,10 @@ MACHINE_CONFIG_START(wiping_state::wiping)
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(wiping_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wiping)
- MCFG_PALETTE_ADD("palette", 64*4+64*4)
- MCFG_PALETTE_INDIRECT_ENTRIES(32)
- MCFG_PALETTE_INIT_OWNER(wiping_state, wiping)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wiping);
+ PALETTE(config, m_palette, FUNC(wiping_state::wiping_palette), 64*4+64*4, 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/witch.cpp b/src/mame/drivers/witch.cpp
index fdfd60db55e..a7031a689f2 100644
--- a/src/mame/drivers/witch.cpp
+++ b/src/mame/drivers/witch.cpp
@@ -989,11 +989,10 @@ MACHINE_CONFIG_START(witch_state::witch)
MCFG_SCREEN_SIZE(256, 256)
MCFG_SCREEN_VISIBLE_AREA(8, 256-1-8, 8*4, 256-8*4-1)
MCFG_SCREEN_UPDATE_DRIVER(witch_state, screen_update_witch)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_witch)
- MCFG_PALETTE_ADD("palette", 0x800)
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_witch)
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_555, 0x800);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -1027,8 +1026,7 @@ MACHINE_CONFIG_START(keirinou_state::keirinou)
MCFG_DEVICE_MODIFY("sub")
MCFG_DEVICE_PROGRAM_MAP(keirinou_sub_map)
- MCFG_DEVICE_REMOVE("palette")
- MCFG_PALETTE_ADD("palette", 0x200+0x80)
+ PALETTE(config.replace(), m_palette).set_entries(0x200+0x80);
MCFG_GFXDECODE_MODIFY("gfxdecode", gfx_keirinou)
// MCFG_PALETTE_FORMAT(IIBBGGRR)
diff --git a/src/mame/drivers/wiz.cpp b/src/mame/drivers/wiz.cpp
index 246c04d8f97..c5f5df16ded 100644
--- a/src/mame/drivers/wiz.cpp
+++ b/src/mame/drivers/wiz.cpp
@@ -808,11 +808,10 @@ MACHINE_CONFIG_START(wiz_state::kungfut)
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(wiz_state, screen_update_kungfut)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_stinger)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(wiz_state, wiz)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_stinger);
+ PALETTE(config, m_palette, FUNC(wiz_state::wiz_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/wmg.cpp b/src/mame/drivers/wmg.cpp
index f33cd649002..e0476dd4ad3 100644
--- a/src/mame/drivers/wmg.cpp
+++ b/src/mame/drivers/wmg.cpp
@@ -544,8 +544,7 @@ MACHINE_CONFIG_START(wmg_state::wmg)
MCFG_VIDEO_START_OVERRIDE(williams_state,williams)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(williams_state,williams)
+ PALETTE(config, m_palette, FUNC(williams_state::williams_palette), 256);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/wolfpack.cpp b/src/mame/drivers/wolfpack.cpp
index 865412a8b05..da7cb3e1449 100644
--- a/src/mame/drivers/wolfpack.cpp
+++ b/src/mame/drivers/wolfpack.cpp
@@ -321,12 +321,10 @@ MACHINE_CONFIG_START(wolfpack_state::wolfpack)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 16, 239)
MCFG_SCREEN_UPDATE_DRIVER(wolfpack_state, screen_update)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, wolfpack_state, screen_vblank))
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wolfpack)
- MCFG_PALETTE_ADD("palette", 12)
- MCFG_PALETTE_INDIRECT_ENTRIES(8)
- MCFG_PALETTE_INIT_OWNER(wolfpack_state, wolfpack)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_wolfpack)
+ PALETTE(config, m_palette, FUNC(wolfpack_state::wolfpack_palette), 12, 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/wrally.cpp b/src/mame/drivers/wrally.cpp
index a0322621d0b..e186e6a9936 100644
--- a/src/mame/drivers/wrally.cpp
+++ b/src/mame/drivers/wrally.cpp
@@ -280,11 +280,10 @@ MACHINE_CONFIG_START(wrally_state::wrally)
MCFG_SCREEN_SIZE(64*16, 32*16)
MCFG_SCREEN_VISIBLE_AREA(8, 24*16-8-1, 16, 16*16-8-1)
MCFG_SCREEN_UPDATE_DRIVER(wrally_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wrally)
- MCFG_PALETTE_ADD("palette", 1024*8)
- MCFG_PALETTE_FORMAT(xxxxBBBBRRRRGGGG)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_wrally)
+ PALETTE(config, m_palette).set_format(palette_device::xBRG_444, 1024*8);
GAELCO_WRALLY_SPRITES(config, m_sprites, 0);
m_sprites->set_gfxdecode_tag("gfxdecode");
diff --git a/src/mame/drivers/wswan.cpp b/src/mame/drivers/wswan.cpp
index b7eb1eeb4c5..424afbf473f 100644
--- a/src/mame/drivers/wswan.cpp
+++ b/src/mame/drivers/wswan.cpp
@@ -90,22 +90,22 @@ static GFXDECODE_START( gfx_wswan )
GFXDECODE_END
/* WonderSwan can display 16 shades of grey */
-PALETTE_INIT_MEMBER(wswan_state, wswan)
+void wswan_state::wswan_palette(palette_device &palette) const
{
for (int i = 0; i < 16; i++)
{
- uint8_t shade = i * (256 / 16);
+ uint8_t const shade = i * (256 / 16);
palette.set_pen_color(15 - i, shade, shade, shade);
}
}
-PALETTE_INIT_MEMBER(wscolor_state, wscolor)
+void wscolor_state::wscolor_palette(palette_device &palette) const
{
for (int i = 0; i < 4096; i++)
{
- int r = (i & 0x0f00) >> 8;
- int g = (i & 0x00f0) >> 4;
- int b = i & 0x000f;
+ int const r = (i & 0x0f00) >> 8;
+ int const g = (i & 0x00f0) >> 4;
+ int const b = i & 0x000f;
palette.set_pen_color(i, r << 4, g << 4, b << 4);
}
}
@@ -144,8 +144,7 @@ MACHINE_CONFIG_START(wswan_state::wswan)
NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_1);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wswan)
- MCFG_PALETTE_ADD("palette", 16)
- MCFG_PALETTE_INIT_OWNER(wswan_state, wswan)
+ PALETTE(config, "palette", FUNC(wswan_state::wswan_palette), 16);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -173,9 +172,9 @@ MACHINE_CONFIG_START(wscolor_state::wscolor)
m_vdp->set_vdp_type(VDP_TYPE_WSC);
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(4096)
- MCFG_PALETTE_INIT_OWNER(wscolor_state, wscolor)
+ auto &palette(*subdevice<palette_device>("palette"));
+ palette.set_entries(4096);
+ palette.set_init(FUNC(wscolor_state::wscolor_palette));
/* software lists */
MCFG_DEVICE_REMOVE("cart_list")
diff --git a/src/mame/drivers/wwfsstar.cpp b/src/mame/drivers/wwfsstar.cpp
index a4458c1f6c4..4402d630f96 100644
--- a/src/mame/drivers/wwfsstar.cpp
+++ b/src/mame/drivers/wwfsstar.cpp
@@ -427,11 +427,10 @@ MACHINE_CONFIG_START(wwfsstar_state::wwfsstar)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 320, 0, 256, 272, 8, 248) /* HTOTAL and VTOTAL are guessed */
MCFG_SCREEN_UPDATE_DRIVER(wwfsstar_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_wwfsstar)
- MCFG_PALETTE_ADD("palette", 384)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_wwfsstar);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 384);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/wyvernf0.cpp b/src/mame/drivers/wyvernf0.cpp
index ef2a3bb2c02..0f6c71f2dd2 100644
--- a/src/mame/drivers/wyvernf0.cpp
+++ b/src/mame/drivers/wyvernf0.cpp
@@ -63,6 +63,11 @@ public:
void wyvernf0(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
// memory pointers
required_shared_ptr<uint8_t> m_bgram;
@@ -79,7 +84,6 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
DECLARE_WRITE8_MEMBER(bgram_w);
DECLARE_WRITE8_MEMBER(fgram_w);
- DECLARE_VIDEO_START(wyvernf0);
uint32_t screen_update_wyvernf0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, bool is_foreground );
@@ -94,8 +98,6 @@ private:
DECLARE_WRITE8_MEMBER(sound_command_w);
DECLARE_WRITE8_MEMBER(nmi_disable_w);
DECLARE_WRITE8_MEMBER(nmi_enable_w);
- DECLARE_MACHINE_START(wyvernf0);
- DECLARE_MACHINE_RESET(wyvernf0);
TIMER_CALLBACK_MEMBER(nmi_callback);
// MCU
@@ -162,7 +164,7 @@ TILE_GET_INFO_MEMBER(wyvernf0_state::get_fg_tile_info)
SET_TILE_INFO_MEMBER(1, code, color, TILE_FLIPXY(code >> 14));
}
-VIDEO_START_MEMBER(wyvernf0_state,wyvernf0)
+void wyvernf0_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wyvernf0_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
m_fg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(wyvernf0_state::get_fg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
@@ -618,7 +620,7 @@ GFXDECODE_END
***************************************************************************/
-MACHINE_START_MEMBER(wyvernf0_state,wyvernf0)
+void wyvernf0_state::machine_start()
{
uint8_t *ROM = memregion("rombank")->base();
membank("rombank")->configure_entries(0, 8, ROM, 0x2000);
@@ -636,7 +638,7 @@ MACHINE_START_MEMBER(wyvernf0_state,wyvernf0)
save_item(NAME(m_mcu_ready));
}
-MACHINE_RESET_MEMBER(wyvernf0_state,wyvernf0)
+void wyvernf0_state::machine_reset()
{
m_sound_nmi_enable = 0;
m_pending_nmi = 0;
@@ -661,9 +663,6 @@ void wyvernf0_state::wyvernf0(machine_config &config)
// MCFG_QUANTUM_TIME(attotime::from_hz(6000)) // 100 CPU slices per second to synchronize between the MCU and the main CPU
- MCFG_MACHINE_START_OVERRIDE(wyvernf0_state,wyvernf0)
- MCFG_MACHINE_RESET_OVERRIDE(wyvernf0_state,wyvernf0)
-
// video hardware
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_refresh_hz(60);
@@ -674,12 +673,9 @@ void wyvernf0_state::wyvernf0(machine_config &config)
screen.set_palette("palette");
GFXDECODE(config, m_gfxdecode, m_palette, gfx_wyvernf0);
- PALETTE(config, m_palette, 512);
- m_palette->set_format(PALETTE_FORMAT_xxxxRRRRGGGGBBBB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_444, 512);
m_palette->set_endianness(ENDIANNESS_BIG);
- MCFG_VIDEO_START_OVERRIDE(wyvernf0_state,wyvernf0)
-
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/x07.cpp b/src/mame/drivers/x07.cpp
index 08d4935b965..cab05b9f357 100644
--- a/src/mame/drivers/x07.cpp
+++ b/src/mame/drivers/x07.cpp
@@ -1076,7 +1076,7 @@ DEVICE_IMAGE_LOAD_MEMBER( x07_state, x07_card )
return image_init_result::PASS;
}
-PALETTE_INIT_MEMBER(x07_state, x07)
+void x07_state::x07_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -1495,9 +1495,8 @@ MACHINE_CONFIG_START(x07_state::x07)
MCFG_SCREEN_VISIBLE_AREA(0, 120-1, 0, 32-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(x07_state, x07)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_x07)
+ PALETTE(config, "palette", FUNC(x07_state::x07_palette), 2);
+ GFXDECODE(config, "gfxdecode", "palette", gfx_x07);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/x1.cpp b/src/mame/drivers/x1.cpp
index 10aeecaaf3d..0a41b7f62e3 100644
--- a/src/mame/drivers/x1.cpp
+++ b/src/mame/drivers/x1.cpp
@@ -2182,14 +2182,6 @@ MACHINE_START_MEMBER(x1_state,x1)
m_gfxdecode->set_gfx(3, std::make_unique<gfx_element>(m_palette, x1_pcg_8x8, m_pcg_ram.get(), 0, 1, 0));
}
-PALETTE_INIT_MEMBER(x1_state,x1)
-{
- int i;
-
- for(i=0;i<(0x10+0x1000);i++)
- palette.set_pen_color(i,rgb_t(0x00,0x00,0x00));
-}
-
FLOPPY_FORMATS_MEMBER( x1_state::floppy_formats )
FLOPPY_2D_FORMAT
FLOPPY_FORMATS_END
@@ -2240,10 +2232,9 @@ MACHINE_CONFIG_START(x1_state::x1)
m_crtc->set_show_border_area(true);
m_crtc->set_char_width(8);
- MCFG_PALETTE_ADD("palette", 0x10+0x1000)
- MCFG_PALETTE_INIT_OWNER(x1_state,x1)
+ PALETTE(config, m_palette, palette_device::BLACK, 0x10+0x1000);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_x1)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_x1);
MCFG_VIDEO_START_OVERRIDE(x1_state,x1)
diff --git a/src/mame/drivers/x1twin.cpp b/src/mame/drivers/x1twin.cpp
index 74ec4443b2b..a12b96eb0a6 100644
--- a/src/mame/drivers/x1twin.cpp
+++ b/src/mame/drivers/x1twin.cpp
@@ -470,10 +470,9 @@ MACHINE_CONFIG_START(x1twin_state::x1twin)
m_crtc->set_show_border_area(true);
m_crtc->set_char_width(8);
- MCFG_PALETTE_ADD("palette", 0x10+0x1000)
- MCFG_PALETTE_INIT_OWNER(x1twin_state,x1)
+ PALETTE(config, m_palette, palette_device::BLACK, 0x10+0x1000);
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_x1)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_x1);
MCFG_VIDEO_START_OVERRIDE(x1twin_state,x1)
diff --git a/src/mame/drivers/x68k.cpp b/src/mame/drivers/x68k.cpp
index 4371aea9c12..d083d5dce10 100644
--- a/src/mame/drivers/x68k.cpp
+++ b/src/mame/drivers/x68k.cpp
@@ -1592,8 +1592,8 @@ MACHINE_CONFIG_START(x68k_state::x68000_base)
GFXDECODE(config, m_gfxdecode, "pcgpalette", gfxdecode_device::empty);
- PALETTE(config, m_gfxpalette, 256).set_format(raw_to_rgb_converter(2, &x68k_state::GGGGGRRRRRBBBBBI_decoder));
- PALETTE(config, m_pcgpalette, 256).set_format(raw_to_rgb_converter(2, &x68k_state::GGGGGRRRRRBBBBBI_decoder));
+ PALETTE(config, m_gfxpalette).set_format(2, &x68k_state::GGGGGRRRRRBBBBBI, 256);
+ PALETTE(config, m_pcgpalette).set_format(2, &x68k_state::GGGGGRRRRRBBBBBI, 256);
config.set_default_layout(layout_x68000);
diff --git a/src/mame/drivers/xain.cpp b/src/mame/drivers/xain.cpp
index e8223e87616..6d97b221b56 100644
--- a/src/mame/drivers/xain.cpp
+++ b/src/mame/drivers/xain.cpp
@@ -492,11 +492,10 @@ MACHINE_CONFIG_START(xain_state::xsleena)
MCFG_SCREEN_ADD(m_screen, RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 384, 0, 256, 272, 8, 248) // based on ddragon driver
MCFG_SCREEN_UPDATE_DRIVER(xain_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, "palette", gfx_xain)
- MCFG_PALETTE_ADD("palette", 512)
- MCFG_PALETTE_FORMAT(xxxxBBBBGGGGRRRR)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_xain);
+ PALETTE(config, m_palette).set_format(palette_device::xBGR_444, 512);
/* sound hardware */
SPEAKER(config, "mono").front_center();
@@ -520,6 +519,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(xain_state::xsleenab)
xsleena(config);
+
MCFG_DEVICE_MODIFY("maincpu")
MCFG_DEVICE_PROGRAM_MAP(bootleg_map)
diff --git a/src/mame/drivers/xavix.cpp b/src/mame/drivers/xavix.cpp
index 4955d7ef27a..224b2b0d3d2 100644
--- a/src/mame/drivers/xavix.cpp
+++ b/src/mame/drivers/xavix.cpp
@@ -862,7 +862,7 @@ void xavix_state::xavix(machine_config &config)
GFXDECODE(config, m_gfxdecode, m_palette, gfx_xavix);
- PALETTE(config, m_palette, 256).set_init("palette", FUNC(palette_device::palette_init_all_black));
+ PALETTE(config, m_palette, palette_device::BLACK, 256);
/* sound hardware */
diff --git a/src/mame/drivers/xerox820.cpp b/src/mame/drivers/xerox820.cpp
index babdbcab929..5e8703bacf0 100644
--- a/src/mame/drivers/xerox820.cpp
+++ b/src/mame/drivers/xerox820.cpp
@@ -614,7 +614,7 @@ MACHINE_CONFIG_START(xerox820_state::xerox820)
MCFG_SCREEN_RAW_PARAMS(10.69425_MHz_XTAL, 700, 0, 560, 260, 0, 240)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xerox820)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* devices */
Z80PIO(config, m_kbpio, 20_MHz_XTAL / 8);
@@ -690,7 +690,7 @@ MACHINE_CONFIG_START(xerox820ii_state::xerox820ii)
MCFG_SCREEN_RAW_PARAMS(10.69425_MHz_XTAL, 700, 0, 560, 260, 0, 240)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xerox820ii)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/xexex.cpp b/src/mame/drivers/xexex.cpp
index e9d500fdd2b..82762a0711e 100644
--- a/src/mame/drivers/xexex.cpp
+++ b/src/mame/drivers/xexex.cpp
@@ -493,8 +493,7 @@ void xexex_state::xexex(machine_config &config)
m_screen->set_visarea(40, 40+384-1, 0, 0+256-1);
m_screen->set_screen_update(FUNC(xexex_state::screen_update_xexex));
- PALETTE(config, m_palette, 2048);
- m_palette->set_format(PALETTE_FORMAT_XRGB);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_888, 2048);
m_palette->enable_shadows();
m_palette->enable_hilights();
diff --git a/src/mame/drivers/xmen.cpp b/src/mame/drivers/xmen.cpp
index 93739e995e7..53008a8cc55 100644
--- a/src/mame/drivers/xmen.cpp
+++ b/src/mame/drivers/xmen.cpp
@@ -321,9 +321,7 @@ MACHINE_CONFIG_START(xmen_state::xmen)
MCFG_SCREEN_UPDATE_DRIVER(xmen_state, screen_update_xmen)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
K052109(config, m_k052109, 0);
m_k052109->set_palette("palette");
@@ -364,9 +362,7 @@ MACHINE_CONFIG_START(xmen_state::xmen6p)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_PALETTE_ADD("palette", 2048)
- MCFG_PALETTE_ENABLE_SHADOWS()
- MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR)
+ PALETTE(config, "palette").set_format(palette_device::xBGR_555, 2048).enable_shadows();
config.set_default_layout(layout_dualhsxs);
MCFG_SCREEN_ADD("screen", RASTER)
diff --git a/src/mame/drivers/xorworld.cpp b/src/mame/drivers/xorworld.cpp
index 3e1eaf3552a..83969a77bb2 100644
--- a/src/mame/drivers/xorworld.cpp
+++ b/src/mame/drivers/xorworld.cpp
@@ -182,8 +182,7 @@ void xorworld_state::xorworld(machine_config &config)
screen.set_palette(m_palette);
GFXDECODE(config, m_gfxdecode, m_palette, gfx_xorworld);
- PALETTE(config, m_palette, 256);
- m_palette->set_init(FUNC(xorworld_state::palette_init_xorworld));
+ PALETTE(config, m_palette, FUNC(xorworld_state::xorworld_palette), 256);
// sound hardware
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/xxmissio.cpp b/src/mame/drivers/xxmissio.cpp
index b350070a5e1..c28818b9322 100644
--- a/src/mame/drivers/xxmissio.cpp
+++ b/src/mame/drivers/xxmissio.cpp
@@ -284,12 +284,11 @@ MACHINE_CONFIG_START(xxmissio_state::xxmissio)
MCFG_SCREEN_SIZE(64*8, 32*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 4*8, 28*8-1)
MCFG_SCREEN_UPDATE_DRIVER(xxmissio_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, xxmissio_state, interrupt_m))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xxmissio)
- MCFG_PALETTE_ADD("palette", 768)
- MCFG_PALETTE_FORMAT_CLASS(1, xxmissio_state, BBGGRRII)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_xxmissio);
+ PALETTE(config, m_palette).set_format(1, &xxmissio_state::BBGGRRII, 768);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/xybots.cpp b/src/mame/drivers/xybots.cpp
index 2bf8decb83d..51dbc9cecff 100644
--- a/src/mame/drivers/xybots.cpp
+++ b/src/mame/drivers/xybots.cpp
@@ -188,10 +188,8 @@ MACHINE_CONFIG_START(xybots_state::xybots)
WATCHDOG_TIMER(config, "watchdog");
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xybots)
-
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(IIIIRRRRGGGGBBBB)
+ GFXDECODE(config, "gfxdecode", "palette", gfx_xybots);
+ PALETTE(config, "palette").set_format(palette_device::IRGB_4444, 1024);
MCFG_TILEMAP_ADD_STANDARD("playfield", "gfxdecode", 2, xybots_state, get_playfield_tile_info, 8,8, SCAN_ROWS, 64,32)
MCFG_TILEMAP_ADD_STANDARD_TRANSPEN("alpha", "gfxdecode", 2, xybots_state, get_alpha_tile_info, 8,8, SCAN_ROWS, 64,32, 0)
diff --git a/src/mame/drivers/xyonix.cpp b/src/mame/drivers/xyonix.cpp
index 6ccec9f0c35..e7d5beac560 100644
--- a/src/mame/drivers/xyonix.cpp
+++ b/src/mame/drivers/xyonix.cpp
@@ -24,6 +24,7 @@ TODO:
#include "emu.h"
#include "includes/xyonix.h"
+
#include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "screen.h"
@@ -263,18 +264,14 @@ MACHINE_CONFIG_START(xyonix_state::xyonix)
MCFG_SCREEN_PALETTE("palette")
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, xyonix_state, nmiclk_w))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_xyonix)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(xyonix_state, xyonix)
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_xyonix);
+ PALETTE(config, "palette", FUNC(xyonix_state::xyonix_palette), 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- MCFG_DEVICE_ADD("sn1", SN76496, 16000000/4)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
-
- MCFG_DEVICE_ADD("sn2", SN76496, 16000000/4)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
+ SN76496(config, "sn1", 16000000/4).add_route(ALL_OUTPUTS, "mono", 1.0);
+ SN76496(config, "sn2", 16000000/4).add_route(ALL_OUTPUTS, "mono", 1.0);
MACHINE_CONFIG_END
/* ROM Loading ***************************************************************/
diff --git a/src/mame/drivers/yiear.cpp b/src/mame/drivers/yiear.cpp
index b5b2c3a90c5..60d5df7e323 100644
--- a/src/mame/drivers/yiear.cpp
+++ b/src/mame/drivers/yiear.cpp
@@ -297,9 +297,8 @@ MACHINE_CONFIG_START(yiear_state::yiear)
MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, yiear_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yiear)
- MCFG_PALETTE_ADD(m_palette, 32)
- MCFG_PALETTE_INIT_OWNER(yiear_state, yiear)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_yiear);
+ PALETTE(config, m_palette, FUNC(yiear_state::yiear_palette), 32);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/yunsun16.cpp b/src/mame/drivers/yunsun16.cpp
index 6f24e273f57..8d7586f410c 100644
--- a/src/mame/drivers/yunsun16.cpp
+++ b/src/mame/drivers/yunsun16.cpp
@@ -611,11 +611,10 @@ MACHINE_CONFIG_START(magicbub_state::magicbub)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(16'000'000)/2, 512, 0x20, 0x180-0x20, 260, 0, 0xe0) /* TODO: completely inaccurate */
MCFG_SCREEN_UPDATE_DRIVER(magicbub_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yunsun16)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_yunsun16);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
@@ -649,11 +648,10 @@ MACHINE_CONFIG_START(shocking_state::shocking)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(16'000'000)/2, 512, 0, 0x180-4, 260, 0, 0xe0) /* TODO: completely inaccurate */
MCFG_SCREEN_UPDATE_DRIVER(shocking_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_yunsun16)
- MCFG_PALETTE_ADD("palette", 8192)
- MCFG_PALETTE_FORMAT(xRRRRRGGGGGBBBBB)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_yunsun16);
+ PALETTE(config, m_palette).set_format(palette_device::xRGB_555, 8192);
/* sound hardware */
SPEAKER(config, "lspeaker").front_left();
diff --git a/src/mame/drivers/z1013.cpp b/src/mame/drivers/z1013.cpp
index 69242021885..919497e9f72 100644
--- a/src/mame/drivers/z1013.cpp
+++ b/src/mame/drivers/z1013.cpp
@@ -387,7 +387,7 @@ MACHINE_CONFIG_START(z1013_state::z1013)
MCFG_SCREEN_PALETTE("palette")
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_z1013)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/z88.cpp b/src/mame/drivers/z88.cpp
index 429c3c28b61..41178d32491 100644
--- a/src/mame/drivers/z88.cpp
+++ b/src/mame/drivers/z88.cpp
@@ -611,8 +611,7 @@ MACHINE_CONFIG_START(z88_state::z88)
m_screen->set_palette(m_palette);
m_screen->set_screen_update("blink", FUNC(upd65031_device::screen_update));
- device = &PALETTE(config, m_palette, Z88_NUM_COLOURS);
- MCFG_PALETTE_INIT_OWNER(z88_state, z88)
+ PALETTE(config, m_palette, FUNC(z88_state::z88_palette), Z88_NUM_COLOURS);
UPD65031(config, m_blink, XTAL(9'830'400));
m_blink->kb_rd_callback().set(FUNC(z88_state::kb_r));
diff --git a/src/mame/drivers/zac2650.cpp b/src/mame/drivers/zac2650.cpp
index dcba11ad8aa..b597f4ee437 100644
--- a/src/mame/drivers/zac2650.cpp
+++ b/src/mame/drivers/zac2650.cpp
@@ -180,7 +180,7 @@ static INPUT_PORTS_START( dodgem )
INPUT_PORTS_END
-PALETTE_INIT_MEMBER(zac2650_state, zac2650)
+void zac2650_state::zac2650_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t::white());
@@ -226,12 +226,12 @@ static const gfx_layout s2636_character =
static GFXDECODE_START( gfx_tinvader )
GFXDECODE_SCALE( "gfx1", 0, tinvader_character, 0, 2, 3, 3 )
- GFXDECODE_SCALE( nullptr, 0x1F00, s2636_character, 0, 2, 4, 3 ) /* dynamic */
- GFXDECODE_SCALE( nullptr, 0x1F00, s2636_character, 0, 2, 8, 6 ) /* dynamic */
+ GFXDECODE_SCALE( nullptr, 0x1f00, s2636_character, 0, 2, 4, 3 ) // dynamic
+ GFXDECODE_SCALE( nullptr, 0x1f00, s2636_character, 0, 2, 8, 6 ) // dynamic
GFXDECODE_END
-MACHINE_CONFIG_START(zac2650_state::tinvader)
-
+void zac2650_state::tinvader(machine_config &config)
+{
/* basic machine hardware */
s2650_device &maincpu(S2650(config, m_maincpu, 3800000/4));
maincpu.set_addrmap(AS_PROGRAM, &zac2650_state::main_map);
@@ -246,16 +246,14 @@ MACHINE_CONFIG_START(zac2650_state::tinvader)
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)
- MCFG_PALETTE_INIT_OWNER(zac2650_state, zac2650)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_tinvader);
+ PALETTE(config, m_palette, FUNC(zac2650_state::zac2650_palette), 4);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- S2636(config, m_s2636, 0);
- m_s2636->add_route(ALL_OUTPUTS, "mono", 0.25);
-MACHINE_CONFIG_END
+ S2636(config, m_s2636, 0).add_route(ALL_OUTPUTS, "mono", 0.25);
+}
WRITE8_MEMBER(zac2650_state::tinvader_sound_w)
{
diff --git a/src/mame/drivers/zaccaria.cpp b/src/mame/drivers/zaccaria.cpp
index d469db0c6fe..c37fb7fb608 100644
--- a/src/mame/drivers/zaccaria.cpp
+++ b/src/mame/drivers/zaccaria.cpp
@@ -361,18 +361,15 @@ MACHINE_CONFIG_START(zaccaria_state::zaccaria)
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(zaccaria_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, zaccaria_state, vblank_irq))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_zaccaria)
- MCFG_PALETTE_ADD("palette", 32*8+32*8)
- MCFG_PALETTE_INDIRECT_ENTRIES(512)
- MCFG_PALETTE_INIT_OWNER(zaccaria_state, zaccaria)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_zaccaria);
+ PALETTE(config, m_palette, FUNC(zaccaria_state::zaccaria_palette), 32*8 + 32*8, 512);
/* sound hardware */
SPEAKER(config, "speaker").front_center();
- MCFG_DEVICE_ADD("audiopcb", ZACCARIA_1B11142)
- MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 1.0)
+ ZACCARIA_1B11142(config, "audiopcb").add_route(ALL_OUTPUTS, "speaker", 1.0);
MACHINE_CONFIG_END
diff --git a/src/mame/drivers/zaxxon.cpp b/src/mame/drivers/zaxxon.cpp
index 0691d75cac2..7fa9581d499 100644
--- a/src/mame/drivers/zaxxon.cpp
+++ b/src/mame/drivers/zaxxon.cpp
@@ -941,9 +941,8 @@ MACHINE_CONFIG_START(zaxxon_state::root)
m_mainlatch[1]->q_out_cb<7>().set(FUNC(zaxxon_state::bg_enable_w)); // BEN
/* video hardware */
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_zaxxon)
- MCFG_PALETTE_ADD("palette", 256)
- MCFG_PALETTE_INIT_OWNER(zaxxon_state, zaxxon)
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_zaxxon);
+ PALETTE(config, m_palette, FUNC(zaxxon_state::zaxxon_palette), 256);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART)
@@ -1062,9 +1061,7 @@ MACHINE_CONFIG_START(zaxxon_state::congo)
MCFG_DEVICE_PERIODIC_INT_DRIVER(zaxxon_state, irq0_line_hold, SOUND_CLOCK/16/16/16/4)
/* video hardware */
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_ENTRIES(512)
- MCFG_PALETTE_INIT_OWNER(zaxxon_state, zaxxon)
+ m_palette->set_entries(512).set_init(FUNC(zaxxon_state::zaxxon_palette));
MCFG_VIDEO_START_OVERRIDE(zaxxon_state,congo)
MCFG_SCREEN_MODIFY("screen")
diff --git a/src/mame/drivers/zerozone.cpp b/src/mame/drivers/zerozone.cpp
index 8020d85a7f7..bf6df337d4c 100644
--- a/src/mame/drivers/zerozone.cpp
+++ b/src/mame/drivers/zerozone.cpp
@@ -201,7 +201,7 @@ void zerozone_state::zerozone(machine_config &config)
GFXDECODE(config, m_gfxdecode, "palette", gfx_zerozone);
- PALETTE(config, "palette", 256).set_format(PALETTE_FORMAT_RRRRGGGGBBBBRGBx);
+ PALETTE(config, "palette").set_format(palette_device::RRRRGGGGBBBBRGBx, 256);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/zorba.cpp b/src/mame/drivers/zorba.cpp
index 9323820383e..c3bbb6e7a3f 100644
--- a/src/mame/drivers/zorba.cpp
+++ b/src/mame/drivers/zorba.cpp
@@ -143,7 +143,7 @@ MACHINE_CONFIG_START(zorba_state::zorba)
MCFG_SCREEN_REFRESH_RATE(50)
MCFG_SCREEN_UPDATE_DEVICE("crtc", i8275_device, screen_update)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_zorba)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT(m_palette)
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/zr107.cpp b/src/mame/drivers/zr107.cpp
index 1c41778ebbc..93d2492e745 100644
--- a/src/mame/drivers/zr107.cpp
+++ b/src/mame/drivers/zr107.cpp
@@ -812,7 +812,7 @@ void zr107_state::zr107(machine_config &config)
m_screen->set_visarea(0*8, 64*8-1, 0*8, 48*8-1);
m_screen->screen_vblank().set(FUNC(zr107_state::vblank));
- PALETTE(config, m_palette, 65536);
+ PALETTE(config, m_palette).set_entries(65536);
K001005(config, m_k001005, 0, m_k001006_1);
diff --git a/src/mame/drivers/zrt80.cpp b/src/mame/drivers/zrt80.cpp
index f4baf373946..b8c03b1e6d2 100644
--- a/src/mame/drivers/zrt80.cpp
+++ b/src/mame/drivers/zrt80.cpp
@@ -293,13 +293,11 @@ void zrt80_state::zrt80(machine_config &config)
GFXDECODE(config, "gfxdecode", m_palette, gfx_zrt80);
- PALETTE(config, m_palette, 2);
- m_palette->set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
/* sound hardware */
SPEAKER(config, "mono").front_center();
- BEEP(config, m_beep, 800);
- m_beep->add_route(ALL_OUTPUTS, "mono", 0.50);
+ BEEP(config, m_beep, 800).add_route(ALL_OUTPUTS, "mono", 0.50);
/* Devices */
MC6845(config, m_crtc, XTAL(20'000'000) / 8);
diff --git a/src/mame/drivers/zwackery.cpp b/src/mame/drivers/zwackery.cpp
index 75d7ba90d70..3f3a2923cd7 100644
--- a/src/mame/drivers/zwackery.cpp
+++ b/src/mame/drivers/zwackery.cpp
@@ -37,8 +37,8 @@
class zwackery_state : public driver_device
{
public:
- zwackery_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ zwackery_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_pia0(*this, "pia0"),
m_pia1(*this, "pia1"),
@@ -533,10 +533,8 @@ void zwackery_state::zwackery(machine_config &config)
m_screen->set_palette(m_palette);
m_screen->scanline().set(FUNC(zwackery_state::scanline_cb));
- GFXDECODE(config, "gfxdecode", "palette", gfx_zwackery);
-
- PALETTE(config, m_palette, 4096);
- m_palette->set_format(PALETTE_FORMAT_xRRRRRBBBBBGGGGG_inverted);
+ GFXDECODE(config, m_gfxdecode, "palette", gfx_zwackery);
+ PALETTE(config, "palette").set_format(palette_device::xRBG_555_inverted, 4096);
// sound hardware
SPEAKER(config, "speaker").front_center();
diff --git a/src/mame/drivers/zx.cpp b/src/mame/drivers/zx.cpp
index 228bba9bebc..92ff4c17467 100644
--- a/src/mame/drivers/zx.cpp
+++ b/src/mame/drivers/zx.cpp
@@ -314,15 +314,6 @@ static INPUT_PORTS_START( pow3000 )
INPUT_PORTS_END
-/* Palette Initialization */
-
-PALETTE_INIT_MEMBER(zx_state, zx)
-{
- palette.set_pen_color(0, rgb_t::white());
- palette.set_pen_color(1, rgb_t::black());
-}
-
-
/* Machine Configs */
void zx_state::zx80(machine_config &config)
@@ -341,8 +332,7 @@ void zx_state::zx80(machine_config &config)
m_screen->set_palette("palette");
m_screen->set_screen_update(FUNC(zx_state::screen_update));
- palette_device &palette(PALETTE(config, "palette", 2));
- palette.set_init(palette_init_delegate(FUNC(zx_state::palette_init_zx), this));
+ PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
CASSETTE(config, m_cassette);
m_cassette->set_formats(zx80_o_format);
diff --git a/src/mame/etc/template_driver.cpp b/src/mame/etc/template_driver.cpp
index 967bdb33314..d126c66ee16 100644
--- a/src/mame/etc/template_driver.cpp
+++ b/src/mame/etc/template_driver.cpp
@@ -35,15 +35,15 @@ protected:
virtual void video_start() override;
private:
- // devices
- required_device<cpu_device> m_maincpu;
+ // screen updates
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void xxx_palette(palette_device *palette) const;
void xxx_io(address_map &map);
void xxx_map(address_map &map);
- // screen updates
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(xxx);
+ // devices
+ required_device<cpu_device> m_maincpu;
};
void xxx_state::video_start()
@@ -146,7 +146,7 @@ void xxx_state::machine_reset()
}
-PALETTE_INIT_MEMBER(xxx_state, xxx)
+void xxx_state::xxx_palette(palette_device &palette) const
{
}
@@ -170,7 +170,7 @@ void xxx_state::xxx(machine_config &config)
GFXDECODE(config, "gfxdecode", "palette", gfx_xxx);
- PALETTE(config, "palette", 8).set_init(palette_init_delegate(FUNC(xxx_state::xxx), this));
+ PALETTE(config, "palette", FUNC(xxx_state::xxx_palette), 8);
/* sound hardware */
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/includes/1942.h b/src/mame/includes/1942.h
index 30d720ec67e..c9b3c8d5a22 100644
--- a/src/mame/includes/1942.h
+++ b/src/mame/includes/1942.h
@@ -50,7 +50,7 @@ protected:
DECLARE_WRITE8_MEMBER(_1942_palette_bank_w);
DECLARE_WRITE8_MEMBER(_1942_scroll_w);
DECLARE_WRITE8_MEMBER(_1942_c804_w);
- DECLARE_PALETTE_INIT(1942);
+ void _1942_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(_1942_scanline);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -71,7 +71,7 @@ protected:
tilemap_t *m_bg_tilemap;
int m_palette_bank;
uint8_t m_scroll[2];
- void create_palette();
+ void create_palette(palette_device &palette) const;
};
class _1942p_state : public _1942_state
@@ -94,7 +94,7 @@ protected:
DECLARE_WRITE8_MEMBER(_1942p_f600_w);
DECLARE_WRITE8_MEMBER(_1942p_palette_w);
- DECLARE_PALETTE_INIT(1942p);
+ void _1942p_palette(palette_device &palette) const;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
diff --git a/src/mame/includes/1943.h b/src/mame/includes/1943.h
index 490eb23775a..d543513fe5c 100644
--- a/src/mame/includes/1943.h
+++ b/src/mame/includes/1943.h
@@ -71,7 +71,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(1943);
+ void _1943_palette(palette_device &palette) const;
uint32_t screen_update_1943(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority);
diff --git a/src/mame/includes/20pacgal.h b/src/mame/includes/20pacgal.h
index 0c901497c37..17793985c20 100644
--- a/src/mame/includes/20pacgal.h
+++ b/src/mame/includes/20pacgal.h
@@ -83,7 +83,7 @@ protected:
virtual void video_start() override;
uint32_t screen_update_20pacgal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
- DECLARE_PALETTE_INIT(starpal_init);
+ void starpal_init(palette_device &palette) const;
void get_pens();
void do_pen_lookup(bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h
index ab9195e1c3f..ae5afda1711 100644
--- a/src/mame/includes/8080bw.h
+++ b/src/mame/includes/8080bw.h
@@ -177,8 +177,8 @@ private:
DECLARE_MACHINE_RESET(schaser_sh);
DECLARE_MACHINE_START(claybust);
- DECLARE_PALETTE_INIT(rollingc);
- DECLARE_PALETTE_INIT(sflush);
+ void rollingc_palette(palette_device &palette) const;
+ void sflush_palette(palette_device &palette) const;
uint32_t screen_update_invadpt2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cosmo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/abc80x.h b/src/mame/includes/abc80x.h
index 606b1013a46..10ae7ca0d8f 100644
--- a/src/mame/includes/abc80x.h
+++ b/src/mame/includes/abc80x.h
@@ -209,7 +209,7 @@ public:
DECLARE_READ8_MEMBER( m1_r ) override;
DECLARE_READ8_MEMBER( char_ram_r );
- DECLARE_PALETTE_INIT( abc800c );
+ void abc800c_palette(palette_device &palette) const;
void abc800c(machine_config &config);
void abc800c_video(machine_config &config);
void abc800c_mem(address_map &map);
@@ -311,7 +311,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( keydtr_w );
DECLARE_WRITE_LINE_MEMBER( hs_w );
DECLARE_WRITE_LINE_MEMBER( vs_w );
- DECLARE_PALETTE_INIT( abc806 );
+ void abc806_palette(palette_device &palette) const;
MC6845_UPDATE_ROW( abc806_update_row );
// memory state
diff --git a/src/mame/includes/advision.h b/src/mame/includes/advision.h
index d18614577ec..4a2cd1b44b5 100644
--- a/src/mame/includes/advision.h
+++ b/src/mame/includes/advision.h
@@ -87,7 +87,7 @@ public:
int m_sound_cmd;
int m_sound_d;
int m_sound_g;
- DECLARE_PALETTE_INIT(advision);
+ void advision_palette(palette_device &palette) const;
void advision(machine_config &config);
void io_map(address_map &map);
void program_map(address_map &map);
diff --git a/src/mame/includes/alesis.h b/src/mame/includes/alesis.h
index 5b4f9817bbc..088754efdad 100644
--- a/src/mame/includes/alesis.h
+++ b/src/mame/includes/alesis.h
@@ -135,7 +135,7 @@ public:
void sr16(machine_config &config);
protected:
- DECLARE_PALETTE_INIT(alesis);
+ void alesis_palette(palette_device &palette) const;
virtual void machine_start() override;
virtual void machine_reset() override;
diff --git a/src/mame/includes/alpha68k.h b/src/mame/includes/alpha68k.h
index c03a55205d3..6617beb481f 100644
--- a/src/mame/includes/alpha68k.h
+++ b/src/mame/includes/alpha68k.h
@@ -89,8 +89,8 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_MACHINE_START(common);
DECLARE_MACHINE_RESET(common);
- DECLARE_PALETTE_INIT(kyros);
- DECLARE_PALETTE_INIT(paddlem);
+ void kyros_palette(palette_device &palette) const;
+ void paddlem_palette(palette_device &palette) const;
DECLARE_MACHINE_START(alpha68k_II);
DECLARE_MACHINE_RESET(alpha68k_II);
DECLARE_VIDEO_START(alpha68k);
diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h
index ef30cbf1565..72b6d0f56e4 100644
--- a/src/mame/includes/amiga.h
+++ b/src/mame/includes/amiga.h
@@ -416,7 +416,7 @@ public:
DECLARE_VIDEO_START( amiga );
DECLARE_VIDEO_START( amiga_aga );
- DECLARE_PALETTE_INIT( amiga );
+ void amiga_palette(palette_device &palette) const;
uint32_t screen_update_amiga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_amiga_aga(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/ampoker2.h b/src/mame/includes/ampoker2.h
index 6e77dae2490..4a5f699cbfe 100644
--- a/src/mame/includes/ampoker2.h
+++ b/src/mame/includes/ampoker2.h
@@ -1,6 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Roberto Fresca, Grull Osgo
-
#ifndef MAME_INCLUDES_AMPOKER2_H
#define MAME_INCLUDES_AMPOKER2_H
@@ -42,7 +41,7 @@ private:
DECLARE_WRITE8_MEMBER(videoram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(s2k_get_bg_tile_info);
- DECLARE_PALETTE_INIT(ampoker2);
+ void ampoker2_palette(palette_device &palette) const;
DECLARE_VIDEO_START(sigma2k);
void io_map(address_map &map);
diff --git a/src/mame/includes/amstrad.h b/src/mame/includes/amstrad.h
index ac333140579..55799d9f58f 100644
--- a/src/mame/includes/amstrad.h
+++ b/src/mame/includes/amstrad.h
@@ -145,27 +145,10 @@ public:
m_rtc(*this, "rtc"),
m_region_maincpu(*this, "maincpu"),
m_region_user1(*this, "user1"),
- m_bank1(*this, "bank1"),
- m_bank2(*this, "bank2"),
- m_bank3(*this, "bank3"),
- m_bank4(*this, "bank4"),
- m_bank5(*this, "bank5"),
- m_bank6(*this, "bank6"),
- m_bank7(*this, "bank7"),
- m_bank8(*this, "bank8"),
- m_bank9(*this, "bank9"),
- m_bank10(*this, "bank10"),
- m_bank11(*this, "bank11"),
- m_bank12(*this, "bank12"),
- m_bank13(*this, "bank13"),
- m_bank14(*this, "bank14"),
- m_bank15(*this, "bank15"),
- m_bank16(*this, "bank16"),
- m_io_kbrow(*this, "kbrow.%u", 0),
- m_io_analog(*this, "analog.%u", 0),
- m_io_mouse1(*this,"mouse_input1"),
- m_io_mouse2(*this,"mouse_input2"),
- m_io_mouse3(*this,"mouse_input3"),
+ m_banks(*this, "bank%u", 1U),
+ m_io_kbrow(*this, "kbrow.%u", 0U),
+ m_io_analog(*this, "analog.%u", 0U),
+ m_io_mouse(*this,"mouse_input%u", 1U),
m_io_solder_links(*this, "solder_links"),
m_io_green_display(*this, "green_display"),
m_io_ctrltype(*this,"controller_type"),
@@ -221,19 +204,19 @@ public:
DECLARE_MACHINE_START(amstrad);
DECLARE_MACHINE_RESET(amstrad);
DECLARE_VIDEO_START(amstrad);
- DECLARE_PALETTE_INIT(amstrad_cpc);
- DECLARE_PALETTE_INIT(amstrad_cpc_green);
+ void amstrad_cpc_palette(palette_device &palette) const;
+ void amstrad_cpc_green_palette(palette_device &palette) const;
DECLARE_MACHINE_START(plus);
DECLARE_MACHINE_RESET(plus);
- DECLARE_PALETTE_INIT(amstrad_plus);
+ void amstrad_plus_palette(palette_device &palette) const;
DECLARE_MACHINE_START(gx4000);
DECLARE_MACHINE_RESET(gx4000);
DECLARE_MACHINE_START(kccomp);
DECLARE_MACHINE_RESET(kccomp);
- DECLARE_PALETTE_INIT(kccomp);
+ void kccomp_palette(palette_device &palette) const;
DECLARE_MACHINE_START(aleste);
DECLARE_MACHINE_RESET(aleste);
- DECLARE_PALETTE_INIT(aleste);
+ void aleste_palette(palette_device &palette) const;
uint32_t screen_update_amstrad(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_amstrad);
DECLARE_INPUT_CHANGED_MEMBER(cpc_monitor_changed);
@@ -280,27 +263,10 @@ public:
protected:
required_memory_region m_region_maincpu;
optional_memory_region m_region_user1;
- required_memory_bank m_bank1;
- required_memory_bank m_bank2;
- required_memory_bank m_bank3;
- required_memory_bank m_bank4;
- required_memory_bank m_bank5;
- required_memory_bank m_bank6;
- required_memory_bank m_bank7;
- required_memory_bank m_bank8;
- required_memory_bank m_bank9;
- required_memory_bank m_bank10;
- required_memory_bank m_bank11;
- required_memory_bank m_bank12;
- required_memory_bank m_bank13;
- required_memory_bank m_bank14;
- required_memory_bank m_bank15;
- required_memory_bank m_bank16;
+ required_memory_bank_array<16> m_banks;
optional_ioport_array<11> m_io_kbrow;
optional_ioport_array<4> m_io_analog;
- optional_ioport m_io_mouse1;
- optional_ioport m_io_mouse2;
- optional_ioport m_io_mouse3;
+ optional_ioport_array<3> m_io_mouse;
required_ioport m_io_solder_links;
required_ioport m_io_green_display;
optional_ioport m_io_ctrltype;
@@ -330,7 +296,7 @@ protected:
void update_psg();
void amstrad_common_init();
void enumerate_roms();
- unsigned char kccomp_get_colour_element(int colour_value);
+ static uint8_t kccomp_get_colour_element(int colour_value);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
int m_centronics_busy;
diff --git a/src/mame/includes/apexc.h b/src/mame/includes/apexc.h
index f012a10da0f..a1a954e9aff 100644
--- a/src/mame/includes/apexc.h
+++ b/src/mame/includes/apexc.h
@@ -40,8 +40,7 @@ protected:
void check_inputs();
private:
-
- DECLARE_PALETTE_INIT(apexc);
+ void apexc_palette(palette_device &palette) const;
uint32_t screen_update_apexc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(apexc_interrupt);
DECLARE_WRITE8_MEMBER(tape_write);
diff --git a/src/mame/includes/apple3.h b/src/mame/includes/apple3.h
index 15f45c2d51f..ef32b981503 100644
--- a/src/mame/includes/apple3.h
+++ b/src/mame/includes/apple3.h
@@ -116,7 +116,7 @@ public:
void apple3_via_out(uint8_t *var, uint8_t data);
uint8_t *apple3_get_indexed_addr(offs_t offset);
TIMER_DEVICE_CALLBACK_MEMBER(apple3_c040_tick);
- DECLARE_PALETTE_INIT(apple3);
+ void palette_init(palette_device &palette) const;
DECLARE_READ_LINE_MEMBER(ay3600_shift_r);
DECLARE_READ_LINE_MEMBER(ay3600_control_r);
DECLARE_WRITE_LINE_MEMBER(ay3600_data_ready_w);
diff --git a/src/mame/includes/appoooh.h b/src/mame/includes/appoooh.h
index 3abda1cc9ac..b0f75867c3c 100644
--- a/src/mame/includes/appoooh.h
+++ b/src/mame/includes/appoooh.h
@@ -44,8 +44,8 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(appoooh);
- DECLARE_PALETTE_INIT(robowres);
+ void appoooh_palette(palette_device &palette) const;
+ void robowres_palette(palette_device &palette) const;
uint32_t screen_update_appoooh(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_robowres(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
diff --git a/src/mame/includes/aquarius.h b/src/mame/includes/aquarius.h
index 5dc3ba748a7..de6f01b28f6 100644
--- a/src/mame/includes/aquarius.h
+++ b/src/mame/includes/aquarius.h
@@ -95,7 +95,7 @@ private:
DECLARE_WRITE8_MEMBER(scrambler_w);
DECLARE_READ8_MEMBER(cartridge_r);
TILE_GET_INFO_MEMBER(aquarius_gettileinfo);
- DECLARE_PALETTE_INIT(aquarius);
+ void aquarius_palette(palette_device &palette) const;
uint32_t screen_update_aquarius(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void aquarius_io(address_map &map);
void aquarius_mem(address_map &map);
diff --git a/src/mame/includes/arabian.h b/src/mame/includes/arabian.h
index 7d0ea574aa9..ef19859531b 100644
--- a/src/mame/includes/arabian.h
+++ b/src/mame/includes/arabian.h
@@ -53,7 +53,7 @@ private:
DECLARE_WRITE8_MEMBER(arabian_videoram_w);
DECLARE_WRITE8_MEMBER(ay8910_porta_w);
DECLARE_WRITE8_MEMBER(ay8910_portb_w);
- DECLARE_PALETTE_INIT(arabian);
+ void arabian_palette(palette_device &palette) const;
uint32_t screen_update_arabian(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void blit_area(uint8_t plane, uint16_t src, uint8_t x, uint8_t y, uint8_t sx, uint8_t sy);
diff --git a/src/mame/includes/arcadia.h b/src/mame/includes/arcadia.h
index 07591487d8c..cf54c0e6a13 100644
--- a/src/mame/includes/arcadia.h
+++ b/src/mame/includes/arcadia.h
@@ -62,7 +62,7 @@ protected:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(arcadia);
+ void palette_init(palette_device &palette) const;
uint32_t screen_update_arcadia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(video_line);
void arcadia_mem(address_map &map);
diff --git a/src/mame/includes/armedf.h b/src/mame/includes/armedf.h
index 60df76e44b4..53c8c4fd412 100644
--- a/src/mame/includes/armedf.h
+++ b/src/mame/includes/armedf.h
@@ -25,7 +25,7 @@ public:
m_spr_pal_clut(*this, "spr_pal_clut"),
m_fg_videoram(*this, "fg_videoram"),
m_bg_videoram(*this, "bg_videoram")
- { }
+ { }
void init_cclimbr2();
void init_armedf();
@@ -55,7 +55,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
- /* devices */
+ // devices
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_extra;
optional_device<nb1414m4_device> m_nb1414m4;
diff --git a/src/mame/includes/astrocde.h b/src/mame/includes/astrocde.h
index 04ee50cdfb5..9d5d437d627 100644
--- a/src/mame/includes/astrocde.h
+++ b/src/mame/includes/astrocde.h
@@ -140,9 +140,9 @@ public:
void init_gorf();
void init_astrocde();
virtual void video_start() override;
- DECLARE_PALETTE_INIT(astrocde);
+ void astrocade_palette(palette_device &palette) const;
DECLARE_VIDEO_START(profpac);
- DECLARE_PALETTE_INIT(profpac);
+ void profpac_palette(palette_device &palette) const;
uint32_t screen_update_astrocde(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_profpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_callback);
diff --git a/src/mame/includes/atari400.h b/src/mame/includes/atari400.h
index af901207ecf..4dc151c9f5c 100644
--- a/src/mame/includes/atari400.h
+++ b/src/mame/includes/atari400.h
@@ -47,7 +47,7 @@ public:
protected:
virtual void video_start() override;
- DECLARE_PALETTE_INIT(atari);
+ void atari_palette(palette_device &palette) const;
POKEY_INTERRUPT_CB_MEMBER(interrupt_cb);
POKEY_KEYBOARD_CB_MEMBER(a5200_keypads);
diff --git a/src/mame/includes/atarifb.h b/src/mame/includes/atarifb.h
index 6827d9e22fd..bafd63d026b 100644
--- a/src/mame/includes/atarifb.h
+++ b/src/mame/includes/atarifb.h
@@ -58,7 +58,7 @@ public:
TILE_GET_INFO_MEMBER(alpha1_get_tile_info);
TILE_GET_INFO_MEMBER(alpha2_get_tile_info);
TILE_GET_INFO_MEMBER(field_get_tile_info);
- DECLARE_PALETTE_INIT(atarifb);
+ void atarifb_palette(palette_device &palette) const;
uint32_t screen_update_atarifb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_abaseb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_soccer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/atarisy2.h b/src/mame/includes/atarisy2.h
index 0d91b258c0b..f714e366ef2 100644
--- a/src/mame/includes/atarisy2.h
+++ b/src/mame/includes/atarisy2.h
@@ -129,7 +129,7 @@ private:
DECLARE_WRITE16_MEMBER(yscroll_w);
DECLARE_WRITE16_MEMBER(xscroll_w);
DECLARE_WRITE16_MEMBER(spriteram_w);
- DECLARE_PALETTE_DECODER(RRRRGGGGBBBBIIII);
+ static rgb_t RRRRGGGGBBBBIIII(uint32_t raw);
static const atari_motion_objects_config s_mob_config;
void main_map(address_map &map);
diff --git a/src/mame/includes/avigo.h b/src/mame/includes/avigo.h
index e82c5425413..d78d81965d0 100644
--- a/src/mame/includes/avigo.h
+++ b/src/mame/includes/avigo.h
@@ -24,8 +24,6 @@
#include "sound/spkrdev.h"
#include "emupal.h"
-#define AVIGO_NUM_COLOURS 2
-
#define AVIGO_SCREEN_WIDTH 160
#define AVIGO_SCREEN_HEIGHT 240
#define AVIGO_PANEL_HEIGHT 26
@@ -35,30 +33,27 @@ class avigo_state : public driver_device
{
public:
avigo_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_speaker(*this, "speaker"),
- m_uart(*this, "ns16550"),
- m_serport(*this, "serport"),
- m_palette(*this, "palette"),
- m_bankdev1(*this, "bank0"),
- m_bankdev2(*this, "bank1"),
- m_flash1(*this, "flash1"),
- m_nvram(*this, "nvram")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_ram(*this, RAM_TAG)
+ , m_speaker(*this, "speaker")
+ , m_uart(*this, "ns16550")
+ , m_serport(*this, "serport")
+ , m_palette(*this, "palette")
+ , m_bankdev1(*this, "bank0")
+ , m_bankdev2(*this, "bank1")
+ , m_flash1(*this, "flash1")
+ , m_nvram(*this, "nvram")
+ { }
- required_device<cpu_device> m_maincpu;
- required_device<ram_device> m_ram;
- required_device<speaker_sound_device> m_speaker;
- required_device<ns16550_device> m_uart;
- required_device<rs232_port_device> m_serport;
- required_device<palette_device> m_palette;
- required_device<address_map_bank_device> m_bankdev1;
- required_device<address_map_bank_device> m_bankdev2;
- required_device<intelfsh8_device> m_flash1;
- required_shared_ptr<uint8_t> m_nvram;
+ void avigo(machine_config &config);
+ DECLARE_INPUT_CHANGED_MEMBER(pen_irq);
+ DECLARE_INPUT_CHANGED_MEMBER(pen_move_irq);
+ DECLARE_INPUT_CHANGED_MEMBER(kb_irq);
+ DECLARE_INPUT_CHANGED_MEMBER(power_down_irq);
+
+protected:
// defined in drivers/avigo.c
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -83,17 +78,31 @@ public:
DECLARE_WRITE8_MEMBER(speaker_w);
DECLARE_READ8_MEMBER(port_04_r);
- DECLARE_INPUT_CHANGED_MEMBER(pen_irq);
- DECLARE_INPUT_CHANGED_MEMBER(pen_move_irq);
- DECLARE_INPUT_CHANGED_MEMBER(kb_irq);
- DECLARE_INPUT_CHANGED_MEMBER(power_down_irq);
-
// defined in video/avigo.c
virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(vid_memory_r);
DECLARE_WRITE8_MEMBER(vid_memory_w);
+ TIMER_DEVICE_CALLBACK_MEMBER(avigo_scan_timer);
+ TIMER_DEVICE_CALLBACK_MEMBER(avigo_1hz_timer);
+
+ DECLARE_QUICKLOAD_LOAD_MEMBER( avigo);
+ void avigo_banked_map(address_map &map);
+ void avigo_io(address_map &map);
+ void avigo_mem(address_map &map);
+
+ required_device<cpu_device> m_maincpu;
+ required_device<ram_device> m_ram;
+ required_device<speaker_sound_device> m_speaker;
+ required_device<ns16550_device> m_uart;
+ required_device<rs232_port_device> m_serport;
+ required_device<palette_device> m_palette;
+ required_device<address_map_bank_device> m_bankdev1;
+ required_device<address_map_bank_device> m_bankdev2;
+ required_device<intelfsh8_device> m_flash1;
+ required_shared_ptr<uint8_t> m_nvram;
+
// driver state
uint8_t m_key_line;
uint8_t m_irq;
@@ -107,15 +116,6 @@ public:
std::unique_ptr<uint8_t[]> m_video_memory;
uint8_t m_screen_column;
uint8_t m_warm_start;
- DECLARE_PALETTE_INIT(avigo);
- TIMER_DEVICE_CALLBACK_MEMBER(avigo_scan_timer);
- TIMER_DEVICE_CALLBACK_MEMBER(avigo_1hz_timer);
-
- DECLARE_QUICKLOAD_LOAD_MEMBER( avigo);
- void avigo(machine_config &config);
- void avigo_banked_map(address_map &map);
- void avigo_io(address_map &map);
- void avigo_mem(address_map &map);
};
#endif // MAME_INCLUDES_AVIGO_H
diff --git a/src/mame/includes/b2m.h b/src/mame/includes/b2m.h
index 5856ed7c3a5..2b57fd3c2f6 100644
--- a/src/mame/includes/b2m.h
+++ b/src/mame/includes/b2m.h
@@ -43,7 +43,7 @@ public:
DECLARE_READ8_MEMBER(b2m_localmachine_r);
void init_b2m();
- DECLARE_PALETTE_INIT(b2m);
+ void b2m_palette(palette_device &palette) const;
uint32_t screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(b2m_vblank_interrupt);
DECLARE_WRITE_LINE_MEMBER(bm2_pit_out1);
diff --git a/src/mame/includes/bagman.h b/src/mame/includes/bagman.h
index b25cdfb65df..21997a4de33 100644
--- a/src/mame/includes/bagman.h
+++ b/src/mame/includes/bagman.h
@@ -55,7 +55,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(bagman);
+ void bagman_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/bankp.h b/src/mame/includes/bankp.h
index 5f7e9552a5b..9d7569c9ba4 100644
--- a/src/mame/includes/bankp.h
+++ b/src/mame/includes/bankp.h
@@ -49,7 +49,7 @@ public:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(bankp);
+ void bankp_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/baraduke.h b/src/mame/includes/baraduke.h
index 1e7625e0c48..a901186185e 100644
--- a/src/mame/includes/baraduke.h
+++ b/src/mame/includes/baraduke.h
@@ -44,7 +44,7 @@ public:
TILE_GET_INFO_MEMBER(get_tile_info0);
TILE_GET_INFO_MEMBER(get_tile_info1);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(baraduke);
+ void baraduke_palette(palette_device &palette) const;
uint32_t screen_update_baraduke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_baraduke);
void scroll_w(address_space &space, int layer, int offset, int data);
diff --git a/src/mame/includes/bbc.h b/src/mame/includes/bbc.h
index 61f040b1804..a912a651cde 100644
--- a/src/mame/includes/bbc.h
+++ b/src/mame/includes/bbc.h
@@ -141,7 +141,7 @@ public:
DECLARE_VIDEO_START(bbc);
- DECLARE_PALETTE_INIT(bbc);
+ void bbc_colours(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(bbcb_keyscan);
TIMER_CALLBACK_MEMBER(tape_timer_cb);
TIMER_CALLBACK_MEMBER(reset_timer_cb);
diff --git a/src/mame/includes/bionicc.h b/src/mame/includes/bionicc.h
index dd579b24f54..646698f9f82 100644
--- a/src/mame/includes/bionicc.h
+++ b/src/mame/includes/bionicc.h
@@ -50,7 +50,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_DECODER(RRRRGGGGBBBBIIII);
+ static rgb_t RRRRGGGGBBBBIIII(uint32_t raw);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
diff --git a/src/mame/includes/bking.h b/src/mame/includes/bking.h
index 6eaa4675f30..2745ec8de13 100644
--- a/src/mame/includes/bking.h
+++ b/src/mame/includes/bking.h
@@ -92,7 +92,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(bking);
+ void bking_palette(palette_device &palette) const;
DECLARE_MACHINE_START(bking3);
DECLARE_MACHINE_RESET(bking3);
DECLARE_MACHINE_RESET(common);
diff --git a/src/mame/includes/bladestl.h b/src/mame/includes/bladestl.h
index ac46bc44430..44357dde603 100644
--- a/src/mame/includes/bladestl.h
+++ b/src/mame/includes/bladestl.h
@@ -45,7 +45,7 @@ public:
DECLARE_WRITE8_MEMBER(bladestl_port_B_w);
DECLARE_READ8_MEMBER(bladestl_speech_busy_r);
DECLARE_WRITE8_MEMBER(bladestl_speech_ctrl_w);
- DECLARE_PALETTE_INIT(bladestl);
+ void bladestl_palette(palette_device &palette) const;
uint32_t screen_update_bladestl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(bladestl_scanline);
K007342_CALLBACK_MEMBER(bladestl_tile_callback);
diff --git a/src/mame/includes/blueprnt.h b/src/mame/includes/blueprnt.h
index 88a1ae9c307..ac5b38783d0 100644
--- a/src/mame/includes/blueprnt.h
+++ b/src/mame/includes/blueprnt.h
@@ -59,7 +59,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_VIDEO_START(blueprnt);
- DECLARE_PALETTE_INIT(blueprnt);
+ void blueprnt_palette(palette_device &palette) const;
uint32_t screen_update_blueprnt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void blueprnt(machine_config &config);
diff --git a/src/mame/includes/bogeyman.h b/src/mame/includes/bogeyman.h
index 871eae6f92b..cbbaafc6c32 100644
--- a/src/mame/includes/bogeyman.h
+++ b/src/mame/includes/bogeyman.h
@@ -72,7 +72,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(bogeyman);
+ void bogeyman_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
void bogeyman_map(address_map &map);
diff --git a/src/mame/includes/bosco.h b/src/mame/includes/bosco.h
index fe5473e85f7..81f1d940a08 100644
--- a/src/mame/includes/bosco.h
+++ b/src/mame/includes/bosco.h
@@ -31,7 +31,7 @@ public:
TILE_GET_INFO_MEMBER(bg_get_tile_info);
TILE_GET_INFO_MEMBER(fg_get_tile_info);
DECLARE_VIDEO_START(bosco);
- DECLARE_PALETTE_INIT(bosco);
+ void bosco_palette(palette_device &palette) const;
uint32_t screen_update_bosco(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_bosco);
diff --git a/src/mame/includes/brkthru.h b/src/mame/includes/brkthru.h
index bc5dc80e5d3..1db10b0652f 100644
--- a/src/mame/includes/brkthru.h
+++ b/src/mame/includes/brkthru.h
@@ -60,7 +60,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(brkthru);
+ void brkthru_palette(palette_device &palette) const;
uint32_t screen_update_brkthru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int prio );
diff --git a/src/mame/includes/bsktball.h b/src/mame/includes/bsktball.h
index 497e83e4b4b..5ae3792bd25 100644
--- a/src/mame/includes/bsktball.h
+++ b/src/mame/includes/bsktball.h
@@ -43,7 +43,7 @@ protected:
DECLARE_READ8_MEMBER(bsktball_in0_r);
DECLARE_WRITE8_MEMBER(bsktball_videoram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(bsktball);
+ void bsktball_palette(palette_device &palette) const;
uint32_t screen_update_bsktball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(bsktball_scanline);
DECLARE_WRITE8_MEMBER(bsktball_bounce_w);
diff --git a/src/mame/includes/btime.h b/src/mame/includes/btime.h
index 699a3203a02..de9365839bd 100644
--- a/src/mame/includes/btime.h
+++ b/src/mame/includes/btime.h
@@ -115,9 +115,9 @@ public:
void init_lnc();
DECLARE_MACHINE_START(btime);
DECLARE_MACHINE_RESET(btime);
- DECLARE_PALETTE_INIT(btime);
+ void btime_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(lnc);
- DECLARE_PALETTE_INIT(lnc);
+ void lnc_palette(palette_device &palette) const;
DECLARE_MACHINE_START(mmonkey);
DECLARE_MACHINE_RESET(mmonkey);
DECLARE_VIDEO_START(bnj);
diff --git a/src/mame/includes/buggychl.h b/src/mame/includes/buggychl.h
index 018feb73fd9..e4f4490b965 100644
--- a/src/mame/includes/buggychl.h
+++ b/src/mame/includes/buggychl.h
@@ -87,7 +87,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(buggychl);
+ void buggychl_palette(palette_device &palette) const;
uint32_t screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_CUSTOM_INPUT_MEMBER( pedal_in_r );
diff --git a/src/mame/includes/busicom.h b/src/mame/includes/busicom.h
index 48da84f18b6..2a61b4d42f5 100644
--- a/src/mame/includes/busicom.h
+++ b/src/mame/includes/busicom.h
@@ -40,7 +40,7 @@ private:
DECLARE_WRITE8_MEMBER(printer_w);
DECLARE_WRITE8_MEMBER(status_w);
DECLARE_WRITE8_MEMBER(printer_ctrl_w);
- DECLARE_PALETTE_INIT(busicom);
+ void busicom_palette(palette_device &palette) const;
uint32_t screen_update_busicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(timer_callback);
uint8_t get_bit_selected(uint32_t val,int num);
diff --git a/src/mame/includes/bw2.h b/src/mame/includes/bw2.h
index 0c1202a6a94..31ef65e4ae6 100644
--- a/src/mame/includes/bw2.h
+++ b/src/mame/includes/bw2.h
@@ -89,7 +89,7 @@ public:
// video state
optional_shared_ptr<uint8_t> m_video_ram;
- DECLARE_PALETTE_INIT(bw2);
+ void bw2_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
int m_centronics_busy;
diff --git a/src/mame/includes/calomega.h b/src/mame/includes/calomega.h
index aaf7c73614e..20a45e13d16 100644
--- a/src/mame/includes/calomega.h
+++ b/src/mame/includes/calomega.h
@@ -71,7 +71,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(update_aciabaud_scale);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
uint32_t screen_update_calomega(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(calomega);
+ void calomega_palette(palette_device &palette) const;
void s903mod_map(address_map &map);
void sys903_map(address_map &map);
diff --git a/src/mame/includes/canyon.h b/src/mame/includes/canyon.h
index 87a0a1f3d9f..09553046039 100644
--- a/src/mame/includes/canyon.h
+++ b/src/mame/includes/canyon.h
@@ -48,7 +48,7 @@ protected:
DECLARE_WRITE8_MEMBER(output_latch_w);
DECLARE_WRITE8_MEMBER(canyon_videoram_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(canyon);
+ void canyon_palette(palette_device &palette) const;
uint32_t screen_update_canyon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(canyon_motor_w);
DECLARE_WRITE8_MEMBER(canyon_explode_w);
diff --git a/src/mame/includes/carpolo.h b/src/mame/includes/carpolo.h
index 93bb229ca2c..fabf1bac653 100644
--- a/src/mame/includes/carpolo.h
+++ b/src/mame/includes/carpolo.h
@@ -43,7 +43,6 @@ public:
, m_palette(*this, "palette")
, m_alpharam(*this, "alpharam")
, m_spriteram(*this, "spriteram")
- , m_proms(*this, "proms")
, m_user1(*this, "user1")
, m_dial(*this, "DIAL%u", 0U)
, m_in(*this, "IN%u", 0U)
@@ -95,7 +94,6 @@ private:
required_device<palette_device> m_palette;
required_shared_ptr<uint8_t> m_alpharam;
required_shared_ptr<uint8_t> m_spriteram;
- required_memory_region m_proms;
required_memory_region m_user1;
required_ioport_array<4> m_dial;
required_ioport_array<3> m_in;
@@ -123,7 +121,7 @@ private:
DECLARE_WRITE8_MEMBER(car_ball_interrupt_clear_w);
DECLARE_WRITE8_MEMBER(car_border_interrupt_clear_w);
DECLARE_WRITE8_MEMBER(timer_interrupt_clear_w);
- DECLARE_PALETTE_INIT(carpolo);
+ void carpolo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
DECLARE_WRITE_LINE_MEMBER(coin1_interrupt_clear_w);
diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h
index 5981b6d23a7..6b11383cdf3 100644
--- a/src/mame/includes/cave.h
+++ b/src/mame/includes/cave.h
@@ -145,13 +145,13 @@ private:
DECLARE_VIDEO_START(cave_3_layers);
DECLARE_VIDEO_START(cave_4_layers);
DECLARE_VIDEO_START(sailormn_3_layers);
- void palette_init_cave(palette_device &palette);
- void palette_init_dfeveron(palette_device &palette);
- void palette_init_korokoro(palette_device &palette);
- void palette_init_mazinger(palette_device &palette);
- void palette_init_pwrinst2(palette_device &palette);
- void palette_init_sailormn(palette_device &palette);
- void palette_init_ppsatan(palette_device &palette);
+ void cave_palette(palette_device &palette);
+ void dfeveron_palette(palette_device &palette);
+ void korokoro_palette(palette_device &palette);
+ void mazinger_palette(palette_device &palette);
+ void pwrinst2_palette(palette_device &palette);
+ void sailormn_palette(palette_device &palette);
+ void ppsatan_palette(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
uint32_t screen_update_ppsatan_core (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int chip);
uint32_t screen_update_ppsatan_top (screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/cclimber.h b/src/mame/includes/cclimber.h
index d520d79ed90..63689b3d5b9 100644
--- a/src/mame/includes/cclimber.h
+++ b/src/mame/includes/cclimber.h
@@ -90,12 +90,12 @@ public:
void init_dking();
void init_rpatrol();
DECLARE_VIDEO_START(cclimber);
- DECLARE_PALETTE_INIT(cclimber);
+ void cclimber_palette(palette_device &palette) const;
DECLARE_VIDEO_START(swimmer);
- DECLARE_PALETTE_INIT(swimmer);
- DECLARE_PALETTE_INIT(yamato);
+ void swimmer_palette(palette_device &palette) const;
+ void yamato_palette(palette_device &palette) const;
DECLARE_VIDEO_START(toprollr);
- DECLARE_PALETTE_INIT(toprollr);
+ void toprollr_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(cclimber_get_pf_tile_info);
TILE_GET_INFO_MEMBER(swimmer_get_pf_tile_info);
diff --git a/src/mame/includes/centiped.h b/src/mame/includes/centiped.h
index 20b52e065ee..d5cd85fd4b8 100644
--- a/src/mame/includes/centiped.h
+++ b/src/mame/includes/centiped.h
@@ -125,7 +125,7 @@ private:
DECLARE_MACHINE_RESET(magworm);
DECLARE_VIDEO_START(milliped);
DECLARE_VIDEO_START(warlords);
- DECLARE_PALETTE_INIT(warlords);
+ void warlords_palette(palette_device &palette) const;
uint32_t screen_update_centiped(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_bullsdrt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_milliped(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/cgc7900.h b/src/mame/includes/cgc7900.h
index a1237bf9c5f..31468f20fa2 100644
--- a/src/mame/includes/cgc7900.h
+++ b/src/mame/includes/cgc7900.h
@@ -81,7 +81,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(cgc7900);
+ void cgc7900_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_READ16_MEMBER( keyboard_r );
diff --git a/src/mame/includes/chaknpop.h b/src/mame/includes/chaknpop.h
index dc09ae584ed..76c38a87345 100644
--- a/src/mame/includes/chaknpop.h
+++ b/src/mame/includes/chaknpop.h
@@ -57,7 +57,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(chaknpop);
+ void chaknpop_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void tx_tilemap_mark_all_dirty();
diff --git a/src/mame/includes/champbas.h b/src/mame/includes/champbas.h
index 8f0af3d570c..cec1f2fa6a9 100644
--- a/src/mame/includes/champbas.h
+++ b/src/mame/includes/champbas.h
@@ -62,7 +62,7 @@ protected:
DECLARE_WRITE_LINE_MEMBER(palette_bank_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- DECLARE_PALETTE_INIT(champbas);
+ void champbas_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(champbas_get_bg_tile_info);
uint32_t screen_update_champbas(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -118,7 +118,7 @@ public:
protected:
TIMER_DEVICE_CALLBACK_MEMBER(exctsccr_sound_irq);
- DECLARE_PALETTE_INIT(exctsccr);
+ void exctsccr_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(exctsccr_get_bg_tile_info);
uint32_t screen_update_exctsccr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/channelf.h b/src/mame/includes/channelf.h
index e603d5be966..d28b2dcb026 100644
--- a/src/mame/includes/channelf.h
+++ b/src/mame/includes/channelf.h
@@ -45,7 +45,7 @@ public:
uint8_t port_read_with_latch(uint8_t ext, uint8_t latch_state);
virtual void video_start() override;
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(channelf);
+ void channelf_palette(palette_device &palette) const;
uint32_t screen_update_channelf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<channelf_sound_device> m_custom;
diff --git a/src/mame/includes/cheekyms.h b/src/mame/includes/cheekyms.h
index 7ab54184d3e..47c83df6ed3 100644
--- a/src/mame/includes/cheekyms.h
+++ b/src/mame/includes/cheekyms.h
@@ -47,7 +47,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(cheekyms);
+ void cheekyms_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
diff --git a/src/mame/includes/circusc.h b/src/mame/includes/circusc.h
index 6b20e5ec7e9..ca07104ff9d 100644
--- a/src/mame/includes/circusc.h
+++ b/src/mame/includes/circusc.h
@@ -73,7 +73,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(circusc);
+ void circusc_palette(palette_device &palette) const;
uint32_t screen_update_circusc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/clshroad.h b/src/mame/includes/clshroad.h
index 8099fbbaee3..f80f05f4d67 100644
--- a/src/mame/includes/clshroad.h
+++ b/src/mame/includes/clshroad.h
@@ -55,9 +55,9 @@ public:
void init_firebatl();
virtual void machine_reset() override;
DECLARE_VIDEO_START(firebatl);
- DECLARE_PALETTE_INIT(firebatl);
+ void firebatl_palette(palette_device &palette) const;
DECLARE_VIDEO_START(clshroad);
- DECLARE_PALETTE_INIT(clshroad);
+ void clshroad_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/combatsc.h b/src/mame/includes/combatsc.h
index a20e21756e4..798da2fd520 100644
--- a/src/mame/includes/combatsc.h
+++ b/src/mame/includes/combatsc.h
@@ -111,10 +111,10 @@ public:
virtual void machine_reset() override;
DECLARE_MACHINE_START(combatsc);
DECLARE_VIDEO_START(combatsc);
- DECLARE_PALETTE_INIT(combatsc);
+ void combatsc_palette(palette_device &palette) const;
DECLARE_MACHINE_START(combatscb);
DECLARE_VIDEO_START(combatscb);
- DECLARE_PALETTE_INIT(combatscb);
+ void combatscb_palette(palette_device &palette) const;
uint32_t screen_update_combatsc(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_combatscb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, const uint8_t *source, int circuit, bitmap_ind8 &priority_bitmap, uint32_t pri_mask );
diff --git a/src/mame/includes/compgolf.h b/src/mame/includes/compgolf.h
index 14e46d4f9fb..0c59bb2418a 100644
--- a/src/mame/includes/compgolf.h
+++ b/src/mame/includes/compgolf.h
@@ -52,7 +52,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(compgolf);
+ void compgolf_palette(palette_device &palette) const;
uint32_t screen_update_compgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void compgolf_expand_bg();
diff --git a/src/mame/includes/contra.h b/src/mame/includes/contra.h
index 6441715a7ee..1f6588bec56 100644
--- a/src/mame/includes/contra.h
+++ b/src/mame/includes/contra.h
@@ -78,7 +78,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(contra);
+ void contra_palette(palette_device &palette) const;
uint32_t screen_update_contra(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(contra_interrupt);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, int bank );
diff --git a/src/mame/includes/cop01.h b/src/mame/includes/cop01.h
index ff93f80f615..ddd5f3acf22 100644
--- a/src/mame/includes/cop01.h
+++ b/src/mame/includes/cop01.h
@@ -68,7 +68,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(cop01);
+ void cop01_palette(palette_device &palette) const;
uint32_t screen_update_cop01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void cop01(machine_config &config);
diff --git a/src/mame/includes/cosmic.h b/src/mame/includes/cosmic.h
index 074b788c4c6..9f19c85b4c7 100644
--- a/src/mame/includes/cosmic.h
+++ b/src/mame/includes/cosmic.h
@@ -93,11 +93,11 @@ public:
DECLARE_MACHINE_START(cosmic);
DECLARE_MACHINE_RESET(cosmic);
DECLARE_MACHINE_RESET(cosmicg);
- DECLARE_PALETTE_INIT(cosmicg);
- DECLARE_PALETTE_INIT(panic);
- DECLARE_PALETTE_INIT(cosmica);
- DECLARE_PALETTE_INIT(magspot);
- DECLARE_PALETTE_INIT(nomnlnd);
+ void panic_palette(palette_device &palette);
+ void cosmica_palette(palette_device &palette);
+ void cosmicg_palette(palette_device &palette);
+ void magspot_palette(palette_device &palette);
+ void nomnlnd_palette(palette_device &palette);
uint32_t screen_update_cosmicg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_panic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cosmica(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/crbaloon.h b/src/mame/includes/crbaloon.h
index 3a2c1024499..dac1ac17fc0 100644
--- a/src/mame/includes/crbaloon.h
+++ b/src/mame/includes/crbaloon.h
@@ -54,7 +54,7 @@ public:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(crbaloon);
+ void crbaloon_palette(palette_device &palette) const;
uint32_t screen_update_crbaloon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vblank_irq);
DECLARE_WRITE8_MEMBER(crbaloon_audio_set_music_freq);
diff --git a/src/mame/includes/crgolf.h b/src/mame/includes/crgolf.h
index f2898e7e2c5..34f2ea93be2 100644
--- a/src/mame/includes/crgolf.h
+++ b/src/mame/includes/crgolf.h
@@ -73,8 +73,8 @@ public:
void init_crgolfhi();
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(crgolf);
- DECLARE_PALETTE_INIT(mastrglf);
+ void crgolf_palette(palette_device &palette) const;
+ void mastrglf_palette(palette_device &palette) const;
uint32_t screen_update_crgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void get_pens( pen_t *pens );
DECLARE_WRITE_LINE_MEMBER(vck_callback);
diff --git a/src/mame/includes/cvs.h b/src/mame/includes/cvs.h
index 5674c4d477f..c4eba96d595 100644
--- a/src/mame/includes/cvs.h
+++ b/src/mame/includes/cvs.h
@@ -91,7 +91,7 @@ protected:
DECLARE_WRITE8_MEMBER(cvs_tms5110_ctl_w);
DECLARE_WRITE8_MEMBER(cvs_tms5110_pdc_w);
DECLARE_VIDEO_START(cvs);
- DECLARE_PALETTE_INIT(cvs);
+ void cvs_palette(palette_device &palette) const;
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);
diff --git a/src/mame/includes/dai.h b/src/mame/includes/dai.h
index 85efb163cb0..d0f55b46e22 100644
--- a/src/mame/includes/dai.h
+++ b/src/mame/includes/dai.h
@@ -65,24 +65,21 @@ private:
DECLARE_WRITE8_MEMBER(dai_pit_w);
DECLARE_READ8_MEMBER(dai_keyboard_r);
DECLARE_WRITE8_MEMBER(dai_keyboard_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(dai);
+ void dai_palette(palette_device &palette) const;
uint32_t screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void dai_update_memory(int dai_rom_bank);
IRQ_CALLBACK_MEMBER(int_ack);
void dai_io(address_map &map);
void dai_mem(address_map &map);
+
+ static const rgb_t s_palette[16];
+
protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
-/*----------- defined in video/dai.c -----------*/
-
-extern const unsigned char dai_palette[16*3];
-
-
#endif // MAME_INCLUDES_DAI_H
diff --git a/src/mame/includes/darkmist.h b/src/mame/includes/darkmist.h
index 554ba53fa98..44335380090 100644
--- a/src/mame/includes/darkmist.h
+++ b/src/mame/includes/darkmist.h
@@ -68,7 +68,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(darkmist);
+ void darkmist_palette(palette_device &palette) const;
bitmap_ind16 m_temp_bitmap;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/dcheese.h b/src/mame/includes/dcheese.h
index 20a386124e2..14db4da22a0 100644
--- a/src/mame/includes/dcheese.h
+++ b/src/mame/includes/dcheese.h
@@ -83,7 +83,7 @@ private:
DECLARE_WRITE16_MEMBER(blitter_vidparam_w);
DECLARE_WRITE16_MEMBER(blitter_unknown_w);
DECLARE_READ16_MEMBER(blitter_vidparam_r);
- DECLARE_PALETTE_INIT(dcheese);
+ void dcheese_palette(palette_device &palette) const;
uint32_t screen_update_dcheese(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(dcheese_vblank);
void dcheese_signal_irq(int which);
diff --git a/src/mame/includes/dday.h b/src/mame/includes/dday.h
index f344ebaa366..21be46f3479 100644
--- a/src/mame/includes/dday.h
+++ b/src/mame/includes/dday.h
@@ -76,7 +76,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_text_tile_info);
TILE_GET_INFO_MEMBER(get_sl_tile_info);
- DECLARE_PALETTE_INIT(dday);
+ void dday_palette(palette_device &palette) const;
uint32_t screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(countdown_timer_callback);
void start_countdown_timer();
diff --git a/src/mame/includes/ddribble.h b/src/mame/includes/ddribble.h
index d65c35b56b6..c6067a32389 100644
--- a/src/mame/includes/ddribble.h
+++ b/src/mame/includes/ddribble.h
@@ -82,7 +82,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(ddribble);
+ void ddribble_palette(palette_device &palette) const;
uint32_t screen_update_ddribble(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* source, int lenght, int gfxset, int flipscreen );
diff --git a/src/mame/includes/dec0.h b/src/mame/includes/dec0.h
index 00eaf0fdc7c..4b43a69a6ac 100644
--- a/src/mame/includes/dec0.h
+++ b/src/mame/includes/dec0.h
@@ -5,6 +5,7 @@
#pragma once
+#include "machine/74157.h"
#include "cpu/h6280/h6280.h"
#include "cpu/mcs51/mcs51.h"
#include "machine/74157.h"
diff --git a/src/mame/includes/decocass.h b/src/mame/includes/decocass.h
index c38ae9b1442..4db894b4a30 100644
--- a/src/mame/includes/decocass.h
+++ b/src/mame/includes/decocass.h
@@ -142,7 +142,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_r_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(decocass);
+ void decocass_palette(palette_device &palette) const;
uint32_t screen_update_decocass(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(decocass_coin_counter_w);
diff --git a/src/mame/includes/dgn_beta.h b/src/mame/includes/dgn_beta.h
index d3aaef6eaa0..46d97a465e1 100644
--- a/src/mame/includes/dgn_beta.h
+++ b/src/mame/includes/dgn_beta.h
@@ -193,7 +193,7 @@ private:
int m_DrawInterlace;
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(dgn);
+ void dgn_beta_palette(palette_device &palette) const;
DECLARE_READ8_MEMBER(d_pia0_pa_r);
DECLARE_WRITE8_MEMBER(d_pia0_pa_w);
diff --git a/src/mame/includes/digdug.h b/src/mame/includes/digdug.h
index 1e3ce6f76c8..40a5d85416b 100644
--- a/src/mame/includes/digdug.h
+++ b/src/mame/includes/digdug.h
@@ -36,7 +36,7 @@ private:
TILE_GET_INFO_MEMBER(bg_get_tile_info);
TILE_GET_INFO_MEMBER(tx_get_tile_info);
DECLARE_VIDEO_START(digdug);
- DECLARE_PALETTE_INIT(digdug);
+ void digdug_palette(palette_device &palette) const;
uint32_t screen_update_digdug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(digdug_videoram_w);
diff --git a/src/mame/includes/divebomb.h b/src/mame/includes/divebomb.h
index 0bfc21f00c8..b4bb739fafa 100644
--- a/src/mame/includes/divebomb.h
+++ b/src/mame/includes/divebomb.h
@@ -64,10 +64,10 @@ private:
DECLARE_MACHINE_RESET(divebomb);
DECLARE_MACHINE_START(divebomb);
DECLARE_VIDEO_START(divebomb);
- DECLARE_PALETTE_INIT(divebomb);
+ void divebomb_palette(palette_device &palette) const;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
- void decode_proms(const uint8_t* rgn, int size, int index, bool inv);
+ static void decode_proms(palette_device &palette, const uint8_t* rgn, int size, int index, bool inv);
uint32_t screen_update_divebomb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
K051316_CB_MEMBER(zoom_callback_1);
diff --git a/src/mame/includes/dkong.h b/src/mame/includes/dkong.h
index ed5578a8174..4f77b975fb4 100644
--- a/src/mame/includes/dkong.h
+++ b/src/mame/includes/dkong.h
@@ -299,13 +299,13 @@ private:
DECLARE_MACHINE_RESET(ddk);
DECLARE_VIDEO_START(dkong);
DECLARE_VIDEO_START(dkong_base);
- DECLARE_PALETTE_INIT(dkong2b);
+ void dkong2b_palette(palette_device &palette);
DECLARE_MACHINE_START(dkong3);
- DECLARE_PALETTE_INIT(dkong3);
+ void dkong3_palette(palette_device &palette);
DECLARE_MACHINE_START(radarscp);
- DECLARE_PALETTE_INIT(radarscp);
+ void radarscp_palette(palette_device &palette);
DECLARE_MACHINE_START(radarscp1);
- DECLARE_PALETTE_INIT(radarscp1);
+ void radarscp1_palette(palette_device &palette);
DECLARE_MACHINE_START(s2650);
DECLARE_MACHINE_RESET(strtheat);
DECLARE_MACHINE_RESET(drakton);
diff --git a/src/mame/includes/docastle.h b/src/mame/includes/docastle.h
index 328c263da4f..890552eb1ea 100644
--- a/src/mame/includes/docastle.h
+++ b/src/mame/includes/docastle.h
@@ -83,7 +83,7 @@ private:
DECLARE_READ8_MEMBER(idsoccer_adpcm_status_r);
DECLARE_WRITE8_MEMBER(idsoccer_adpcm_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(docastle);
+ void docastle_palette(palette_device &palette) const;
DECLARE_VIDEO_START(dorunrun);
uint32_t screen_update_docastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void video_start_common( uint32_t tile_transmask );
diff --git a/src/mame/includes/dogfgt.h b/src/mame/includes/dogfgt.h
index 370b1b34c99..427d5940bf1 100644
--- a/src/mame/includes/dogfgt.h
+++ b/src/mame/includes/dogfgt.h
@@ -78,7 +78,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(dogfgt);
+ void dogfgt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/dragrace.h b/src/mame/includes/dragrace.h
index 2cb8c5cd077..459d36ad141 100644
--- a/src/mame/includes/dragrace.h
+++ b/src/mame/includes/dragrace.h
@@ -56,7 +56,7 @@ private:
DECLARE_READ8_MEMBER(dragrace_steering_r);
DECLARE_READ8_MEMBER(dragrace_scanline_r);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(dragrace);
+ void dragrace_palette(palette_device &palette) const;
uint32_t screen_update_dragrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(dragrace_frame_callback);
void dragrace_update_misc_flags( address_space &space );
diff --git a/src/mame/includes/drgnmst.h b/src/mame/includes/drgnmst.h
index a42ad4eeca7..6ac2260b005 100644
--- a/src/mame/includes/drgnmst.h
+++ b/src/mame/includes/drgnmst.h
@@ -83,9 +83,9 @@ private:
TILEMAP_MAPPER_MEMBER(fg_tilemap_scan_cols);
TILEMAP_MAPPER_MEMBER(md_tilemap_scan_cols);
TILEMAP_MAPPER_MEMBER(bg_tilemap_scan_cols);
- DECLARE_PALETTE_DECODER(drgnmst_IIIIRRRRGGGGBBBB);
+ static rgb_t drgnmst_IIIIRRRRGGGGBBBB(uint32_t raw);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
+ void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
uint8_t drgnmst_asciitohex( uint8_t data );
required_device<cpu_device> m_maincpu;
required_device<pic16c55_device> m_audiocpu;
diff --git a/src/mame/includes/dribling.h b/src/mame/includes/dribling.h
index 1018f149029..0e0c5b1bfd4 100644
--- a/src/mame/includes/dribling.h
+++ b/src/mame/includes/dribling.h
@@ -60,7 +60,7 @@ private:
DECLARE_WRITE8_MEMBER(sound_w);
DECLARE_WRITE8_MEMBER(pb_w);
DECLARE_WRITE8_MEMBER(shr_w);
- DECLARE_PALETTE_INIT(dribling);
+ void dribling_palette(palette_device &palette) const;
uint32_t screen_update_dribling(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(dribling_irq_gen);
void dribling_map(address_map &map);
diff --git a/src/mame/includes/drmicro.h b/src/mame/includes/drmicro.h
index bbf59def64d..229a367d423 100644
--- a/src/mame/includes/drmicro.h
+++ b/src/mame/includes/drmicro.h
@@ -49,7 +49,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(drmicro);
+ void drmicro_palette(palette_device &palette) const;
uint32_t screen_update_drmicro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(drmicro_interrupt);
DECLARE_WRITE_LINE_MEMBER(pcm_w);
diff --git a/src/mame/includes/dynax.h b/src/mame/includes/dynax.h
index 2a883ca09c9..f7e9fb1d09b 100644
--- a/src/mame/includes/dynax.h
+++ b/src/mame/includes/dynax.h
@@ -237,7 +237,7 @@ private:
DECLARE_MACHINE_START(hanamai);
DECLARE_MACHINE_START(hjingi);
DECLARE_VIDEO_START(hanamai);
- DECLARE_PALETTE_INIT(sprtmtch);
+ void sprtmtch_palette(palette_device &palette) const;
DECLARE_VIDEO_START(sprtmtch);
DECLARE_MACHINE_START(jantouki);
DECLARE_VIDEO_START(jantouki);
@@ -245,7 +245,7 @@ private:
DECLARE_VIDEO_START(mjembase);
DECLARE_VIDEO_START(mjdialq2);
DECLARE_VIDEO_START(mcnpshnt);
- DECLARE_PALETTE_INIT(janyuki);
+ void janyuki_palette(palette_device &palette) const;
DECLARE_VIDEO_START(neruton);
//int blitter_drawgfx( int layer, int mask, memory_region *gfx, int src, int pen, int x, int y, int wrap, int flags );
diff --git a/src/mame/includes/efdt.h b/src/mame/includes/efdt.h
index 137465917ad..1993699377a 100644
--- a/src/mame/includes/efdt.h
+++ b/src/mame/includes/efdt.h
@@ -54,7 +54,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info_0);
TILE_GET_INFO_MEMBER(get_tile_info_1);
- DECLARE_PALETTE_INIT(efdt);
+ void efdt_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_nmi_w);
DECLARE_WRITE_LINE_MEMBER(nmi_clear_w);
diff --git a/src/mame/includes/electron.h b/src/mame/includes/electron.h
index b90e27c61f9..9dd9bb30eca 100644
--- a/src/mame/includes/electron.h
+++ b/src/mame/includes/electron.h
@@ -9,10 +9,11 @@
* Driver by Wilbert Pol
*
****************************************************************************/
-
#ifndef MAME_INCLUDES_ELECTRON_H
#define MAME_INCLUDES_ELECTRON_H
+#pragma once
+
#include "machine/ram.h"
#include "imagedev/cassette.h"
#include "sound/beep.h"
@@ -79,7 +80,7 @@ private:
DECLARE_READ8_MEMBER(electron_sheila_r);
DECLARE_WRITE8_MEMBER(electron_sheila_w);
- DECLARE_PALETTE_INIT(electron);
+ void electron_colours(palette_device &palette) const;
uint32_t screen_update_electron(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(electron_tape_timer_handler);
TIMER_CALLBACK_MEMBER(setup_beep);
diff --git a/src/mame/includes/epos.h b/src/mame/includes/epos.h
index 84b39ccc23f..f4aeefe1dd5 100644
--- a/src/mame/includes/epos.h
+++ b/src/mame/includes/epos.h
@@ -43,9 +43,9 @@ private:
DECLARE_WRITE8_MEMBER(dealer_pal_w);
DECLARE_MACHINE_START(epos);
DECLARE_MACHINE_START(dealer);
- DECLARE_PALETTE_INIT(epos);
+ void epos_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- void set_pal_color( uint8_t offset, uint8_t data );
+ static void set_pal_color(palette_device &palette, uint8_t offset, uint8_t data); // TODO: convert to an RGB converter and set_format
void dealer_io_map(address_map &map);
void dealer_map(address_map &map);
void epos_io_map(address_map &map);
diff --git a/src/mame/includes/equites.h b/src/mame/includes/equites.h
index bc0c8c8b08b..7638e32aa25 100644
--- a/src/mame/includes/equites.h
+++ b/src/mame/includes/equites.h
@@ -114,7 +114,7 @@ public:
TILE_GET_INFO_MEMBER(equites_fg_info);
TILE_GET_INFO_MEMBER(equites_bg_info);
DECLARE_VIDEO_START(equites);
- DECLARE_PALETTE_INIT(equites);
+ void equites_palette(palette_device &palette) const;
uint32_t screen_update_equites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(equites_8155_timer_pulse);
TIMER_CALLBACK_MEMBER(equites_frq_adjuster_callback);
@@ -171,7 +171,7 @@ protected:
TILE_GET_INFO_MEMBER(splndrbt_fg_info);
TILE_GET_INFO_MEMBER(splndrbt_bg_info);
DECLARE_VIDEO_START(splndrbt);
- DECLARE_PALETTE_INIT(splndrbt);
+ void splndrbt_palette(palette_device &palette) const;
uint32_t screen_update_splndrbt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(splndrbt_scanline);
void splndrbt_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/espial.h b/src/mame/includes/espial.h
index adc0b3f453c..0e04ab984dd 100644
--- a/src/mame/includes/espial.h
+++ b/src/mame/includes/espial.h
@@ -74,7 +74,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(espial);
+ void espial_palette(palette_device &palette) const;
DECLARE_VIDEO_START(netwars);
uint32_t screen_update_espial(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(espial_sound_nmi_gen);
diff --git a/src/mame/includes/exedexes.h b/src/mame/includes/exedexes.h
index 0597ffd7c04..f736798858c 100644
--- a/src/mame/includes/exedexes.h
+++ b/src/mame/includes/exedexes.h
@@ -62,7 +62,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(exedexes);
+ void exedexes_palette(palette_device &palette) const;
uint32_t screen_update_exedexes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(exedexes_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, int priority );
diff --git a/src/mame/includes/exerion.h b/src/mame/includes/exerion.h
index a22cd9628d2..e5547146658 100644
--- a/src/mame/includes/exerion.h
+++ b/src/mame/includes/exerion.h
@@ -85,7 +85,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(exerion);
+ void exerion_palette(palette_device &palette) const;
uint32_t screen_update_exerion(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect);
void main_map(address_map &map);
diff --git a/src/mame/includes/exterm.h b/src/mame/includes/exterm.h
index c096fc20f69..15e736edc50 100644
--- a/src/mame/includes/exterm.h
+++ b/src/mame/includes/exterm.h
@@ -68,7 +68,7 @@ private:
DECLARE_READ8_MEMBER(sound_nmi_to_slave_r);
DECLARE_WRITE8_MEMBER(sound_control_w);
DECLARE_WRITE8_MEMBER(ym2151_data_latch_w);
- DECLARE_PALETTE_INIT(exterm);
+ void exterm_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(master_sound_nmi_callback);
TMS340X0_SCANLINE_IND16_CB_MEMBER(scanline_update);
TMS340X0_TO_SHIFTREG_CB_MEMBER(to_shiftreg_master);
diff --git a/src/mame/includes/fastfred.h b/src/mame/includes/fastfred.h
index 9bfd39d5e5e..8e62cd2cbce 100644
--- a/src/mame/includes/fastfred.h
+++ b/src/mame/includes/fastfred.h
@@ -91,7 +91,7 @@ private:
INTERRUPT_GEN_MEMBER(sound_timer_irq);
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(fastfred);
+ void fastfred_palette(palette_device &palette) const;
DECLARE_MACHINE_START(imago);
DECLARE_VIDEO_START(fastfred);
DECLARE_VIDEO_START(imago);
diff --git a/src/mame/includes/fastlane.h b/src/mame/includes/fastlane.h
index 09b0e033aaf..3772b09035f 100644
--- a/src/mame/includes/fastlane.h
+++ b/src/mame/includes/fastlane.h
@@ -72,7 +72,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info1);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(fastlane);
+ void fastlane_palette(palette_device &palette) const;
uint32_t screen_update_fastlane(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(fastlane_scanline);
DECLARE_WRITE8_MEMBER(volume_callback0);
diff --git a/src/mame/includes/fcombat.h b/src/mame/includes/fcombat.h
index f6c5e443483..17ed6499ce4 100644
--- a/src/mame/includes/fcombat.h
+++ b/src/mame/includes/fcombat.h
@@ -85,7 +85,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(fcombat);
+ void fcombat_palette(palette_device &palette) const;
uint32_t screen_update_fcombat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void audio_map(address_map &map);
void main_map(address_map &map);
diff --git a/src/mame/includes/fgoal.h b/src/mame/includes/fgoal.h
index d46689acd77..5dd1ab62fef 100644
--- a/src/mame/includes/fgoal.h
+++ b/src/mame/includes/fgoal.h
@@ -79,7 +79,7 @@ private:
TIMER_CALLBACK_MEMBER(interrupt_callback);
- DECLARE_PALETTE_INIT(fgoal);
+ void fgoal_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
static int intensity(int bits);
diff --git a/src/mame/includes/finalizr.h b/src/mame/includes/finalizr.h
index 7c67ae3c466..8124ba3af56 100644
--- a/src/mame/includes/finalizr.h
+++ b/src/mame/includes/finalizr.h
@@ -73,7 +73,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(finalizr);
+ void finalizr_palette(palette_device &palette) const;
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_finalizr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(finalizr_scanline);
diff --git a/src/mame/includes/firetrap.h b/src/mame/includes/firetrap.h
index 4cdd2fa47d9..fcdaacaa3ab 100644
--- a/src/mame/includes/firetrap.h
+++ b/src/mame/includes/firetrap.h
@@ -97,7 +97,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(firetrap);
+ void firetrap_palette(palette_device &palette) const;
uint32_t screen_update_firetrap(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(firetrap_irq);
inline void get_bg_tile_info(tile_data &tileinfo, int tile_index, uint8_t *bgvideoram, int gfx_region);
diff --git a/src/mame/includes/firetrk.h b/src/mame/includes/firetrk.h
index 27a6e62b888..958f3068b14 100644
--- a/src/mame/includes/firetrk.h
+++ b/src/mame/includes/firetrk.h
@@ -101,10 +101,10 @@ private:
TILE_GET_INFO_MEMBER(firetrk_get_tile_info2);
TILE_GET_INFO_MEMBER(superbug_get_tile_info2);
TILE_GET_INFO_MEMBER(montecar_get_tile_info2);
- DECLARE_PALETTE_INIT(firetrk);
+ void firetrk_palette(palette_device &palette);
DECLARE_VIDEO_START(superbug);
DECLARE_VIDEO_START(montecar);
- DECLARE_PALETTE_INIT(montecar);
+ void montecar_palette(palette_device &palette);
uint32_t screen_update_firetrk(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_superbug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_montecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/flkatck.h b/src/mame/includes/flkatck.h
index 7e326171f78..f2b8eef0201 100644
--- a/src/mame/includes/flkatck.h
+++ b/src/mame/includes/flkatck.h
@@ -18,8 +18,8 @@
class flkatck_state : public driver_device
{
public:
- flkatck_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ flkatck_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_vram(*this, "vram"),
m_spriteram(*this, "spriteram"),
m_maincpu(*this, "maincpu"),
diff --git a/src/mame/includes/fromance.h b/src/mame/includes/fromance.h
index 108730614a3..732e35a5d7a 100644
--- a/src/mame/includes/fromance.h
+++ b/src/mame/includes/fromance.h
@@ -28,10 +28,10 @@ public:
m_maincpu(*this, "maincpu"),
m_subcpu(*this, "sub"),
m_spriteram(*this, "spriteram"),
+ m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_gga(*this, "gga"),
m_spr_old(*this, "vsystem_spr_old"),
- m_gfxdecode(*this, "gfxdecode"),
m_videoram(*this, "videoram"),
m_sublatch(*this, "sublatch"),
m_msm(*this, "msm"),
@@ -50,10 +50,10 @@ protected:
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_subcpu;
optional_shared_ptr<uint8_t> m_spriteram;
+ required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_device<vsystem_gga_device> m_gga;
optional_device<vsystem_spr2_device> m_spr_old; // only used by pipe dream, split this state up and clean things...
- required_device<gfxdecode_device> m_gfxdecode;
DECLARE_WRITE8_MEMBER(fromance_gfxreg_w);
DECLARE_READ8_MEMBER(fromance_videoram_r);
diff --git a/src/mame/includes/funkybee.h b/src/mame/includes/funkybee.h
index 83426afc323..d650e58ea71 100644
--- a/src/mame/includes/funkybee.h
+++ b/src/mame/includes/funkybee.h
@@ -44,7 +44,7 @@ private:
TILEMAP_MAPPER_MEMBER(funkybee_tilemap_scan);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(funkybee);
+ void funkybee_palette(palette_device &palette) const;
uint32_t screen_update_funkybee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void draw_columns( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/funworld.h b/src/mame/includes/funworld.h
index 0cdcb89d2a6..3a69f8becae 100644
--- a/src/mame/includes/funworld.h
+++ b/src/mame/includes/funworld.h
@@ -12,10 +12,10 @@ class funworld_state : public driver_device
public:
funworld_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
+ m_gfxdecode(*this, "gfxdecode"),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_maincpu(*this, "maincpu"),
- m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_lamps(*this, "lamp%u", 0U)
{ }
@@ -24,19 +24,14 @@ public:
void royalcd2(machine_config &config);
void fw1stpal(machine_config &config);
void fw2ndpal(machine_config &config);
- void chinatow(machine_config &config);
- void magicrd2(machine_config &config);
- void fw_brick_1(machine_config &config);
- void fw_brick_2(machine_config &config);
void saloon(machine_config &config);
void cuoreuno(machine_config &config);
void funquiz(machine_config &config);
- void rcdino4(machine_config &config);
- void intrgmes(machine_config &config);
void witchryl(machine_config &config);
+ void intrgmes(machine_config &config);
+ void fw_brick_1(machine_config &config);
+ void fw_brick_2(machine_config &config);
- void init_magicd2b();
- void init_magicd2c();
void init_saloon();
void init_royalcdc();
void init_multiwin();
@@ -45,64 +40,96 @@ public:
void init_tabblue();
void init_dino4();
void init_ctunk();
- void init_rcdino4();
- void init_rcdinch();
+protected:
DECLARE_WRITE8_MEMBER(funworld_videoram_w);
DECLARE_WRITE8_MEMBER(funworld_colorram_w);
+ DECLARE_WRITE8_MEMBER(funworld_lamp_a_w);
+ DECLARE_WRITE8_MEMBER(funworld_lamp_b_w);
-protected:
virtual void machine_start() override { m_lamps.resolve(); }
- DECLARE_VIDEO_START(funworld);
- DECLARE_PALETTE_INIT(funworld);
+ virtual void video_start() override;
+ void funworld_palette(palette_device &palette) const;
uint32_t screen_update_funworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ TILE_GET_INFO_MEMBER(get_bg_tile_info);
- void lunapark_map(address_map &map);
+ void magicrd2_map(address_map &map);
+
+ required_device<gfxdecode_device> m_gfxdecode;
+ tilemap_t *m_bg_tilemap = nullptr;
private:
DECLARE_READ8_MEMBER(questions_r);
DECLARE_WRITE8_MEMBER(question_bank_w);
- DECLARE_WRITE8_MEMBER(funworld_lamp_a_w);
- DECLARE_WRITE8_MEMBER(funworld_lamp_b_w);
DECLARE_WRITE_LINE_MEMBER(pia1_ca2_w);
DECLARE_READ8_MEMBER(funquiz_ay8910_a_r);
DECLARE_READ8_MEMBER(funquiz_ay8910_b_r);
- DECLARE_READ8_MEMBER(chinatow_r_32f0);
- TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_VIDEO_START(magicrd2);
- DECLARE_VIDEO_START(chinatow);
- void chinatow_map(address_map &map);
void cuoreuno_map(address_map &map);
void funquiz_map(address_map &map);
void funworld_map(address_map &map);
void fw_a7_11_map(address_map &map);
void intergames_map(address_map &map);
- void magicrd2_map(address_map &map);
void saloon_map(address_map &map);
void witchryl_map(address_map &map);
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_colorram;
- tilemap_t *m_bg_tilemap;
required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
output_finder<8> m_lamps;
};
+class magicrd2_state : public funworld_state
+{
+public:
+ using funworld_state::funworld_state;
+
+ void magicrd2(machine_config &config);
+
+ void init_magicd2b();
+ void init_magicd2c();
+
+protected:
+ virtual void video_start() override;
+};
+
+
class lunapark_state : public funworld_state
{
public:
- lunapark_state(const machine_config &mconfig, device_type type, const char *tag)
- : funworld_state(mconfig, type, tag)
- { }
+ using funworld_state::funworld_state;
void lunapark(machine_config &config);
+
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
+
+private:
+ void lunapark_map(address_map &map);
+};
+
+
+class chinatow_state : public funworld_state
+{
+public:
+ using funworld_state::funworld_state;
+
+ void chinatow(machine_config &config);
+ void rcdino4(machine_config &config);
+
+ void init_rcdino4();
+ void init_rcdinch();
+
+protected:
+ virtual void video_start() override;
+
+private:
+ DECLARE_READ8_MEMBER(chinatow_r_32f0);
+
+ void chinatow_map(address_map &map);
};
#endif // MAME_INCLUDES_FUNWORLD_H
diff --git a/src/mame/includes/funybubl.h b/src/mame/includes/funybubl.h
index 4c90ba4eeea..ce65a1e8173 100644
--- a/src/mame/includes/funybubl.h
+++ b/src/mame/includes/funybubl.h
@@ -1,5 +1,9 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood
+#ifndef MAME_INCLUDES_FUNYBUBL_H
+#define MAME_INCLUDES_FUNYBUBL_H
+
+#pragma once
#include "machine/bankdev.h"
#include "machine/gen_latch.h"
@@ -21,10 +25,15 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_soundlatch(*this, "soundlatch"),
- m_vrambank(*this, "vrambank") { }
+ m_vrambank(*this, "vrambank")
+ { }
void funybubl(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void video_start() override;
+
private:
/* memory pointers */
required_shared_ptr<uint8_t> m_tilemapram;
@@ -50,12 +59,10 @@ private:
DECLARE_WRITE8_MEMBER(cpurombank_w);
DECLARE_WRITE8_MEMBER(oki_bank_w);
- DECLARE_PALETTE_DECODER(funybubl_R6B6G6);
+ static rgb_t funybubl_R6B6G6(uint32_t raw);
DECLARE_WRITE8_MEMBER(tilemap_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_start() override;
- virtual void video_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
void funybubl_map(address_map &map);
@@ -64,3 +71,5 @@ private:
void sound_map(address_map &map);
void vrambank_map(address_map &map);
};
+
+#endif // MAME_INCLUDES_FUNYBUBL_H
diff --git a/src/mame/includes/galaga.h b/src/mame/includes/galaga.h
index 0228f87adb7..edc973034df 100644
--- a/src/mame/includes/galaga.h
+++ b/src/mame/includes/galaga.h
@@ -48,7 +48,7 @@ public:
TILEMAP_MAPPER_MEMBER(tilemap_scan);
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_VIDEO_START(galaga);
- DECLARE_PALETTE_INIT(galaga);
+ void galaga_palette(palette_device &palette) const;
uint32_t screen_update_galaga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_galaga);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/galaxia.h b/src/mame/includes/galaxia.h
index edd9b6cacb5..08ab94e8fe0 100644
--- a/src/mame/includes/galaxia.h
+++ b/src/mame/includes/galaxia.h
@@ -36,9 +36,9 @@ private:
TILE_GET_INFO_MEMBER(get_galaxia_bg_tile_info);
TILE_GET_INFO_MEMBER(get_astrowar_bg_tile_info);
DECLARE_VIDEO_START(galaxia);
- DECLARE_PALETTE_INIT(galaxia);
+ void galaxia_palette(palette_device &palette) const;
DECLARE_VIDEO_START(astrowar);
- DECLARE_PALETTE_INIT(astrowar);
+ void astrowar_palette(palette_device &palette) const;
uint32_t screen_update_galaxia(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_astrowar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/galaxian.h b/src/mame/includes/galaxian.h
index 8d2b4cead20..95f75b9d29a 100644
--- a/src/mame/includes/galaxian.h
+++ b/src/mame/includes/galaxian.h
@@ -233,8 +233,8 @@ public:
void init_jungsub();
void init_victoryc();
TILE_GET_INFO_MEMBER(bg_get_tile_info);
- DECLARE_PALETTE_INIT(galaxian);
- DECLARE_PALETTE_INIT(moonwar);
+ void galaxian_palette(palette_device &palette);
+ void moonwar_palette(palette_device &palette);
void tenspot_set_game_bank(int bank, int from_game);
uint32_t screen_update_galaxian(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_interrupt_w);
diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h
index 824dca90f3d..33ff44e778d 100644
--- a/src/mame/includes/galaxold.h
+++ b/src/mame/includes/galaxold.h
@@ -177,16 +177,16 @@ public:
DECLARE_MACHINE_RESET(devilfsg);
DECLARE_MACHINE_RESET(hunchbkg);
- DECLARE_PALETTE_INIT(galaxold);
- DECLARE_PALETTE_INIT(rockclim);
- DECLARE_PALETTE_INIT(scrambold);
- DECLARE_PALETTE_INIT(stratgyx);
- DECLARE_PALETTE_INIT(darkplnt);
- DECLARE_PALETTE_INIT(minefld);
- DECLARE_PALETTE_INIT(rescue);
- DECLARE_PALETTE_INIT(mariner);
- DECLARE_PALETTE_INIT(dambustr);
- DECLARE_PALETTE_INIT(turtles);
+ void galaxold_palette(palette_device &palette);
+ void rockclim_palette(palette_device &palette) const;
+ void scrambold_palette(palette_device &palette);
+ void stratgyx_palette(palette_device &palette);
+ void darkplnt_palette(palette_device &palette) const;
+ void minefld_palette(palette_device &palette);
+ void rescue_palette(palette_device &palette);
+ void mariner_palette(palette_device &palette);
+ void dambustr_palette(palette_device &palette);
+ void turtles_palette(palette_device &palette);
DECLARE_VIDEO_START(galaxold);
DECLARE_VIDEO_START(drivfrcg);
diff --git a/src/mame/includes/galivan.h b/src/mame/includes/galivan.h
index 04db06584e7..6d25df2de94 100644
--- a/src/mame/includes/galivan.h
+++ b/src/mame/includes/galivan.h
@@ -74,7 +74,7 @@ private:
TILE_GET_INFO_MEMBER(get_tx_tile_info);
TILE_GET_INFO_MEMBER(ninjemak_get_bg_tile_info);
TILE_GET_INFO_MEMBER(ninjemak_get_tx_tile_info);
- DECLARE_PALETTE_INIT(galivan);
+ void galivan_palette(palette_device &palette) const;
DECLARE_MACHINE_START(galivan);
DECLARE_MACHINE_RESET(galivan);
DECLARE_VIDEO_START(galivan);
diff --git a/src/mame/includes/galpani2.h b/src/mame/includes/galpani2.h
index 549864b963d..d7b642d8d90 100644
--- a/src/mame/includes/galpani2.h
+++ b/src/mame/includes/galpani2.h
@@ -70,8 +70,6 @@ private:
DECLARE_WRITE16_MEMBER(subdatabank_select_w);
virtual void machine_start() override;
virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(galpani2);
uint32_t screen_update_galpani2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void copybg8(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect, int layer);
void copybg15(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/galpanic.h b/src/mame/includes/galpanic.h
index 1b772443ca0..bb24dc31814 100644
--- a/src/mame/includes/galpanic.h
+++ b/src/mame/includes/galpanic.h
@@ -44,7 +44,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(galpanic);
+ void galpanic_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
diff --git a/src/mame/includes/galspnbl.h b/src/mame/includes/galspnbl.h
index c345fe378b3..db1a7c00aba 100644
--- a/src/mame/includes/galspnbl.h
+++ b/src/mame/includes/galspnbl.h
@@ -57,7 +57,7 @@ private:
DECLARE_WRITE16_MEMBER(soundcommand_w);
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(galspnbl);
+ void galspnbl_palette(palette_device &palette) const;
uint32_t screen_update_galspnbl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect );
bitmap_ind16 m_sprite_bitmap;
diff --git a/src/mame/includes/gamecom.h b/src/mame/includes/gamecom.h
index 9ad26af4dc7..cd1dfda724a 100644
--- a/src/mame/includes/gamecom.h
+++ b/src/mame/includes/gamecom.h
@@ -9,10 +9,11 @@
* Driver by Wilbert Pol
*
****************************************************************************/
-
#ifndef MAME_INCLUDES_GAMECOM_H
#define MAME_INCLUDES_GAMECOM_H
+#pragma once
+
#include "cpu/sm8500/sm8500.h"
#include "sound/dac.h"
#include "bus/generic/slot.h"
@@ -242,7 +243,7 @@ private:
DECLARE_READ8_MEMBER( gamecom_pio_r );
DECLARE_WRITE8_MEMBER( gamecom_internal_w );
DECLARE_WRITE8_MEMBER( gamecom_pio_w );
- DECLARE_PALETTE_INIT(gamecom);
+ void gamecom_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(gamecom_interrupt);
TIMER_CALLBACK_MEMBER(gamecom_clock_timer_callback);
TIMER_CALLBACK_MEMBER(gamecom_sound0_timer_callback);
diff --git a/src/mame/includes/gaplus.h b/src/mame/includes/gaplus.h
index 3afe0ada2ce..3ebef7acebc 100644
--- a/src/mame/includes/gaplus.h
+++ b/src/mame/includes/gaplus.h
@@ -57,7 +57,7 @@ public:
DECLARE_WRITE8_MEMBER(videoram_w);
DECLARE_WRITE8_MEMBER(starfield_control_w);
- DECLARE_PALETTE_INIT(gaplus);
+ void gaplus_palette(palette_device &palette) const;
TILEMAP_MAPPER_MEMBER(tilemap_scan);
TILE_GET_INFO_MEMBER(get_tile_info);
diff --git a/src/mame/includes/gb.h b/src/mame/includes/gb.h
index fef86844961..50ead96a8d1 100644
--- a/src/mame/includes/gb.h
+++ b/src/mame/includes/gb.h
@@ -74,14 +74,14 @@ public:
DECLARE_WRITE8_MEMBER(gbc_io_w);
DECLARE_WRITE8_MEMBER(gbc_io2_w);
DECLARE_READ8_MEMBER(gbc_io2_r);
- DECLARE_PALETTE_INIT(gb);
+ void gb_palette(palette_device &palette) const;
DECLARE_MACHINE_START(sgb);
DECLARE_MACHINE_RESET(sgb);
- DECLARE_PALETTE_INIT(sgb);
- DECLARE_PALETTE_INIT(gbp);
+ void sgb_palette(palette_device &palette) const;
+ void gbp_palette(palette_device &palette) const;
DECLARE_MACHINE_START(gbc);
DECLARE_MACHINE_RESET(gbc);
- DECLARE_PALETTE_INIT(gbc);
+ void gbc_palette(palette_device &palette) const;
DECLARE_WRITE8_MEMBER(gb_timer_callback);
DECLARE_READ8_MEMBER(gb_cart_r);
@@ -155,7 +155,7 @@ private:
DECLARE_READ8_MEMBER(megaduck_sound_r1);
DECLARE_WRITE8_MEMBER(megaduck_sound_w2);
DECLARE_READ8_MEMBER(megaduck_sound_r2);
- DECLARE_PALETTE_INIT(megaduck);
+ void megaduck_palette(palette_device &palette) const;;
void megaduck_map(address_map &map);
DECLARE_READ8_MEMBER(cart_r);
diff --git a/src/mame/includes/gberet.h b/src/mame/includes/gberet.h
index 48299877ec9..b4918e2cd96 100644
--- a/src/mame/includes/gberet.h
+++ b/src/mame/includes/gberet.h
@@ -72,7 +72,7 @@ private:
DECLARE_MACHINE_START(gberet);
DECLARE_MACHINE_RESET(gberet);
DECLARE_VIDEO_START(gberet);
- DECLARE_PALETTE_INIT(gberet);
+ void gberet_palette(palette_device &palette) const;
uint32_t screen_update_gberet(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_gberetb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(gberet_interrupt_tick);
diff --git a/src/mame/includes/goldstar.h b/src/mame/includes/goldstar.h
index 73b7bc76669..55f65c7f399 100644
--- a/src/mame/includes/goldstar.h
+++ b/src/mame/includes/goldstar.h
@@ -1,6 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood, Roberto Fresca, Vas Crabb
-
#ifndef MAME_INCLUDES_GOLDSTAR_H
#define MAME_INCLUDES_GOLDSTAR_H
@@ -53,10 +52,10 @@ public:
void init_wcherry();
void init_super9();
DECLARE_VIDEO_START(goldstar);
- DECLARE_PALETTE_INIT(cm);
+ void cm_palette(palette_device &palette) const;
DECLARE_VIDEO_START(cherrym);
- DECLARE_PALETTE_INIT(cmast91);
- DECLARE_PALETTE_INIT(lucky8);
+ void cmast91_palette(palette_device &palette) const;
+ void lucky8_palette(palette_device &palette) const;
uint32_t screen_update_goldstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_cmast91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -227,7 +226,7 @@ public:
DECLARE_VIDEO_START(bingowng);
DECLARE_VIDEO_START(magical);
- DECLARE_PALETTE_INIT(magodds);
+ void magodds_palette(palette_device &palette) const;
uint32_t screen_update_bingowng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_magical(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_mbstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/gomoku.h b/src/mame/includes/gomoku.h
index 521e62b294c..d97afcd5ba5 100644
--- a/src/mame/includes/gomoku.h
+++ b/src/mame/includes/gomoku.h
@@ -41,7 +41,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(bg_dispsw_w);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(gomoku);
+ void gomoku_palette(palette_device &palette) const;
uint32_t screen_update_gomoku(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
diff --git a/src/mame/includes/gotya.h b/src/mame/includes/gotya.h
index 86826a9abad..b0d388633f7 100644
--- a/src/mame/includes/gotya.h
+++ b/src/mame/includes/gotya.h
@@ -52,7 +52,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(gotya);
+ void gotya_palette(palette_device &palette) const;
uint32_t screen_update_gotya(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_status_row( bitmap_ind16 &bitmap, const rectangle &cliprect, int sx, int col );
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/grchamp.h b/src/mame/includes/grchamp.h
index 4b1e0457a1d..b7b0c0a6b77 100644
--- a/src/mame/includes/grchamp.h
+++ b/src/mame/includes/grchamp.h
@@ -77,7 +77,7 @@ private:
TILE_GET_INFO_MEMBER(get_center_tile_info);
TILEMAP_MAPPER_MEMBER(get_memory_offset);
- DECLARE_PALETTE_INIT(grchamp);
+ void grchamp_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(cpu0_interrupt);
INTERRUPT_GEN_MEMBER(cpu1_interrupt);
TIMER_CALLBACK_MEMBER(main_to_sub_comm_sync_w);
diff --git a/src/mame/includes/gridlee.h b/src/mame/includes/gridlee.h
index 5aca6952b19..8c18411073d 100644
--- a/src/mame/includes/gridlee.h
+++ b/src/mame/includes/gridlee.h
@@ -53,7 +53,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(cocktail_flip_w);
DECLARE_WRITE8_MEMBER(gridlee_videoram_w);
DECLARE_WRITE8_MEMBER(gridlee_palette_select_w);
- DECLARE_PALETTE_INIT(gridlee);
+ void gridlee_palette(palette_device &palette) const;
uint32_t screen_update_gridlee(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(irq_off_tick);
TIMER_CALLBACK_MEMBER(irq_timer_tick);
diff --git a/src/mame/includes/gsword.h b/src/mame/includes/gsword.h
index 7d349a733e3..fde871a6fad 100644
--- a/src/mame/includes/gsword.h
+++ b/src/mame/includes/gsword.h
@@ -105,7 +105,7 @@ protected:
INTERRUPT_GEN_MEMBER(sound_interrupt);
- DECLARE_PALETTE_INIT(gsword);
+ void gsword_palette(palette_device &palette) const;
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -154,7 +154,7 @@ protected:
DECLARE_WRITE8_MEMBER(mcu2_p1_w);
DECLARE_WRITE8_MEMBER(mcu2_p2_w);
- DECLARE_PALETTE_INIT(josvolly);
+ void josvolly_palette(palette_device &palette) const;
virtual void machine_start() override;
virtual void machine_reset() override;
diff --git a/src/mame/includes/gunsmoke.h b/src/mame/includes/gunsmoke.h
index 7afafb81ba5..6255ee95e27 100644
--- a/src/mame/includes/gunsmoke.h
+++ b/src/mame/includes/gunsmoke.h
@@ -54,7 +54,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(gunsmoke);
+ void gunsmoke_palette(palette_device &palette) const;
uint32_t screen_update_gunsmoke(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/gyruss.h b/src/mame/includes/gyruss.h
index ba561d9bedd..1857fdd6576 100644
--- a/src/mame/includes/gyruss.h
+++ b/src/mame/includes/gyruss.h
@@ -73,7 +73,7 @@ private:
TILE_GET_INFO_MEMBER(gyruss_get_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(gyruss);
+ void gyruss_palette(palette_device &palette) const;
uint32_t screen_update_gyruss(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/hanaawas.h b/src/mame/includes/hanaawas.h
index 25f56747f9d..75bffa921ab 100644
--- a/src/mame/includes/hanaawas.h
+++ b/src/mame/includes/hanaawas.h
@@ -47,7 +47,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(hanaawas);
+ void hanaawas_palette(palette_device &palette) const;
uint32_t screen_update_hanaawas(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(hanaawas_portB_w);
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/hcastle.h b/src/mame/includes/hcastle.h
index a074d4bf4d4..32e6fc79cbf 100644
--- a/src/mame/includes/hcastle.h
+++ b/src/mame/includes/hcastle.h
@@ -73,7 +73,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(hcastle);
+ void hcastle_palette(palette_device &palette) const;
uint32_t screen_update_hcastle(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, uint8_t *sbank, int bank );
DECLARE_WRITE8_MEMBER(volume_callback);
diff --git a/src/mame/includes/higemaru.h b/src/mame/includes/higemaru.h
index 7d184898120..a744663a45b 100644
--- a/src/mame/includes/higemaru.h
+++ b/src/mame/includes/higemaru.h
@@ -41,7 +41,7 @@ private:
DECLARE_WRITE8_MEMBER(higemaru_c800_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(higemaru);
+ void higemaru_palette(palette_device &palette) const;
uint32_t screen_update_higemaru(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(higemaru_scanline);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/homedata.h b/src/mame/includes/homedata.h
index 9c0b37c63eb..14c53106dec 100644
--- a/src/mame/includes/homedata.h
+++ b/src/mame/includes/homedata.h
@@ -137,17 +137,17 @@ private:
DECLARE_MACHINE_START(homedata);
DECLARE_MACHINE_RESET(homedata);
DECLARE_VIDEO_START(mrokumei);
- DECLARE_PALETTE_INIT(mrokumei);
+ void mrokumei_palette(palette_device &palette) const;
DECLARE_MACHINE_START(reikaids);
DECLARE_MACHINE_RESET(reikaids);
DECLARE_VIDEO_START(reikaids);
- DECLARE_PALETTE_INIT(reikaids);
+ void reikaids_palette(palette_device &palette) const;
DECLARE_MACHINE_START(pteacher);
DECLARE_MACHINE_RESET(pteacher);
DECLARE_VIDEO_START(pteacher);
- DECLARE_PALETTE_INIT(pteacher);
+ void pteacher_palette(palette_device &palette) const;
DECLARE_VIDEO_START(mirderby);
- DECLARE_PALETTE_INIT(mirderby);
+ void mirderby_palette(palette_device &palette) const;
DECLARE_VIDEO_START(lemnangl);
uint32_t screen_update_mrokumei(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_reikaids(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/hp48.h b/src/mame/includes/hp48.h
index c51542e28c3..d478736fe39 100644
--- a/src/mame/includes/hp48.h
+++ b/src/mame/includes/hp48.h
@@ -84,7 +84,7 @@ private:
virtual void machine_reset() override;
void base_machine_start(hp48_models model);
- DECLARE_PALETTE_INIT(hp48);
+ void hp48_palette(palette_device &palette) const;
DECLARE_MACHINE_START(hp49g);
DECLARE_MACHINE_START(hp48gx);
DECLARE_MACHINE_START(hp48g);
diff --git a/src/mame/includes/hx20.h b/src/mame/includes/hx20.h
index 7fd1e0722ce..ea5182c9a80 100644
--- a/src/mame/includes/hx20.h
+++ b/src/mame/includes/hx20.h
@@ -22,13 +22,6 @@
#define HD6301V1_MAIN_TAG "8g"
#define HD6301V1_SLAVE_TAG "6d"
#define MC146818_TAG "6g"
-#define UPD7227_0_TAG "lcdc0"
-#define UPD7227_1_TAG "lcdc1"
-#define UPD7227_2_TAG "lcdc2"
-#define UPD7227_3_TAG "lcdc3"
-#define UPD7227_4_TAG "lcdc4"
-#define UPD7227_5_TAG "lcdc5"
-#define SPEAKER_TAG "speaker"
#define CASSETTE_TAG "cassette"
#define RS232_TAG "rs232"
#define SCREEN_TAG "screen"
@@ -37,35 +30,23 @@ class hx20_state : public driver_device
{
public:
hx20_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, HD6301V1_MAIN_TAG),
- m_subcpu(*this, HD6301V1_SLAVE_TAG),
- m_rtc(*this, MC146818_TAG),
- m_lcdc0(*this, UPD7227_0_TAG),
- m_lcdc1(*this, UPD7227_1_TAG),
- m_lcdc2(*this, UPD7227_2_TAG),
- m_lcdc3(*this, UPD7227_3_TAG),
- m_lcdc4(*this, UPD7227_4_TAG),
- m_lcdc5(*this, UPD7227_5_TAG),
- m_speaker(*this, SPEAKER_TAG),
- m_cassette(*this, CASSETTE_TAG),
- m_rs232(*this, RS232_TAG),
- m_sio(*this, "sio"),
- m_optrom(*this, "optrom"),
- m_ksc0(*this, "KSC0"),
- m_ksc1(*this, "KSC1"),
- m_ksc2(*this, "KSC2"),
- m_ksc3(*this, "KSC3"),
- m_ksc4(*this, "KSC4"),
- m_ksc5(*this, "KSC5"),
- m_ksc6(*this, "KSC6"),
- m_ksc7(*this, "KSC7"),
- m_sw6(*this, "SW6"),
- m_slave_rx(1),
- m_slave_tx(1),
- m_slave_flag(1),
- m_rtc_irq(CLEAR_LINE),
- m_kbrequest(1)
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, HD6301V1_MAIN_TAG)
+ , m_subcpu(*this, HD6301V1_SLAVE_TAG)
+ , m_rtc(*this, MC146818_TAG)
+ , m_lcdc(*this, "lcdc%u", 0U)
+ , m_speaker(*this, "speaker")
+ , m_cassette(*this, CASSETTE_TAG)
+ , m_rs232(*this, RS232_TAG)
+ , m_sio(*this, "sio")
+ , m_optrom(*this, "optrom")
+ , m_ksc_io(*this, "KSC%u", 0U)
+ , m_sw6(*this, "SW6")
+ , m_slave_rx(1)
+ , m_slave_tx(1)
+ , m_slave_flag(1)
+ , m_rtc_irq(CLEAR_LINE)
+ , m_kbrequest(1)
{ }
void cm6000(machine_config &config);
@@ -75,29 +56,17 @@ private:
required_device<hd63701_cpu_device> m_maincpu;
required_device<hd63701_cpu_device> m_subcpu;
required_device<mc146818_device> m_rtc;
- required_device<upd7227_device> m_lcdc0;
- required_device<upd7227_device> m_lcdc1;
- required_device<upd7227_device> m_lcdc2;
- required_device<upd7227_device> m_lcdc3;
- required_device<upd7227_device> m_lcdc4;
- required_device<upd7227_device> m_lcdc5;
+ required_device_array<upd7227_device, 6> m_lcdc;
required_device<speaker_sound_device> m_speaker;
required_device<cassette_image_device> m_cassette;
required_device<rs232_port_device> m_rs232;
required_device<epson_sio_device> m_sio;
optional_device<generic_slot_device> m_optrom;
- required_ioport m_ksc0;
- required_ioport m_ksc1;
- required_ioport m_ksc2;
- required_ioport m_ksc3;
- required_ioport m_ksc4;
- required_ioport m_ksc5;
- required_ioport m_ksc6;
- required_ioport m_ksc7;
+ required_ioport_array<8> m_ksc_io;
required_ioport m_sw6;
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(hx20);
+ void hx20_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER( ksc_w );
diff --git a/src/mame/includes/hyperspt.h b/src/mame/includes/hyperspt.h
index aa3abed5f83..d47c670cfa6 100644
--- a/src/mame/includes/hyperspt.h
+++ b/src/mame/includes/hyperspt.h
@@ -72,7 +72,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(hyperspt);
+ void hyperspt_palette(palette_device &palette) const;
DECLARE_VIDEO_START(roadf);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
diff --git a/src/mame/includes/ikki.h b/src/mame/includes/ikki.h
index b0cfa9f7e24..f4788050309 100644
--- a/src/mame/includes/ikki.h
+++ b/src/mame/includes/ikki.h
@@ -57,7 +57,7 @@ private:
DECLARE_READ8_MEMBER(ikki_e000_r);
DECLARE_WRITE8_MEMBER(ikki_coin_counters);
DECLARE_WRITE8_MEMBER(ikki_scrn_ctrl_w);
- DECLARE_PALETTE_INIT(ikki);
+ void ikki_palette(palette_device &palette);
uint32_t screen_update_ikki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(ikki_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/intv.h b/src/mame/includes/intv.h
index 88673886b2c..72b9e3fd71b 100644
--- a/src/mame/includes/intv.h
+++ b/src/mame/includes/intv.h
@@ -119,7 +119,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(intv);
+ void intv_palette(palette_device &palette) const;
uint32_t screen_update_intv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_intvkbd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(intv_interrupt2);
diff --git a/src/mame/includes/irobot.h b/src/mame/includes/irobot.h
index 5bb51104587..8b1780254ad 100644
--- a/src/mame/includes/irobot.h
+++ b/src/mame/includes/irobot.h
@@ -72,7 +72,7 @@ private:
DECLARE_WRITE8_MEMBER(irobot_paletteram_w);
DECLARE_READ8_MEMBER(quad_pokeyn_r);
DECLARE_WRITE8_MEMBER(quad_pokeyn_w);
- DECLARE_PALETTE_INIT(irobot);
+ void irobot_palette(palette_device &palette) const;
uint32_t screen_update_irobot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_callback);
TIMER_DEVICE_CALLBACK_MEMBER(irobot_irvg_done_callback);
diff --git a/src/mame/includes/ironhors.h b/src/mame/includes/ironhors.h
index 96d1ced3b84..5c9a9e01864 100644
--- a/src/mame/includes/ironhors.h
+++ b/src/mame/includes/ironhors.h
@@ -55,7 +55,7 @@ private:
TIMER_DEVICE_CALLBACK_MEMBER(ironhors_scanline_tick);
TIMER_DEVICE_CALLBACK_MEMBER(farwest_scanline_tick);
- DECLARE_PALETTE_INIT(ironhors);
+ void ironhors_palette(palette_device &palette) const;
DECLARE_VIDEO_START(farwest);
void farwest_master_map(address_map &map);
diff --git a/src/mame/includes/jack.h b/src/mame/includes/jack.h
index 49740a54908..8192534831f 100644
--- a/src/mame/includes/jack.h
+++ b/src/mame/includes/jack.h
@@ -81,7 +81,7 @@ private:
TILEMAP_MAPPER_MEMBER(tilemap_scan_cols_flipy);
TILE_GET_INFO_MEMBER(joinem_get_bg_tile_info);
DECLARE_VIDEO_START(joinem);
- DECLARE_PALETTE_INIT(joinem);
+ void joinem_palette(palette_device &palette) const;
DECLARE_MACHINE_START(striv);
DECLARE_MACHINE_RESET(striv);
DECLARE_MACHINE_START(joinem);
diff --git a/src/mame/includes/jackal.h b/src/mame/includes/jackal.h
index fb74d00c537..ad6d7457170 100644
--- a/src/mame/includes/jackal.h
+++ b/src/mame/includes/jackal.h
@@ -61,7 +61,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(jackal);
+ void jackal_palette(palette_device &palette) const;
uint32_t screen_update_jackal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void jackal_mark_tile_dirty( int offset );
diff --git a/src/mame/includes/jailbrek.h b/src/mame/includes/jailbrek.h
index c92ef5dab2b..44b02339ee0 100644
--- a/src/mame/includes/jailbrek.h
+++ b/src/mame/includes/jailbrek.h
@@ -64,7 +64,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(jailbrek);
+ void jailbrek_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(interrupt_nmi);
diff --git a/src/mame/includes/kaneko16.h b/src/mame/includes/kaneko16.h
index 7f46de6d9c8..e5714367bad 100644
--- a/src/mame/includes/kaneko16.h
+++ b/src/mame/includes/kaneko16.h
@@ -209,7 +209,6 @@ public:
void init_berlwallk();
void init_berlwallt();
void init_berlwall_common();
- DECLARE_PALETTE_INIT(berlwall);
DECLARE_VIDEO_START(berlwall);
uint32_t screen_update_berlwall(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void kaneko16_render_15bpp_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/kaypro.h b/src/mame/includes/kaypro.h
index 1999a6ded80..d344e6d40a1 100644
--- a/src/mame/includes/kaypro.h
+++ b/src/mame/includes/kaypro.h
@@ -60,7 +60,7 @@ public:
DECLARE_MACHINE_START(kayproii);
DECLARE_MACHINE_RESET(kaypro);
DECLARE_VIDEO_START(kaypro);
- DECLARE_PALETTE_INIT(kaypro);
+ void kaypro_palette(palette_device &palette) const;
void init_kaypro();
uint32_t screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_kaypro484(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/kc.h b/src/mame/includes/kc.h
index 4dc25f1e17a..0f26350c78f 100644
--- a/src/mame/includes/kc.h
+++ b/src/mame/includes/kc.h
@@ -5,10 +5,11 @@
* includes/kc.h
*
****************************************************************************/
-
#ifndef MAME_INCLUDES_KC_H
#define MAME_INCLUDES_KC_H
+#pragma once
+
/* Devices */
#include "imagedev/cassette.h"
#include "machine/ram.h"
@@ -150,7 +151,7 @@ public:
int m_astb;
int m_cassette_in;
- DECLARE_PALETTE_INIT(kc85);
+ void kc85_palette(palette_device &palette) const;
TIMER_CALLBACK_MEMBER(kc_cassette_oneshot_timer);
TIMER_CALLBACK_MEMBER(kc_cassette_timer_callback);
TIMER_DEVICE_CALLBACK_MEMBER(kc_scanline);
@@ -167,7 +168,7 @@ class kc85_4_state : public kc_state
public:
kc85_4_state(const machine_config &mconfig, device_type type, const char *tag)
: kc_state(mconfig, type, tag)
- { }
+ { }
// defined in machine/kc.c
virtual void machine_reset() override;
diff --git a/src/mame/includes/kchamp.h b/src/mame/includes/kchamp.h
index 3802d31ddfc..7a24855a08f 100644
--- a/src/mame/includes/kchamp.h
+++ b/src/mame/includes/kchamp.h
@@ -81,7 +81,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(kchamp);
+ void kchamp_palette(palette_device &palette) const;
DECLARE_MACHINE_START(kchampvs);
DECLARE_MACHINE_START(kchamp);
uint32_t screen_update_kchampvs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/kickgoal.h b/src/mame/includes/kickgoal.h
index 1158c4d0084..8b828067333 100644
--- a/src/mame/includes/kickgoal.h
+++ b/src/mame/includes/kickgoal.h
@@ -43,8 +43,8 @@ public:
void init_actionhw();
protected:
- void machine_start() override;
- void machine_reset() override;
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
private:
DECLARE_READ16_MEMBER(kickgoal_eeprom_r);
diff --git a/src/mame/includes/kingobox.h b/src/mame/includes/kingobox.h
index fbee6a13c70..123ef8da5ab 100644
--- a/src/mame/includes/kingobox.h
+++ b/src/mame/includes/kingobox.h
@@ -73,13 +73,13 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_VIDEO_START(kingofb);
- DECLARE_PALETTE_INIT(kingofb);
+ void kingofb_palette(palette_device &palette);
DECLARE_VIDEO_START(ringking);
- DECLARE_PALETTE_INIT(ringking);
+ void ringking_palette(palette_device &palette);
uint32_t screen_update_kingofb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_ringking(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(kingofb_interrupt);
- void palette_init_common( palette_device &palette, const uint8_t *color_prom, void (kingofb_state::*get_rgb_data)(const uint8_t *, int, int *, int *, int *) );
+ void palette_init_common(palette_device &palette, const uint8_t *color_prom, void (kingofb_state::*get_rgb_data)(const uint8_t *, int, int *, int *, int *));
void kingofb_get_rgb_data( const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data );
void ringking_get_rgb_data( const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data );
void kingofb_draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/kncljoe.h b/src/mame/includes/kncljoe.h
index dcf42e5b6d2..17820edd036 100644
--- a/src/mame/includes/kncljoe.h
+++ b/src/mame/includes/kncljoe.h
@@ -73,7 +73,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(kncljoe);
+ void kncljoe_palette(palette_device &palette) const;
uint32_t screen_update_kncljoe(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(sound_nmi);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/kopunch.h b/src/mame/includes/kopunch.h
index b4581f1764d..84e4d99a4db 100644
--- a/src/mame/includes/kopunch.h
+++ b/src/mame/includes/kopunch.h
@@ -44,7 +44,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(kopunch);
+ void kopunch_palette(palette_device &palette) const;
uint32_t screen_update_kopunch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void kopunch_io_map(address_map &map);
diff --git a/src/mame/includes/ksayakyu.h b/src/mame/includes/ksayakyu.h
index 46a698c6ac6..671d7f9957a 100644
--- a/src/mame/includes/ksayakyu.h
+++ b/src/mame/includes/ksayakyu.h
@@ -59,7 +59,7 @@ private:
DECLARE_WRITE8_MEMBER(dummy3_w);
TILE_GET_INFO_MEMBER(get_ksayakyu_tile_info);
TILE_GET_INFO_MEMBER(get_text_tile_info);
- DECLARE_PALETTE_INIT(ksayakyu);
+ void ksayakyu_palette(palette_device &palette) const;
uint32_t screen_update_ksayakyu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/kyocera.h b/src/mame/includes/kyocera.h
index 9643c7f23ba..2098f70da08 100644
--- a/src/mame/includes/kyocera.h
+++ b/src/mame/includes/kyocera.h
@@ -148,7 +148,7 @@ protected:
int m_centronics_busy;
int m_centronics_select;
- DECLARE_PALETTE_INIT(kc85);
+ void kc85_palette(palette_device &palette) const;
void kc85_io(address_map &map);
void kc85_mem(address_map &map);
void trsm100_io(address_map &map);
@@ -250,7 +250,7 @@ public:
DECLARE_WRITE_LINE_MEMBER( write_centronics_busy );
DECLARE_WRITE_LINE_MEMBER( write_centronics_select );
- DECLARE_PALETTE_INIT(tandy200);
+ void tandy200_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(tandy200_tp_tick);
diff --git a/src/mame/includes/labyrunr.h b/src/mame/includes/labyrunr.h
index 20f1ad932cf..144b8c43da4 100644
--- a/src/mame/includes/labyrunr.h
+++ b/src/mame/includes/labyrunr.h
@@ -61,7 +61,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info1);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(labyrunr);
+ void labyrunr_palette(palette_device &palette) const;
uint32_t screen_update_labyrunr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(labyrunr_timer_interrupt);
diff --git a/src/mame/includes/ladybug.h b/src/mame/includes/ladybug.h
index f34bd6b34d1..964a994252c 100644
--- a/src/mame/includes/ladybug.h
+++ b/src/mame/includes/ladybug.h
@@ -48,7 +48,7 @@ public:
protected:
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- DECLARE_PALETTE_INIT(ladybug);
+ void ladybug_palette(palette_device &palette) const;
uint32_t screen_update_ladybug(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void ladybug_map(address_map &map);
@@ -102,7 +102,7 @@ protected:
DECLARE_READ8_MEMBER(sraider_8005_r);
DECLARE_WRITE8_MEMBER(sraider_misc_w);
DECLARE_WRITE8_MEMBER(sraider_io_w);
- DECLARE_PALETTE_INIT(sraider);
+ void sraider_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sraider);
TILE_GET_INFO_MEMBER(get_grid_tile_info);
diff --git a/src/mame/includes/laserbat.h b/src/mame/includes/laserbat.h
index 880ea3529cd..ee7dac539f2 100644
--- a/src/mame/includes/laserbat.h
+++ b/src/mame/includes/laserbat.h
@@ -173,7 +173,7 @@ protected:
virtual void machine_start() override;
// video initialisation
- DECLARE_PALETTE_INIT(laserbat);
+ void laserbat_palette(palette_device &palette) const;
// sound control ports
virtual DECLARE_WRITE8_MEMBER(csound2_w) override;
@@ -202,7 +202,7 @@ public:
protected:
// video initialisation
- DECLARE_PALETTE_INIT(catnmous);
+ void catnmous_palette(palette_device &palette) const;
// sound control ports
virtual DECLARE_WRITE8_MEMBER(csound1_w) override;
diff --git a/src/mame/includes/lasso.h b/src/mame/includes/lasso.h
index b44454f1d0a..04d3707058c 100644
--- a/src/mame/includes/lasso.h
+++ b/src/mame/includes/lasso.h
@@ -87,11 +87,11 @@ private:
TILE_GET_INFO_MEMBER(lasso_get_bg_tile_info);
TILE_GET_INFO_MEMBER(wwjgtin_get_track_tile_info);
TILE_GET_INFO_MEMBER(pinbo_get_bg_tile_info);
- DECLARE_PALETTE_INIT(lasso);
+ void lasso_palette(palette_device &palette) const;
DECLARE_MACHINE_START(wwjgtin);
DECLARE_MACHINE_RESET(wwjgtin);
DECLARE_VIDEO_START(wwjgtin);
- DECLARE_PALETTE_INIT(wwjgtin);
+ void wwjgtin_palette(palette_device &palette) const;
DECLARE_VIDEO_START(pinbo);
uint32_t screen_update_lasso(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_chameleo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/lastduel.h b/src/mame/includes/lastduel.h
index f1c2d2470d4..0e59d87106a 100644
--- a/src/mame/includes/lastduel.h
+++ b/src/mame/includes/lastduel.h
@@ -63,7 +63,7 @@ private:
template<int Layer> DECLARE_WRITE16_MEMBER(lastduel_vram_w);
DECLARE_WRITE16_MEMBER(txram_w);
template<int Layer> DECLARE_WRITE16_MEMBER(madgear_vram_w);
- DECLARE_PALETTE_DECODER(lastduel_RRRRGGGGBBBBIIII);
+ static rgb_t lastduel_RRRRGGGGBBBBIIII(uint32_t raw);
TILE_GET_INFO_MEMBER(ld_get_bg_tile_info);
TILE_GET_INFO_MEMBER(ld_get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
diff --git a/src/mame/includes/lazercmd.h b/src/mame/includes/lazercmd.h
index e2d3e5e3499..fdb7d2c91cc 100644
--- a/src/mame/includes/lazercmd.h
+++ b/src/mame/includes/lazercmd.h
@@ -82,7 +82,7 @@ private:
DECLARE_READ8_MEMBER(lazercmd_hardware_r);
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(lazercmd);
+ void lazercmd_palette(palette_device &palette) const;
uint32_t screen_update_lazercmd(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(lazercmd_timer);
TIMER_DEVICE_CALLBACK_MEMBER(bbonk_timer);
diff --git a/src/mame/includes/liberate.h b/src/mame/includes/liberate.h
index 9fb7944effa..20c1760a3d0 100644
--- a/src/mame/includes/liberate.h
+++ b/src/mame/includes/liberate.h
@@ -88,7 +88,7 @@ private:
DECLARE_MACHINE_START(liberate);
DECLARE_MACHINE_RESET(liberate);
DECLARE_VIDEO_START(liberate);
- DECLARE_PALETTE_INIT(liberate);
+ void liberate_palette(palette_device &palette) const;
DECLARE_VIDEO_START(prosport);
DECLARE_VIDEO_START(boomrang);
DECLARE_VIDEO_START(prosoccr);
diff --git a/src/mame/includes/lockon.h b/src/mame/includes/lockon.h
index 7eb313c5af1..abdbbe9219c 100644
--- a/src/mame/includes/lockon.h
+++ b/src/mame/includes/lockon.h
@@ -139,7 +139,7 @@ private:
DECLARE_WRITE8_MEMBER(sound_vol);
DECLARE_WRITE8_MEMBER(ym2203_out_b);
TILE_GET_INFO_MEMBER(get_lockon_tile_info);
- DECLARE_PALETTE_INIT(lockon);
+ void lockon_palette(palette_device &palette) const;
uint32_t screen_update_lockon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_lockon);
TIMER_CALLBACK_MEMBER(cursor_callback);
diff --git a/src/mame/includes/lucky74.h b/src/mame/includes/lucky74.h
index 2608f448bcf..109e7e6e01c 100644
--- a/src/mame/includes/lucky74.h
+++ b/src/mame/includes/lucky74.h
@@ -47,7 +47,7 @@ private:
DECLARE_WRITE8_MEMBER(lamps_b_w);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(lucky74);
+ void lucky74_palette(palette_device &palette) const;
uint32_t screen_update_lucky74(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(nmi_interrupt);
DECLARE_WRITE_LINE_MEMBER(lucky74_adpcm_int);
diff --git a/src/mame/includes/lvcards.h b/src/mame/includes/lvcards.h
index 44160a7b89c..8bb4cc71061 100644
--- a/src/mame/includes/lvcards.h
+++ b/src/mame/includes/lvcards.h
@@ -31,7 +31,7 @@ private:
required_shared_ptr<uint8_t> m_colorram;
tilemap_t *m_bg_tilemap;
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(lvcards);
+ void lvcards_palette(palette_device &palette) const;
uint32_t screen_update_lvcards(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<gfxdecode_device> m_gfxdecode;
diff --git a/src/mame/includes/lviv.h b/src/mame/includes/lviv.h
index e0fc9150e57..90d9d6a8dac 100644
--- a/src/mame/includes/lviv.h
+++ b/src/mame/includes/lviv.h
@@ -43,7 +43,7 @@ public:
private:
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(lviv);
+ void lviv_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(io_r);
@@ -93,7 +93,7 @@ private:
uint8_t m_startup_mem_map;
/*----------- defined in video/lviv.c -----------*/
- static const uint8_t s_palette[8*3];
+ static const rgb_t s_palette[8];
};
#endif // MAME_INCLUDES_LVIV_H
diff --git a/src/mame/includes/m10.h b/src/mame/includes/m10.h
index 100b39c83c6..9ec34e917dd 100644
--- a/src/mame/includes/m10.h
+++ b/src/mame/includes/m10.h
@@ -119,7 +119,7 @@ private:
DECLARE_MACHINE_START(m10);
DECLARE_MACHINE_RESET(m10);
DECLARE_VIDEO_START(m10);
- DECLARE_PALETTE_INIT(m10);
+ void m10_palette(palette_device &palette) const;
DECLARE_VIDEO_START(m15);
uint32_t screen_update_m10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_m15(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/m52.h b/src/mame/includes/m52.h
index 297008286b9..5a5eccd6f5d 100644
--- a/src/mame/includes/m52.h
+++ b/src/mame/includes/m52.h
@@ -11,8 +11,8 @@
class m52_state : public driver_device
{
public:
- m52_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ m52_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_videoram(*this, "videoram"),
m_colorram(*this, "colorram"),
m_spriteram(*this, "spriteram"),
@@ -33,6 +33,7 @@ public:
DECLARE_READ8_MEMBER(m52_protection_r);
protected:
+ virtual void machine_reset() override;
virtual void video_start() override;
virtual DECLARE_WRITE8_MEMBER(m52_scroll_w);
@@ -54,6 +55,16 @@ private:
uint8_t m_bg2xpos;
uint8_t m_bg2ypos;
uint8_t m_bgcontrol;
+
+ required_device<cpu_device> m_maincpu;
+ required_device<gfxdecode_device> m_sp_gfxdecode;
+ required_device<gfxdecode_device> m_tx_gfxdecode;
+ required_device<gfxdecode_device> m_bg_gfxdecode;
+ required_device<screen_device> m_screen;
+ required_device<palette_device> m_sp_palette;
+ required_device<palette_device> m_tx_palette;
+ required_device<palette_device> m_bg_palette;
+
DECLARE_WRITE8_MEMBER(m52_bg1ypos_w);
DECLARE_WRITE8_MEMBER(m52_bg1xpos_w);
DECLARE_WRITE8_MEMBER(m52_bg2xpos_w);
@@ -61,20 +72,12 @@ private:
DECLARE_WRITE8_MEMBER(m52_bgcontrol_w);
DECLARE_WRITE8_MEMBER(m52_flipscreen_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- virtual void machine_reset() override;
void init_palette();
void init_sprite_palette(const int *resistances_3, const int *resistances_2, double *weights_r, double *weights_g, double *weights_b, double scale);
uint32_t screen_update_m52(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void draw_background(bitmap_rgb32 &bitmap, const rectangle &cliprect, int xpos, int ypos, int image);
void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int initoffs);
- required_device<cpu_device> m_maincpu;
- required_device<gfxdecode_device> m_sp_gfxdecode;
- required_device<gfxdecode_device> m_tx_gfxdecode;
- required_device<gfxdecode_device> m_bg_gfxdecode;
- required_device<screen_device> m_screen;
- required_device<palette_device> m_sp_palette;
- required_device<palette_device> m_tx_palette;
- required_device<palette_device> m_bg_palette;
+
void main_map(address_map &map);
void main_portmap(address_map &map);
};
diff --git a/src/mame/includes/m57.h b/src/mame/includes/m57.h
index ad9135effa1..a325bc34830 100644
--- a/src/mame/includes/m57.h
+++ b/src/mame/includes/m57.h
@@ -35,7 +35,7 @@ private:
DECLARE_WRITE8_MEMBER(m57_flipscreen_w);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(m57);
+ void m57_palette(palette_device &palette) const;
uint32_t screen_update_m57(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_background(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/m58.h b/src/mame/includes/m58.h
index 3e9e1671df0..660a8326b69 100644
--- a/src/mame/includes/m58.h
+++ b/src/mame/includes/m58.h
@@ -57,7 +57,7 @@ private:
DECLARE_WRITE8_MEMBER(flipscreen_w);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(m58);
+ void m58_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILEMAP_MAPPER_MEMBER(tilemap_scan_rows);
diff --git a/src/mame/includes/m62.h b/src/mame/includes/m62.h
index f1122023a89..6bb54deaafe 100644
--- a/src/mame/includes/m62.h
+++ b/src/mame/includes/m62.h
@@ -123,10 +123,10 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(m62_spr);
- DECLARE_PALETTE_INIT(m62_chr);
- DECLARE_PALETTE_INIT(m62_lotlot_fg);
- DECLARE_PALETTE_INIT(m62_battroad_fg);
+ void m62_spr(palette_device &palette) const;
+ void m62_chr(palette_device &palette) const;
+ void m62_lotlot_fg(palette_device &palette) const;
+ void m62_battroad_fg(palette_device &palette) const;
DECLARE_VIDEO_START(kungfum);
DECLARE_VIDEO_START(battroad);
DECLARE_VIDEO_START(ldrun2);
@@ -135,7 +135,7 @@ private:
DECLARE_VIDEO_START(kidniki);
DECLARE_VIDEO_START(spelunkr);
DECLARE_VIDEO_START(spelunk2);
- DECLARE_PALETTE_INIT(spelunk2);
+ void spelunk2_palette(palette_device &palette) const;
DECLARE_VIDEO_START(youjyudn);
DECLARE_VIDEO_START(horizon);
uint32_t screen_update_ldrun(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/mac.h b/src/mame/includes/mac.h
index 562e294bfcc..a0735c98ce7 100644
--- a/src/mame/includes/mac.h
+++ b/src/mame/includes/mac.h
@@ -530,8 +530,7 @@ private:
emu_timer *m_scanline_timer;
emu_timer *m_adb_timer;
- void palette_init_mac(palette_device &palette);
- void palette_init_macgsc(palette_device &palette);
+ void macgsc_palette(palette_device &palette) const;
DECLARE_VIDEO_START(mac);
DECLARE_VIDEO_START(macprtb);
diff --git a/src/mame/includes/madalien.h b/src/mame/includes/madalien.h
index 785ba29ef54..edeb06a7111 100644
--- a/src/mame/includes/madalien.h
+++ b/src/mame/includes/madalien.h
@@ -80,7 +80,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info_BG_2);
TILE_GET_INFO_MEMBER(get_tile_info_FG);
DECLARE_VIDEO_START(madalien);
- DECLARE_PALETTE_INIT(madalien);
+ void madalien_palette(palette_device &palette) const;
uint32_t screen_update_madalien(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline int scan_helper(int col, int row, int section);
void draw_edges(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int flip, int scroll_mode);
diff --git a/src/mame/includes/magmax.h b/src/mame/includes/magmax.h
index 97e7a437ea0..1200248fc90 100644
--- a/src/mame/includes/magmax.h
+++ b/src/mame/includes/magmax.h
@@ -67,7 +67,7 @@ private:
DECLARE_WRITE8_MEMBER(ay8910_portB_0_w);
DECLARE_WRITE8_MEMBER(ay8910_portA_0_w);
- DECLARE_PALETTE_INIT(magmax);
+ void magmax_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(scanline_callback);
diff --git a/src/mame/includes/mainsnk.h b/src/mame/includes/mainsnk.h
index 58b8c418fe8..4711e811236 100644
--- a/src/mame/includes/mainsnk.h
+++ b/src/mame/includes/mainsnk.h
@@ -53,7 +53,7 @@ private:
TILE_GET_INFO_MEMBER(get_tx_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(mainsnk);
+ void mainsnk_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int scrollx, int scrolly );
diff --git a/src/mame/includes/malzak.h b/src/mame/includes/malzak.h
index e21e8f0664e..f67c2aa363b 100644
--- a/src/mame/includes/malzak.h
+++ b/src/mame/includes/malzak.h
@@ -66,7 +66,7 @@ private:
DECLARE_WRITE8_MEMBER(malzak_playfield_w);
DECLARE_READ8_MEMBER(videoram_r);
- DECLARE_PALETTE_INIT(malzak);
+ void malzak_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void malzak2_map(address_map &map);
diff --git a/src/mame/includes/mappy.h b/src/mame/includes/mappy.h
index 4bedd29328e..4137691847a 100644
--- a/src/mame/includes/mappy.h
+++ b/src/mame/includes/mappy.h
@@ -91,11 +91,11 @@ private:
template<uint8_t Chip> TIMER_CALLBACK_MEMBER(namcoio_run_timer);
DECLARE_VIDEO_START(superpac);
- DECLARE_PALETTE_INIT(superpac);
+ void superpac_palette(palette_device &palette) const;
DECLARE_VIDEO_START(phozon);
- DECLARE_PALETTE_INIT(phozon);
+ void phozon_palette(palette_device &palette) const;
DECLARE_VIDEO_START(mappy);
- DECLARE_PALETTE_INIT(mappy);
+ void mappy_palette(palette_device &palette) const;
uint32_t screen_update_superpac(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_phozon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_mappy(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/marineb.h b/src/mame/includes/marineb.h
index baa5064772f..ed70b14892c 100644
--- a/src/mame/includes/marineb.h
+++ b/src/mame/includes/marineb.h
@@ -65,7 +65,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(marineb);
+ void marineb_palette(palette_device &palette) const;
uint32_t screen_update_marineb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_changes(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_springer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h
index 2135f0ec64d..9e490383fba 100644
--- a/src/mame/includes/mario.h
+++ b/src/mame/includes/mario.h
@@ -138,7 +138,7 @@ private:
virtual void video_start() override;
virtual void sound_start() override;
virtual void sound_reset() override;
- DECLARE_PALETTE_INIT(mario);
+ void mario_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
DECLARE_WRITE8_MEMBER(mario_sh_sound_w);
diff --git a/src/mame/includes/markham.h b/src/mame/includes/markham.h
index 31311d1eb97..4e94ddc4390 100644
--- a/src/mame/includes/markham.h
+++ b/src/mame/includes/markham.h
@@ -88,7 +88,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(markham);
+ void markham_palette(palette_device &palette) const;
DECLARE_VIDEO_START(strnskil);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/matmania.h b/src/mame/includes/matmania.h
index 0e85d2f7ea2..54d4873b670 100644
--- a/src/mame/includes/matmania.h
+++ b/src/mame/includes/matmania.h
@@ -71,7 +71,7 @@ private:
DECLARE_WRITE8_MEMBER(matmania_sh_command_w);
DECLARE_WRITE8_MEMBER(maniach_sh_command_w);
DECLARE_WRITE8_MEMBER(matmania_paletteram_w);
- DECLARE_PALETTE_INIT(matmania);
+ void matmania_palette(palette_device &palette) const;
uint32_t screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void maniach_map(address_map &map);
diff --git a/src/mame/includes/mbc55x.h b/src/mame/includes/mbc55x.h
index d046a5d6732..78faa224c0b 100644
--- a/src/mame/includes/mbc55x.h
+++ b/src/mame/includes/mbc55x.h
@@ -146,7 +146,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(vid_vsync_changed);
MC6845_UPDATE_ROW(crtc_update_row);
- DECLARE_PALETTE_INIT(mbc55x);
+ void mbc55x_palette(palette_device &palette) const;
TIMER_CALLBACK_MEMBER(keyscan_callback);
void mbc55x_io(address_map &map);
diff --git a/src/mame/includes/mbee.h b/src/mame/includes/mbee.h
index da03bdafc90..29bf255e9c5 100644
--- a/src/mame/includes/mbee.h
+++ b/src/mame/includes/mbee.h
@@ -120,8 +120,8 @@ private:
DECLARE_VIDEO_START(mono);
DECLARE_VIDEO_START(standard);
DECLARE_VIDEO_START(premium);
- DECLARE_PALETTE_INIT(standard);
- DECLARE_PALETTE_INIT(premium);
+ void standard_palette(palette_device &palette) const;
+ void premium_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(mbee56);
DECLARE_MACHINE_RESET(mbee128);
DECLARE_MACHINE_RESET(mbee256);
diff --git a/src/mame/includes/mcr3.h b/src/mame/includes/mcr3.h
index 647a04182df..f98c59d90ed 100644
--- a/src/mame/includes/mcr3.h
+++ b/src/mame/includes/mcr3.h
@@ -61,7 +61,7 @@ public:
void init_spyhunt();
void init_sarge();
DECLARE_VIDEO_START(spyhunt);
- DECLARE_PALETTE_INIT(spyhunt);
+ void spyhunt_palette(palette_device &palette) const;
uint32_t screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/megasys1.h b/src/mame/includes/megasys1.h
index 6249e26bb03..158e18277a9 100644
--- a/src/mame/includes/megasys1.h
+++ b/src/mame/includes/megasys1.h
@@ -175,7 +175,7 @@ private:
DECLARE_MACHINE_RESET(megasys1);
DECLARE_VIDEO_START(megasys1);
- DECLARE_PALETTE_INIT(megasys1);
+ void megasys1_palette(palette_device &palette);
DECLARE_MACHINE_RESET(megasys1_hachoo);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/megazone.h b/src/mame/includes/megazone.h
index 52a45854efc..7573acd4439 100644
--- a/src/mame/includes/megazone.h
+++ b/src/mame/includes/megazone.h
@@ -73,7 +73,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(megazone);
+ void megazone_palette(palette_device &palette) const;
uint32_t screen_update_megazone(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void megazone_i8039_io_map(address_map &map);
diff --git a/src/mame/includes/mermaid.h b/src/mame/includes/mermaid.h
index f4bcfd783e5..6ed14f00197 100644
--- a/src/mame/includes/mermaid.h
+++ b/src/mame/includes/mermaid.h
@@ -106,8 +106,9 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(mermaid);
- DECLARE_PALETTE_INIT(rougien);
+ void common_palette(palette_device &palette) const;
+ void mermaid_palette(palette_device &palette) const;
+ void rougien_palette(palette_device &palette) const;
uint32_t screen_update_mermaid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_mermaid);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/micronic.h b/src/mame/includes/micronic.h
index 82656a0ea18..d4b019ffba7 100644
--- a/src/mame/includes/micronic.h
+++ b/src/mame/includes/micronic.h
@@ -73,7 +73,7 @@ private:
DECLARE_WRITE8_MEMBER( rtc_data_w );
DECLARE_WRITE_LINE_MEMBER( mc146818_irq );
- DECLARE_PALETTE_INIT(micronic);
+ void micronic_palette(palette_device &palette) const;
void micronic_io(address_map &map);
void micronic_mem(address_map &map);
diff --git a/src/mame/includes/mikie.h b/src/mame/includes/mikie.h
index 1f8fdfc1c6c..c58a465ee12 100644
--- a/src/mame/includes/mikie.h
+++ b/src/mame/includes/mikie.h
@@ -58,7 +58,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(mikie);
+ void mikie_palette(palette_device &palette) const;
uint32_t screen_update_mikie(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/mikromik.h b/src/mame/includes/mikromik.h
index 92186318482..07f5e65b582 100644
--- a/src/mame/includes/mikromik.h
+++ b/src/mame/includes/mikromik.h
@@ -134,7 +134,7 @@ private:
DECLARE_FLOPPY_FORMATS( floppy_formats );
I8275_DRAW_CHARACTER_MEMBER( crtc_display_pixels );
UPD7220_DISPLAY_PIXELS_MEMBER( hgdc_display_pixels );
- DECLARE_PALETTE_INIT( mm1 );
+ void mm1_palette(palette_device &palette) const;
void mm1_map(address_map &map);
void mm1_upd7220_map(address_map &map);
};
diff --git a/src/mame/includes/mouser.h b/src/mame/includes/mouser.h
index 657b7d28737..aaaf2e65848 100644
--- a/src/mame/includes/mouser.h
+++ b/src/mame/includes/mouser.h
@@ -55,7 +55,7 @@ private:
DECLARE_WRITE8_MEMBER(mouser_sound_nmi_clear_w);
DECLARE_WRITE_LINE_MEMBER(flip_screen_x_w);
DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
- DECLARE_PALETTE_INIT(mouser);
+ void mouser_palette(palette_device &palette) const;
uint32_t screen_update_mouser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(mouser_nmi_interrupt);
INTERRUPT_GEN_MEMBER(mouser_sound_nmi_assert);
diff --git a/src/mame/includes/mrdo.h b/src/mame/includes/mrdo.h
index 86861aaaae9..0896d2661c7 100644
--- a/src/mame/includes/mrdo.h
+++ b/src/mame/includes/mrdo.h
@@ -54,7 +54,7 @@ private:
DECLARE_WRITE8_MEMBER(mrdo_flipscreen_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(mrdo);
+ void mrdo_palette(palette_device &palette) const;
uint32_t screen_update_mrdo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap,const rectangle &cliprect );
void main_map(address_map &map);
diff --git a/src/mame/includes/mrjong.h b/src/mame/includes/mrjong.h
index 85b6277a70a..8e5907c66da 100644
--- a/src/mame/includes/mrjong.h
+++ b/src/mame/includes/mrjong.h
@@ -33,7 +33,7 @@ private:
DECLARE_WRITE8_MEMBER(mrjong_flipscreen_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(mrjong);
+ void mrjong_palette(palette_device &palette) const;
uint32_t screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/munchmo.h b/src/mame/includes/munchmo.h
index 80ec3fcbf69..e85bce77918 100644
--- a/src/mame/includes/munchmo.h
+++ b/src/mame/includes/munchmo.h
@@ -54,7 +54,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(palette_bank_1_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- DECLARE_PALETTE_INIT(munchmo);
+ void munchmo_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
IRQ_CALLBACK_MEMBER(generic_irq_ack);
diff --git a/src/mame/includes/mz2500.h b/src/mame/includes/mz2500.h
index 013582b222c..6cf34fe401c 100644
--- a/src/mame/includes/mz2500.h
+++ b/src/mame/includes/mz2500.h
@@ -170,7 +170,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(mz2500);
+ void mz2500_palette(palette_device &palette) const;
uint32_t screen_update_mz2500(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(mz2500_vbl);
diff --git a/src/mame/includes/n8080.h b/src/mame/includes/n8080.h
index 02a5e6fdb23..6ab6e33a958 100644
--- a/src/mame/includes/n8080.h
+++ b/src/mame/includes/n8080.h
@@ -100,12 +100,12 @@ private:
DECLARE_WRITE8_MEMBER(n8080_status_callback);
DECLARE_MACHINE_RESET(spacefev);
DECLARE_VIDEO_START(spacefev);
- DECLARE_PALETTE_INIT(n8080);
+ void n8080_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(sheriff);
DECLARE_VIDEO_START(sheriff);
DECLARE_MACHINE_RESET(helifire);
DECLARE_VIDEO_START(helifire);
- DECLARE_PALETTE_INIT(helifire);
+ void helifire_palette(palette_device &palette) const;
DECLARE_SOUND_START(spacefev);
DECLARE_SOUND_RESET(spacefev);
DECLARE_SOUND_START(sheriff);
diff --git a/src/mame/includes/namcos86.h b/src/mame/includes/namcos86.h
index 05822f3b638..691c740ad69 100644
--- a/src/mame/includes/namcos86.h
+++ b/src/mame/includes/namcos86.h
@@ -67,7 +67,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info2);
TILE_GET_INFO_MEMBER(get_tile_info3);
- DECLARE_PALETTE_INIT(namcos86);
+ void namcos86_palette(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
diff --git a/src/mame/includes/naughtyb.h b/src/mame/includes/naughtyb.h
index f78609c9f05..1ff72be7dbe 100644
--- a/src/mame/includes/naughtyb.h
+++ b/src/mame/includes/naughtyb.h
@@ -67,7 +67,7 @@ private:
DECLARE_WRITE8_MEMBER(naughtyb_videoreg_w);
DECLARE_WRITE8_MEMBER(popflame_videoreg_w);
- DECLARE_PALETTE_INIT(naughtyb);
+ void naughtyb_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/nbmj8688.h b/src/mame/includes/nbmj8688.h
index 396c5920950..92a87c2a6d9 100644
--- a/src/mame/includes/nbmj8688.h
+++ b/src/mame/includes/nbmj8688.h
@@ -125,12 +125,12 @@ private:
DECLARE_WRITE8_MEMBER(barline_output_w);
DECLARE_VIDEO_START(mbmj8688_pure_12bit);
- DECLARE_PALETTE_INIT(mbmj8688_12bit);
+ void mbmj8688_12bit(palette_device &palette) const;
DECLARE_VIDEO_START(mbmj8688_pure_16bit_LCD);
- DECLARE_PALETTE_INIT(mbmj8688_16bit);
- DECLARE_PALETTE_INIT(mbmj8688_lcd);
+ void mbmj8688_16bit(palette_device &palette) const;
+ void mbmj8688_lcd(palette_device &palette) const;
DECLARE_VIDEO_START(mbmj8688_8bit);
- DECLARE_PALETTE_INIT(mbmj8688_8bit);
+ void mbmj8688_8bit(palette_device &palette) const;
DECLARE_VIDEO_START(mbmj8688_hybrid_16bit);
DECLARE_VIDEO_START(mbmj8688_hybrid_12bit);
DECLARE_VIDEO_START(mbmj8688_pure_16bit);
diff --git a/src/mame/includes/nc.h b/src/mame/includes/nc.h
index cf35feedda9..4610b3903d7 100644
--- a/src/mame/includes/nc.h
+++ b/src/mame/includes/nc.h
@@ -73,7 +73,7 @@ protected:
DECLARE_WRITE8_MEMBER(nc_uart_control_w);
DECLARE_WRITE8_MEMBER(nc100_display_memory_start_w);
- DECLARE_PALETTE_INIT(nc);
+ void nc_colours(palette_device &palette) const;
TIMER_CALLBACK_MEMBER(nc_keyboard_timer_callback);
TIMER_DEVICE_CALLBACK_MEMBER(dummy_timer_callback);
DECLARE_WRITE_LINE_MEMBER(write_uart_clock);
diff --git a/src/mame/includes/norautp.h b/src/mame/includes/norautp.h
index 9768787f3da..c912b0ccd13 100644
--- a/src/mame/includes/norautp.h
+++ b/src/mame/includes/norautp.h
@@ -60,7 +60,7 @@ private:
DECLARE_WRITE8_MEMBER(mainlamps_w);
DECLARE_WRITE8_MEMBER(soundlamps_w);
DECLARE_WRITE8_MEMBER(counterlamps_w);
- DECLARE_PALETTE_INIT(norautp);
+ void norautp_palette(palette_device &palette) const;
uint32_t screen_update_norautp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void dphl_map(address_map &map);
void dphla_map(address_map &map);
diff --git a/src/mame/includes/nova2001.h b/src/mame/includes/nova2001.h
index 48b6b5b8ccb..c1d105e78d1 100644
--- a/src/mame/includes/nova2001.h
+++ b/src/mame/includes/nova2001.h
@@ -56,8 +56,8 @@ private:
DECLARE_WRITE8_MEMBER(pkunwar_flipscreen_w);
DECLARE_VIDEO_START(nova2001);
- DECLARE_PALETTE_INIT(nova2001);
- DECLARE_PALETTE_DECODER(BBGGRRII);
+ void nova2001_palette(palette_device &palette) const;
+ static rgb_t BBGGRRII(uint32_t raw);
DECLARE_MACHINE_START(ninjakun);
DECLARE_VIDEO_START(ninjakun);
DECLARE_VIDEO_START(pkunwar);
diff --git a/src/mame/includes/novagbase.h b/src/mame/includes/novagbase.h
index c9e58a33f5c..8957c6fafd9 100644
--- a/src/mame/includes/novagbase.h
+++ b/src/mame/includes/novagbase.h
@@ -67,7 +67,7 @@ protected:
u16 m_display_segmask[0x20]; // if not 0, display matrix row is a digit, mask indicates connected segments
u8 m_display_decay[0x20][0x20]; // (internal use)
- DECLARE_PALETTE_INIT(novag_lcd);
+ void novag_lcd_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(display_decay_tick);
HD44780_PIXEL_UPDATE(novag_lcd_pixel_update);
void display_update();
diff --git a/src/mame/includes/ojankohs.h b/src/mame/includes/ojankohs.h
index 1a0dca5c8ba..c70a5a10e8c 100644
--- a/src/mame/includes/ojankohs.h
+++ b/src/mame/includes/ojankohs.h
@@ -112,7 +112,7 @@ private:
DECLARE_VIDEO_START(ojankohs);
DECLARE_MACHINE_START(ojankoy);
DECLARE_VIDEO_START(ojankoy);
- DECLARE_PALETTE_INIT(ojankoy);
+ void ojankoy_palette(palette_device &palette) const;
DECLARE_VIDEO_START(ccasino);
DECLARE_MACHINE_START(ojankoc);
DECLARE_VIDEO_START(ojankoc);
diff --git a/src/mame/includes/orion.h b/src/mame/includes/orion.h
index 3a17968b13f..74252c5f6a5 100644
--- a/src/mame/includes/orion.h
+++ b/src/mame/includes/orion.h
@@ -81,7 +81,7 @@ protected:
DECLARE_WRITE8_MEMBER(orionpro_io_w);
DECLARE_MACHINE_START(orion128);
DECLARE_MACHINE_RESET(orion128);
- DECLARE_PALETTE_INIT(orion128);
+ void orion128_palette(palette_device &palette) const;
uint32_t screen_update_orion128(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(orionz80_interrupt);
DECLARE_READ8_MEMBER(orion_romdisk_porta_r);
diff --git a/src/mame/includes/osi.h b/src/mame/includes/osi.h
index a67d3b2ec5f..2e50c0d585d 100644
--- a/src/mame/includes/osi.h
+++ b/src/mame/includes/osi.h
@@ -60,7 +60,7 @@ protected:
void floppy_index_callback(floppy_image_device *floppy, int state);
- DECLARE_PALETTE_INIT(osi630);
+ void osi630_palette(palette_device &palette) const;
void osi600_video(machine_config &config);
void osi630_video(machine_config &config);
diff --git a/src/mame/includes/p2000t.h b/src/mame/includes/p2000t.h
index c66a33d1e23..4c41f72e9fe 100644
--- a/src/mame/includes/p2000t.h
+++ b/src/mame/includes/p2000t.h
@@ -75,7 +75,7 @@ public:
protected:
virtual void video_start() override;
- DECLARE_PALETTE_INIT(p2000m);
+ void p2000m_palette(palette_device &palette) const;
uint32_t screen_update_p2000m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void p2000m_mem(address_map &map);
diff --git a/src/mame/includes/pacland.h b/src/mame/includes/pacland.h
index 6c29eecf757..c7318b1a482 100644
--- a/src/mame/includes/pacland.h
+++ b/src/mame/includes/pacland.h
@@ -71,7 +71,7 @@ public:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pacland);
+ void pacland_palette(palette_device &palette);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/pacman.h b/src/mame/includes/pacman.h
index 0546384e451..da0ccd3c4cd 100644
--- a/src/mame/includes/pacman.h
+++ b/src/mame/includes/pacman.h
@@ -181,7 +181,7 @@ public:
TILEMAP_MAPPER_MEMBER(jrpacman_scan_rows);
TILE_GET_INFO_MEMBER(jrpacman_get_tile_info);
DECLARE_VIDEO_START(pacman);
- DECLARE_PALETTE_INIT(pacman);
+ void pacman_palette(palette_device &palette) const;
DECLARE_VIDEO_START(birdiy);
DECLARE_VIDEO_START(s2650games);
DECLARE_MACHINE_RESET(mschamp);
diff --git a/src/mame/includes/pandoras.h b/src/mame/includes/pandoras.h
index 08ada3b1b0b..af483dd4b35 100644
--- a/src/mame/includes/pandoras.h
+++ b/src/mame/includes/pandoras.h
@@ -71,7 +71,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pandoras);
+ void pandoras_palette(palette_device &palette) const;
uint32_t screen_update_pandoras(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t* sr );
diff --git a/src/mame/includes/pastelg.h b/src/mame/includes/pastelg.h
index e140c84af1b..8c25d968e8b 100644
--- a/src/mame/includes/pastelg.h
+++ b/src/mame/includes/pastelg.h
@@ -63,7 +63,7 @@ public:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pastelg);
+ void pastelg_palette(palette_device &palette) const;
uint32_t screen_update_pastelg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
int pastelg_blitter_src_addr_r();
void pastelg_vramflip();
diff --git a/src/mame/includes/pbaction.h b/src/mame/includes/pbaction.h
index f5038b82d73..3ebc7d442db 100644
--- a/src/mame/includes/pbaction.h
+++ b/src/mame/includes/pbaction.h
@@ -94,13 +94,14 @@ public:
class pbaction_tecfri_state : public pbaction_state
{
public:
- pbaction_tecfri_state(const machine_config &mconfig, device_type type, const char *tag)
- : pbaction_state(mconfig, type, tag),
+ pbaction_tecfri_state(const machine_config &mconfig, device_type type, const char *tag) :
+ pbaction_state(mconfig, type, tag),
m_subcpu(*this, "subcpu"),
m_ctc2(*this, "ctc2"),
m_maintosublatch(*this, "maintosublatch"),
//m_subtomainlatch(*this, "subtomainlatch"),
- m_digits(*this, "digit%u", 0U) { }
+ m_digits(*this, "digit%u", 0U)
+ { }
void pbactiont(machine_config &config);
diff --git a/src/mame/includes/pc4.h b/src/mame/includes/pc4.h
index f799382a865..ed5eac80488 100644
--- a/src/mame/includes/pc4.h
+++ b/src/mame/includes/pc4.h
@@ -5,11 +5,11 @@
VTech Laser PC4
****************************************************************************/
+#ifndef MAME_INCLUDES_PC4_H
+#define MAME_INCLUDES_PC4_H
#pragma once
-#ifndef MAME_INCLUDES_PC4_H
-#define MAME_INCLUDES_PC4_H
#include "sound/beep.h"
#include "emupal.h"
@@ -17,27 +17,34 @@
class pc4_state : public driver_device
{
public:
- pc4_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pc4_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beep(*this, "beeper"),
m_region_charset(*this, "charset"),
- m_rombank(*this, "rombank") { }
+ m_rombank(*this, "rombank")
+ { }
- required_device<cpu_device> m_maincpu;
- required_device<beep_device> m_beep;
+ void pc4(machine_config &config);
+
+protected:
+ static const device_timer_id BUSY_TIMER = 0;
+ static const device_timer_id BLINKING_TIMER = 1;
- uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual void machine_start() override;
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
+private:
+ uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+
DECLARE_WRITE8_MEMBER( beep_w );
DECLARE_WRITE8_MEMBER( bank_w );
DECLARE_READ8_MEMBER( kb_r );
//LCD controller
- void update_ac(void);
+ void update_ac();
void set_busy_flag(uint16_t usec);
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
DECLARE_WRITE8_MEMBER(lcd_control_w);
DECLARE_READ8_MEMBER(lcd_control_r);
@@ -45,8 +52,10 @@ public:
DECLARE_READ8_MEMBER(lcd_data_r);
DECLARE_WRITE8_MEMBER( lcd_offset_w );
- static const device_timer_id BUSY_TIMER = 0;
- static const device_timer_id BLINKING_TIMER = 1;
+ void pc4_palette(palette_device &palette) const;
+
+ void pc4_io(address_map &map);
+ void pc4_mem(address_map &map);
emu_timer *m_blink_timer;
emu_timer *m_busy_timer;
@@ -65,12 +74,10 @@ public:
int8_t m_disp_shift;
int8_t m_direction;
uint8_t m_blink;
- DECLARE_PALETTE_INIT(pc4);
- void pc4(machine_config &config);
- void pc4_io(address_map &map);
- void pc4_mem(address_map &map);
-protected:
+ required_device<cpu_device> m_maincpu;
+ required_device<beep_device> m_beep;
+
required_memory_region m_region_charset;
required_memory_bank m_rombank;
ioport_port *io_port[8];
diff --git a/src/mame/includes/pc6001.h b/src/mame/includes/pc6001.h
index 836d5ceeebc..175ae918c71 100644
--- a/src/mame/includes/pc6001.h
+++ b/src/mame/includes/pc6001.h
@@ -53,7 +53,7 @@ public:
DECLARE_READ8_MEMBER(nec_ppi8255_r);
DECLARE_WRITE8_MEMBER(nec_ppi8255_w);
- DECLARE_PALETTE_INIT(pc6001);
+ void pc6001_palette(palette_device &palette) const;
uint32_t screen_update_pc6001(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -175,7 +175,7 @@ public:
DECLARE_WRITE8_MEMBER(mk2_timer_adj_w);
DECLARE_WRITE8_MEMBER(mk2_timer_irqv_w);
- DECLARE_PALETTE_INIT(pc6001mk2);
+ void pc6001mk2_palette(palette_device &palette) const;
void pc6001mk2(machine_config &config);
uint32_t screen_update_pc6001mk2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/pc8401a.h b/src/mame/includes/pc8401a.h
index 4548da89ad4..d01cc5982a3 100644
--- a/src/mame/includes/pc8401a.h
+++ b/src/mame/includes/pc8401a.h
@@ -83,7 +83,7 @@ public:
DECLARE_WRITE8_MEMBER( port71_w );
DECLARE_READ8_MEMBER( ppi_pc_r );
DECLARE_WRITE8_MEMBER( ppi_pc_w );
- DECLARE_PALETTE_INIT(pc8401a);
+ void pc8401a_palette(palette_device &palette) const;
void scan_keyboard();
void bankswitch(uint8_t data);
diff --git a/src/mame/includes/pc8801.h b/src/mame/includes/pc8801.h
index 5de446834dc..92c6963ecae 100644
--- a/src/mame/includes/pc8801.h
+++ b/src/mame/includes/pc8801.h
@@ -237,7 +237,7 @@ private:
void draw_text(bitmap_ind16 &bitmap,int y_size, uint8_t width);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(pc8801);
+ void pc8801_palette(palette_device &palette) const;
void pc8801_io(address_map &map);
void pc8801_mem(address_map &map);
void pc8801fdc_io(address_map &map);
diff --git a/src/mame/includes/pc9801.h b/src/mame/includes/pc9801.h
index 69dcc89c0f1..f7c51eb2185 100644
--- a/src/mame/includes/pc9801.h
+++ b/src/mame/includes/pc9801.h
@@ -278,7 +278,7 @@ private:
DECLARE_MACHINE_RESET(pc9801rs);
DECLARE_MACHINE_RESET(pc9821);
- DECLARE_PALETTE_INIT(pc9801);
+ void pc9801_palette(palette_device &palette) const;
DECLARE_WRITE_LINE_MEMBER(vrtc_irq);
DECLARE_READ8_MEMBER(get_slave_ack);
DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed);
diff --git a/src/mame/includes/pcktgal.h b/src/mame/includes/pcktgal.h
index 8e119425a00..075161db2f0 100644
--- a/src/mame/includes/pcktgal.h
+++ b/src/mame/includes/pcktgal.h
@@ -46,7 +46,7 @@ public:
DECLARE_WRITE_LINE_MEMBER(adpcm_int);
void init_pcktgal();
- DECLARE_PALETTE_INIT(pcktgal);
+ void pcktgal_palette(palette_device &palette) const;
virtual void machine_start() override;
uint32_t screen_update_pcktgal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/pcw.h b/src/mame/includes/pcw.h
index 138d4a4b703..2e2c3891300 100644
--- a/src/mame/includes/pcw.h
+++ b/src/mame/includes/pcw.h
@@ -116,7 +116,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pcw);
+ void pcw_colours(palette_device &palette) const;
uint32_t screen_update_pcw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_pcw_printer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(pcw_timer_pulse);
diff --git a/src/mame/includes/pcw16.h b/src/mame/includes/pcw16.h
index 2a9c76f8566..0447234b860 100644
--- a/src/mame/includes/pcw16.h
+++ b/src/mame/includes/pcw16.h
@@ -97,7 +97,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pcw16);
+ void pcw16_colours(palette_device &palette) const;
uint32_t screen_update_pcw16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(pcw16_timer_callback);
TIMER_DEVICE_CALLBACK_MEMBER(rtc_timer_callback);
@@ -109,9 +109,9 @@ protected:
DECLARE_WRITE_LINE_MEMBER( fdc_interrupt );
DECLARE_FLOPPY_FORMATS( floppy_formats );
inline void pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, uint32_t color);
- void pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte);
- void pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte);
- void pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte);
+ void pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, uint8_t byte);
+ void pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, uint8_t byte);
+ void pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, uint8_t byte);
void pcw16_io(address_map &map);
void pcw16_map(address_map &map);
diff --git a/src/mame/includes/pdp1.h b/src/mame/includes/pdp1.h
index 5342d016bfb..102554eb438 100644
--- a/src/mame/includes/pdp1.h
+++ b/src/mame/includes/pdp1.h
@@ -267,7 +267,7 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pdp1);
+ void pdp1_palette(palette_device &palette) const;
uint32_t screen_update_pdp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_pdp1);
INTERRUPT_GEN_MEMBER(pdp1_interrupt);
diff --git a/src/mame/includes/phoenix.h b/src/mame/includes/phoenix.h
index b3bad7f1e4f..e66be308575 100644
--- a/src/mame/includes/phoenix.h
+++ b/src/mame/includes/phoenix.h
@@ -36,9 +36,9 @@ public:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_MACHINE_RESET(phoenix);
DECLARE_VIDEO_START(phoenix);
- DECLARE_PALETTE_INIT(phoenix);
- DECLARE_PALETTE_INIT(survival);
- DECLARE_PALETTE_INIT(pleiads);
+ void phoenix_palette(palette_device &palette) const;
+ void survival_palette(palette_device &palette) const;
+ void pleiads_palette(palette_device &palette) const;
uint32_t screen_update_phoenix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_READ8_MEMBER(survival_protection_r);
DECLARE_READ_LINE_MEMBER(survival_sid_callback);
diff --git a/src/mame/includes/pingpong.h b/src/mame/includes/pingpong.h
index 3aba860b091..fab62d8945c 100644
--- a/src/mame/includes/pingpong.h
+++ b/src/mame/includes/pingpong.h
@@ -40,7 +40,7 @@ public:
void init_merlinmm();
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pingpong);
+ void pingpong_palette(palette_device &palette) const;
uint32_t screen_update_pingpong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(pingpong_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(merlinmm_interrupt);
diff --git a/src/mame/includes/pitnrun.h b/src/mame/includes/pitnrun.h
index 64b6e85b386..405fe188c1e 100644
--- a/src/mame/includes/pitnrun.h
+++ b/src/mame/includes/pitnrun.h
@@ -88,7 +88,7 @@ private:
TIMER_CALLBACK_MEMBER(mcu_data_real_r);
TIMER_CALLBACK_MEMBER(mcu_status_real_w);
- DECLARE_PALETTE_INIT(pitnrun);
+ void pitnrun_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void spotlights();
diff --git a/src/mame/includes/pk8000.h b/src/mame/includes/pk8000.h
index 8855b7f7498..6bd85f76204 100644
--- a/src/mame/includes/pk8000.h
+++ b/src/mame/includes/pk8000.h
@@ -33,7 +33,7 @@ protected:
DECLARE_READ8_MEMBER(color_r);
DECLARE_WRITE8_MEMBER(color_w);
- DECLARE_PALETTE_INIT(pk8000);
+ void pk8000_palette(palette_device &palette) const;
uint32_t video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *videomem);
uint8_t m_text_start;
diff --git a/src/mame/includes/pk8020.h b/src/mame/includes/pk8020.h
index fe40d80a176..23ffb6f3cd5 100644
--- a/src/mame/includes/pk8020.h
+++ b/src/mame/includes/pk8020.h
@@ -50,20 +50,13 @@ public:
void pk8020(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
- uint8_t m_color;
- uint8_t m_video_page;
- uint8_t m_wide;
- uint8_t m_font;
- uint8_t m_attr;
- uint8_t m_text_attr;
- uint8_t m_takt;
- uint8_t m_video_page_access;
- uint8_t m_portc_data;
- uint8_t m_sound_gate;
- uint8_t m_sound_level;
DECLARE_READ8_MEMBER(keyboard_r);
DECLARE_READ8_MEMBER(sysreg_r);
DECLARE_WRITE8_MEMBER(sysreg_w);
@@ -73,9 +66,7 @@ private:
DECLARE_WRITE8_MEMBER(gzu_w);
DECLARE_READ8_MEMBER(devices_r);
DECLARE_WRITE8_MEMBER(devices_w);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(pk8020);
+ void pk8020_palette(palette_device &palette) const;
uint32_t screen_update_pk8020(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(pk8020_interrupt);
DECLARE_READ8_MEMBER(pk8020_porta_r);
@@ -85,10 +76,23 @@ private:
DECLARE_WRITE8_MEMBER(pk8020_2_portc_w);
DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out0);
DECLARE_WRITE_LINE_MEMBER(pk8020_pit_out1);
+ void pk8020_set_bank(uint8_t data);
void pk8020_io(address_map &map);
void pk8020_mem(address_map &map);
+ uint8_t m_color;
+ uint8_t m_video_page;
+ uint8_t m_wide;
+ uint8_t m_font;
+ uint8_t m_attr;
+ uint8_t m_text_attr;
+ uint8_t m_takt;
+ uint8_t m_video_page_access;
+ uint8_t m_portc_data;
+ uint8_t m_sound_gate;
+ uint8_t m_sound_level;
+
required_device<cpu_device> m_maincpu;
required_device<i8255_device> m_ppi8255_1;
required_device<i8255_device> m_ppi8255_2;
@@ -108,7 +112,6 @@ private:
required_region_ptr<uint8_t> m_region_gfx1;
ioport_port *m_io_port[16];
required_device<palette_device> m_palette;
- void pk8020_set_bank(uint8_t data);
};
#endif // MAME_INCLUDES_PK8020_H
diff --git a/src/mame/includes/playch10.h b/src/mame/includes/playch10.h
index 8f82e96bcdb..cc04e5d7d9d 100644
--- a/src/mame/includes/playch10.h
+++ b/src/mame/includes/playch10.h
@@ -102,7 +102,7 @@ private:
uint8_t* chr; // direct access to the memory
};
- DECLARE_PALETTE_INIT(playch10);
+ void playch10_palette(palette_device &palette) const;
DECLARE_MACHINE_START(playch10_hboard);
DECLARE_VIDEO_START(playch10_hboard);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/pocketc.h b/src/mame/includes/pocketc.h
index a750bac9c6c..2eae2e05115 100644
--- a/src/mame/includes/pocketc.h
+++ b/src/mame/includes/pocketc.h
@@ -34,16 +34,16 @@ public:
void pocketc_base(machine_config &config);
protected:
+ static const device_timer_id TIMER_POWER_UP = 0;
+
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- DECLARE_PALETTE_INIT(pocketc);
+ void pocketc_palette(palette_device &palette) const;
void pocketc_draw_special(bitmap_ind16 &bitmap,int x, int y, const char* const *fig, int color);
- static const device_timer_id TIMER_POWER_UP = 0;
-
DECLARE_WRITE8_MEMBER(out_a_w);
DECLARE_READ_LINE_MEMBER(brk_r);
diff --git a/src/mame/includes/polepos.h b/src/mame/includes/polepos.h
index ed7775d7e01..accfbd89b9a 100644
--- a/src/mame/includes/polepos.h
+++ b/src/mame/includes/polepos.h
@@ -115,7 +115,7 @@ private:
DECLARE_WRITE8_MEMBER(bootleg_soundlatch_w);
TILE_GET_INFO_MEMBER(bg_get_tile_info);
TILE_GET_INFO_MEMBER(tx_get_tile_info);
- DECLARE_PALETTE_INIT(polepos);
+ void polepos_palette(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(scanline);
void draw_road(bitmap_ind16 &bitmap);
diff --git a/src/mame/includes/polyplay.h b/src/mame/includes/polyplay.h
index bf9867934f6..4e84d08d2e1 100644
--- a/src/mame/includes/polyplay.h
+++ b/src/mame/includes/polyplay.h
@@ -60,7 +60,7 @@ private:
DECLARE_WRITE8_MEMBER(pio_portb_w);
DECLARE_WRITE8_MEMBER(polyplay_characterram_w);
- DECLARE_PALETTE_INIT(polyplay);
+ void polyplay_palette(palette_device &palette) const;
uint32_t screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void polyplay_io_zre(address_map &map);
void polyplay_io_zrepp(address_map &map);
diff --git a/src/mame/includes/poolshrk.h b/src/mame/includes/poolshrk.h
index c8c284ec8f8..84aa6ccbc3d 100644
--- a/src/mame/includes/poolshrk.h
+++ b/src/mame/includes/poolshrk.h
@@ -49,7 +49,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(poolshrk);
+ void poolshrk_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual void video_start() override;
diff --git a/src/mame/includes/pooyan.h b/src/mame/includes/pooyan.h
index 31a4396bb9d..8f743096232 100644
--- a/src/mame/includes/pooyan.h
+++ b/src/mame/includes/pooyan.h
@@ -52,7 +52,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(pooyan);
+ void pooyan_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/popeye.h b/src/mame/includes/popeye.h
index 3400e80af0b..8cb8a79d1de 100644
--- a/src/mame/includes/popeye.h
+++ b/src/mame/includes/popeye.h
@@ -74,7 +74,7 @@ protected:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void driver_start() override;
virtual void video_start() override;
- virtual DECLARE_PALETTE_INIT(tnx1);
+ virtual void tnx1_palette(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual DECLARE_WRITE_LINE_MEMBER(screen_vblank);
void update_palette();
@@ -93,7 +93,7 @@ class tpp1_state : public tnx1_state
{
using tnx1_state::tnx1_state;
protected:
- virtual DECLARE_PALETTE_INIT(tnx1) override;
+ virtual void tnx1_palette(palette_device &palette) override;
virtual void draw_background(bitmap_ind16 &bitmap, const rectangle &cliprect) override;
static const res_net_info tpp1_bak_mb7051_net_info;
diff --git a/src/mame/includes/portrait.h b/src/mame/includes/portrait.h
index 6bbce95a165..e3db2e6a473 100644
--- a/src/mame/includes/portrait.h
+++ b/src/mame/includes/portrait.h
@@ -41,7 +41,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(portrait);
+ void portrait_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info( tile_data &tileinfo, int tile_index, const uint8_t *source );
diff --git a/src/mame/includes/powerins.h b/src/mame/includes/powerins.h
index 0a89cbc0483..81189214703 100644
--- a/src/mame/includes/powerins.h
+++ b/src/mame/includes/powerins.h
@@ -1,5 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
+#ifndef MAME_INCLUDES_POWERINS_H
+#define MAME_INCLUDES_POWERINS_H
+
#include "emupal.h"
#include "screen.h"
@@ -64,3 +67,5 @@ private:
void powerinsa_oki_map(address_map &map);
void powerinsb_sound_io_map(address_map &map);
};
+
+#endif // MAME_INCLUDES_POWERINS_H
diff --git a/src/mame/includes/pp01.h b/src/mame/includes/pp01.h
index ace44ea26a7..dc034071611 100644
--- a/src/mame/includes/pp01.h
+++ b/src/mame/includes/pp01.h
@@ -24,15 +24,21 @@
class pp01_state : public driver_device
{
public:
- pp01_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ pp01_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_pit(*this, "pit8253"),
m_speaker(*this, "speaker"),
- m_ram(*this, RAM_TAG) { }
+ m_ram(*this, RAM_TAG)
+ { }
void pp01(machine_config &config);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+ virtual void video_start() override;
+
private:
required_device<cpu_device> m_maincpu;
required_device<pit8253_device> m_pit;
@@ -42,6 +48,7 @@ private:
uint8_t m_memory_block[16];
uint8_t m_video_write_mode;
uint8_t m_key_line;
+
DECLARE_WRITE8_MEMBER(pp01_video_write_mode_w);
DECLARE_WRITE8_MEMBER(pp01_video_r_1_w);
DECLARE_WRITE8_MEMBER(pp01_video_g_1_w);
@@ -51,10 +58,7 @@ private:
DECLARE_WRITE8_MEMBER(pp01_video_b_2_w);
DECLARE_WRITE8_MEMBER(pp01_mem_block_w);
DECLARE_READ8_MEMBER(pp01_mem_block_r);
- virtual void machine_start() override;
- virtual void machine_reset() override;
- virtual void video_start() override;
- DECLARE_PALETTE_INIT(pp01);
+ void pp01_palette(palette_device &palette) const;
uint32_t screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(pp01_pit_out0);
DECLARE_WRITE_LINE_MEMBER(pp01_pit_out1);
diff --git a/src/mame/includes/psion.h b/src/mame/includes/psion.h
index 0e2e67bf32f..e81d4cc30b9 100644
--- a/src/mame/includes/psion.h
+++ b/src/mame/includes/psion.h
@@ -90,7 +90,7 @@ protected:
void io_rw(address_space &space, uint16_t offset);
DECLARE_WRITE8_MEMBER( io_w );
DECLARE_READ8_MEMBER( io_r );
- DECLARE_PALETTE_INIT(psion);
+ void psion_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(nmi_timer);
HD44780_PIXEL_UPDATE(lz_pixel_update);
diff --git a/src/mame/includes/px8.h b/src/mame/includes/px8.h
index dcb938dd071..d8cec2111c3 100644
--- a/src/mame/includes/px8.h
+++ b/src/mame/includes/px8.h
@@ -84,7 +84,7 @@ private:
/* keyboard state */
int m_ksc; /* keyboard scan column */
- DECLARE_PALETTE_INIT(px8);
+ void px8_palette(palette_device &palette) const;
void px8_io(address_map &map);
void px8_mem(address_map &map);
void px8_slave_mem(address_map &map);
diff --git a/src/mame/includes/quasar.h b/src/mame/includes/quasar.h
index c192bc87f7e..7453770564f 100644
--- a/src/mame/includes/quasar.h
+++ b/src/mame/includes/quasar.h
@@ -21,11 +21,12 @@ public:
void quasar(machine_config &config);
-private:
+protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
+private:
DECLARE_WRITE8_MEMBER(video_page_select_w);
DECLARE_WRITE8_MEMBER(io_page_select_w);
DECLARE_WRITE8_MEMBER(quasar_video_w);
@@ -34,7 +35,7 @@ private:
DECLARE_WRITE8_MEMBER(quasar_sh_command_w);
DECLARE_READ8_MEMBER(quasar_sh_command_r);
DECLARE_READ_LINE_MEMBER(audio_t1_r);
- DECLARE_PALETTE_INIT(quasar);
+ void quasar_palette(palette_device &palette) const;
uint32_t screen_update_quasar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(quasar_interrupt);
diff --git a/src/mame/includes/radio86.h b/src/mame/includes/radio86.h
index fbc6c5907b1..5fd3afbb899 100644
--- a/src/mame/includes/radio86.h
+++ b/src/mame/includes/radio86.h
@@ -56,7 +56,7 @@ public:
void radio86_pagesel(uint8_t data);
void init_radioram();
void init_radio86();
- DECLARE_PALETTE_INIT(radio86);
+ void radio86_palette(palette_device &palette) const;
uint8_t radio86_8255_portb_r2();
uint8_t radio86_8255_portc_r2();
void radio86_8255_porta_w2(uint8_t data);
diff --git a/src/mame/includes/rallyx.h b/src/mame/includes/rallyx.h
index 69d09eab6ac..4c93463801e 100644
--- a/src/mame/includes/rallyx.h
+++ b/src/mame/includes/rallyx.h
@@ -84,9 +84,9 @@ public:
TILE_GET_INFO_MEMBER(locomotn_fg_get_tile_info);
DECLARE_MACHINE_START(rallyx);
DECLARE_VIDEO_START(rallyx);
- DECLARE_PALETTE_INIT(rallyx);
+ void rallyx_palette(palette_device &palette) const;
DECLARE_VIDEO_START(jungler);
- DECLARE_PALETTE_INIT(jungler);
+ void jungler_palette(palette_device &palette) const;
DECLARE_VIDEO_START(locomotn);
DECLARE_VIDEO_START(commsega);
uint32_t screen_update_rallyx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/redclash.h b/src/mame/includes/redclash.h
index 72f5259e686..5abdfb6dd07 100644
--- a/src/mame/includes/redclash.h
+++ b/src/mame/includes/redclash.h
@@ -49,7 +49,7 @@ private:
DECLARE_WRITE8_MEMBER(irqack_w);
DECLARE_WRITE8_MEMBER(redclash_star_reset_w);
template <unsigned B> DECLARE_WRITE8_MEMBER(redclash_star_w);
- DECLARE_PALETTE_INIT(redclash);
+ void redclash_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_fg_tile_info);
uint32_t screen_update_redclash(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/retofinv.h b/src/mame/includes/retofinv.h
index 670cc5658d4..14b326e2c39 100644
--- a/src/mame/includes/retofinv.h
+++ b/src/mame/includes/retofinv.h
@@ -55,8 +55,8 @@ private:
TILE_GET_INFO_MEMBER(bg_get_tile_info);
TILE_GET_INFO_MEMBER(fg_get_tile_info);
- DECLARE_PALETTE_INIT(retofinv);
- DECLARE_PALETTE_INIT(retofinv_bl);
+ void retofinv_palette(palette_device &palette) const;
+ void retofinv_bl_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/rockrage.h b/src/mame/includes/rockrage.h
index 67b56612f2f..a4692101516 100644
--- a/src/mame/includes/rockrage.h
+++ b/src/mame/includes/rockrage.h
@@ -58,7 +58,7 @@ private:
DECLARE_WRITE8_MEMBER(rockrage_speech_w);
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(rockrage);
+ void rockrage_palette(palette_device &palette) const;
uint32_t screen_update_rockrage(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
K007342_CALLBACK_MEMBER(rockrage_tile_callback);
diff --git a/src/mame/includes/rocnrope.h b/src/mame/includes/rocnrope.h
index 06b1f416162..216dd87c068 100644
--- a/src/mame/includes/rocnrope.h
+++ b/src/mame/includes/rocnrope.h
@@ -50,7 +50,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(rocnrope);
+ void rocnrope_palette(palette_device &palette) const;
uint32_t screen_update_rocnrope(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/rollrace.h b/src/mame/includes/rollrace.h
index 8931389cea6..1bdf698dbcc 100644
--- a/src/mame/includes/rollrace.h
+++ b/src/mame/includes/rollrace.h
@@ -67,7 +67,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
void tilemap_refresh_flip();
- DECLARE_PALETTE_INIT(rollrace);
+ void rollrace_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/samcoupe.h b/src/mame/includes/samcoupe.h
index f484c71a75c..52eed56b196 100644
--- a/src/mame/includes/samcoupe.h
+++ b/src/mame/includes/samcoupe.h
@@ -143,7 +143,7 @@ private:
DECLARE_READ8_MEMBER(samcoupe_keyboard_r);
DECLARE_WRITE8_MEMBER(samcoupe_border_w);
DECLARE_READ8_MEMBER(samcoupe_attributes_r);
- DECLARE_PALETTE_INIT(samcoupe);
+ void samcoupe_palette(palette_device &palette) const;
INTERRUPT_GEN_MEMBER(samcoupe_frame_interrupt);
TIMER_CALLBACK_MEMBER(irq_off);
TIMER_CALLBACK_MEMBER(samcoupe_mouse_reset);
diff --git a/src/mame/includes/sbasketb.h b/src/mame/includes/sbasketb.h
index 0780c076d95..663f93cbc11 100644
--- a/src/mame/includes/sbasketb.h
+++ b/src/mame/includes/sbasketb.h
@@ -77,7 +77,7 @@ private:
DECLARE_WRITE8_MEMBER( konami_SN76496_w ) { m_sn->write(m_SN76496_latch); };
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sbasketb);
+ void sbasketb_palette(palette_device &palette) const;
uint32_t screen_update_sbasketb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/sbugger.h b/src/mame/includes/sbugger.h
index 0bb1693e600..7ff4fc098cd 100644
--- a/src/mame/includes/sbugger.h
+++ b/src/mame/includes/sbugger.h
@@ -35,7 +35,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sbugger);
+ void sbugger_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void sbugger_io_map(address_map &map);
diff --git a/src/mame/includes/scotrsht.h b/src/mame/includes/scotrsht.h
index 58dfaddb6cd..19c426e91b5 100644
--- a/src/mame/includes/scotrsht.h
+++ b/src/mame/includes/scotrsht.h
@@ -56,7 +56,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(scotrsht);
+ void scotrsht_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/seicross.h b/src/mame/includes/seicross.h
index 943086625c9..0e6ef27d025 100644
--- a/src/mame/includes/seicross.h
+++ b/src/mame/includes/seicross.h
@@ -68,7 +68,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(seicross);
+ void seicross_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/senjyo.h b/src/mame/includes/senjyo.h
index 2bd07c8402e..80ef22b37d0 100644
--- a/src/mame/includes/senjyo.h
+++ b/src/mame/includes/senjyo.h
@@ -109,8 +109,8 @@ private:
DECLARE_WRITE8_MEMBER(irq_ctrl_w);
DECLARE_READ8_MEMBER(pio_pa_r);
- DECLARE_PALETTE_DECODER(IIBBGGRR);
- DECLARE_PALETTE_INIT(radar);
+ static rgb_t IIBBGGRR(uint32_t raw);
+ void radar_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(senjyo_bg1_tile_info);
diff --git a/src/mame/includes/seta.h b/src/mame/includes/seta.h
index f56dc3c580d..40e19a32162 100644
--- a/src/mame/includes/seta.h
+++ b/src/mame/includes/seta.h
@@ -124,7 +124,7 @@ public:
void init_eightfrc();
void init_pairlove();
- DECLARE_PALETTE_INIT(RRRRRGGGGGBBBBB_proms);
+ void palette_init_RRRRRGGGGGBBBBB_proms(palette_device &palette) const;
SETA001_SPRITE_GFXBANK_CB_MEMBER(setac_gfxbank_callback);
@@ -235,11 +235,11 @@ protected:
DECLARE_MACHINE_RESET(calibr50);
DECLARE_VIDEO_START(seta_2_layers);
- DECLARE_PALETTE_INIT(blandia);
- DECLARE_PALETTE_INIT(zingzip);
+ void blandia_palette(palette_device &palette) const;
+ void zingzip_palette(palette_device &palette) const;
DECLARE_MACHINE_START(wrofaero);
- DECLARE_PALETTE_INIT(gundhara);
- DECLARE_PALETTE_INIT(jjsquawk);
+ void gundhara_palette(palette_device &palette) const;
+ void jjsquawk_palette(palette_device &palette) const;
DECLARE_MACHINE_START(keroppi);
DECLARE_MACHINE_START(magspeed);
DECLARE_VIDEO_START(oisipuzl_2_layers);
@@ -341,7 +341,7 @@ private:
uint16_t dsw_r(offs_t offset);
void lockout_w(uint8_t data);
- DECLARE_PALETTE_INIT(usclssic);
+ void usclssic_palette(palette_device &palette) const;
uint32_t screen_update_usclssic(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -453,7 +453,7 @@ private:
DECLARE_MACHINE_RESET(setaroul);
DECLARE_VIDEO_START(setaroul_1_layer);
- DECLARE_PALETTE_INIT(setaroul);
+ void setaroul_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
diff --git a/src/mame/includes/shangkid.h b/src/mame/includes/shangkid.h
index d5b5e2bb845..54c815018ee 100644
--- a/src/mame/includes/shangkid.h
+++ b/src/mame/includes/shangkid.h
@@ -73,7 +73,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_VIDEO_START(shangkid);
- DECLARE_PALETTE_INIT(dynamski);
+ void dynamski_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(shangkid);
uint32_t screen_update_shangkid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/shaolins.h b/src/mame/includes/shaolins.h
index 5106e77eb93..15db04608a2 100644
--- a/src/mame/includes/shaolins.h
+++ b/src/mame/includes/shaolins.h
@@ -45,7 +45,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(shaolins);
+ void shaolins_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/shootout.h b/src/mame/includes/shootout.h
index 70b0b78934c..4ce7bebfd51 100644
--- a/src/mame/includes/shootout.h
+++ b/src/mame/includes/shootout.h
@@ -58,7 +58,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(shootout);
+ void shootout_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
diff --git a/src/mame/includes/sidepckt.h b/src/mame/includes/sidepckt.h
index c570b0bf56f..37a9318a810 100644
--- a/src/mame/includes/sidepckt.h
+++ b/src/mame/includes/sidepckt.h
@@ -65,7 +65,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sidepckt);
+ void sidepckt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/simpsons.h b/src/mame/includes/simpsons.h
index 1210d9ea709..3a206085c3c 100644
--- a/src/mame/includes/simpsons.h
+++ b/src/mame/includes/simpsons.h
@@ -5,7 +5,7 @@
#pragma once
-#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
+#include "cpu/m6809/konami.h" // for the callback and the firq irq definition
#include "machine/bankdev.h"
#include "video/k052109.h"
#include "video/k053251.h"
diff --git a/src/mame/includes/skydiver.h b/src/mame/includes/skydiver.h
index fbe3958073d..7c93886212c 100644
--- a/src/mame/includes/skydiver.h
+++ b/src/mame/includes/skydiver.h
@@ -76,7 +76,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(skydiver);
+ void skydiver_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/skyfox.h b/src/mame/includes/skyfox.h
index bc4dd6e4738..85baf20e8b8 100644
--- a/src/mame/includes/skyfox.h
+++ b/src/mame/includes/skyfox.h
@@ -50,7 +50,7 @@ private:
DECLARE_WRITE8_MEMBER(skyfox_vregs_w);
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(skyfox);
+ void skyfox_palette(palette_device &palette) const;
uint32_t screen_update_skyfox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(skyfox_interrupt);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/skykid.h b/src/mame/includes/skykid.h
index fcd38520435..91bbf51f3ad 100644
--- a/src/mame/includes/skykid.h
+++ b/src/mame/includes/skykid.h
@@ -47,7 +47,7 @@ private:
TILEMAP_MAPPER_MEMBER(tx_tilemap_scan);
TILE_GET_INFO_MEMBER(tx_get_tile_info);
TILE_GET_INFO_MEMBER(bg_get_tile_info);
- DECLARE_PALETTE_INIT(skykid);
+ void skykid_palette(palette_device &palette) const;
uint32_t screen_update_skykid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/skyraid.h b/src/mame/includes/skyraid.h
index 4c546097ac2..11d4f484ee1 100644
--- a/src/mame/includes/skyraid.h
+++ b/src/mame/includes/skyraid.h
@@ -32,7 +32,7 @@ private:
DECLARE_WRITE8_MEMBER(skyraid_scroll_w);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(skyraid);
+ void skyraid_palette(palette_device &palette) const;
uint32_t screen_update_skyraid(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE8_MEMBER(skyraid_sound_w);
void draw_text(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/snk.h b/src/mame/includes/snk.h
index 634c7b92492..0f5fd5727e3 100644
--- a/src/mame/includes/snk.h
+++ b/src/mame/includes/snk.h
@@ -213,7 +213,7 @@ private:
TILE_GET_INFO_MEMBER(ikari_get_bg_tile_info);
TILE_GET_INFO_MEMBER(gwar_get_bg_tile_info);
DECLARE_VIDEO_START(marvins);
- DECLARE_PALETTE_INIT(tnk3);
+ void tnk3_palette(palette_device &palette) const;
DECLARE_VIDEO_START(jcross);
DECLARE_VIDEO_START(tnk3);
DECLARE_VIDEO_START(ikari);
diff --git a/src/mame/includes/snk6502.h b/src/mame/includes/snk6502.h
index f5cfedfda92..4507f2aa2d3 100644
--- a/src/mame/includes/snk6502.h
+++ b/src/mame/includes/snk6502.h
@@ -76,9 +76,9 @@ protected:
virtual void machine_start() override;
DECLARE_MACHINE_RESET(sasuke);
DECLARE_VIDEO_START(satansat);
- DECLARE_PALETTE_INIT(satansat);
+ void satansat_palette(palette_device &palette);
DECLARE_VIDEO_START(snk6502);
- DECLARE_PALETTE_INIT(snk6502);
+ void snk6502_palette(palette_device &palette);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/snookr10.h b/src/mame/includes/snookr10.h
index 5f5e430c02d..2958a559c6d 100644
--- a/src/mame/includes/snookr10.h
+++ b/src/mame/includes/snookr10.h
@@ -34,11 +34,11 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(apple10_get_bg_tile_info);
TILE_GET_INFO_MEMBER(crystalc_get_bg_tile_info);
- DECLARE_PALETTE_INIT(snookr10);
+ void snookr10_palette(palette_device &palette) const;
DECLARE_VIDEO_START(apple10);
DECLARE_VIDEO_START(crystalc);
- DECLARE_PALETTE_INIT(apple10);
- DECLARE_PALETTE_INIT(crystalc);
+ void apple10_palette(palette_device &palette) const;
+ void crystalc_palette(palette_device &palette) const;
uint32_t screen_update_snookr10(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void crystalc_map(address_map &map);
void snookr10_map(address_map &map);
diff --git a/src/mame/includes/sonson.h b/src/mame/includes/sonson.h
index 26d9f7e64ab..f152500d746 100644
--- a/src/mame/includes/sonson.h
+++ b/src/mame/includes/sonson.h
@@ -48,7 +48,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sonson);
+ void sonson_palette(palette_device &palette) const;
uint32_t screen_update_sonson(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/spcforce.h b/src/mame/includes/spcforce.h
index be4bc41c960..3a72685efc9 100644
--- a/src/mame/includes/spcforce.h
+++ b/src/mame/includes/spcforce.h
@@ -47,7 +47,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(flip_screen_w);
DECLARE_WRITE_LINE_MEMBER(unknown_w);
- DECLARE_PALETTE_INIT(spcforce);
+ void spcforce_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/spdodgeb.h b/src/mame/includes/spdodgeb.h
index 943ffeca7ed..88c6890744c 100644
--- a/src/mame/includes/spdodgeb.h
+++ b/src/mame/includes/spdodgeb.h
@@ -90,7 +90,7 @@ private:
TILEMAP_MAPPER_MEMBER(background_scan);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(spdodgeb);
+ void spdodgeb_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/special.h b/src/mame/includes/special.h
index 93efa62815d..c0b466829e9 100644
--- a/src/mame/includes/special.h
+++ b/src/mame/includes/special.h
@@ -30,8 +30,8 @@
class special_state : public driver_device
{
public:
- special_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ special_state(const machine_config &mconfig, device_type type, const char *tag) :
+ driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ppi(*this, "ppi8255"),
m_fdc(*this, "fd1793"),
@@ -49,7 +49,8 @@ public:
m_bank5(*this, "bank5"),
m_bank6(*this, "bank6"),
m_io_line(*this, "LINE%u", 0U),
- m_palette(*this, "palette") { }
+ m_palette(*this, "palette")
+ { }
void special(machine_config &config);
void erik(machine_config &config);
@@ -60,6 +61,9 @@ public:
void init_erik();
void init_special();
+protected:
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
enum
{
@@ -88,15 +92,12 @@ private:
DECLARE_WRITE8_MEMBER(specialist_8255_portc_w);
DECLARE_MACHINE_RESET(special);
- DECLARE_VIDEO_START(special);
DECLARE_MACHINE_RESET(erik);
- DECLARE_VIDEO_START(erik);
- DECLARE_PALETTE_INIT(erik);
- DECLARE_VIDEO_START(specialp);
+ void erik_palette(palette_device &palette) const;
DECLARE_MACHINE_START(specimx);
DECLARE_MACHINE_RESET(specimx);
DECLARE_VIDEO_START(specimx);
- DECLARE_PALETTE_INIT(specimx);
+ void specimx_palette(palette_device &palette) const;
uint32_t screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -141,7 +142,6 @@ private:
optional_memory_bank m_bank6;
required_ioport_array<13> m_io_line;
required_device<palette_device> m_palette;
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
};
#endif // MAME_INCLUDES_SPECIAL_H
diff --git a/src/mame/includes/spectrum.h b/src/mame/includes/spectrum.h
index 19b92f34e1c..9ace2a689fc 100644
--- a/src/mame/includes/spectrum.h
+++ b/src/mame/includes/spectrum.h
@@ -180,7 +180,7 @@ protected:
DECLARE_MACHINE_RESET(spectrum);
DECLARE_VIDEO_START(spectrum);
- DECLARE_PALETTE_INIT(spectrum);
+ void spectrum_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(tc2048);
DECLARE_VIDEO_START(spectrum_128);
DECLARE_MACHINE_RESET(spectrum_128);
diff --git a/src/mame/includes/speedatk.h b/src/mame/includes/speedatk.h
index 9432c6cb33c..7f78528e04a 100644
--- a/src/mame/includes/speedatk.h
+++ b/src/mame/includes/speedatk.h
@@ -49,7 +49,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(speedatk);
+ void speedatk_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/sprint2.h b/src/mame/includes/sprint2.h
index a081783e052..00a0927fccb 100644
--- a/src/mame/includes/sprint2.h
+++ b/src/mame/includes/sprint2.h
@@ -84,7 +84,7 @@ private:
DECLARE_WRITE8_MEMBER(sprint2_noise_reset_w);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sprint2);
+ void sprint2_palette(palette_device &palette) const;
uint32_t screen_update_sprint2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sprint2);
INTERRUPT_GEN_MEMBER(sprint2);
diff --git a/src/mame/includes/sprint4.h b/src/mame/includes/sprint4.h
index 2646d78b411..77e124f38c7 100644
--- a/src/mame/includes/sprint4.h
+++ b/src/mame/includes/sprint4.h
@@ -56,7 +56,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- DECLARE_PALETTE_INIT(sprint4);
+ void sprint4_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/sprint8.h b/src/mame/includes/sprint8.h
index f6af552bb8c..1439e0747e3 100644
--- a/src/mame/includes/sprint8.h
+++ b/src/mame/includes/sprint8.h
@@ -40,7 +40,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(sprint8);
+ void sprint8_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_tile_info1);
TILE_GET_INFO_MEMBER(get_tile_info2);
diff --git a/src/mame/includes/srmp2.h b/src/mame/includes/srmp2.h
index 652a474989c..2b391e1d241 100644
--- a/src/mame/includes/srmp2.h
+++ b/src/mame/includes/srmp2.h
@@ -79,9 +79,9 @@ private:
virtual void machine_start() override;
DECLARE_MACHINE_START(srmp2);
- DECLARE_PALETTE_INIT(srmp2);
+ void srmp2_palette(palette_device &palette) const;
DECLARE_MACHINE_START(srmp3);
- DECLARE_PALETTE_INIT(srmp3);
+ void srmp3_palette(palette_device &palette) const;
DECLARE_MACHINE_START(rmgoldyh);
DECLARE_MACHINE_START(mjyuugi);
diff --git a/src/mame/includes/ssozumo.h b/src/mame/includes/ssozumo.h
index 95c456a3b89..0d0a1d757bb 100644
--- a/src/mame/includes/ssozumo.h
+++ b/src/mame/includes/ssozumo.h
@@ -47,7 +47,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(ssozumo);
+ void ssozumo_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void ssozumo_map(address_map &map);
diff --git a/src/mame/includes/sspeedr.h b/src/mame/includes/sspeedr.h
index e80f4e565b6..69544941039 100644
--- a/src/mame/includes/sspeedr.h
+++ b/src/mame/includes/sspeedr.h
@@ -38,7 +38,7 @@ private:
DECLARE_WRITE8_MEMBER(sspeedr_track_horz_2_w);
DECLARE_WRITE8_MEMBER(sspeedr_track_vert_w);
DECLARE_WRITE8_MEMBER(sspeedr_track_ice_w);
- DECLARE_PALETTE_INIT(sspeedr);
+ void sspeedr_palette(palette_device &palette) const;
uint32_t screen_update_sspeedr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_sspeedr);
void sspeedr_io_map(address_map &map);
diff --git a/src/mame/includes/ssrj.h b/src/mame/includes/ssrj.h
index edbed1271c9..de8ee0af577 100644
--- a/src/mame/includes/ssrj.h
+++ b/src/mame/includes/ssrj.h
@@ -55,7 +55,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info2);
TILE_GET_INFO_MEMBER(get_tile_info4);
- DECLARE_PALETTE_INIT(ssrj);
+ void ssrj_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
diff --git a/src/mame/includes/stactics.h b/src/mame/includes/stactics.h
index ac2826ca7c1..bb9ed627e85 100644
--- a/src/mame/includes/stactics.h
+++ b/src/mame/includes/stactics.h
@@ -73,7 +73,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(stactics);
+ void stactics_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void update_beam();
diff --git a/src/mame/includes/starshp1.h b/src/mame/includes/starshp1.h
index 25bbf4ef447..028746b6ec7 100644
--- a/src/mame/includes/starshp1.h
+++ b/src/mame/includes/starshp1.h
@@ -88,7 +88,7 @@ private:
DECLARE_WRITE8_MEMBER(starshp1_analog_out_w);
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(starshp1);
+ void starshp1_palette(palette_device &palette) const;
uint32_t screen_update_starshp1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_starshp1);
INTERRUPT_GEN_MEMBER(starshp1_interrupt);
diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h
index 29150473eab..7b74a402d7c 100644
--- a/src/mame/includes/stfight.h
+++ b/src/mame/includes/stfight.h
@@ -13,11 +13,6 @@
class stfight_state : public driver_device
{
public:
- enum
- {
- TIMER_STFIGHT_INTERRUPT_1
- };
-
stfight_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag)
, m_coin_mech(*this, "COIN")
@@ -48,6 +43,17 @@ public:
void init_empcity();
void init_cshooter();
+protected:
+ enum
+ {
+ TIMER_STFIGHT_INTERRUPT_1
+ };
+
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
+ virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
+
private:
DECLARE_WRITE_LINE_MEMBER(stfight_adpcm_int);
@@ -75,11 +81,6 @@ private:
void decrypted_opcodes_map(address_map &map);
void stfight_cpu1_map(address_map &map);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
-
required_ioport m_coin_mech;
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/sub.h b/src/mame/includes/sub.h
index 2dbc441c058..7737f8c6d53 100644
--- a/src/mame/includes/sub.h
+++ b/src/mame/includes/sub.h
@@ -48,7 +48,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
DECLARE_WRITE8_MEMBER(nmi_mask_w);
- DECLARE_PALETTE_INIT(sub);
+ void sub_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(get_tile_info);
DECLARE_WRITE8_MEMBER(attr_w);
DECLARE_WRITE8_MEMBER(vram_w);
diff --git a/src/mame/includes/subs.h b/src/mame/includes/subs.h
index 52ce0cb8294..d0f5393547d 100644
--- a/src/mame/includes/subs.h
+++ b/src/mame/includes/subs.h
@@ -64,7 +64,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(subs);
+ void subs_palette(palette_device &palette) const;
uint32_t screen_update_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/super80.h b/src/mame/includes/super80.h
index 6e72e9f532b..ff8e274d60b 100644
--- a/src/mame/includes/super80.h
+++ b/src/mame/includes/super80.h
@@ -96,7 +96,7 @@ private:
DECLARE_MACHINE_RESET(super80);
DECLARE_MACHINE_RESET(super80r);
DECLARE_VIDEO_START(super80);
- DECLARE_PALETTE_INIT(super80m);
+ void super80m_palette(palette_device &palette) const;
DECLARE_QUICKLOAD_LOAD_MEMBER(super80);
MC6845_UPDATE_ROW(crtc_update_row);
uint32_t screen_update_super80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/superqix.h b/src/mame/includes/superqix.h
index 5eccd818fc8..1fdcc69f995 100644
--- a/src/mame/includes/superqix.h
+++ b/src/mame/includes/superqix.h
@@ -69,7 +69,7 @@ protected:
DECLARE_WRITE8_MEMBER(superqix_0410_w);
DECLARE_VIDEO_START(superqix);
- DECLARE_PALETTE_DECODER(BBGGRRII);
+ static rgb_t BBGGRRII(uint32_t raw);
uint32_t screen_update_superqix(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void superqix_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/suprloco.h b/src/mame/includes/suprloco.h
index 76674f4d4d1..5527b1e1611 100644
--- a/src/mame/includes/suprloco.h
+++ b/src/mame/includes/suprloco.h
@@ -45,7 +45,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(suprloco);
+ void suprloco_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void draw_pixel(bitmap_ind16 &bitmap,const rectangle &cliprect,int x,int y,int color,int flip);
diff --git a/src/mame/includes/suprridr.h b/src/mame/includes/suprridr.h
index 4bbe6a1a4ae..cc41d4540aa 100644
--- a/src/mame/includes/suprridr.h
+++ b/src/mame/includes/suprridr.h
@@ -70,7 +70,7 @@ private:
INTERRUPT_GEN_MEMBER(main_nmi_gen);
- DECLARE_PALETTE_INIT(suprridr);
+ void suprridr_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
int is_screen_flipped();
diff --git a/src/mame/includes/svision.h b/src/mame/includes/svision.h
index b595b90b5c7..65ed473ccc1 100644
--- a/src/mame/includes/svision.h
+++ b/src/mame/includes/svision.h
@@ -9,6 +9,8 @@
#ifndef MAME_INCLUDES_SVISION_H
#define MAME_INCLUDES_SVISION_H
+#pragma once
+
#include "cpu/m6502/m65c02.h"
#include "machine/timer.h"
#include "audio/svis_snd.h"
@@ -16,20 +18,6 @@
#include "bus/generic/carts.h"
#include "emupal.h"
-struct svision_t
-{
- emu_timer *timer1;
- int timer_shot;
-};
-
-struct svision_pet_t
-{
- int state;
- int on, clock, data;
- uint8_t input;
- emu_timer *timer;
-};
-
struct tvlink_t
{
uint32_t palette[4/*0x40?*/]; /* rgb8 */
@@ -64,7 +52,25 @@ public:
void init_svisions();
void init_svision();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
+ struct svision_t
+ {
+ emu_timer *timer1;
+ int timer_shot;
+ };
+
+ struct svision_pet_t
+ {
+ int state;
+ int on, clock, data;
+ uint8_t input;
+ emu_timer *timer;
+ };
+
DECLARE_WRITE_LINE_MEMBER(sound_irq_w);
DECLARE_READ8_MEMBER(svision_r);
DECLARE_WRITE8_MEMBER(svision_w);
@@ -76,12 +82,9 @@ private:
DECLARE_WRITE_LINE_MEMBER(frame_int_w);
DECLARE_DEVICE_IMAGE_LOAD_MEMBER(svision_cart);
- virtual void machine_start() override;
- virtual void machine_reset() override;
-
- DECLARE_PALETTE_INIT(svision);
- DECLARE_PALETTE_INIT(svisionp);
- DECLARE_PALETTE_INIT(svisionn);
+ void svision_palette(palette_device &palette) const;
+ void svisionp_palette(palette_device &palette) const;
+ void svisionn_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(tvlink);
enum
diff --git a/src/mame/includes/tagteam.h b/src/mame/includes/tagteam.h
index f90cc030bc0..0aa2de1cbdd 100644
--- a/src/mame/includes/tagteam.h
+++ b/src/mame/includes/tagteam.h
@@ -59,7 +59,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(tagteam);
+ void tagteam_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/tank8.h b/src/mame/includes/tank8.h
index 88e9dd3f19f..833b5bebfb4 100644
--- a/src/mame/includes/tank8.h
+++ b/src/mame/includes/tank8.h
@@ -73,7 +73,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tank8);
+ void tank8_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
diff --git a/src/mame/includes/tankbatt.h b/src/mame/includes/tankbatt.h
index ca948a4da70..3be649e07bc 100644
--- a/src/mame/includes/tankbatt.h
+++ b/src/mame/includes/tankbatt.h
@@ -57,7 +57,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tankbatt);
+ void tankbatt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_bullets(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/tankbust.h b/src/mame/includes/tankbust.h
index 09995cab17a..8a525853ca6 100644
--- a/src/mame/includes/tankbust.h
+++ b/src/mame/includes/tankbust.h
@@ -65,7 +65,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_txt_tile_info);
- DECLARE_PALETTE_INIT(tankbust);
+ void tankbust_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/taxidriv.h b/src/mame/includes/taxidriv.h
index 2911878a28d..3d7722dc9af 100644
--- a/src/mame/includes/taxidriv.h
+++ b/src/mame/includes/taxidriv.h
@@ -77,7 +77,7 @@ private:
DECLARE_WRITE8_MEMBER(p8910_0b_w);
DECLARE_WRITE8_MEMBER(spritectrl_w);
- DECLARE_PALETTE_INIT(taxidriv);
+ void taxidriv_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void cpu2_map(address_map &map);
diff --git a/src/mame/includes/tceptor.h b/src/mame/includes/tceptor.h
index 48d9da69a5f..2ce49c8892e 100644
--- a/src/mame/includes/tceptor.h
+++ b/src/mame/includes/tceptor.h
@@ -92,7 +92,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tceptor);
+ void tceptor_palette(palette_device &palette);
uint32_t screen_update_tceptor(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_tceptor);
INTERRUPT_GEN_MEMBER(m6809_vb_interrupt);
diff --git a/src/mame/includes/terracre.h b/src/mame/includes/terracre.h
index ecbc9241f53..d6f2b35806d 100644
--- a/src/mame/includes/terracre.h
+++ b/src/mame/includes/terracre.h
@@ -55,7 +55,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(terracre);
+ void terracre_palette(palette_device &palette) const;
uint32_t screen_update_amazon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/thedeep.h b/src/mame/includes/thedeep.h
index ff8f48102c6..67897430c98 100644
--- a/src/mame/includes/thedeep.h
+++ b/src/mame/includes/thedeep.h
@@ -79,7 +79,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info_0);
TILE_GET_INFO_MEMBER(get_tile_info_1);
- DECLARE_PALETTE_INIT(thedeep);
+ void thedeep_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/thepit.h b/src/mame/includes/thepit.h
index d886aa0d9ae..bb4e80ea965 100644
--- a/src/mame/includes/thepit.h
+++ b/src/mame/includes/thepit.h
@@ -75,8 +75,8 @@ private:
TILE_GET_INFO_MEMBER(solid_get_tile_info);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(thepit);
- DECLARE_PALETTE_INIT(suprmous);
+ void thepit_palette(palette_device &palette) const;
+ void suprmous_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_desertdan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/thomson.h b/src/mame/includes/thomson.h
index e70f2e1e968..5a7ec3760d9 100644
--- a/src/mame/includes/thomson.h
+++ b/src/mame/includes/thomson.h
@@ -365,8 +365,8 @@ private:
WRITE_LINE_MEMBER( fdc_index_2_w );
WRITE_LINE_MEMBER( fdc_index_3_w );
void thomson_index_callback(int index, int state);
- DECLARE_PALETTE_INIT(thom);
- DECLARE_PALETTE_INIT(mo5);
+ void thom_palette(palette_device &palette);
+ void mo5_palette(palette_device &palette);
optional_device<mc6854_device> m_mc6854;
diff --git a/src/mame/includes/thunderx.h b/src/mame/includes/thunderx.h
index 67fb0e5f809..7b908f97949 100644
--- a/src/mame/includes/thunderx.h
+++ b/src/mame/includes/thunderx.h
@@ -10,7 +10,7 @@
#pragma once
-#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
+#include "cpu/m6809/konami.h" // for the callback and the firq irq definition
#include "machine/bankdev.h"
#include "sound/k007232.h"
#include "video/k051960.h"
diff --git a/src/mame/includes/ti85.h b/src/mame/includes/ti85.h
index 6294bf2416c..66a28ba9377 100644
--- a/src/mame/includes/ti85.h
+++ b/src/mame/includes/ti85.h
@@ -185,10 +185,10 @@ private:
DECLARE_READ8_MEMBER(ti84pse_port_0056_r);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(ti85);
+ void ti85_palette(palette_device &palette);
DECLARE_MACHINE_RESET(ti85);
DECLARE_MACHINE_RESET(ti83p);
- DECLARE_PALETTE_INIT(ti82);
+ void ti82_palette(palette_device &palette) const;
DECLARE_MACHINE_START(ti86);
DECLARE_MACHINE_START(ti83p);
DECLARE_MACHINE_START(ti83pse);
diff --git a/src/mame/includes/ti89.h b/src/mame/includes/ti89.h
index cfe81043df4..dd785ee2b3c 100644
--- a/src/mame/includes/ti89.h
+++ b/src/mame/includes/ti89.h
@@ -5,10 +5,11 @@
* includes/ti89.h
*
****************************************************************************/
-
#ifndef MAME_INCLUDES_TI89_H
#define MAME_INCLUDES_TI89_H
+#pragma once
+
#include "machine/intelfsh.h"
#include "machine/timer.h"
#include "emupal.h"
@@ -17,19 +18,19 @@ class ti68k_state : public driver_device
{
public:
ti68k_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
- m_maincpu(*this, "maincpu"),
- m_flash(*this, "flash"),
- m_rom_base(*this, "flash"),
- m_io_bit0(*this, "BIT0"),
- m_io_bit1(*this, "BIT1"),
- m_io_bit2(*this, "BIT2"),
- m_io_bit3(*this, "BIT3"),
- m_io_bit4(*this, "BIT4"),
- m_io_bit5(*this, "BIT5"),
- m_io_bit6(*this, "BIT6"),
- m_io_bit7(*this, "BIT7")
- { }
+ : driver_device(mconfig, type, tag)
+ , m_maincpu(*this, "maincpu")
+ , m_flash(*this, "flash")
+ , m_rom_base(*this, "flash")
+ , m_io_bit0(*this, "BIT0")
+ , m_io_bit1(*this, "BIT1")
+ , m_io_bit2(*this, "BIT2")
+ , m_io_bit3(*this, "BIT3")
+ , m_io_bit4(*this, "BIT4")
+ , m_io_bit5(*this, "BIT5")
+ , m_io_bit6(*this, "BIT6")
+ , m_io_bit7(*this, "BIT7")
+ { }
void v200(machine_config &config);
void ti92(machine_config &config);
@@ -39,7 +40,14 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(ti68k_on_key);
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
+ // hardware versions
+ enum { HW1=1, HW2, HW3, HW4 };
+
required_device<cpu_device> m_maincpu;
required_device<sharp_unk128mbit_device> m_flash;
required_region_ptr<uint16_t> m_rom_base;
@@ -52,9 +60,6 @@ private:
required_ioport m_io_bit6;
required_ioport m_io_bit7;
- // hardware versions
- enum { HW1=1, HW2, HW3, HW4 };
-
// HW specifications
uint8_t m_hw_version;
bool m_flash_mem;
@@ -79,20 +84,18 @@ private:
uint8_t m_timer_on;
uint8_t m_timer_val;
uint16_t m_timer_mask;
+ uint64_t m_timer;
- virtual void machine_start() override;
- virtual void machine_reset() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint8_t keypad_r();
- DECLARE_WRITE16_MEMBER ( ti68k_io_w );
- DECLARE_READ16_MEMBER ( ti68k_io_r );
- DECLARE_WRITE16_MEMBER ( ti68k_io2_w );
- DECLARE_READ16_MEMBER ( ti68k_io2_r );
- DECLARE_WRITE16_MEMBER ( flash_w );
- DECLARE_READ16_MEMBER ( flash_r );
- uint64_t m_timer;
- DECLARE_PALETTE_INIT(ti68k);
+ DECLARE_WRITE16_MEMBER( ti68k_io_w );
+ DECLARE_READ16_MEMBER( ti68k_io_r );
+ DECLARE_WRITE16_MEMBER( ti68k_io2_w );
+ DECLARE_READ16_MEMBER( ti68k_io2_r );
+ DECLARE_WRITE16_MEMBER( flash_w );
+ DECLARE_READ16_MEMBER( flash_r );
+ void ti68k_palette(palette_device &palette) const;
TIMER_DEVICE_CALLBACK_MEMBER(ti68k_timer_callback);
diff --git a/src/mame/includes/tiamc1.h b/src/mame/includes/tiamc1.h
index e7000f885bf..8c7c09c3358 100644
--- a/src/mame/includes/tiamc1.h
+++ b/src/mame/includes/tiamc1.h
@@ -61,7 +61,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg1_tile_info);
TILE_GET_INFO_MEMBER(get_bg2_tile_info);
DECLARE_VIDEO_START(kot);
- DECLARE_PALETTE_INIT(tiamc1);
+ void tiamc1_palette(palette_device &palette);
uint32_t screen_update_tiamc1(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_kot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/timelimt.h b/src/mame/includes/timelimt.h
index b6aac719d7d..e600d5ab864 100644
--- a/src/mame/includes/timelimt.h
+++ b/src/mame/includes/timelimt.h
@@ -55,7 +55,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_INIT(timelimt);
+ void timelimt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/timeplt.h b/src/mame/includes/timeplt.h
index 47d8b1295f3..628e6097176 100644
--- a/src/mame/includes/timeplt.h
+++ b/src/mame/includes/timeplt.h
@@ -85,7 +85,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(timeplt);
+ void timeplt_palette(palette_device &palette) const;
DECLARE_VIDEO_START(chkun);
DECLARE_VIDEO_START(psurge);
diff --git a/src/mame/includes/tnzs.h b/src/mame/includes/tnzs.h
index ac24d47cfea..07a245e6cec 100644
--- a/src/mame/includes/tnzs.h
+++ b/src/mame/includes/tnzs.h
@@ -41,7 +41,7 @@ protected:
DECLARE_WRITE8_MEMBER(ramrom_bankswitch_w);
- DECLARE_PALETTE_INIT(prompalette);
+ void prompalette(palette_device &palette) const;
uint32_t screen_update_tnzs(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_tnzs);
diff --git a/src/mame/includes/tp84.h b/src/mame/includes/tp84.h
index 80c930ccfd8..71b0f0239b7 100644
--- a/src/mame/includes/tp84.h
+++ b/src/mame/includes/tp84.h
@@ -73,7 +73,7 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tp84);
+ void tp84_palette(palette_device &palette) const;
uint32_t screen_update_tp84(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/trackfld.h b/src/mame/includes/trackfld.h
index 5cd3c177228..af09148d340 100644
--- a/src/mame/includes/trackfld.h
+++ b/src/mame/includes/trackfld.h
@@ -122,7 +122,7 @@ private:
DECLARE_MACHINE_START(trackfld);
DECLARE_MACHINE_RESET(trackfld);
DECLARE_VIDEO_START(trackfld);
- DECLARE_PALETTE_INIT(trackfld);
+ void trackfld_palette(palette_device &palette) const;
DECLARE_VIDEO_START(atlantol);
uint32_t screen_update_trackfld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
diff --git a/src/mame/includes/travrusa.h b/src/mame/includes/travrusa.h
index d3c23b4ce6c..da97b371b90 100644
--- a/src/mame/includes/travrusa.h
+++ b/src/mame/includes/travrusa.h
@@ -44,8 +44,8 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(travrusa);
- DECLARE_PALETTE_INIT(shtrider);
+ void travrusa_palette(palette_device &palette) const;
+ void shtrider_palette(palette_device &palette) const;
uint32_t screen_update_travrusa(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_scroll();
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/triplhnt.h b/src/mame/includes/triplhnt.h
index 9a378779121..7e2674c1fda 100644
--- a/src/mame/includes/triplhnt.h
+++ b/src/mame/includes/triplhnt.h
@@ -67,7 +67,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(triplhnt);
+ void triplhnt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/trs80.h b/src/mame/includes/trs80.h
index 961185d203f..6a4ee33673d 100644
--- a/src/mame/includes/trs80.h
+++ b/src/mame/includes/trs80.h
@@ -65,6 +65,10 @@ public:
void init_trs80l2();
void init_trs80();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_WRITE8_MEMBER(port_ff_w);
@@ -92,7 +96,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(intrq_w);
DECLARE_QUICKLOAD_LOAD_MEMBER( trs80_cmd );
DECLARE_MACHINE_RESET(lnw80);
- DECLARE_PALETTE_INIT(lnw80);
+ void lnw80_palette(palette_device &palette) const;
uint32_t screen_update_trs80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_ht1080z(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_lnw80(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
@@ -121,8 +125,6 @@ private:
uint8_t m_size_store;
uint16_t m_timeout;
floppy_image_device *m_floppy;
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_memory_region m_region_maincpu;
required_region_ptr<u8> m_p_chargen;
diff --git a/src/mame/includes/trs80m3.h b/src/mame/includes/trs80m3.h
index cf5bc3f3022..4ac196022e9 100644
--- a/src/mame/includes/trs80m3.h
+++ b/src/mame/includes/trs80m3.h
@@ -54,7 +54,7 @@ public:
, m_32kbanks(*this, "bank%u", 0U)
, m_16kbank(*this, "16kbank")
, m_vidbank(*this, "vidbank")
- { }
+ { }
void model4p(machine_config &config);
void model3(machine_config &config);
@@ -65,6 +65,10 @@ public:
void init_trs80m4();
void init_trs80m4p();
+protected:
+ virtual void machine_start() override;
+ virtual void machine_reset() override;
+
private:
DECLARE_FLOPPY_FORMATS(floppy_formats);
DECLARE_WRITE8_MEMBER(port_ff_w);
@@ -128,8 +132,6 @@ private:
bool m_drq_off;
bool m_intrq_off;
floppy_image_device *m_floppy;
- virtual void machine_start() override;
- virtual void machine_reset() override;
required_device<cpu_device> m_maincpu;
required_memory_region m_region_maincpu;
required_region_ptr<u8> m_p_chargen;
diff --git a/src/mame/includes/truco.h b/src/mame/includes/truco.h
index 8c12fa66165..53c1f3ce653 100644
--- a/src/mame/includes/truco.h
+++ b/src/mame/includes/truco.h
@@ -43,7 +43,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(pia_irqa_w);
DECLARE_WRITE_LINE_MEMBER(pia_irqb_w);
- DECLARE_PALETTE_INIT(truco);
+ void truco_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/trucocl.h b/src/mame/includes/trucocl.h
index 324098e7ef5..16492a9b8e5 100644
--- a/src/mame/includes/trucocl.h
+++ b/src/mame/includes/trucocl.h
@@ -49,7 +49,7 @@ private:
DECLARE_WRITE8_MEMBER(trucocl_colorram_w);
DECLARE_WRITE8_MEMBER(audio_dac_w);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(trucocl);
+ void trucocl_palette(palette_device &palette) const;
uint32_t screen_update_trucocl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(trucocl_interrupt);
required_device<cpu_device> m_maincpu;
diff --git a/src/mame/includes/tryout.h b/src/mame/includes/tryout.h
index f9d552c6789..1d88c06a29d 100644
--- a/src/mame/includes/tryout.h
+++ b/src/mame/includes/tryout.h
@@ -63,7 +63,7 @@ private:
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tryout);
+ void tryout_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/tubep.h b/src/mame/includes/tubep.h
index 3cf2edd1bcc..f56bd63b344 100644
--- a/src/mame/includes/tubep.h
+++ b/src/mame/includes/tubep.h
@@ -102,10 +102,10 @@ private:
DECLARE_MACHINE_RESET(tubep);
virtual void video_start() override;
virtual void video_reset() override;
- DECLARE_PALETTE_INIT(tubep);
+ void tubep_palette(palette_device &palette);
DECLARE_MACHINE_START(rjammer);
DECLARE_MACHINE_RESET(rjammer);
- DECLARE_PALETTE_INIT(rjammer);
+ void rjammer_palette(palette_device &palette) const;
uint32_t screen_update_tubep(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_rjammer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(tubep_scanline_callback);
diff --git a/src/mame/includes/tunhunt.h b/src/mame/includes/tunhunt.h
index 06a178fb293..078534d2d28 100644
--- a/src/mame/includes/tunhunt.h
+++ b/src/mame/includes/tunhunt.h
@@ -40,7 +40,7 @@ private:
virtual void machine_start() override { m_led.resolve(); }
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tunhunt);
+ void tunhunt_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void set_pens();
diff --git a/src/mame/includes/turbo.h b/src/mame/includes/turbo.h
index d7d10843b6c..077e1ec3e62 100644
--- a/src/mame/includes/turbo.h
+++ b/src/mame/includes/turbo.h
@@ -182,11 +182,11 @@ private:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
DECLARE_VIDEO_START(turbo);
- DECLARE_PALETTE_INIT(turbo);
- DECLARE_PALETTE_INIT(subroc3d);
+ void turbo_palette(palette_device &palette) const;
+ void subroc3d_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(buckrog);
DECLARE_VIDEO_START(buckrog);
- DECLARE_PALETTE_INIT(buckrog);
+ void buckrog_palette(palette_device &palette) const;
uint32_t screen_update_turbo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_subroc3d(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_buckrog(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/tx0.h b/src/mame/includes/tx0.h
index e079dd883bd..7c2e1c066d1 100644
--- a/src/mame/includes/tx0.h
+++ b/src/mame/includes/tx0.h
@@ -172,7 +172,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(tx0);
+ void tx0_palette(palette_device &palette) const;
uint32_t screen_update_tx0(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_tx0);
INTERRUPT_GEN_MEMBER(tx0_interrupt);
diff --git a/src/mame/includes/tx1.h b/src/mame/includes/tx1.h
index c5c2547a23a..da5040522e3 100644
--- a/src/mame/includes/tx1.h
+++ b/src/mame/includes/tx1.h
@@ -199,10 +199,10 @@ private:
DECLARE_READ16_MEMBER(dipswitches_r);
DECLARE_MACHINE_RESET(tx1);
DECLARE_VIDEO_START(tx1);
- DECLARE_PALETTE_INIT(tx1);
+ void tx1_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(buggyboy);
DECLARE_VIDEO_START(buggyboy);
- DECLARE_PALETTE_INIT(buggyboy);
+ void buggyboy_palette(palette_device &palette) const;
DECLARE_VIDEO_START(buggybjr);
void tx1_draw_char(uint8_t *bitmap);
diff --git a/src/mame/includes/ultratnk.h b/src/mame/includes/ultratnk.h
index b335130e89b..e1464eff0e8 100644
--- a/src/mame/includes/ultratnk.h
+++ b/src/mame/includes/ultratnk.h
@@ -55,7 +55,7 @@ protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(ultratnk);
+ void ultratnk_palette(palette_device &palette) const;
TILE_GET_INFO_MEMBER(tile_info);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h
index 524cfe855f2..2fc0a5ee9f4 100644
--- a/src/mame/includes/unico.h
+++ b/src/mame/includes/unico.h
@@ -28,7 +28,7 @@ public:
void burglarx(machine_config &config);
protected:
- DECLARE_PALETTE_DECODER(unico_R6G6B6X);
+ static rgb_t unico_R6G6B6X(uint32_t raw);
DECLARE_READ16_MEMBER(vram_r);
DECLARE_WRITE16_MEMBER(vram_w);
DECLARE_READ16_MEMBER(scroll_r);
diff --git a/src/mame/includes/usgames.h b/src/mame/includes/usgames.h
index 6c0280cea19..9be0f95a4e9 100644
--- a/src/mame/includes/usgames.h
+++ b/src/mame/includes/usgames.h
@@ -45,7 +45,7 @@ private:
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(usgames);
+ void usgames_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void usg185_map(address_map &map);
diff --git a/src/mame/includes/vc4000.h b/src/mame/includes/vc4000.h
index 37e193bb610..58a96fc63e3 100644
--- a/src/mame/includes/vc4000.h
+++ b/src/mame/includes/vc4000.h
@@ -133,7 +133,7 @@ private:
std::unique_ptr<bitmap_ind16> m_bitmap;
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(vc4000);
+ void vc4000_palette(palette_device &palette) const;
uint32_t screen_update_vc4000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vc4000_video_line);
DECLARE_QUICKLOAD_LOAD_MEMBER(vc4000);
diff --git a/src/mame/includes/vector06.h b/src/mame/includes/vector06.h
index ca1c8f2fcf2..d535114ca9d 100644
--- a/src/mame/includes/vector06.h
+++ b/src/mame/includes/vector06.h
@@ -78,7 +78,6 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(vector06);
uint32_t screen_update_vector06(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vector06_interrupt);
TIMER_CALLBACK_MEMBER(reset_check_callback);
diff --git a/src/mame/includes/vendetta.h b/src/mame/includes/vendetta.h
index 9da277a1ed8..f0cd809e669 100644
--- a/src/mame/includes/vendetta.h
+++ b/src/mame/includes/vendetta.h
@@ -10,7 +10,7 @@
#pragma once
-#include "cpu/m6809/konami.h" /* for the callback and the firq irq definition */
+#include "cpu/m6809/konami.h" // for the callback and the firq irq definition
#include "machine/bankdev.h"
#include "machine/k053252.h"
#include "video/k052109.h"
diff --git a/src/mame/includes/vtech2.h b/src/mame/includes/vtech2.h
index 4e6582adc9c..ee1ee965ddd 100644
--- a/src/mame/includes/vtech2.h
+++ b/src/mame/includes/vtech2.h
@@ -5,10 +5,11 @@
* includes/vtech2.h
*
****************************************************************************/
-
#ifndef MAME_INCLUDES_VTECH2_H
#define MAME_INCLUDES_VTECH2_H
+#pragma once
+
#include "machine/bankdev.h"
#include "bus/generic/carts.h"
#include "bus/generic/slot.h"
@@ -49,14 +50,16 @@ public:
DECLARE_INPUT_CHANGED_MEMBER(reset_button);
+protected:
+ virtual void machine_reset() override;
+
private:
DECLARE_WRITE8_MEMBER(laser_bank_select_w);
DECLARE_WRITE8_MEMBER(laser_fdc_w);
DECLARE_WRITE8_MEMBER(laser_bg_mode_w);
DECLARE_WRITE8_MEMBER(laser_two_color_w);
DECLARE_READ8_MEMBER(laser_fdc_r);
- virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(vtech2);
+ void vtech2_palette(palette_device &palette) const;
uint32_t screen_update_laser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
INTERRUPT_GEN_MEMBER(vtech2_interrupt);
DECLARE_WRITE8_MEMBER(mmio_w);
@@ -112,5 +115,4 @@ private:
memory_region *m_cart_rom;
};
-
#endif // MAME_INCLUDES_VTECH2_H
diff --git a/src/mame/includes/vulgus.h b/src/mame/includes/vulgus.h
index c55e5f6c5ac..6b15716b687 100644
--- a/src/mame/includes/vulgus.h
+++ b/src/mame/includes/vulgus.h
@@ -55,7 +55,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(vulgus);
+ void vulgus_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/warpwarp.h b/src/mame/includes/warpwarp.h
index ec6239bf6a4..371712b84e6 100644
--- a/src/mame/includes/warpwarp.h
+++ b/src/mame/includes/warpwarp.h
@@ -101,11 +101,11 @@ private:
DECLARE_MACHINE_RESET(kaitei);
DECLARE_VIDEO_START(geebee);
- DECLARE_PALETTE_INIT(geebee);
+ void geebee_palette(palette_device &palette) const;
DECLARE_VIDEO_START(warpwarp);
- DECLARE_PALETTE_INIT(warpwarp);
+ void warpwarp_palette(palette_device &palette) const;
DECLARE_VIDEO_START(navarone);
- DECLARE_PALETTE_INIT(navarone);
+ void navarone_palette(palette_device &palette) const;
TILEMAP_MAPPER_MEMBER(tilemap_scan);
TILE_GET_INFO_MEMBER(geebee_get_tile_info);
diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h
index 38b1e231342..83cc5048720 100644
--- a/src/mame/includes/williams.h
+++ b/src/mame/includes/williams.h
@@ -79,7 +79,7 @@ public:
uint32_t screen_update_williams(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_VIDEO_START(williams);
- DECLARE_PALETTE_INIT(williams);
+ void williams_palette(palette_device &palette) const;
protected:
enum
diff --git a/src/mame/includes/wiping.h b/src/mame/includes/wiping.h
index 1a6ea429830..94449b8cb54 100644
--- a/src/mame/includes/wiping.h
+++ b/src/mame/includes/wiping.h
@@ -43,7 +43,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(sound_irq_mask_w);
DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
- DECLARE_PALETTE_INIT(wiping);
+ void wiping_palette(palette_device &palette) const;
virtual void machine_start() override;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/wiz.h b/src/mame/includes/wiz.h
index b8f30793d42..7380cf28d61 100644
--- a/src/mame/includes/wiz.h
+++ b/src/mame/includes/wiz.h
@@ -85,7 +85,7 @@ private:
virtual void machine_reset() override;
virtual void machine_start() override;
- DECLARE_PALETTE_INIT(wiz);
+ void wiz_palette(palette_device &palette) const;
uint32_t screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/wolfpack.h b/src/mame/includes/wolfpack.h
index fd54848a09a..ecccb0c69f4 100644
--- a/src/mame/includes/wolfpack.h
+++ b/src/mame/includes/wolfpack.h
@@ -71,7 +71,7 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
- DECLARE_PALETTE_INIT(wolfpack);
+ void wolfpack_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(screen_vblank);
diff --git a/src/mame/includes/wswan.h b/src/mame/includes/wswan.h
index b0a2b820e78..5ca95fce472 100644
--- a/src/mame/includes/wswan.h
+++ b/src/mame/includes/wswan.h
@@ -94,7 +94,7 @@ protected:
void common_start();
virtual void machine_start() override;
virtual void machine_reset() override;
- DECLARE_PALETTE_INIT(wswan);
+ void wswan_palette(palette_device &palette) const;
void wswan_io(address_map &map);
void wswan_mem(address_map &map);
@@ -114,7 +114,7 @@ public:
protected:
virtual void machine_start() override;
void wscolor_mem(address_map &map);
- DECLARE_PALETTE_INIT(wscolor);
+ void wscolor_palette(palette_device &palette) const;
};
#endif // MAME_INCLUDES_WSWAN_H
diff --git a/src/mame/includes/x07.h b/src/mame/includes/x07.h
index 030e693dfba..85fa6ddc1e9 100644
--- a/src/mame/includes/x07.h
+++ b/src/mame/includes/x07.h
@@ -283,7 +283,7 @@ private:
uint8_t m_prn_char_code;
uint8_t m_prn_buffer[0x100];
uint8_t m_prn_size;
- DECLARE_PALETTE_INIT(x07);
+ void x07_palette(palette_device &palette) const;
TIMER_CALLBACK_MEMBER(cassette_tick);
TIMER_CALLBACK_MEMBER(cassette_poll);
TIMER_CALLBACK_MEMBER(rsta_clear);
diff --git a/src/mame/includes/x1.h b/src/mame/includes/x1.h
index dd9fdd2c531..70ad3474489 100644
--- a/src/mame/includes/x1.h
+++ b/src/mame/includes/x1.h
@@ -138,7 +138,6 @@ public:
DECLARE_MACHINE_START(x1);
DECLARE_MACHINE_RESET(x1);
DECLARE_VIDEO_START(x1);
- DECLARE_PALETTE_INIT(x1);
DECLARE_MACHINE_RESET(x1turbo);
uint32_t screen_update_x1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
DECLARE_INPUT_CHANGED_MEMBER(ipl_reset);
diff --git a/src/mame/includes/x68k.h b/src/mame/includes/x68k.h
index cf7b3cbef74..4295b9dfca1 100644
--- a/src/mame/includes/x68k.h
+++ b/src/mame/includes/x68k.h
@@ -329,7 +329,7 @@ protected:
void draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect);
public:
- DECLARE_PALETTE_DECODER(GGGGGRRRRRBBBBBI);
+ static rgb_t GGGGGRRRRRBBBBBI(uint32_t raw);
protected:
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
diff --git a/src/mame/includes/xevious.h b/src/mame/includes/xevious.h
index b430ce8b484..94bd28dd61e 100644
--- a/src/mame/includes/xevious.h
+++ b/src/mame/includes/xevious.h
@@ -44,7 +44,7 @@ protected:
TILE_GET_INFO_MEMBER(get_fg_tile_info);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
DECLARE_VIDEO_START(xevious);
- DECLARE_PALETTE_INIT(xevious);
+ void xevious_palette(palette_device &palette) const;
DECLARE_MACHINE_RESET(xevios);
uint32_t screen_update_xevious(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
diff --git a/src/mame/includes/xorworld.h b/src/mame/includes/xorworld.h
index b78c28e1a7b..cce8e69d69d 100644
--- a/src/mame/includes/xorworld.h
+++ b/src/mame/includes/xorworld.h
@@ -43,7 +43,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
virtual void video_start() override;
- DECLARE_PALETTE_INIT(xorworld);
+ void xorworld_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect );
diff --git a/src/mame/includes/xxmissio.h b/src/mame/includes/xxmissio.h
index 61047b5041f..9a027094fa3 100644
--- a/src/mame/includes/xxmissio.h
+++ b/src/mame/includes/xxmissio.h
@@ -61,7 +61,7 @@ private:
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
- DECLARE_PALETTE_DECODER(BBGGRRII);
+ static rgb_t BBGGRRII(uint32_t raw);
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx);
diff --git a/src/mame/includes/xyonix.h b/src/mame/includes/xyonix.h
index e56727f6f7d..85d3a9362e7 100644
--- a/src/mame/includes/xyonix.h
+++ b/src/mame/includes/xyonix.h
@@ -46,7 +46,7 @@ private:
DECLARE_WRITE8_MEMBER(vidram_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(xyonix);
+ void xyonix_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void handle_coins(int coin);
diff --git a/src/mame/includes/yiear.h b/src/mame/includes/yiear.h
index 6ccd0c76565..7b1c7ea08b5 100644
--- a/src/mame/includes/yiear.h
+++ b/src/mame/includes/yiear.h
@@ -64,7 +64,7 @@ private:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(yiear);
+ void yiear_palette(palette_device &palette) const;
uint32_t screen_update_yiear(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
INTERRUPT_GEN_MEMBER(yiear_nmi_interrupt);
diff --git a/src/mame/includes/z88.h b/src/mame/includes/z88.h
index 6d55aaae74a..90fb78de122 100644
--- a/src/mame/includes/z88.h
+++ b/src/mame/includes/z88.h
@@ -88,7 +88,7 @@ private:
void vh_render_6x8(bitmap_ind16 &bitmap, int x, int y, uint16_t pen0, uint16_t pen1, uint8_t *gfx);
void vh_render_line(bitmap_ind16 &bitmap, int x, int y, uint16_t pen);
- DECLARE_PALETTE_INIT(z88);
+ void z88_palette(palette_device &palette) const;
void z88_io(address_map &map);
void z88_mem(address_map &map);
diff --git a/src/mame/includes/zac2650.h b/src/mame/includes/zac2650.h
index 5ca4c5a3bfd..4e8a3c2ba23 100644
--- a/src/mame/includes/zac2650.h
+++ b/src/mame/includes/zac2650.h
@@ -52,7 +52,7 @@ private:
DECLARE_WRITE8_MEMBER(zac_s2636_w);
DECLARE_READ8_MEMBER(tinvader_port_0_r);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
- DECLARE_PALETTE_INIT(zac2650);
+ void zac2650_palette(palette_device &palette) const;
uint32_t screen_update_tinvader(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
int SpriteCollision(int first,int second);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/zaccaria.h b/src/mame/includes/zaccaria.h
index 2069dab3521..52b6e25a529 100644
--- a/src/mame/includes/zaccaria.h
+++ b/src/mame/includes/zaccaria.h
@@ -43,7 +43,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(flip_screen_y_w);
DECLARE_WRITE8_MEMBER(dsw_sel_w);
TILE_GET_INFO_MEMBER(get_tile_info);
- DECLARE_PALETTE_INIT(zaccaria);
+ void zaccaria_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
DECLARE_WRITE_LINE_MEMBER(vblank_irq);
void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,uint8_t *spriteram,int color,int section);
diff --git a/src/mame/includes/zaxxon.h b/src/mame/includes/zaxxon.h
index 75366e0aab3..3c2cd1f5d98 100644
--- a/src/mame/includes/zaxxon.h
+++ b/src/mame/includes/zaxxon.h
@@ -110,7 +110,7 @@ private:
TILE_GET_INFO_MEMBER(congo_get_fg_tile_info);
virtual void machine_start() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(zaxxon);
+ void zaxxon_palette(palette_device &palette);
DECLARE_VIDEO_START(razmataz);
DECLARE_VIDEO_START(congo);
uint32_t screen_update_zaxxon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h
index 099b5a012b0..ab0161f9fc3 100644
--- a/src/mame/includes/zx.h
+++ b/src/mame/includes/zx.h
@@ -73,7 +73,6 @@ private:
virtual void machine_reset() override;
virtual void video_start() override;
- DECLARE_PALETTE_INIT(zx);
void zx_tape_input();
void zx_ula_hsync();
diff --git a/src/mame/machine/amstrad.cpp b/src/mame/machine/amstrad.cpp
index eb7b97a7f1f..280c4a2cb28 100644
--- a/src/mame/machine/amstrad.cpp
+++ b/src/mame/machine/amstrad.cpp
@@ -201,15 +201,15 @@ static const rgb_t amstrad_green_palette[32] =
*******************************************************************/
/* Initialise the palette */
-PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc)
+void amstrad_state::amstrad_cpc_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette));
+ palette.set_pen_colors(0, amstrad_palette);
}
-PALETTE_INIT_MEMBER(amstrad_state,amstrad_cpc_green)
+void amstrad_state::amstrad_cpc_green_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, amstrad_green_palette, ARRAY_LENGTH(amstrad_green_palette));
+ palette.set_pen_colors(0, amstrad_green_palette);
}
@@ -268,18 +268,18 @@ Green value, Red value, Blue value: 0 = 0%, 01/10 = 50%, 11 = 100%.
The 01 case is not used, it is unknown if this produces a different amount of colour.
*/
-unsigned char amstrad_state::kccomp_get_colour_element(int colour_value)
+uint8_t amstrad_state::kccomp_get_colour_element(int colour_value)
{
switch (colour_value)
{
- case 0:
- return 0x00;
- case 1:
- return 0x60;
- case 2:
- return 0x60;
- case 3:
- return 0xff;
+ case 0:
+ return 0x00;
+ case 1:
+ return 0x60;
+ case 2:
+ return 0x60;
+ case 3:
+ return 0xff;
}
return 0xff;
@@ -289,19 +289,18 @@ unsigned char amstrad_state::kccomp_get_colour_element(int colour_value)
/* the colour rom has the same 32 bytes repeated, but it might be possible to put a new rom in
with different data and be able to select the other entries - not tested on a real kc compact yet
and not supported by this driver */
-PALETTE_INIT_MEMBER(amstrad_state,kccomp)
+void amstrad_state::kccomp_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- color_prom = color_prom+0x018000;
+ color_prom += 0x018000;
- for (i=0; i<32; i++)
+ for (int i=0; i<32; i++)
{
palette.set_pen_color(i,
- kccomp_get_colour_element((color_prom[i]>>2) & 0x03),
- kccomp_get_colour_element((color_prom[i]>>4) & 0x03),
- kccomp_get_colour_element((color_prom[i]>>0) & 0x03));
+ kccomp_get_colour_element((color_prom[i]>>2) & 0x03),
+ kccomp_get_colour_element((color_prom[i]>>4) & 0x03),
+ kccomp_get_colour_element((color_prom[i]>>0) & 0x03));
}
}
@@ -312,42 +311,30 @@ Amstrad Plus
The Amstrad Plus has a 4096 colour palette
*********************************************/
-PALETTE_INIT_MEMBER(amstrad_state,amstrad_plus)
+void amstrad_state::amstrad_plus_palette(palette_device &palette) const
{
- int i;
-
- palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette) / 3);
- for ( i = 0; i < 0x1000; i++ )
+ palette.set_pen_colors(0, amstrad_palette, ARRAY_LENGTH(amstrad_palette) / 3); // FIXME: isn't this overwritten by the loop?
+ for (int i = 0; i < 0x1000; i++)
{
- int r, g, b;
+ int const g = ( i >> 8 ) & 0x0f;
+ int const r = ( i >> 4 ) & 0x0f;
+ int const b = i & 0x0f;
- g = ( i >> 8 ) & 0x0f;
- r = ( i >> 4 ) & 0x0f;
- b = i & 0x0f;
-
- r = ( r << 4 ) | ( r );
- g = ( g << 4 ) | ( g );
- b = ( b << 4 ) | ( b );
-
- palette.set_pen_color(i, r, g, b);
+ palette.set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b));
}
}
-PALETTE_INIT_MEMBER(amstrad_state,aleste)
+void amstrad_state::aleste_palette(palette_device &palette) const
{
- int i;
-
/* CPC Colour data is stored in the colour ROM (RFCOLDAT.BIN) at 0x140-0x17f */
- unsigned char* pal = memregion("user4")->base();
+ uint8_t const *const pal = memregion("user4")->base();
- for(i=0; i<32; i++)
+ for (int i=0; i<32; i++)
{
- int r,g,b;
-
- b = (pal[0x140+i] >> 4) & 0x03;
- g = (pal[0x140+i] >> 2) & 0x03;
- r = pal[0x140+i] & 0x03;
+ int b = (pal[0x140+i] >> 4) & 0x03;
+ int g = (pal[0x140+i] >> 2) & 0x03;
+ int r = pal[0x140+i] & 0x03;
r = (r << 6);
g = (g << 6);
@@ -357,13 +344,11 @@ PALETTE_INIT_MEMBER(amstrad_state,aleste)
}
/* MSX colour palette is 6-bit RGB */
- for(i=0; i<64; i++)
+ for (int i=0; i<64; i++)
{
- int r,g,b;
-
- r = (i >> 4) & 0x03;
- g = (i >> 2) & 0x03;
- b = i & 0x03;
+ int r = (i >> 4) & 0x03;
+ int g = (i >> 2) & 0x03;
+ int b = i & 0x03;
r = (r << 6);
g = (g << 6);
@@ -376,9 +361,7 @@ PALETTE_INIT_MEMBER(amstrad_state,aleste)
void amstrad_state::amstrad_init_lookups()
{
- int i;
-
- for ( i = 0; i < 256; i++ )
+ for ( int i = 0; i < 256; i++ )
{
m_mode0_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x20 ) >> 3 ) | ( ( i & 0x08 ) >> 2 ) | ( ( i & 0x02 ) << 2 );
m_mode1_lookup[i] = ( ( i & 0x80 ) >> 7 ) | ( ( i & 0x08 ) >> 2 );
@@ -1163,8 +1146,8 @@ void amstrad_state::amstrad_setLowerRom()
else
bank_base = m_AmstradCPC_RamBanks[0];
}
- m_bank1->set_base(bank_base);
- m_bank2->set_base(bank_base+0x02000);
+ m_banks[0]->set_base(bank_base);
+ m_banks[1]->set_base(bank_base+0x02000);
if ((m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0)
{
if (m_exp)
@@ -1190,14 +1173,14 @@ void amstrad_state::amstrad_setLowerRom()
space.install_write_bank(0x6000, 0x7fff, "bank12");
}
*/
- if(m_AmstradCPC_RamBanks[0] != nullptr)
+ if (m_AmstradCPC_RamBanks[0])
{
- m_bank1->set_base(m_AmstradCPC_RamBanks[0]);
- m_bank2->set_base(m_AmstradCPC_RamBanks[0]+0x2000);
- m_bank3->set_base(m_AmstradCPC_RamBanks[1]);
- m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
- m_bank5->set_base(m_AmstradCPC_RamBanks[2]);
- m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
+ m_banks[0]->set_base(m_AmstradCPC_RamBanks[0]);
+ m_banks[1]->set_base(m_AmstradCPC_RamBanks[0]+0x2000);
+ m_banks[2]->set_base(m_AmstradCPC_RamBanks[1]);
+ m_banks[3]->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
+ m_banks[4]->set_base(m_AmstradCPC_RamBanks[2]);
+ m_banks[5]->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
}
if ( (m_gate_array.mrer & (1<<2)) == 0 && m_gate_array.romdis == 0)
@@ -1210,30 +1193,30 @@ void amstrad_state::amstrad_setLowerRom()
{
case 0x00:
// logerror("L-ROM: located at &0000\n");
- m_bank1->set_base(bank_base);
- m_bank2->set_base(bank_base+0x02000);
+ m_banks[0]->set_base(bank_base);
+ m_banks[1]->set_base(bank_base+0x02000);
break;
case 0x08:
// logerror("L-ROM: located at &4000\n");
- m_bank3->set_base(bank_base);
- m_bank4->set_base(bank_base+0x02000);
+ m_banks[2]->set_base(bank_base);
+ m_banks[3]->set_base(bank_base+0x02000);
break;
case 0x10:
// logerror("L-ROM: located at &8000\n");
- m_bank5->set_base(bank_base);
- m_bank6->set_base(bank_base+0x02000);
+ m_banks[4]->set_base(bank_base);
+ m_banks[5]->set_base(bank_base+0x02000);
break;
case 0x18:
// logerror("L-ROM: located at &0000, ASIC registers enabled\n");
- m_bank1->set_base(bank_base);
- m_bank2->set_base(bank_base+0x02000);
+ m_banks[0]->set_base(bank_base);
+ m_banks[1]->set_base(bank_base+0x02000);
break;
}
}
else
{
- m_bank1->set_base(m_region_cart->base());
- m_bank2->set_base(m_region_cart->base() + 0x2000);
+ m_banks[0]->set_base(m_region_cart->base());
+ m_banks[1]->set_base(m_region_cart->base() + 0x2000);
if (m_exp)
m_exp->set_mapping(device_cpc_expansion_card_interface::MAP_LOWER);
}
@@ -1264,8 +1247,8 @@ void amstrad_state::amstrad_setUpperRom()
if (bank_base)
{
- m_bank7->set_base(bank_base);
- m_bank8->set_base(bank_base+0x2000);
+ m_banks[6]->set_base(bank_base);
+ m_banks[7]->set_base(bank_base+0x2000);
}
if ( ! ( m_gate_array.mrer & 0x08 ) && m_gate_array.romdis == 0)
{
@@ -1407,7 +1390,7 @@ WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_4000_w)
m_asic.ram[offset] = data & 0x0f;
else
{
- uint8_t* RAM = (uint8_t*)m_bank11->base();
+ uint8_t* RAM = (uint8_t*)m_banks[10]->base();
RAM[offset] = data;
}
}
@@ -1510,7 +1493,7 @@ WRITE8_MEMBER(amstrad_state::amstrad_plus_asic_6000_w)
}
else
{
- uint8_t* RAM = (uint8_t*)m_bank12->base();
+ uint8_t* RAM = (uint8_t*)m_banks[11]->base();
RAM[offset] = data;
}
}
@@ -1523,7 +1506,7 @@ READ8_MEMBER(amstrad_state::amstrad_plus_asic_4000_r)
return m_asic.ram[offset];
else
{
- uint8_t* RAM = (uint8_t*)m_bank3->base();
+ uint8_t* RAM = (uint8_t*)m_banks[2]->base();
return RAM[offset];
}
}
@@ -1566,7 +1549,7 @@ READ8_MEMBER(amstrad_state::amstrad_plus_asic_6000_r)
}
else
{
- uint8_t* RAM = (uint8_t*)m_bank4->base();
+ uint8_t* RAM = (uint8_t*)m_banks[3]->base();
return RAM[offset];
}
}
@@ -1752,37 +1735,37 @@ WRITE8_MEMBER(amstrad_state::aleste_msx_mapper)
switch(page)
{
case 0: /* 0x0000 - 0x3fff */
- m_bank1->set_base(ram+ramptr);
- m_bank2->set_base(ram+ramptr+0x2000);
- m_bank9->set_base(ram+ramptr);
- m_bank10->set_base(ram+ramptr+0x2000);
+ m_banks[0]->set_base(ram+ramptr);
+ m_banks[1]->set_base(ram+ramptr+0x2000);
+ m_banks[8]->set_base(ram+ramptr);
+ m_banks[9]->set_base(ram+ramptr+0x2000);
m_Aleste_RamBanks[0] = ram+ramptr;
m_aleste_active_page[0] = data;
logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x0000\n",ramptr,rampage);
break;
case 1: /* 0x4000 - 0x7fff */
- m_bank3->set_base(ram+ramptr);
- m_bank4->set_base(ram+ramptr+0x2000);
- m_bank11->set_base(ram+ramptr);
- m_bank12->set_base(ram+ramptr+0x2000);
+ m_banks[2]->set_base(ram+ramptr);
+ m_banks[3]->set_base(ram+ramptr+0x2000);
+ m_banks[10]->set_base(ram+ramptr);
+ m_banks[11]->set_base(ram+ramptr+0x2000);
m_Aleste_RamBanks[1] = ram+ramptr;
m_aleste_active_page[1] = data;
logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x4000\n",ramptr,rampage);
break;
case 2: /* 0x8000 - 0xbfff */
- m_bank5->set_base(ram+ramptr);
- m_bank6->set_base(ram+ramptr+0x2000);
- m_bank13->set_base(ram+ramptr);
- m_bank14->set_base(ram+ramptr+0x2000);
+ m_banks[4]->set_base(ram+ramptr);
+ m_banks[5]->set_base(ram+ramptr+0x2000);
+ m_banks[12]->set_base(ram+ramptr);
+ m_banks[13]->set_base(ram+ramptr+0x2000);
m_Aleste_RamBanks[2] = ram+ramptr;
m_aleste_active_page[2] = data;
logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0x8000\n",ramptr,rampage);
break;
case 3: /* 0xc000 - 0xffff */
- m_bank7->set_base(ram+ramptr);
- m_bank8->set_base(ram+ramptr+0x2000);
- m_bank15->set_base(ram+ramptr);
- m_bank16->set_base(ram+ramptr+0x2000);
+ m_banks[6]->set_base(ram+ramptr);
+ m_banks[7]->set_base(ram+ramptr+0x2000);
+ m_banks[14]->set_base(ram+ramptr);
+ m_banks[15]->set_base(ram+ramptr+0x2000);
m_Aleste_RamBanks[3] = ram+ramptr;
m_aleste_active_page[3] = data;
logerror("RAM: RAM location 0x%06x (page %02x) mapped to 0xc000\n",ramptr,rampage);
@@ -1856,7 +1839,7 @@ Expansion Peripherals Read/Write - - - - - 0 - - - - - -
READ8_MEMBER(amstrad_state::amstrad_cpc_io_r)
{
- unsigned char data = 0xFF;
+ uint8_t data = 0xFF;
unsigned int r1r0 = (unsigned int)((offset & 0x0300) >> 8);
// m6845_personality_t crtc_type;
int page;
@@ -2388,19 +2371,19 @@ void amstrad_state::amstrad_rethinkMemory()
{
if(m_aleste_mode & 0x04)
{
- m_bank3->set_base(m_Aleste_RamBanks[1]);
- m_bank4->set_base(m_Aleste_RamBanks[1]+0x2000);
+ m_banks[2]->set_base(m_Aleste_RamBanks[1]);
+ m_banks[3]->set_base(m_Aleste_RamBanks[1]+0x2000);
/* bank 2 - 0x08000..0x0bfff */
- m_bank5->set_base(m_Aleste_RamBanks[2]);
- m_bank6->set_base(m_Aleste_RamBanks[2]+0x2000);
+ m_banks[4]->set_base(m_Aleste_RamBanks[2]);
+ m_banks[5]->set_base(m_Aleste_RamBanks[2]+0x2000);
}
else
{
- m_bank3->set_base(m_AmstradCPC_RamBanks[1]);
- m_bank4->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
+ m_banks[2]->set_base(m_AmstradCPC_RamBanks[1]);
+ m_banks[3]->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
/* bank 2 - 0x08000..0x0bfff */
- m_bank5->set_base(m_AmstradCPC_RamBanks[2]);
- m_bank6->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
+ m_banks[4]->set_base(m_AmstradCPC_RamBanks[2]);
+ m_banks[5]->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
}
}
else
@@ -2414,25 +2397,25 @@ void amstrad_state::amstrad_rethinkMemory()
/* other banks */
if(m_aleste_mode & 0x04)
{
- m_bank9->set_base(m_Aleste_RamBanks[0]);
- m_bank10->set_base(m_Aleste_RamBanks[0]+0x2000);
- m_bank11->set_base(m_Aleste_RamBanks[1]);
- m_bank12->set_base(m_Aleste_RamBanks[1]+0x2000);
- m_bank13->set_base(m_Aleste_RamBanks[2]);
- m_bank14->set_base(m_Aleste_RamBanks[2]+0x2000);
- m_bank15->set_base(m_Aleste_RamBanks[3]);
- m_bank16->set_base(m_Aleste_RamBanks[3]+0x2000);
+ m_banks[8]->set_base(m_Aleste_RamBanks[0]);
+ m_banks[9]->set_base(m_Aleste_RamBanks[0]+0x2000);
+ m_banks[10]->set_base(m_Aleste_RamBanks[1]);
+ m_banks[11]->set_base(m_Aleste_RamBanks[1]+0x2000);
+ m_banks[12]->set_base(m_Aleste_RamBanks[2]);
+ m_banks[13]->set_base(m_Aleste_RamBanks[2]+0x2000);
+ m_banks[14]->set_base(m_Aleste_RamBanks[3]);
+ m_banks[15]->set_base(m_Aleste_RamBanks[3]+0x2000);
}
else
{
- m_bank9->set_base(m_AmstradCPC_RamBanks[0]);
- m_bank10->set_base(m_AmstradCPC_RamBanks[0]+0x2000);
- m_bank11->set_base(m_AmstradCPC_RamBanks[1]);
- m_bank12->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
- m_bank13->set_base(m_AmstradCPC_RamBanks[2]);
- m_bank14->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
- m_bank15->set_base(m_AmstradCPC_RamBanks[3]);
- m_bank16->set_base(m_AmstradCPC_RamBanks[3]+0x2000);
+ m_banks[8]->set_base(m_AmstradCPC_RamBanks[0]);
+ m_banks[9]->set_base(m_AmstradCPC_RamBanks[0]+0x2000);
+ m_banks[10]->set_base(m_AmstradCPC_RamBanks[1]);
+ m_banks[11]->set_base(m_AmstradCPC_RamBanks[1]+0x2000);
+ m_banks[12]->set_base(m_AmstradCPC_RamBanks[2]);
+ m_banks[13]->set_base(m_AmstradCPC_RamBanks[2]+0x2000);
+ m_banks[14]->set_base(m_AmstradCPC_RamBanks[3]);
+ m_banks[15]->set_base(m_AmstradCPC_RamBanks[3]+0x2000);
}
/* multiface hardware enabled? */
@@ -2769,8 +2752,8 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int)
uint8_t data_x, data_y;
m_amx_mouse_data = 0x0f;
- data_x = m_io_mouse1.read_safe(0);
- data_y = m_io_mouse2.read_safe(0);
+ data_x = m_io_mouse[0].read_safe(0);
+ data_y = m_io_mouse[1].read_safe(0);
if(data_x > prev_x)
m_amx_mouse_data &= ~0x08;
@@ -2780,7 +2763,7 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int)
m_amx_mouse_data &= ~0x02;
if(data_y < prev_y)
m_amx_mouse_data &= ~0x01;
- m_amx_mouse_data |= (m_io_mouse3.read_safe(0) << 4);
+ m_amx_mouse_data |= (m_io_mouse[2].read_safe(0) << 4);
prev_x = data_x;
prev_y = data_y;
diff --git a/src/mame/machine/imds2ioc.cpp b/src/mame/machine/imds2ioc.cpp
index 8295d431e03..28cea70c5c8 100644
--- a/src/mame/machine/imds2ioc.cpp
+++ b/src/mame/machine/imds2ioc.cpp
@@ -602,8 +602,8 @@ MACHINE_CONFIG_START(imds2ioc_device::device_add_mconfig)
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
screen.set_screen_update("ioccrtc", FUNC(i8275_device::screen_update));
screen.set_refresh_hz(50);
- GFXDECODE(config, "gfxdecode", "palette", gfx_imds2);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ GFXDECODE(config, m_gfxdecode, m_palette, gfx_imds2);
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
SPEAKER(config, "mono").front_center();
BEEP(config, m_iocbeep, IOC_BEEP_FREQ).add_route(ALL_OUTPUTS, "mono", 1.00);
diff --git a/src/mame/machine/mmboard.cpp b/src/mame/machine/mmboard.cpp
index 8484694f405..30483da163e 100644
--- a/src/mame/machine/mmboard.cpp
+++ b/src/mame/machine/mmboard.cpp
@@ -328,8 +328,7 @@ MACHINE_CONFIG_START(mephisto_display_modul_device::device_add_mconfig)
MCFG_SCREEN_VISIBLE_AREA(0, 16*6-1, 0, 9*2-3)
MCFG_SCREEN_UPDATE_DEVICE("hd44780", hd44780_device, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(mephisto_display_modul_device, lcd_palette)
+ PALETTE(config, "palette", FUNC(mephisto_display_modul_device::lcd_palette), 2);
MCFG_HD44780_ADD("hd44780")
MCFG_HD44780_LCD_SIZE(2, 16)
@@ -341,7 +340,7 @@ MACHINE_CONFIG_START(mephisto_display_modul_device::device_add_mconfig)
MACHINE_CONFIG_END
-PALETTE_INIT_MEMBER(mephisto_display_modul_device,lcd_palette)
+void mephisto_display_modul_device::lcd_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
diff --git a/src/mame/machine/mmboard.h b/src/mame/machine/mmboard.h
index 9b634dca8ee..6df2c3f828e 100644
--- a/src/mame/machine/mmboard.h
+++ b/src/mame/machine/mmboard.h
@@ -99,14 +99,14 @@ public:
DECLARE_WRITE8_MEMBER(latch_w);
DECLARE_WRITE8_MEMBER(io_w);
- DECLARE_PALETTE_INIT(lcd_palette);
-
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
+ void lcd_palette(palette_device &palette) const;
+
private:
optional_device<hd44780_device> m_lcdc;
required_device<beep_device> m_beeper;
diff --git a/src/mame/machine/model1io2.cpp b/src/mame/machine/model1io2.cpp
index 3325cdae26c..1b581fa5b14 100644
--- a/src/mame/machine/model1io2.cpp
+++ b/src/mame/machine/model1io2.cpp
@@ -134,7 +134,8 @@ const tiny_rom_entry *model1io2_device::device_rom_region() const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START( model1io2_device::device_add_mconfig )
+void model1io2_device::device_add_mconfig(machine_config &config)
+{
tmpz84c015_device &iocpu(TMPZ84C015(config, "iocpu", 19.6608_MHz_XTAL / 2)); // TMPZ84C015AF-12
iocpu.set_addrmap(AS_PROGRAM, &model1io2_device::mem_map);
@@ -196,13 +197,12 @@ MACHINE_CONFIG_START( model1io2_device::device_add_mconfig )
screen.set_screen_update("lcd", FUNC(hd44780_device::screen_update));
screen.set_palette("palette");
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(model1io2_device, lcd)
+ PALETTE(config, "palette", FUNC(model1io2_device::lcd_palette), 3);
HD44780(config, m_lcd, 0);
m_lcd->set_lcd_size(2, 20);
m_lcd->set_pixel_update_cb(FUNC(model1io2_device::lcd_pixel_update), this);
-MACHINE_CONFIG_END
+}
//**************************************************************************
@@ -274,7 +274,7 @@ void model1io2_device::device_reset()
// DIAGNOSTIC LCD
//**************************************************************************
-PALETTE_INIT_MEMBER( model1io2_device, lcd )
+void model1io2_device::lcd_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
palette.set_pen_color(1, rgb_t( 92, 83, 88)); // lcd pixel on
diff --git a/src/mame/machine/model1io2.h b/src/mame/machine/model1io2.h
index 11784ec0cb0..7ead0a5b61c 100644
--- a/src/mame/machine/model1io2.h
+++ b/src/mame/machine/model1io2.h
@@ -41,13 +41,13 @@ public:
template <typename T> void set_lightgun_p2y_tag(T && tag) { m_lightgun_ports[2].set_tag(std::forward<T>(tag)); }
template <typename T> void set_lightgun_p2x_tag(T && tag) { m_lightgun_ports[3].set_tag(std::forward<T>(tag)); }
+protected:
void mem_map(address_map &map);
void io_map(address_map &map);
- DECLARE_PALETTE_INIT(lcd);
+ void lcd_palette(palette_device &palette) const;
HD44780_PIXEL_UPDATE(lcd_pixel_update);
-protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
diff --git a/src/mame/machine/radio86.cpp b/src/mame/machine/radio86.cpp
index 6f8a46acd8f..759020dab81 100644
--- a/src/mame/machine/radio86.cpp
+++ b/src/mame/machine/radio86.cpp
@@ -228,13 +228,13 @@ I8275_DRAW_CHARACTER_MEMBER(radio86_state::display_pixels)
bitmap.pix32(y, x + i) = palette[(pixels >> (5-i)) & 1 ? (hlgt ? 2 : 1) : 0];
}
-static constexpr rgb_t radio86_palette[3] = {
+static constexpr rgb_t radio86_pens[3] = {
{ 0x00, 0x00, 0x00 }, // black
{ 0xa0, 0xa0, 0xa0 }, // white
{ 0xff, 0xff, 0xff } // highlight
};
-PALETTE_INIT_MEMBER(radio86_state,radio86)
+void radio86_state::radio86_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, radio86_palette, ARRAY_LENGTH(radio86_palette));
+ palette.set_pen_colors(0, radio86_pens);
}
diff --git a/src/mame/machine/st0016.cpp b/src/mame/machine/st0016.cpp
index f07424147e5..17cf6e660be 100644
--- a/src/mame/machine/st0016.cpp
+++ b/src/mame/machine/st0016.cpp
@@ -124,7 +124,7 @@ void st0016_cpu_device::device_add_mconfig(machine_config &config)
SPEAKER(config, "lspeaker").front_left();
SPEAKER(config, "rspeaker").front_right();
- PALETTE(config, "palette", 16*16*4+1);
+ PALETTE(config, "palette").set_entries(16*16*4+1);
st0016_device &stsnd(ST0016(config, "stsnd", 0));
stsnd.ram_read().set(FUNC(st0016_cpu_device::soundram_read));
diff --git a/src/mame/video/1942.cpp b/src/mame/video/1942.cpp
index f7038baff93..31dfa891649 100644
--- a/src/mame/video/1942.cpp
+++ b/src/mame/video/1942.cpp
@@ -26,84 +26,76 @@
***************************************************************************/
-void _1942_state::create_palette()
+void _1942_state::create_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
+ int bit0, bit1, bit2, bit3;
- /* red component */
+ // red component
bit0 = (color_prom[i + 0 * 256] >> 0) & 0x01;
bit1 = (color_prom[i + 0 * 256] >> 1) & 0x01;
bit2 = (color_prom[i + 0 * 256] >> 2) & 0x01;
bit3 = (color_prom[i + 0 * 256] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // green component
bit0 = (color_prom[i + 1 * 256] >> 0) & 0x01;
bit1 = (color_prom[i + 1 * 256] >> 1) & 0x01;
bit2 = (color_prom[i + 1 * 256] >> 2) & 0x01;
bit3 = (color_prom[i + 1 * 256] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
bit0 = (color_prom[i + 2 * 256] >> 0) & 0x01;
bit1 = (color_prom[i + 2 * 256] >> 1) & 0x01;
bit2 = (color_prom[i + 2 * 256] >> 2) & 0x01;
bit3 = (color_prom[i + 2 * 256] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- m_palette->set_indirect_color(i,rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(_1942_state,1942)
+void _1942_state::_1942_palette(palette_device &palette) const
{
- create_palette();
+ create_palette(palette);
const uint8_t *color_prom = memregion("proms")->base();
- int i, colorbase;
color_prom += 3 * 256;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
/* characters use palette entries 128-143 */
- colorbase = 0;
- for (i = 0; i < 64 * 4; i++)
- {
- m_palette->set_pen_indirect(colorbase + i, 0x80 | *color_prom++);
- }
- colorbase += 64 * 4;
+ int colorbase = 0;
+ for (int i = 0; i < 64 * 4; i++)
+ palette.set_pen_indirect(colorbase + i, 0x80 | *color_prom++);
- /* background tiles use palette entries 0-63 in four banks */
- for (i = 0; i < 32 * 8; i++)
+ // background tiles use palette entries 0-63 in four banks
+ colorbase += 64 * 4;
+ for (int i = 0; i < 32 * 8; i++)
{
- m_palette->set_pen_indirect(colorbase + 0 * 32 * 8 + i, 0x00 | *color_prom);
- m_palette->set_pen_indirect(colorbase + 1 * 32 * 8 + i, 0x10 | *color_prom);
- m_palette->set_pen_indirect(colorbase + 2 * 32 * 8 + i, 0x20 | *color_prom);
- m_palette->set_pen_indirect(colorbase + 3 * 32 * 8 + i, 0x30 | *color_prom);
+ palette.set_pen_indirect(colorbase + 0 * 32 * 8 + i, 0x00 | *color_prom);
+ palette.set_pen_indirect(colorbase + 1 * 32 * 8 + i, 0x10 | *color_prom);
+ palette.set_pen_indirect(colorbase + 2 * 32 * 8 + i, 0x20 | *color_prom);
+ palette.set_pen_indirect(colorbase + 3 * 32 * 8 + i, 0x30 | *color_prom);
color_prom++;
}
- colorbase += 4 * 32 * 8;
- /* sprites use palette entries 64-79 */
- for (i = 0; i < 16 * 16; i++)
- m_palette->set_pen_indirect(colorbase + i, 0x40 | *color_prom++);
+ // sprites use palette entries 64-79
+ colorbase += 4 * 32 * 8;
+ for (int i = 0; i < 16 * 16; i++)
+ palette.set_pen_indirect(colorbase + i, 0x40 | *color_prom++);
}
-PALETTE_INIT_MEMBER(_1942p_state,1942p)
+void _1942p_state::_1942p_palette(palette_device &palette) const
{
for (int i = 0; i < 0x400; i++)
- {
palette.set_pen_indirect(i, i);
- }
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < 0x100; i++)
- {
- palette.set_pen_indirect(i+0x400, color_prom[i]| 0x240);
- }
+ palette.set_pen_indirect(i + 0x400, color_prom[i] | 0x240);
}
diff --git a/src/mame/video/1943.cpp b/src/mame/video/1943.cpp
index 1138368d52f..16cc09cf95f 100644
--- a/src/mame/video/1943.cpp
+++ b/src/mame/video/1943.cpp
@@ -47,73 +47,74 @@ other 2 bits (output & 0x0c) unknown
***************************************************************************/
-PALETTE_INIT_MEMBER(_1943_state,1943)
+void _1943_state::_1943_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
- /* red component */
+ // red component
bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
+ // green component
bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
+ // blue component
bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x40-0x4f */
- for (i = 0x00; i < 0x80; i++)
+ // characters use colors 0x40-0x4f
+ for (int i = 0x00; i < 0x80; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x40;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x40;
palette.set_pen_indirect(i, ctabentry);
}
- /* foreground tiles use colors 0x00-0x3f */
- for (i = 0x80; i < 0x180; i++)
+ // foreground tiles use colors 0x00-0x3f
+ for (int i = 0x80; i < 0x180; i++)
{
- uint8_t ctabentry = ((color_prom[0x200 + (i - 0x080)] & 0x03) << 4) |
- ((color_prom[0x100 + (i - 0x080)] & 0x0f) << 0);
+ uint8_t const ctabentry =
+ ((color_prom[0x200 + (i - 0x080)] & 0x03) << 4) |
+ ((color_prom[0x100 + (i - 0x080)] & 0x0f) << 0);
palette.set_pen_indirect(i, ctabentry);
}
- /* background tiles also use colors 0x00-0x3f */
- for (i = 0x180; i < 0x280; i++)
+ // background tiles also use colors 0x00-0x3f
+ for (int i = 0x180; i < 0x280; i++)
{
- uint8_t ctabentry = ((color_prom[0x400 + (i - 0x180)] & 0x03) << 4) |
- ((color_prom[0x300 + (i - 0x180)] & 0x0f) << 0);
+ uint8_t const ctabentry =
+ ((color_prom[0x400 + (i - 0x180)] & 0x03) << 4) |
+ ((color_prom[0x300 + (i - 0x180)] & 0x0f) << 0);
palette.set_pen_indirect(i, ctabentry);
}
/* sprites use colors 0x80-0xff
bit 3 of BMPROM.07 selects priority over the background,
but we handle it differently for speed reasons */
- for (i = 0x280; i < 0x380; i++)
+ for (int i = 0x280; i < 0x380; i++)
{
- uint8_t ctabentry = ((color_prom[0x600 + (i - 0x280)] & 0x07) << 4) |
- ((color_prom[0x500 + (i - 0x280)] & 0x0f) << 0) | 0x80;
+ uint8_t const ctabentry =
+ ((color_prom[0x600 + (i - 0x280)] & 0x07) << 4) |
+ ((color_prom[0x500 + (i - 0x280)] & 0x0f) << 0) |
+ 0x80;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/20pacgal.cpp b/src/mame/video/20pacgal.cpp
index c5d404d0a12..d8eef7e0c6d 100644
--- a/src/mame/video/20pacgal.cpp
+++ b/src/mame/video/20pacgal.cpp
@@ -27,31 +27,30 @@
void _20pacgal_state::get_pens()
{
- // TODO : Accurate palette when prom isn't exists
- offs_t offs;
- uint8_t *color_prom = m_proms->base() + (NUM_PENS * m_game_selected);
+ // TODO: Accurate palette when prom doesn't exist
+ uint8_t const *color_prom = m_proms->base() + (NUM_PENS * m_game_selected);
- for (offs = 0; offs < NUM_PENS ;offs++)
+ for (offs_t offs = 0; offs < NUM_PENS; offs++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
m_palette->set_pen_color(offs, rgb_t(r, g, b));
@@ -59,22 +58,18 @@ void _20pacgal_state::get_pens()
}
}
-PALETTE_INIT_MEMBER(_20pacgal_state,starpal_init)
+void _20pacgal_state::starpal_init(palette_device &palette) const
{
- /* Star field */
+ // Star field
- /* palette for the stars */
- for (offs_t offs = 0;offs < 64;offs++)
+ // palette for the stars
+ for (offs_t offs = 0; offs < 64; offs++)
{
- int bits,r,g,b;
- static const int map[4] = { 0x00, 0x47, 0x97 ,0xde };
+ static constexpr int map[4] = { 0x00, 0x47, 0x97 ,0xde };
- bits = (offs >> 0) & 0x03;
- r = map[bits];
- bits = (offs >> 2) & 0x03;
- g = map[bits];
- bits = (offs >> 4) & 0x03;
- b = map[bits];
+ int const r = map[(offs >> 0) & 0x03];
+ int const g = map[(offs >> 2) & 0x03];
+ int const b = map[(offs >> 4) & 0x03];
palette.set_pen_color(NUM_PENS + offs, rgb_t(r, g, b));
}
@@ -459,6 +454,5 @@ MACHINE_CONFIG_START(_20pacgal_state::_20pacgal_video)
MCFG_SCREEN_UPDATE_DRIVER(_20pacgal_state, screen_update_20pacgal)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, _20pacgal_state, vblank_irq))
- MCFG_PALETTE_ADD("palette", NUM_PENS + NUM_STAR_PENS)
- MCFG_PALETTE_INIT_OWNER(_20pacgal_state,starpal_init)
+ PALETTE(config, m_palette, FUNC(_20pacgal_state::starpal_init), NUM_PENS + NUM_PENS);
MACHINE_CONFIG_END
diff --git a/src/mame/video/733_asr.cpp b/src/mame/video/733_asr.cpp
index 64a50935497..59bfa3bc76f 100644
--- a/src/mame/video/733_asr.cpp
+++ b/src/mame/video/733_asr.cpp
@@ -71,12 +71,6 @@ static GFXDECODE_START( gfx_asr733 )
GFXDECODE_ENTRY( asr733_chr_region, 0, fontlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER(asr733_device, asr733)
-{
- palette.set_pen_color(0, rgb_t::white()); /* white */
- palette.set_pen_color(1, rgb_t::black()); /* black */
-}
-
DEFINE_DEVICE_TYPE(ASR733, asr733_device, "asr733", "733 ASR")
@@ -784,8 +778,7 @@ ioport_constructor asr733_device::device_input_ports() const
MACHINE_CONFIG_START(asr733_device::device_add_mconfig)
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(asr733_device, asr733)
+ PALETTE(config, "palette", palette_device::MONOCHROME_INVERTED);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
diff --git a/src/mame/video/733_asr.h b/src/mame/video/733_asr.h
index c76e533c391..1f2bc08560a 100644
--- a/src/mame/video/733_asr.h
+++ b/src/mame/video/733_asr.h
@@ -51,8 +51,6 @@ private:
void linefeed();
void transmit(uint8_t data);
- DECLARE_PALETTE_INIT(asr733);
-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<screen_device> m_screen;
diff --git a/src/mame/video/8080bw.cpp b/src/mame/video/8080bw.cpp
index 4f213e05648..2d84c4df351 100644
--- a/src/mame/video/8080bw.cpp
+++ b/src/mame/video/8080bw.cpp
@@ -26,7 +26,7 @@ MACHINE_START_MEMBER(_8080bw_state,extra_8080bw_vh)
}
-PALETTE_INIT_MEMBER(_8080bw_state,rollingc)
+void _8080bw_state::rollingc_palette(palette_device &palette) const
{
// palette is 3bpp + intensity
for (int i = 0; i < 8; i++)
@@ -42,13 +42,12 @@ PALETTE_INIT_MEMBER(_8080bw_state,rollingc)
}
-PALETTE_INIT_MEMBER( _8080bw_state, sflush )
+void _8080bw_state::sflush_palette(palette_device &palette) const
{
- // standard 3-bit rbg palette
- palette.palette_init_3bit_rbg(palette);
-
- // but background color is bright blue
+ // standard 3-bit rbg palette, but background color is bright blue
palette.set_pen_color(0, 0x80, 0x80, 0xff);
+ for (int i = 1; i < 8; i++)
+ palette.set_pen_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 2), pal1bit(i >> 1)));
}
diff --git a/src/mame/video/911_vdt.cpp b/src/mame/video/911_vdt.cpp
index ad189a5e4e7..1290e3bea51 100644
--- a/src/mame/video/911_vdt.cpp
+++ b/src/mame/video/911_vdt.cpp
@@ -74,19 +74,19 @@ static GFXDECODE_START( gfx_vdt911 )
GFXDECODE_ENTRY( vdt911_chr_region, vdt911_device::frenchWP_chr_offset, fontlayout_7bit, 0, 4 )
GFXDECODE_END
-static const unsigned char vdt911_colors[] =
+static constexpr rgb_t vdt911_colors[] =
{
- 0x00,0x00,0x00, /* black */
- 0xC0,0xC0,0xC0, /* low intensity */
- 0xFF,0xFF,0xFF /* high intensity */
+ { 0x00, 0x00, 0x00 }, // black
+ { 0xc0, 0xc0, 0xc0 }, // low intensity
+ { 0xff, 0xff, 0xff } // high intensity
};
-static const unsigned short vdt911_palette[] =
+static const unsigned short vdt911_pens[] =
{
- 0, 2, /* high intensity */
- 0, 1, /* low intensity */
- 2, 0, /* high intensity, reverse */
- 2, 1 /* low intensity, reverse */
+ 0, 2, // high intensity
+ 0, 1, // low intensity
+ 2, 0, // high intensity, reverse
+ 2, 1 // low intensity, reverse
};
/*
@@ -104,18 +104,13 @@ static const unsigned short vdt911_palette[] =
/*
Initialize vdt911 palette
*/
-PALETTE_INIT_MEMBER(vdt911_device, vdt911)
+void vdt911_device::vdt911_palette(palette_device &palette) const
{
- uint8_t i, r, g, b;
+ for (int i = 0; i < ARRAY_LENGTH(vdt911_colors); i++)
+ palette.set_indirect_color(i, vdt911_colors[i]);
- for ( i = 0; i < 3; i++ )
- {
- r = vdt911_colors[i*3]; g = vdt911_colors[i*3+1]; b = vdt911_colors[i*3+2];
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- for(i=0;i<8;i++)
- palette.set_pen_indirect(i, vdt911_palette[i]);
+ for (int i = 0; i < ARRAY_LENGTH(vdt911_pens); i++)
+ palette.set_pen_indirect(i, vdt911_pens[i]);
}
/*
@@ -809,9 +804,7 @@ MACHINE_CONFIG_START(vdt911_device::device_add_mconfig)
MCFG_DEVICE_ADD("beeper", BEEP, 3250)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.50)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INDIRECT_ENTRIES(3)
- MCFG_PALETTE_INIT_OWNER(vdt911_device, vdt911)
+ PALETTE(config, "palette", FUNC(vdt911_device::vdt911_palette), ARRAY_LENGTH(vdt911_pens), ARRAY_LENGTH(vdt911_colors));
MACHINE_CONFIG_END
ioport_constructor vdt911_device::device_input_ports() const
diff --git a/src/mame/video/911_vdt.h b/src/mame/video/911_vdt.h
index 70a762c162c..b1c35194f12 100644
--- a/src/mame/video/911_vdt.h
+++ b/src/mame/video/911_vdt.h
@@ -66,7 +66,7 @@ private:
void refresh(bitmap_ind16 &bitmap, const rectangle &cliprect, int x, int y);
void check_keyboard();
- DECLARE_PALETTE_INIT(vdt911);
+ void vdt911_palette(palette_device &palette) const;
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
diff --git a/src/mame/video/abc1600.cpp b/src/mame/video/abc1600.cpp
index 0bb12472ca0..5fa0fa95a9f 100644
--- a/src/mame/video/abc1600.cpp
+++ b/src/mame/video/abc1600.cpp
@@ -206,7 +206,7 @@ MACHINE_CONFIG_START(abc1600_mover_device::device_add_mconfig)
MCFG_SCREEN_UPDATE_DRIVER(abc1600_mover_device, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(64'000'000), 0x3e0, 0, 0x300, 0x433, 0, 0x400)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
SY6845E(config, m_crtc, XTAL(64'000'000)/32);
m_crtc->set_screen(SCREEN_TAG);
diff --git a/src/mame/video/abc80.cpp b/src/mame/video/abc80.cpp
index af1a5b6e166..bc6768223da 100644
--- a/src/mame/video/abc80.cpp
+++ b/src/mame/video/abc80.cpp
@@ -199,5 +199,5 @@ MACHINE_CONFIG_START(abc80_state::abc80_video)
MCFG_SCREEN_RAW_PARAMS(XTAL(11'980'800)/2, ABC80_HTOTAL, ABC80_HBEND, ABC80_HBSTART, ABC80_VTOTAL, ABC80_VBEND, ABC80_VBSTART)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_abc80)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/video/abc800.cpp b/src/mame/video/abc800.cpp
index ec9c2c63999..eb8286e58ea 100644
--- a/src/mame/video/abc800.cpp
+++ b/src/mame/video/abc800.cpp
@@ -139,7 +139,7 @@ READ8_MEMBER( abc800c_state::char_ram_r )
// PALETTE_INIT( abc800c )
//-------------------------------------------------
-PALETTE_INIT_MEMBER( abc800c_state, abc800c )
+void abc800c_state::abc800c_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red
@@ -164,8 +164,7 @@ MACHINE_CONFIG_START(abc800c_state::abc800c_video)
MCFG_SCREEN_SIZE(480, 480)
MCFG_SCREEN_VISIBLE_AREA(0, 480-1, 0, 480-1)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(abc800c_state, abc800c)
+ PALETTE(config, m_palette, FUNC(abc800c_state::abc800c_palette), 8);
MCFG_DEVICE_ADD(SAA5052_TAG, SAA5052, XTAL(12'000'000)/2)
MCFG_SAA5050_D_CALLBACK(READ8(*this, abc800c_state, char_ram_r))
@@ -289,5 +288,5 @@ MACHINE_CONFIG_START(abc800m_state::abc800m_video)
MCFG_SCREEN_UPDATE_DRIVER(abc800m_state, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000), 0x300, 0, 0x1e0, 0x13a, 0, 0xf0)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/video/abc802.cpp b/src/mame/video/abc802.cpp
index fb1eb1da22f..70f088fb0fb 100644
--- a/src/mame/video/abc802.cpp
+++ b/src/mame/video/abc802.cpp
@@ -191,5 +191,5 @@ MACHINE_CONFIG_START(abc802_state::abc802_video)
MCFG_SCREEN_UPDATE_DEVICE(MC6845_TAG, mc6845_device, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000), 0x300, 0, 0x1e0, 0x13a, 0, 0xf0)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MACHINE_CONFIG_END
diff --git a/src/mame/video/abc806.cpp b/src/mame/video/abc806.cpp
index e773717292a..78d4a67306d 100644
--- a/src/mame/video/abc806.cpp
+++ b/src/mame/video/abc806.cpp
@@ -460,7 +460,7 @@ uint32_t abc806_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap
// PALETTE_INIT( abc806 )
//-------------------------------------------------
-PALETTE_INIT_MEMBER( abc806_state, abc806 )
+void abc806_state::abc806_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(0xff, 0x00, 0x00)); // red
@@ -490,6 +490,5 @@ MACHINE_CONFIG_START(abc806_state::abc806_video)
MCFG_SCREEN_UPDATE_DRIVER(abc806_state, screen_update)
MCFG_SCREEN_RAW_PARAMS(XTAL(12'000'000), 0x300, 0, 0x1e0, 0x13a, 0, 0xfa)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(abc806_state, abc806)
+ PALETTE(config, m_palette, FUNC(abc806_state::abc806_palette), 8);
MACHINE_CONFIG_END
diff --git a/src/mame/video/advision.cpp b/src/mame/video/advision.cpp
index 21df8ea0c1f..60ba1928bdc 100644
--- a/src/mame/video/advision.cpp
+++ b/src/mame/video/advision.cpp
@@ -14,6 +14,9 @@
#include "emu.h"
#include "includes/advision.h"
+#include <algorithm>
+
+
/***************************************************************************
Start the video hardware emulation.
@@ -35,13 +38,11 @@ void advision_state::video_start()
***************************************************************************/
-PALETTE_INIT_MEMBER(advision_state, advision)
+void advision_state::advision_palette(palette_device &palette) const
{
+ // 8 shades of RED
for (int i = 0; i < 8; i++)
- {
- /* 8 shades of RED */
- m_palette->set_pen_color(i, i * 0x22, 0x00, 0x00);
- }
+ m_palette->set_pen_color(i, pal3bit(i), 0x00, 0x00);
}
/***************************************************************************
@@ -53,9 +54,7 @@ PALETTE_INIT_MEMBER(advision_state, advision)
void advision_state::vh_write(int data)
{
if (m_video_bank >= 1 && m_video_bank <=5)
- {
m_led_latch[m_video_bank] = data;
- }
}
void advision_state::vh_update(int x)
diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp
index e165ae96c60..cc551d87237 100644
--- a/src/mame/video/agat7.cpp
+++ b/src/mame/video/agat7.cpp
@@ -43,10 +43,7 @@ MACHINE_CONFIG_START(agat7video_device::device_add_mconfig)
MCFG_SCREEN_ADD("a7screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(XTAL(10'500'000), 672, 0, 512, 312, 0, 256)
MCFG_SCREEN_UPDATE_DRIVER(agat7video_device, screen_update)
- MCFG_SCREEN_PALETTE("a7palette")
-
- MCFG_PALETTE_ADD("a7palette", 16)
- MCFG_PALETTE_INIT_OWNER(agat7video_device, agat7)
+ MCFG_SCREEN_PALETTE(DEVICE_SELF)
MACHINE_CONFIG_END
@@ -56,8 +53,8 @@ MACHINE_CONFIG_END
agat7video_device::agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, AGAT7VIDEO, tag, owner, clock),
+ device_palette_interface(mconfig, *this),
m_ram_dev(*this, finder_base::DUMMY_TAG),
- m_palette(*this, "a7palette"),
m_char_region(*this, finder_base::DUMMY_TAG),
m_char_ptr(nullptr),
m_char_size(0),
@@ -75,6 +72,13 @@ void agat7video_device::device_start()
m_char_ptr = m_char_region->base();
m_char_size = m_char_region->bytes();
+ // per http://agatcomp.ru/Reading/IiO/87-2-077.djvu
+ for (int i = 0; 8 > i; ++i)
+ {
+ set_pen_color(i + 0, rgb_t(BIT(i, 0) ? 0xff : 0, BIT(i, 1) ? 0xff : 0, BIT(i, 2) ? 0xff : 0));
+ set_pen_color(i + 8, rgb_t(BIT(i, 0) ? 0x7f : 0, BIT(i, 1) ? 0x7f : 0, BIT(i, 2) ? 0x7f : 0));
+ }
+
// save_item(NAME(m_video_mode));
save_item(NAME(m_start_address));
}
@@ -348,7 +352,7 @@ uint32_t agat7video_device::screen_update(screen_device &screen, bitmap_ind16 &b
return 0;
}
-// per http://agatcomp.ru/Reading/IiO/87-2-077.djvu
+#if 0
static const rgb_t agat7_palette[] =
{
rgb_t::black(),
@@ -368,8 +372,4 @@ static const rgb_t agat7_palette[] =
rgb_t(0x7F, 0x7F, 0x00), /* White */
rgb_t(0x7F, 0x7F, 0x7F) /* White */
};
-
-PALETTE_INIT_MEMBER(agat7video_device, agat7)
-{
- palette.set_pen_colors(0, agat7_palette, ARRAY_LENGTH(agat7_palette));
-}
+#endif
diff --git a/src/mame/video/agat7.h b/src/mame/video/agat7.h
index 6e1cd58a02d..cea25ed0cc2 100644
--- a/src/mame/video/agat7.h
+++ b/src/mame/video/agat7.h
@@ -14,14 +14,13 @@
#pragma once
#include "machine/ram.h"
-#include "emupal.h"
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
-class agat7video_device : public device_t
+class agat7video_device : public device_t, public device_palette_interface
{
public:
template <typename T, typename U>
@@ -42,6 +41,8 @@ protected:
virtual void device_reset() override;
virtual void device_add_mconfig(machine_config &config) override;
+ virtual u32 palette_entries() const override { return 16; }
+
void text_update_lores(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void text_update_hires(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
void graph_update_mono(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int beginrow, int endrow);
@@ -55,10 +56,7 @@ private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
- DECLARE_PALETTE_INIT(agat7);
-
required_device<ram_device> m_ram_dev;
- required_device<palette_device> m_palette;
required_memory_region m_char_region;
uint8_t *m_char_ptr;
diff --git a/src/mame/video/alpha68k.cpp b/src/mame/video/alpha68k.cpp
index 780687c445f..9c1aa98d4d7 100644
--- a/src/mame/video/alpha68k.cpp
+++ b/src/mame/video/alpha68k.cpp
@@ -296,17 +296,16 @@ uint32_t alpha68k_state::screen_update_alpha68k_I(screen_device &screen, bitmap_
//ZT
/******************************************************************************/
-PALETTE_INIT_MEMBER(alpha68k_state,kyros)
+void alpha68k_state::kyros_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
/* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -314,24 +313,23 @@ PALETTE_INIT_MEMBER(alpha68k_state,kyros)
/* color_prom now points to the beginning of the lookup table */
color_prom += 0x300;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = ((color_prom[i] & 0x0f) << 4) | (color_prom[i + 0x100] & 0x0f);
+ uint8_t const ctabentry = ((color_prom[i] & 0x0f) << 4) | (color_prom[i + 0x100] & 0x0f);
palette.set_pen_indirect(i, ctabentry);
}
}
-PALETTE_INIT_MEMBER(alpha68k_state,paddlem)
+void alpha68k_state::paddlem_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
/* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -339,9 +337,9 @@ PALETTE_INIT_MEMBER(alpha68k_state,paddlem)
/* color_prom now points to the beginning of the lookup table */
color_prom += 0x300;
- for (i = 0; i < 0x400; i++)
+ for (int i = 0; i < 0x400; i++)
{
- uint8_t ctabentry = ((color_prom[i + 0x400] & 0x0f) << 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = ((color_prom[i + 0x400] & 0x0f) << 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/amiga.cpp b/src/mame/video/amiga.cpp
index 7409e5d471e..804f4643325 100644
--- a/src/mame/video/amiga.cpp
+++ b/src/mame/video/amiga.cpp
@@ -108,11 +108,9 @@ const uint16_t delay[256] =
*
*************************************/
-PALETTE_INIT_MEMBER(amiga_state,amiga)
+void amiga_state::amiga_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 0x1000; i++)
+ for (int i = 0; i < 0x1000; i++)
palette.set_pen_color(i, pal4bit(i >> 8), pal4bit(i >> 4), pal4bit(i));
}
diff --git a/src/mame/video/ampoker2.cpp b/src/mame/video/ampoker2.cpp
index aa1f8222d38..358b720e20d 100644
--- a/src/mame/video/ampoker2.cpp
+++ b/src/mame/video/ampoker2.cpp
@@ -70,45 +70,50 @@
#include "emu.h"
-#include "video/resnet.h"
#include "includes/ampoker2.h"
+#include "video/resnet.h"
+
-PALETTE_INIT_MEMBER(ampoker2_state, ampoker2)
+void ampoker2_state::ampoker2_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
-/* - bits -
- 76543210
- RRRGGGBB
-*/
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
+ /* - bits -
+ 76543210
+ RRRGGGBB
+ */
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 0, 0,
3, resistances_rg, weights_g, 0, 0,
2, resistances_b, weights_b, 0, 0);
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); i++)
{
- /* blue component */
- int bit0 = (color_prom[i] >> 0) & 0x01;
- int bit1 = (color_prom[i] >> 1) & 0x01;
- int b = combine_2_weights(weights_b, bit0, bit1);
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i] >> 3) & 0x01;
- int bit2 = (color_prom[i] >> 4) & 0x01;
- int g = combine_3_weights(weights_g, bit0, bit1, bit2);
- /* red component */
- bit0 = (color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- int r = combine_3_weights(weights_r, bit0, bit1, bit2);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
+
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 4);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
+
+ // red component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/apexc.cpp b/src/mame/video/apexc.cpp
index 5e933a25519..174a665a4f4 100644
--- a/src/mame/video/apexc.cpp
+++ b/src/mame/video/apexc.cpp
@@ -11,7 +11,7 @@
#include "emu.h"
#include "includes/apexc.h"
-/*static*/ const rgb_t apexc_state::palette_table[] =
+const rgb_t apexc_state::palette_table[] =
{
rgb_t::white(),
rgb_t::black(),
@@ -51,9 +51,9 @@ static const rectangle teletyper_scroll_clear_window(
);
//static const int var_teletyper_scroll_step = - teletyper_scroll_step;
-PALETTE_INIT_MEMBER(apexc_state, apexc)
+void apexc_state::apexc_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, palette_table, ARRAY_LENGTH(palette_table));
+ palette.set_pen_colors(0, palette_table);
}
void apexc_state::video_start()
diff --git a/src/mame/video/apollo.cpp b/src/mame/video/apollo.cpp
index b75ecfeaab3..7d169e706ac 100644
--- a/src/mame/video/apollo.cpp
+++ b/src/mame/video/apollo.cpp
@@ -1886,7 +1886,7 @@ void apollo_graphics_15i::device_reset()
MACHINE_CONFIG_START(apollo_graphics_19i::device_add_mconfig)
config.set_default_layout(layout_apollo);
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MCFG_SCREEN_ADD(m_screen, RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK)
MCFG_SCREEN_RAW_PARAMS(120000000, 1728, 0, 1280, 1066, 0, 1024)
diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp
index 31229729742..e3a2bf97a85 100644
--- a/src/mame/video/apple2.cpp
+++ b/src/mame/video/apple2.cpp
@@ -38,6 +38,7 @@ DEFINE_DEVICE_TYPE(APPLE2_VIDEO, a2_video_device, "a2video", "Apple II video")
a2_video_device::a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, APPLE2_VIDEO, tag, owner, clock)
+ , device_palette_interface(mconfig, *this)
{
}
@@ -96,6 +97,9 @@ void a2_video_device::device_start()
m_dhires_artifact_map[i] = dhires_artifact_color_table[i];
}
+ // initialise for device_palette_interface
+ init_palette();
+
save_item(NAME(m_page2));
save_item(NAME(m_flash));
save_item(NAME(m_mix));
@@ -1068,10 +1072,15 @@ static const rgb_t apple2_palette[] =
rgb_t(0xFF, 0xFF, 0xFF) /* White */
};
-/* Initialize the palette */
-PALETTE_INIT_MEMBER(a2_video_device, apple2)
+void a2_video_device::init_palette()
+{
+ for (int i = 0; i < ARRAY_LENGTH(apple2_palette); i++)
+ set_pen_color(i, apple2_palette[i]);
+}
+
+uint32_t a2_video_device::palette_entries() const
{
- palette.set_pen_colors(0, apple2_palette, ARRAY_LENGTH(apple2_palette));
+ return ARRAY_LENGTH(apple2_palette);
}
uint32_t a2_video_device::screen_update_GS(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/video/apple2.h b/src/mame/video/apple2.h
index 1f601981b9f..819fe3bfb09 100644
--- a/src/mame/video/apple2.h
+++ b/src/mame/video/apple2.h
@@ -15,15 +15,12 @@
#define BORDER_RIGHT (32)
#define BORDER_TOP (16) // (plus bottom)
-class a2_video_device :
- public device_t
+class a2_video_device : public device_t, public device_palette_interface
{
public:
// construction/destruction
a2_video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
- DECLARE_PALETTE_INIT(apple2);
-
bool m_page2;
bool m_flash;
bool m_mix;
@@ -64,6 +61,9 @@ protected:
virtual void device_reset() override;
virtual void device_start() override;
+ virtual uint32_t palette_entries() const override;
+ void init_palette();
+
private:
void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg);
void plot_text_character_ultr(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg);
diff --git a/src/mame/video/apple3.cpp b/src/mame/video/apple3.cpp
index 77d5a66d089..5eba4a46a4b 100644
--- a/src/mame/video/apple3.cpp
+++ b/src/mame/video/apple3.cpp
@@ -78,16 +78,14 @@ static const uint32_t text_map[] =
};
-PALETTE_INIT_MEMBER(apple3_state, apple3)
+void apple3_state::palette_init(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
- m_palette->set_pen_color(i,
- apple3_palette[(3*i)]*17,
- apple3_palette[(3*i)+1]*17,
- apple3_palette[(3*i)+2]*17);
+ palette.set_pen_color(i,
+ apple3_palette[(3*i)]*17,
+ apple3_palette[(3*i)+1]*17,
+ apple3_palette[(3*i)+2]*17);
}
}
diff --git a/src/mame/video/appoooh.cpp b/src/mame/video/appoooh.cpp
index 534c840e9c4..e59b0332e8c 100644
--- a/src/mame/video/appoooh.cpp
+++ b/src/mame/video/appoooh.cpp
@@ -22,73 +22,65 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(appoooh_state,appoooh)
+void appoooh_state::appoooh_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- uint8_t pen;
- int bit0, bit1, bit2, r, g, b;
-
- if (i < 0x100)
- /* charset #1 */
- pen = (color_prom[0x020 + (i - 0x000)] & 0x0f) | 0x00;
- else
- /* charset #2 */
- pen = (color_prom[0x120 + (i - 0x100)] & 0x0f) | 0x10;
-
- /* red component */
- bit0 = (color_prom[pen] >> 0) & 0x01;
- bit1 = (color_prom[pen] >> 1) & 0x01;
- bit2 = (color_prom[pen] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[pen] >> 3) & 0x01;
- bit1 = (color_prom[pen] >> 4) & 0x01;
- bit2 = (color_prom[pen] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
+ int bit0, bit1, bit2;
+
+ uint8_t const pen = (color_prom[0x20 + i] & 0x0f) | ((i < 0x100) ? 0x00 : 0x10);
+
+ // red component
+ bit0 = BIT(color_prom[pen], 0);
+ bit1 = BIT(color_prom[pen], 1);
+ bit2 = BIT(color_prom[pen], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[pen], 3);
+ bit1 = BIT(color_prom[pen], 4);
+ bit2 = BIT(color_prom[pen], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
bit0 = 0;
- bit1 = (color_prom[pen] >> 6) & 0x01;
- bit2 = (color_prom[pen] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[pen], 6);
+ bit2 = BIT(color_prom[pen], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(appoooh_state,robowres)
+void appoooh_state::robowres_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- uint8_t pen = color_prom[0x020 + i] & 0x0f;
+ uint8_t const pen = color_prom[0x20 + i] & 0x0f;
- /* red component */
- bit0 = (color_prom[pen] >> 0) & 0x01;
- bit1 = (color_prom[pen] >> 1) & 0x01;
- bit2 = (color_prom[pen] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[pen], 0);
+ bit1 = BIT(color_prom[pen], 1);
+ bit2 = BIT(color_prom[pen], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[pen] >> 3) & 0x01;
- bit1 = (color_prom[pen] >> 4) & 0x01;
- bit2 = (color_prom[pen] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[pen], 3);
+ bit1 = BIT(color_prom[pen], 4);
+ bit2 = BIT(color_prom[pen], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[pen] >> 6) & 0x01;
- bit2 = (color_prom[pen] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[pen], 6);
+ bit2 = BIT(color_prom[pen], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/aquarius.cpp b/src/mame/video/aquarius.cpp
index c93a82fdd44..f291f3e9f60 100644
--- a/src/mame/video/aquarius.cpp
+++ b/src/mame/video/aquarius.cpp
@@ -12,7 +12,7 @@
#include "includes/aquarius.h"
-static const unsigned short aquarius_palette[] =
+static constexpr unsigned short aquarius_pens[] =
{
0, 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 9, 0,10, 0,11, 0,12, 0,13, 0,14, 0,15, 0,
0, 1, 1, 1, 2, 1, 3, 1, 4, 1, 5, 1, 6, 1, 7, 1, 8, 1, 9, 1,10, 1,11, 1,12, 1,13, 1,14, 1,15, 1,
@@ -32,15 +32,13 @@ static const unsigned short aquarius_palette[] =
0,15, 1,15, 2,15, 3,15, 4,15, 5,15, 6,15, 7,15, 8,15, 9,15,10,15,11,15,12,15,13,15,14,15,15,15,
};
-PALETTE_INIT_MEMBER(aquarius_state, aquarius)
+void aquarius_state::aquarius_palette(palette_device &palette) const
{
- int i;
+ for (int i = 0; i < 16; i++)
+ palette.set_indirect_color(i, m_tea1002->color(i));
- for (i = 0; i < 16; i++)
- m_palette->set_indirect_color(i, m_tea1002->color(i));
-
- for (i = 0; i < 512; i++)
- m_palette->set_pen_indirect(i, aquarius_palette[i]);
+ for (int i = 0; i < 512; i++)
+ palette.set_pen_indirect(i, aquarius_pens[i]);
}
WRITE8_MEMBER(aquarius_state::aquarius_videoram_w)
diff --git a/src/mame/video/arabian.cpp b/src/mame/video/arabian.cpp
index 0aaa2d88ad1..241cc2d8ed0 100644
--- a/src/mame/video/arabian.cpp
+++ b/src/mame/video/arabian.cpp
@@ -22,30 +22,26 @@
*
*************************************/
-PALETTE_INIT_MEMBER(arabian_state, arabian)
+void arabian_state::arabian_palette(palette_device &palette) const
{
- int i;
-
- /* there are 13 color table bits */
- for (i = 0; i < (1 << 13); i++)
+ // there are 13 color table bits
+ for (int i = 0; i < (1 << 13); i++)
{
- int r, g, b;
-
- int ena = (i >> 12) & 1;
- int enb = (i >> 11) & 1;
- int abhf = (~i >> 10) & 1;
- int aghf = (~i >> 9) & 1;
- int arhf = (~i >> 8) & 1;
- int az = (i >> 7) & 1;
- int ar = (i >> 6) & 1;
- int ag = (i >> 5) & 1;
- int ab = (i >> 4) & 1;
- int bz = (i >> 3) & 1;
- int br = (i >> 2) & 1;
- int bg = (i >> 1) & 1;
- int bb = (i >> 0) & 1;
-
- int planea = (az | ar | ag | ab) & ena;
+ int const ena = BIT(i, 12);
+ int const enb = BIT(i, 11);
+ int const abhf = BIT(~i, 10);
+ int const aghf = BIT(~i, 9);
+ int const arhf = BIT(~i, 8);
+ int const az = BIT(i, 7);
+ int const ar = BIT(i, 6);
+ int const ag = BIT(i, 5);
+ int const ab = BIT(i, 4);
+ int const bz = BIT(i, 3);
+ int const br = BIT(i, 2);
+ int const bg = BIT(i, 1);
+ int const bb = BIT(i, 0);
+
+ int const planea = (az | ar | ag | ab) & ena;
/*-------------------------------------------------------------------------
red derivation:
@@ -74,8 +70,8 @@ PALETTE_INIT_MEMBER(arabian_state, arabian)
red.base = (red.hi | red.lo)
-------------------------------------------------------------------------*/
- int rhi = planea ? ar : enb ? bz : 0;
- int rlo = planea ? (((!arhf) & az) ? 0 : ar) : enb ? br : 0;
+ int const rhi = planea ? ar : enb ? bz : 0;
+ int const rlo = planea ? (((!arhf) & az) ? 0 : ar) : enb ? br : 0;
/*-------------------------------------------------------------------------
green derivation:
@@ -105,8 +101,8 @@ PALETTE_INIT_MEMBER(arabian_state, arabian)
grn.base = (grn.hi | grn.lo)
-------------------------------------------------------------------------*/
- int ghi = planea ? ag : enb ? bb : 0;
- int glo = planea ? (((!aghf) & az) ? 0 : ag) : enb ? bg : 0;
+ int const ghi = planea ? ag : enb ? bb : 0;
+ int const glo = planea ? (((!aghf) & az) ? 0 : ag) : enb ? bg : 0;
/*-------------------------------------------------------------------------
blue derivation:
@@ -126,20 +122,20 @@ PALETTE_INIT_MEMBER(arabian_state, arabian)
blu.base = ((!abhf & az) ? 0 : ab);
-------------------------------------------------------------------------*/
- int bhi = ab;
- int bbase = ((!abhf) & az) ? 0 : ab;
+ int const bhi = ab;
+ int const bbase = ((!abhf) & az) ? 0 : ab;
/* convert an RGB color -
there are effectively 6 bits of color: 2 red, 2 green, 2 blue */
- r = ( rhi * (int)(((153.0 * 192) / 255) + 0.5)) +
- ( rlo * (int)(((102.0 * 192) / 255) + 0.5)) +
- ((rhi | rlo) ? 63 : 0);
+ int const r = ( rhi * (int)(((153.0 * 192) / 255) + 0.5)) +
+ ( rlo * int(((102.0 * 192) / 255) + 0.5)) +
+ ((rhi | rlo) ? 63 : 0);
- g = ( ghi * (int)(((156.0 * 192) / 255) + 0.5)) +
- ( glo * (int)((( 99.0 * 192) / 255) + 0.5)) +
- ((ghi | glo) ? 63 : 0);
+ int const g = ( ghi * (int)(((156.0 * 192) / 255) + 0.5)) +
+ ( glo * int((( 99.0 * 192) / 255) + 0.5)) +
+ ((ghi | glo) ? 63 : 0);
- b = (bhi * 192) + (bbase * 63);
+ int const b = (bhi * 192) + (bbase * 63);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/astrocde.cpp b/src/mame/video/astrocde.cpp
index 0f806df0e0f..2dbb9991410 100644
--- a/src/mame/video/astrocde.cpp
+++ b/src/mame/video/astrocde.cpp
@@ -7,11 +7,15 @@
***************************************************************************/
#include "emu.h"
-#include "cpu/z80/z80.h"
#include "includes/astrocde.h"
+
+#include "cpu/z80/z80.h"
#include "sound/astrocde.h"
#include "video/resnet.h"
+#include <cmath>
+
+
/*************************************
*
* Machine setup
@@ -75,7 +79,7 @@ inline int astrocde_state::mame_vpos_to_astrocade_vpos(int scanline)
*
*************************************/
-PALETTE_INIT_MEMBER(astrocde_state, astrocde)
+void astrocde_state::astrocade_palette(palette_device &palette) const
{
/*
The Astrocade has a 256 color palette: 32 colors with 8 luminance
@@ -88,81 +92,71 @@ PALETTE_INIT_MEMBER(astrocde_state, astrocde)
that has a 4-bit resolution.
*/
- int color, luma;
-
- /* loop over color values */
- for (color = 0; color < 32; color++)
+ // loop over color values
+ for (int color = 0; color < 32; color++)
{
- float ry = 0.75 * sin((color / 32.0) * (2.0 * M_PI));
- float by = 1.15 * cos((color / 32.0) * (2.0 * M_PI));
-
- /* color 0 maps to ry = by = 0 */
- if (color == 0)
- ry = by = 0;
+ // color 0 maps to ry = by = 0
+ double const angle = (color / 32.0) * (2.0 * M_PI);
+ float const ry = color ? (0.75 * std::sin(angle)) : 0;
+ float const by = color ? (1.15 * std::cos(angle)) : 0;
- /* iterate over luminence values */
- for (luma = 0; luma < 16; luma++)
+ // iterate over luminence values
+ for (int luma = 0; luma < 16; luma++)
{
- float y = luma / 15.0;
- int r, g, b;
-
- /* transform to RGB */
- r = (ry + y) * 255;
- g = ((y - 0.299f * (ry + y) - 0.114f * (by + y)) / 0.587f) * 255;
- b = (by + y) * 255;
-
- /* clamp and store */
- r = std::max(r, 0);
- r = std::min(r, 255);
- g = std::max(g, 0);
- g = std::min(g, 255);
- b = std::max(b, 0);
- b = std::min(b, 255);
+ float const y = luma / 15.0;
+
+ // transform to RGB
+ int r = (ry + y) * 255;
+ int g = ((y - 0.299f * (ry + y) - 0.114f * (by + y)) / 0.587f) * 255;
+ int b = (by + y) * 255;
+
+ // clamp and store
+ r = (std::min)((std::max)(r, 0), 255);
+ g = (std::min)((std::max)(g, 0), 255);
+ b = (std::min)((std::max)(b, 0), 255);
palette.set_pen_color(color * 16 + luma, rgb_t(r, g, b));
}
}
}
-PALETTE_INIT_MEMBER(astrocde_state,profpac)
+void astrocde_state::profpac_palette(palette_device &palette) const
{
- /* Professor Pac-Man uses a more standard 12-bit RGB palette layout */
- static const int resistances[4] = { 6200, 3000, 1500, 750 };
- double weights[4];
- int i;
+ // Professor Pac-Man uses a more standard 12-bit RGB palette layout
+ static constexpr int resistances[4] = { 6200, 3000, 1500, 750 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, weights, 1500, 0,
4, resistances, weights, 1500, 0,
4, resistances, weights, 1500, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < 4096; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 4096; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* blue component */
- bit0 = (i >> 0) & 0x01;
- bit1 = (i >> 1) & 0x01;
- bit2 = (i >> 2) & 0x01;
- bit3 = (i >> 3) & 0x01;
- b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (i >> 4) & 0x01;
- bit1 = (i >> 5) & 0x01;
- bit2 = (i >> 6) & 0x01;
- bit3 = (i >> 7) & 0x01;
- g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
-
- /* red component */
- bit0 = (i >> 8) & 0x01;
- bit1 = (i >> 9) & 0x01;
- bit2 = (i >> 10) & 0x01;
- bit3 = (i >> 11) & 0x01;
- r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(i, 0);
+ bit1 = BIT(i, 1);
+ bit2 = BIT(i, 2);
+ bit3 = BIT(i, 3);
+ int const b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(i, 4);
+ bit1 = BIT(i, 5);
+ bit2 = BIT(i, 6);
+ bit3 = BIT(i, 7);
+ int const g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(i, 8);
+ bit1 = BIT(i, 9);
+ bit2 = BIT(i, 10);
+ bit3 = BIT(i, 11);
+ int const r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/atari400.cpp b/src/mame/video/atari400.cpp
index 275a0b94a6d..c17cf89c625 100644
--- a/src/mame/video/atari400.cpp
+++ b/src/mame/video/atari400.cpp
@@ -12,9 +12,8 @@
#include "includes/atari400.h"
#include "screen.h"
-#define VERBOSE 0
-
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
+//#define VERBOSE 1
+#include "logmacro.h"
/************************************************************************
@@ -37,98 +36,93 @@ void atari_common_state::video_start()
*
**************************************************************/
-static const uint8_t atari_palette[256*3] =
+static constexpr rgb_t atari_pens[256] =
{
- /* Grey */
- 0x00,0x00,0x00, 0x25,0x25,0x25, 0x34,0x34,0x34, 0x4e,0x4e,0x4e,
- 0x68,0x68,0x68, 0x75,0x75,0x75, 0x8e,0x8e,0x8e, 0xa4,0xa4,0xa4,
- 0xb8,0xb8,0xb8, 0xc5,0xc5,0xc5, 0xd0,0xd0,0xd0, 0xd7,0xd7,0xd7,
- 0xe1,0xe1,0xe1, 0xea,0xea,0xea, 0xf4,0xf4,0xf4, 0xff,0xff,0xff,
- /* Gold */
- 0x41,0x20,0x00, 0x54,0x28,0x00, 0x76,0x37,0x00, 0x9a,0x50,0x00,
- 0xc3,0x68,0x06, 0xe4,0x7b,0x07, 0xff,0x91,0x1a, 0xff,0xab,0x1d,
- 0xff,0xc5,0x1f, 0xff,0xd0,0x3b, 0xff,0xd8,0x4c, 0xff,0xe6,0x51,
- 0xff,0xf4,0x56, 0xff,0xf9,0x70, 0xff,0xff,0x90, 0xff,0xff,0xaa,
- /* Orange */
- 0x45,0x19,0x04, 0x72,0x1e,0x11, 0x9f,0x24,0x1e, 0xb3,0x3a,0x20,
- 0xc8,0x51,0x20, 0xe3,0x69,0x20, 0xfc,0x81,0x20, 0xfd,0x8c,0x25,
- 0xfe,0x98,0x2c, 0xff,0xae,0x38, 0xff,0xb9,0x46, 0xff,0xbf,0x51,
- 0xff,0xc6,0x6d, 0xff,0xd5,0x87, 0xff,0xe4,0x98, 0xff,0xe6,0xab,
- /* Red-Orange */
- 0x5d,0x1f,0x0c, 0x7a,0x24,0x0d, 0x98,0x2c,0x0e, 0xb0,0x2f,0x0f,
- 0xbf,0x36,0x24, 0xd3,0x4e,0x2a, 0xe7,0x62,0x3e, 0xf3,0x6e,0x4a,
- 0xfd,0x78,0x54, 0xff,0x8a,0x6a, 0xff,0x98,0x7c, 0xff,0xa4,0x8b,
- 0xff,0xb3,0x9e, 0xff,0xc2,0xb2, 0xff,0xd0,0xc3, 0xff,0xda,0xd0,
- /* Pink */
- 0x4a,0x17,0x00, 0x72,0x1f,0x00, 0xa8,0x13,0x00, 0xc8,0x21,0x0a,
- 0xdf,0x25,0x12, 0xec,0x3b,0x24, 0xfa,0x52,0x36, 0xfc,0x61,0x48,
- 0xff,0x70,0x5f, 0xff,0x7e,0x7e, 0xff,0x8f,0x8f, 0xff,0x9d,0x9e,
- 0xff,0xab,0xad, 0xff,0xb9,0xbd, 0xff,0xc7,0xce, 0xff,0xca,0xde,
- /* Purple */
- 0x49,0x00,0x36, 0x66,0x00,0x4b, 0x80,0x03,0x5f, 0x95,0x0f,0x74,
- 0xaa,0x22,0x88, 0xba,0x3d,0x99, 0xca,0x4d,0xa9, 0xd7,0x5a,0xb6,
- 0xe4,0x67,0xc3, 0xef,0x72,0xce, 0xfb,0x7e,0xda, 0xff,0x8d,0xe1,
- 0xff,0x9d,0xe5, 0xff,0xa5,0xe7, 0xff,0xaf,0xea, 0xff,0xb8,0xec,
- /* Purple-Blue */
- 0x48,0x03,0x6c, 0x5c,0x04,0x88, 0x65,0x0d,0x90, 0x7b,0x23,0xa7,
- 0x93,0x3b,0xbf, 0x9d,0x45,0xc9, 0xa7,0x4f,0xd3, 0xb2,0x5a,0xde,
- 0xbd,0x65,0xe9, 0xc5,0x6d,0xf1, 0xce,0x76,0xfa, 0xd5,0x83,0xff,
- 0xda,0x90,0xff, 0xde,0x9c,0xff, 0xe2,0xa9,0xff, 0xe6,0xb6,0xff,
- /* Blue 1 */
- 0x05,0x1e,0x81, 0x06,0x26,0xa5, 0x08,0x2f,0xca, 0x26,0x3d,0xd4,
- 0x44,0x4c,0xde, 0x4f,0x5a,0xec, 0x5a,0x68,0xff, 0x65,0x75,0xff,
- 0x71,0x83,0xff, 0x80,0x91,0xff, 0x90,0xa0,0xff, 0x97,0xa9,0xff,
- 0x9f,0xb2,0xff, 0xaf,0xbe,0xff, 0xc0,0xcb,0xff, 0xcd,0xd3,0xff,
- /* Blue 2 */
- 0x0b,0x07,0x79, 0x20,0x1c,0x8e, 0x35,0x31,0xa3, 0x46,0x42,0xb4,
- 0x57,0x53,0xc5, 0x61,0x5d,0xcf, 0x6d,0x69,0xdb, 0x7b,0x77,0xe9,
- 0x89,0x85,0xf7, 0x91,0x8d,0xff, 0x9c,0x98,0xff, 0xa7,0xa4,0xff,
- 0xb2,0xaf,0xff, 0xbb,0xb8,0xff, 0xc3,0xc1,0xff, 0xd3,0xd1,0xff,
- /* Light-Blue */
- 0x1d,0x29,0x5a, 0x1d,0x38,0x76, 0x1d,0x48,0x92, 0x1d,0x5c,0xac,
- 0x1d,0x71,0xc6, 0x32,0x86,0xcf, 0x48,0x9b,0xd9, 0x4e,0xa8,0xec,
- 0x55,0xb6,0xff, 0x69,0xca,0xff, 0x74,0xcb,0xff, 0x82,0xd3,0xff,
- 0x8d,0xda,0xff, 0x9f,0xd4,0xff, 0xb4,0xe2,0xff, 0xc0,0xeb,0xff,
- /* Turquoise */
- 0x00,0x4b,0x59, 0x00,0x5d,0x6e, 0x00,0x6f,0x84, 0x00,0x84,0x9c,
- 0x00,0x99,0xbf, 0x00,0xab,0xca, 0x00,0xbc,0xde, 0x00,0xd0,0xf5,
- 0x10,0xdc,0xff, 0x3e,0xe1,0xff, 0x64,0xe7,0xff, 0x76,0xea,0xff,
- 0x8b,0xed,0xff, 0x9a,0xef,0xff, 0xb1,0xf3,0xff, 0xc7,0xf6,0xff,
- /* Green-Blue */
- 0x00,0x48,0x00, 0x00,0x54,0x00, 0x03,0x6b,0x03, 0x0e,0x76,0x0e,
- 0x18,0x80,0x18, 0x27,0x92,0x27, 0x36,0xa4,0x36, 0x4e,0xb9,0x4e,
- 0x51,0xcd,0x51, 0x72,0xda,0x72, 0x7c,0xe4,0x7c, 0x85,0xed,0x85,
- 0x99,0xf2,0x99, 0xb3,0xf7,0xb3, 0xc3,0xf9,0xc3, 0xcd,0xfc,0xcd,
- /* Green */
- 0x16,0x40,0x00, 0x1c,0x53,0x00, 0x23,0x66,0x00, 0x28,0x78,0x00,
- 0x2e,0x8c,0x00, 0x3a,0x98,0x0c, 0x47,0xa5,0x19, 0x51,0xaf,0x23,
- 0x5c,0xba,0x2e, 0x71,0xcf,0x43, 0x85,0xe3,0x57, 0x8d,0xeb,0x5f,
- 0x97,0xf5,0x69, 0xa0,0xfe,0x72, 0xb1,0xff,0x8a, 0xbc,0xff,0x9a,
- /* Yellow-Green */
- 0x2c,0x35,0x00, 0x38,0x44,0x00, 0x44,0x52,0x00, 0x49,0x56,0x00,
- 0x60,0x71,0x00, 0x6c,0x7f,0x00, 0x79,0x8d,0x0a, 0x8b,0x9f,0x1c,
- 0x9e,0xb2,0x2f, 0xab,0xbf,0x3c, 0xb8,0xcc,0x49, 0xc2,0xd6,0x53,
- 0xcd,0xe1,0x53, 0xdb,0xef,0x6c, 0xe8,0xfc,0x79, 0xf2,0xff,0xab,
- /* Orange-Green */
- 0x46,0x3a,0x09, 0x4d,0x3f,0x09, 0x54,0x45,0x09, 0x6c,0x58,0x09,
- 0x90,0x76,0x09, 0xab,0x8b,0x0a, 0xc1,0xa1,0x20, 0xd0,0xb0,0x2f,
- 0xde,0xbe,0x3d, 0xe6,0xc6,0x45, 0xed,0xcd,0x4c, 0xf5,0xd8,0x62,
- 0xfb,0xe2,0x76, 0xfc,0xee,0x98, 0xfd,0xf3,0xa9, 0xfd,0xf3,0xbe,
- /* Light-Orange */
- 0x40,0x1a,0x02, 0x58,0x1f,0x05, 0x70,0x24,0x08, 0x8d,0x3a,0x13,
- 0xab,0x51,0x1f, 0xb5,0x64,0x27, 0xbf,0x77,0x30, 0xd0,0x85,0x3a,
- 0xe1,0x93,0x44, 0xed,0xa0,0x4e, 0xf9,0xad,0x58, 0xfc,0xb7,0x5c,
- 0xff,0xc1,0x60, 0xff,0xca,0x69, 0xff,0xcf,0x7e, 0xff,0xda,0x96
+ // Grey
+ {0x00,0x00,0x00}, {0x25,0x25,0x25}, {0x34,0x34,0x34}, {0x4e,0x4e,0x4e},
+ {0x68,0x68,0x68}, {0x75,0x75,0x75}, {0x8e,0x8e,0x8e}, {0xa4,0xa4,0xa4},
+ {0xb8,0xb8,0xb8}, {0xc5,0xc5,0xc5}, {0xd0,0xd0,0xd0}, {0xd7,0xd7,0xd7},
+ {0xe1,0xe1,0xe1}, {0xea,0xea,0xea}, {0xf4,0xf4,0xf4}, {0xff,0xff,0xff},
+ // Gold
+ {0x41,0x20,0x00}, {0x54,0x28,0x00}, {0x76,0x37,0x00}, {0x9a,0x50,0x00},
+ {0xc3,0x68,0x06}, {0xe4,0x7b,0x07}, {0xff,0x91,0x1a}, {0xff,0xab,0x1d},
+ {0xff,0xc5,0x1f}, {0xff,0xd0,0x3b}, {0xff,0xd8,0x4c}, {0xff,0xe6,0x51},
+ {0xff,0xf4,0x56}, {0xff,0xf9,0x70}, {0xff,0xff,0x90}, {0xff,0xff,0xaa},
+ // Orange
+ {0x45,0x19,0x04}, {0x72,0x1e,0x11}, {0x9f,0x24,0x1e}, {0xb3,0x3a,0x20},
+ {0xc8,0x51,0x20}, {0xe3,0x69,0x20}, {0xfc,0x81,0x20}, {0xfd,0x8c,0x25},
+ {0xfe,0x98,0x2c}, {0xff,0xae,0x38}, {0xff,0xb9,0x46}, {0xff,0xbf,0x51},
+ {0xff,0xc6,0x6d}, {0xff,0xd5,0x87}, {0xff,0xe4,0x98}, {0xff,0xe6,0xab},
+ // Red-Orange
+ {0x5d,0x1f,0x0c}, {0x7a,0x24,0x0d}, {0x98,0x2c,0x0e}, {0xb0,0x2f,0x0f},
+ {0xbf,0x36,0x24}, {0xd3,0x4e,0x2a}, {0xe7,0x62,0x3e}, {0xf3,0x6e,0x4a},
+ {0xfd,0x78,0x54}, {0xff,0x8a,0x6a}, {0xff,0x98,0x7c}, {0xff,0xa4,0x8b},
+ {0xff,0xb3,0x9e}, {0xff,0xc2,0xb2}, {0xff,0xd0,0xc3}, {0xff,0xda,0xd0},
+ // Pink
+ {0x4a,0x17,0x00}, {0x72,0x1f,0x00}, {0xa8,0x13,0x00}, {0xc8,0x21,0x0a},
+ {0xdf,0x25,0x12}, {0xec,0x3b,0x24}, {0xfa,0x52,0x36}, {0xfc,0x61,0x48},
+ {0xff,0x70,0x5f}, {0xff,0x7e,0x7e}, {0xff,0x8f,0x8f}, {0xff,0x9d,0x9e},
+ {0xff,0xab,0xad}, {0xff,0xb9,0xbd}, {0xff,0xc7,0xce}, {0xff,0xca,0xde},
+ // Purple
+ {0x49,0x00,0x36}, {0x66,0x00,0x4b}, {0x80,0x03,0x5f}, {0x95,0x0f,0x74},
+ {0xaa,0x22,0x88}, {0xba,0x3d,0x99}, {0xca,0x4d,0xa9}, {0xd7,0x5a,0xb6},
+ {0xe4,0x67,0xc3}, {0xef,0x72,0xce}, {0xfb,0x7e,0xda}, {0xff,0x8d,0xe1},
+ {0xff,0x9d,0xe5}, {0xff,0xa5,0xe7}, {0xff,0xaf,0xea}, {0xff,0xb8,0xec},
+ // Purple-Blue
+ {0x48,0x03,0x6c}, {0x5c,0x04,0x88}, {0x65,0x0d,0x90}, {0x7b,0x23,0xa7},
+ {0x93,0x3b,0xbf}, {0x9d,0x45,0xc9}, {0xa7,0x4f,0xd3}, {0xb2,0x5a,0xde},
+ {0xbd,0x65,0xe9}, {0xc5,0x6d,0xf1}, {0xce,0x76,0xfa}, {0xd5,0x83,0xff},
+ {0xda,0x90,0xff}, {0xde,0x9c,0xff}, {0xe2,0xa9,0xff}, {0xe6,0xb6,0xff},
+ // Blue 1
+ {0x05,0x1e,0x81}, {0x06,0x26,0xa5}, {0x08,0x2f,0xca}, {0x26,0x3d,0xd4},
+ {0x44,0x4c,0xde}, {0x4f,0x5a,0xec}, {0x5a,0x68,0xff}, {0x65,0x75,0xff},
+ {0x71,0x83,0xff}, {0x80,0x91,0xff}, {0x90,0xa0,0xff}, {0x97,0xa9,0xff},
+ {0x9f,0xb2,0xff}, {0xaf,0xbe,0xff}, {0xc0,0xcb,0xff}, {0xcd,0xd3,0xff},
+ // Blue 2
+ {0x0b,0x07,0x79}, {0x20,0x1c,0x8e}, {0x35,0x31,0xa3}, {0x46,0x42,0xb4},
+ {0x57,0x53,0xc5}, {0x61,0x5d,0xcf}, {0x6d,0x69,0xdb}, {0x7b,0x77,0xe9},
+ {0x89,0x85,0xf7}, {0x91,0x8d,0xff}, {0x9c,0x98,0xff}, {0xa7,0xa4,0xff},
+ {0xb2,0xaf,0xff}, {0xbb,0xb8,0xff}, {0xc3,0xc1,0xff}, {0xd3,0xd1,0xff},
+ // Light-Blue
+ {0x1d,0x29,0x5a}, {0x1d,0x38,0x76}, {0x1d,0x48,0x92}, {0x1d,0x5c,0xac},
+ {0x1d,0x71,0xc6}, {0x32,0x86,0xcf}, {0x48,0x9b,0xd9}, {0x4e,0xa8,0xec},
+ {0x55,0xb6,0xff}, {0x69,0xca,0xff}, {0x74,0xcb,0xff}, {0x82,0xd3,0xff},
+ {0x8d,0xda,0xff}, {0x9f,0xd4,0xff}, {0xb4,0xe2,0xff}, {0xc0,0xeb,0xff},
+ // Turquoise
+ {0x00,0x4b,0x59}, {0x00,0x5d,0x6e}, {0x00,0x6f,0x84}, {0x00,0x84,0x9c},
+ {0x00,0x99,0xbf}, {0x00,0xab,0xca}, {0x00,0xbc,0xde}, {0x00,0xd0,0xf5},
+ {0x10,0xdc,0xff}, {0x3e,0xe1,0xff}, {0x64,0xe7,0xff}, {0x76,0xea,0xff},
+ {0x8b,0xed,0xff}, {0x9a,0xef,0xff}, {0xb1,0xf3,0xff}, {0xc7,0xf6,0xff},
+ // Green-Blue
+ {0x00,0x48,0x00}, {0x00,0x54,0x00}, {0x03,0x6b,0x03}, {0x0e,0x76,0x0e},
+ {0x18,0x80,0x18}, {0x27,0x92,0x27}, {0x36,0xa4,0x36}, {0x4e,0xb9,0x4e},
+ {0x51,0xcd,0x51}, {0x72,0xda,0x72}, {0x7c,0xe4,0x7c}, {0x85,0xed,0x85},
+ {0x99,0xf2,0x99}, {0xb3,0xf7,0xb3}, {0xc3,0xf9,0xc3}, {0xcd,0xfc,0xcd},
+ // Green
+ {0x16,0x40,0x00}, {0x1c,0x53,0x00}, {0x23,0x66,0x00}, {0x28,0x78,0x00},
+ {0x2e,0x8c,0x00}, {0x3a,0x98,0x0c}, {0x47,0xa5,0x19}, {0x51,0xaf,0x23},
+ {0x5c,0xba,0x2e}, {0x71,0xcf,0x43}, {0x85,0xe3,0x57}, {0x8d,0xeb,0x5f},
+ {0x97,0xf5,0x69}, {0xa0,0xfe,0x72}, {0xb1,0xff,0x8a}, {0xbc,0xff,0x9a},
+ // Yellow-Green
+ {0x2c,0x35,0x00}, {0x38,0x44,0x00}, {0x44,0x52,0x00}, {0x49,0x56,0x00},
+ {0x60,0x71,0x00}, {0x6c,0x7f,0x00}, {0x79,0x8d,0x0a}, {0x8b,0x9f,0x1c},
+ {0x9e,0xb2,0x2f}, {0xab,0xbf,0x3c}, {0xb8,0xcc,0x49}, {0xc2,0xd6,0x53},
+ {0xcd,0xe1,0x53}, {0xdb,0xef,0x6c}, {0xe8,0xfc,0x79}, {0xf2,0xff,0xab},
+ // Orange-Green
+ {0x46,0x3a,0x09}, {0x4d,0x3f,0x09}, {0x54,0x45,0x09}, {0x6c,0x58,0x09},
+ {0x90,0x76,0x09}, {0xab,0x8b,0x0a}, {0xc1,0xa1,0x20}, {0xd0,0xb0,0x2f},
+ {0xde,0xbe,0x3d}, {0xe6,0xc6,0x45}, {0xed,0xcd,0x4c}, {0xf5,0xd8,0x62},
+ {0xfb,0xe2,0x76}, {0xfc,0xee,0x98}, {0xfd,0xf3,0xa9}, {0xfd,0xf3,0xbe},
+ // Light-Orange
+ {0x40,0x1a,0x02}, {0x58,0x1f,0x05}, {0x70,0x24,0x08}, {0x8d,0x3a,0x13},
+ {0xab,0x51,0x1f}, {0xb5,0x64,0x27}, {0xbf,0x77,0x30}, {0xd0,0x85,0x3a},
+ {0xe1,0x93,0x44}, {0xed,0xa0,0x4e}, {0xf9,0xad,0x58}, {0xfc,0xb7,0x5c},
+ {0xff,0xc1,0x60}, {0xff,0xca,0x69}, {0xff,0xcf,0x7e}, {0xff,0xda,0x96}
};
/* Initialise the palette */
-PALETTE_INIT_MEMBER(atari_common_state, atari)
+void atari_common_state::atari_palette(palette_device &palette) const
{
- int i;
-
- for ( i = 0; i < sizeof(atari_palette) / 3; i++ )
- {
- palette.set_pen_color(i, atari_palette[i*3], atari_palette[i*3+1], atari_palette[i*3+2]);
- }
+ palette.set_pen_colors(0, atari_pens);
}
diff --git a/src/mame/video/atarisy2.cpp b/src/mame/video/atarisy2.cpp
index 4dc92540ca8..2f8d509b756 100644
--- a/src/mame/video/atarisy2.cpp
+++ b/src/mame/video/atarisy2.cpp
@@ -159,25 +159,25 @@ WRITE16_MEMBER( atarisy2_state::yscroll_w )
*
*************************************/
-PALETTE_DECODER_MEMBER( atarisy2_state, RRRRGGGGBBBBIIII )
+rgb_t atarisy2_state::RRRRGGGGBBBBIIII(uint32_t raw)
{
- static const int ZB = 115, Z3 = 78, Z2 = 37, Z1 = 17, Z0 = 9;
+ static constexpr int ZB = 115, Z3 = 78, Z2 = 37, Z1 = 17, Z0 = 9;
- static const int intensity_table[16] =
+ static constexpr int intensity_table[16] =
{
0, ZB+Z0, ZB+Z1, ZB+Z1+Z0, ZB+Z2, ZB+Z2+Z0, ZB+Z2+Z1, ZB+Z2+Z1+Z0,
ZB+Z3, ZB+Z3+Z0, ZB+Z3+Z1, ZB+Z3+Z1+Z0,ZB+ Z3+Z2, ZB+Z3+Z2+Z0, ZB+Z3+Z2+Z1, ZB+Z3+Z2+Z1+Z0
};
- static const int color_table[16] =
+ static constexpr int color_table[16] =
{
0x0, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xe, 0xf, 0xf
};
- int i = intensity_table[raw & 15];
- uint8_t r = (color_table[(raw >> 12) & 15] * i) >> 4;
- uint8_t g = (color_table[(raw >> 8) & 15] * i) >> 4;
- uint8_t b = (color_table[(raw >> 4) & 15] * i) >> 4;
+ int const i = intensity_table[raw & 15];
+ uint8_t const r = (color_table[(raw >> 12) & 15] * i) >> 4;
+ uint8_t const g = (color_table[(raw >> 8) & 15] * i) >> 4;
+ uint8_t const b = (color_table[(raw >> 4) & 15] * i) >> 4;
return rgb_t(r, g, b);
}
diff --git a/src/mame/video/avigo.cpp b/src/mame/video/avigo.cpp
index 9e4a4681879..ca21f5867e2 100644
--- a/src/mame/video/avigo.cpp
+++ b/src/mame/video/avigo.cpp
@@ -76,13 +76,6 @@ void avigo_state::video_start()
save_pointer(NAME(m_video_memory), (AVIGO_SCREEN_WIDTH>>3) * AVIGO_SCREEN_HEIGHT + 1);
}
-/* Initialise the palette */
-PALETTE_INIT_MEMBER(avigo_state, avigo)
-{
- m_palette->set_pen_color(0,rgb_t(0xff,0xff,0xff)); /* white */
- m_palette->set_pen_color(1,rgb_t(0x00,0x00,0x00)); /* black */
-}
-
uint32_t avigo_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
int y;
diff --git a/src/mame/video/b2m.cpp b/src/mame/video/b2m.cpp
index c7c521f21ae..a2c99de3681 100644
--- a/src/mame/video/b2m.cpp
+++ b/src/mame/video/b2m.cpp
@@ -47,14 +47,14 @@ uint32_t b2m_state::screen_update_b2m(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
-static const rgb_t b2m_palette[4] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0x00), // 1
- rgb_t(0x00, 0x00, 0x00), // 2
- rgb_t(0x00, 0x00, 0x00), // 3
-};
-
-PALETTE_INIT_MEMBER(b2m_state, b2m)
+void b2m_state::b2m_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, b2m_palette, ARRAY_LENGTH(b2m_palette));
+ static constexpr rgb_t b2m_pens[4] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0x00 }, // 1
+ { 0x00, 0x00, 0x00 }, // 2
+ { 0x00, 0x00, 0x00 }, // 3
+ };
+
+ palette.set_pen_colors(0, b2m_pens);
}
diff --git a/src/mame/video/bagman.cpp b/src/mame/video/bagman.cpp
index 4e3406ce724..41e61a97311 100644
--- a/src/mame/video/bagman.cpp
+++ b/src/mame/video/bagman.cpp
@@ -44,41 +44,40 @@ WRITE8_MEMBER(bagman_state::colorram_w)
bit 0 -- 1 kohm resistor -- /
***************************************************************************/
-PALETTE_INIT_MEMBER(bagman_state,bagman)
+void bagman_state::bagman_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
-
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 470, 0,
3, resistances_rg, weights_g, 470, 0,
2, resistances_b, weights_b, 470, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/bankp.cpp b/src/mame/video/bankp.cpp
index cca425b24df..44b70c4cd06 100644
--- a/src/mame/video/bankp.cpp
+++ b/src/mame/video/bankp.cpp
@@ -35,49 +35,48 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(bankp_state, bankp)
+void bankp_state::bankp_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r,g,b));
color_prom++;
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
- /* charset #1 lookup table */
- for (i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++)
+ // charset #1 lookup table
+ for (int i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++)
palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i, *color_prom++ & 0x0f);
- color_prom += 128; /* skip the bottom half of the PROM - seems to be not used */
+ color_prom += 128; // skip the bottom half of the PROM - seems to be not used
- /* charset #2 lookup table */
- for (i = 0; i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity(); i++)
+ // charset #2 lookup table
+ for (int i = 0; i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity(); i++)
palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + i, *color_prom++ & 0x0f);
- /* the bottom half of the PROM seems to be not used */
+ // the bottom half of the PROM seems to be not used
}
WRITE8_MEMBER(bankp_state::scroll_w)
diff --git a/src/mame/video/baraduke.cpp b/src/mame/video/baraduke.cpp
index a24df28ca89..3aa646b21f8 100644
--- a/src/mame/video/baraduke.cpp
+++ b/src/mame/video/baraduke.cpp
@@ -17,36 +17,36 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(baraduke_state, baraduke)
+void baraduke_state::baraduke_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0,bit1,bit2,bit3,r,g,b;
- for (i = 0; i < 2048; i++)
+ for (int i = 0; i < 2048; i++)
{
- /* red component */
- bit0 = (color_prom[2048] >> 0) & 0x01;
- bit1 = (color_prom[2048] >> 1) & 0x01;
- bit2 = (color_prom[2048] >> 2) & 0x01;
- bit3 = (color_prom[2048] >> 3) & 0x01;
- r = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
-
- /* green component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- g = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
-
- /* blue component */
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- bit2 = (color_prom[0] >> 6) & 0x01;
- bit3 = (color_prom[0] >> 7) & 0x01;
- b = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[2048], 0);
+ bit1 = BIT(color_prom[2048], 1);
+ bit2 = BIT(color_prom[2048], 2);
+ bit3 = BIT(color_prom[2048], 3);
+ int const r = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
+
+ // green component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const g = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
+
+ // blue component
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 5);
+ bit2 = BIT(color_prom[0], 6);
+ bit3 = BIT(color_prom[0], 7);
+ int const b = 0x0e*bit0 + 0x1f*bit1 + 0x43*bit2 + 0x8f*bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/bbc.cpp b/src/mame/video/bbc.cpp
index f8d9ed94c9e..4f8245f43df 100644
--- a/src/mame/video/bbc.cpp
+++ b/src/mame/video/bbc.cpp
@@ -117,9 +117,9 @@ inline rgb_t bbc_state::out_rgb(rgb_t entry)
}
}
-PALETTE_INIT_MEMBER(bbc_state, bbc)
+void bbc_state::bbc_colours(palette_device &palette) const
{
- palette.set_pen_colors(0, bbc_palette, ARRAY_LENGTH(bbc_palette));
+ palette.set_pen_colors(0, bbc_palette);
}
/************************************************************************
diff --git a/src/mame/video/bionicc.cpp b/src/mame/video/bionicc.cpp
index 5f443feb1dd..28662dcc075 100644
--- a/src/mame/video/bionicc.cpp
+++ b/src/mame/video/bionicc.cpp
@@ -98,7 +98,7 @@ void bionicc_state::video_start()
m_bg_tilemap->set_transparent_pen(15);
}
-PALETTE_DECODER_MEMBER( bionicc_state, RRRRGGGGBBBBIIII )
+rgb_t bionicc_state::RRRRGGGGBBBBIIII(uint32_t raw)
{
uint8_t bright = (raw & 0x0f);
diff --git a/src/mame/video/bking.cpp b/src/mame/video/bking.cpp
index d39212ad6f2..678482e5d7b 100644
--- a/src/mame/video/bking.cpp
+++ b/src/mame/video/bking.cpp
@@ -30,55 +30,50 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(bking_state, bking)
+void bking_state::bking_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 220, 390, 820 };
- static const int resistances_b [2] = { 220, 390 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 220, 390, 820 };
+ static constexpr int resistances_b [2] = { 220, 390 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 0, 0);
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
uint16_t pen;
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* color PROM A7-A8 is the palette select */
- if (i < 0x20)
- /* characters - image bits go to A0-A2 of the color PROM */
+ // color PROM A7-A8 is the palette select
+ if (i < 0x20) // characters - image bits go to A0-A2 of the color PROM
pen = (((i - 0x00) << 4) & 0x180) | ((i - 0x00) & 0x07);
- else if (i < 0x30)
- /* crow - image bits go to A5-A6. */
+ else if (i < 0x30) // crow - image bits go to A5-A6.
pen = (((i - 0x20) << 5) & 0x180) | (((i - 0x20) & 0x03) << 5);
- else if (i < 0x38)
- /* ball #1 - image bit goes to A3 */
+ else if (i < 0x38) // ball #1 - image bit goes to A3
pen = (((i - 0x30) << 6) & 0x180) | (((i - 0x30) & 0x01) << 3);
- else
- /* ball #2 - image bit goes to A4 */
+ else // ball #2 - image bit goes to A4
pen = (((i - 0x38) << 6) & 0x180) | (((i - 0x38) & 0x01) << 4);
- /* red component */
+ // red component
bit0 = (color_prom[pen] >> 0) & 0x01;
bit1 = (color_prom[pen] >> 1) & 0x01;
bit2 = (color_prom[pen] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
+ // green component
bit0 = (color_prom[pen] >> 3) & 0x01;
bit1 = (color_prom[pen] >> 4) & 0x01;
bit2 = (color_prom[pen] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
+ // blue component
bit0 = (color_prom[pen] >> 6) & 0x01;
bit1 = (color_prom[pen] >> 7) & 0x01;
- b = combine_2_weights(gweights, bit0, bit1);
+ int const b = combine_2_weights(gweights, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/bladestl.cpp b/src/mame/video/bladestl.cpp
index 0e4cddb942c..a4e738ebc21 100644
--- a/src/mame/video/bladestl.cpp
+++ b/src/mame/video/bladestl.cpp
@@ -4,19 +4,18 @@
#include "includes/bladestl.h"
-PALETTE_INIT_MEMBER(bladestl_state, bladestl)
+void bladestl_state::bladestl_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* characters use pens 0x00-0x1f, no look-up table */
- for (i = 0; i < 0x20; i++)
+ // characters use pens 0x00-0x1f, no look-up table
+ for (int i = 0; i < 0x20; i++)
palette.set_pen_indirect(i, i);
- /* sprites use pens 0x20-0x2f */
- for (i = 0x20; i < 0x120; i++)
+ // sprites use pens 0x20-0x2f
+ for (int i = 0x20; i < 0x120; i++)
{
- uint8_t ctabentry = (color_prom[i - 0x20] & 0x0f) | 0x20;
+ uint8_t const ctabentry = (color_prom[i - 0x20] & 0x0f) | 0x20;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/blueprnt.cpp b/src/mame/video/blueprnt.cpp
index 756a7db1abd..59ea2aa97b8 100644
--- a/src/mame/video/blueprnt.cpp
+++ b/src/mame/video/blueprnt.cpp
@@ -22,14 +22,11 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(blueprnt_state, blueprnt)
+void blueprnt_state::blueprnt_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
uint8_t pen;
- int r, g, b;
if (i < 0x200)
/* characters */
@@ -40,9 +37,9 @@ PALETTE_INIT_MEMBER(blueprnt_state, blueprnt)
/* sprites */
pen = i - 0x200;
- r = ((pen >> 0) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
- g = ((pen >> 2) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
- b = ((pen >> 1) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
+ int const r = ((pen >> 0) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
+ int const g = ((pen >> 2) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
+ int const b = ((pen >> 1) & 1) * ((pen & 0x08) ? 0xbf : 0xff);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/bogeyman.cpp b/src/mame/video/bogeyman.cpp
index 3f5a02fa463..ed7ed049fa3 100644
--- a/src/mame/video/bogeyman.cpp
+++ b/src/mame/video/bogeyman.cpp
@@ -4,36 +4,34 @@
#include "includes/bogeyman.h"
-PALETTE_INIT_MEMBER(bogeyman_state, bogeyman)
+void bogeyman_state::bogeyman_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* first 16 colors are RAM */
-
- for (i = 0; i < 256; i++)
+ // first 16 colors are RAM
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[256] >> 0) & 0x01;
- bit2 = (color_prom[256] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[0], 3);
+ bit1 = BIT(color_prom[256], 0);
+ bit2 = BIT(color_prom[256], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[256] >> 2) & 0x01;
- bit2 = (color_prom[256] >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[256], 2);
+ bit2 = BIT(color_prom[256], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i + 16, rgb_t(r,g,b));
+ palette.set_pen_color(i + 16, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/bosco.cpp b/src/mame/video/bosco.cpp
index a4595cfb3d9..6d344c75fb4 100644
--- a/src/mame/video/bosco.cpp
+++ b/src/mame/video/bosco.cpp
@@ -17,64 +17,58 @@
#define STARS_COLOR_BASE (64*4+64*4+4)
#define VIDEO_RAM_SIZE 0x400
-PALETTE_INIT_MEMBER(bosco_state,bosco)
+void bosco_state::bosco_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* core palette */
- for (i = 0;i < 32;i++)
+ // core palette
+ for (int i = 0; i < 32; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
-
- bit0 = ((*color_prom) >> 0) & 0x01;
- bit1 = ((*color_prom) >> 1) & 0x01;
- bit2 = ((*color_prom) >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = ((*color_prom) >> 3) & 0x01;
- bit1 = ((*color_prom) >> 4) & 0x01;
- bit2 = ((*color_prom) >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
- bit1 = ((*color_prom) >> 6) & 0x01;
- bit2 = ((*color_prom) >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
- /* palette for the stars */
- for (i = 0;i < 64;i++)
+ // palette for the stars
+ for (int i = 0; i < 64; i++)
{
- int bits,r,g,b;
- static const int map[4] = { 0x00, 0x47, 0x97 ,0xde };
+ static constexpr int map[4] = { 0x00, 0x47, 0x97 ,0xde };
- bits = (i >> 0) & 0x03;
- r = map[bits];
- bits = (i >> 2) & 0x03;
- g = map[bits];
- bits = (i >> 4) & 0x03;
- b = map[bits];
+ int const r = map[(i >> 0) & 0x03];
+ int const g = map[(i >> 2) & 0x03];
+ int const b = map[(i >> 4) & 0x03];
- palette.set_indirect_color(32 + i,rgb_t(r,g,b));
+ palette.set_indirect_color(32 + i, rgb_t(r, g, b));
}
- /* characters / sprites */
- for (i = 0;i < 64*4;i++)
+ // characters / sprites
+ for (int i = 0; i < 64*4; i++)
{
- palette.set_pen_indirect(i, (color_prom[i] & 0x0f) + 0x10); /* chars */
- palette.set_pen_indirect(i+64*4, color_prom[i] & 0x0f); /* sprites */
+ palette.set_pen_indirect(i, (color_prom[i] & 0x0f) | 0x10); // chars
+ palette.set_pen_indirect(i + 64*4, color_prom[i] & 0x0f); // sprites
}
- /* bullets lookup table */
- /* they use colors 28-31, I think - PAL 5A controls it */
- for (i = 0;i < 4;i++)
- palette.set_pen_indirect(64*4+64*4+i, 31-i);
+ // bullets lookup table
+ // they use colors 28-31, I think - PAL 5A controls it
+ for (int i = 0; i < 4; i++)
+ palette.set_pen_indirect(64*4+64*4+i, 31 - i);
- /* now the stars */
- for (i = 0;i < 64;i++)
+ // now the stars
+ for (int i = 0; i < 64; i++)
palette.set_pen_indirect(64*4+64*4+4+i, 32 + i);
}
diff --git a/src/mame/video/brkthru.cpp b/src/mame/video/brkthru.cpp
index d0134024539..eab926f5310 100644
--- a/src/mame/video/brkthru.cpp
+++ b/src/mame/video/brkthru.cpp
@@ -34,30 +34,29 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(brkthru_state, brkthru)
+void brkthru_state::brkthru_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
+ int bit0, bit1, bit2, bit3;
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[0] >> 1) & 0x01;
bit2 = (color_prom[0] >> 2) & 0x01;
bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[0] >> 4) & 0x01;
bit1 = (color_prom[0] >> 5) & 0x01;
bit2 = (color_prom[0] >> 6) & 0x01;
bit3 = (color_prom[0] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[palette.entries()] >> 0) & 0x01;
bit1 = (color_prom[palette.entries()] >> 1) & 0x01;
bit2 = (color_prom[palette.entries()] >> 2) & 0x01;
bit3 = (color_prom[palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r,g,b));
diff --git a/src/mame/video/btime.cpp b/src/mame/video/btime.cpp
index f0341bb9c6a..663e8362d75 100644
--- a/src/mame/video/btime.cpp
+++ b/src/mame/video/btime.cpp
@@ -30,38 +30,36 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(btime_state,btime)
+void btime_state::btime_palette(palette_device &palette) const
{
- /* Burger Time doesn't have a color PROM, but Hamburge has. */
- /* This function is also used by Eggs. */
- if (m_prom_region == nullptr)
- {
+ // Burger Time doesn't have a color PROM, but Hamburge has.
+ // This function is also used by Eggs.
+ if (!m_prom_region)
return;
- }
- const uint8_t *color_prom = m_prom_region->base();
+ uint8_t const *const color_prom = m_prom_region->base();
for (int i = 0; i < palette.entries(); i++)
{
- /* red component */
+ // red component
int bit0 = (color_prom[i] >> 0) & 0x01;
int bit1 = (color_prom[i] >> 1) & 0x01;
int bit2 = (color_prom[i] >> 2) & 0x01;
- int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -82,29 +80,29 @@ PALETTE_INIT_MEMBER(btime_state,btime)
***************************************************************************/
-PALETTE_INIT_MEMBER(btime_state,lnc)
+void btime_state::lnc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); i++)
{
- /* red component */
+ // red component
int bit0 = (color_prom[i] >> 7) & 0x01;
int bit1 = (color_prom[i] >> 6) & 0x01;
int bit2 = (color_prom[i] >> 5) & 0x01;
- int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = (color_prom[i] >> 4) & 0x01;
bit1 = (color_prom[i] >> 3) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 0) & 0x01;
- int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
}
diff --git a/src/mame/video/buggychl.cpp b/src/mame/video/buggychl.cpp
index db33cbff098..26bf22f4ff4 100644
--- a/src/mame/video/buggychl.cpp
+++ b/src/mame/video/buggychl.cpp
@@ -4,11 +4,11 @@
#include "includes/buggychl.h"
-PALETTE_INIT_MEMBER(buggychl_state, buggychl)
+void buggychl_state::buggychl_palette(palette_device &palette) const
{
- /* arbitrary blue shading for the sky, estimation */
+ // arbitrary blue shading for the sky, estimation
for (int i = 0; i < 128; i++)
- palette.set_pen_color(i + 128, rgb_t(0, 240-i, 255));
+ palette.set_pen_color(i + 128, rgb_t(0, 240 - i, 255));
}
void buggychl_state::video_start()
diff --git a/src/mame/video/busicom.cpp b/src/mame/video/busicom.cpp
index e86e5c248d1..e2d109e6b45 100644
--- a/src/mame/video/busicom.cpp
+++ b/src/mame/video/busicom.cpp
@@ -1843,18 +1843,17 @@ uint32_t busicom_state::screen_update_busicom(screen_device &screen, bitmap_ind1
}
return 0;
}
-static const uint8_t color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 };
+static constexpr uint8_t color[] = { 0xFF,0xDB,0xB7,0x92,0x6E,0x49,0x25,0x00 };
-static const uint8_t color_red[] = { 0xb0,0xb5,0xc0,0xc5,0xd0,0xd5,0xdf };
+static constexpr uint8_t color_red[] = { 0xb0,0xb5,0xc0,0xc5,0xd0,0xd5,0xdf };
-PALETTE_INIT_MEMBER(busicom_state, busicom)
+void busicom_state::busicom_palette(palette_device &palette) const
{
- int i;
- for(i=0;i<8;i++) {
+ for(int i = 0; i < 8; i++)
m_palette->set_pen_color( i, rgb_t(color[i],color[i],color[i]) );
- }
+
m_palette->set_pen_color( 8, rgb_t(0xff,0xff,0xff) );
- for(i=0;i<7;i++) {
+
+ for(int i = 0; i < 7; i++)
m_palette->set_pen_color( i+9, rgb_t(color_red[i],0x00,0x00) );
- }
}
diff --git a/src/mame/video/calomega.cpp b/src/mame/video/calomega.cpp
index d77b47a85ab..329481a4b84 100644
--- a/src/mame/video/calomega.cpp
+++ b/src/mame/video/calomega.cpp
@@ -59,10 +59,8 @@ uint32_t calomega_state::screen_update_calomega(screen_device &screen, bitmap_in
return 0;
}
-PALETTE_INIT_MEMBER(calomega_state, calomega)
+void calomega_state::calomega_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
-
/* the proms are 256x4 bit, but the games only seem to need the first 128 entries,
and the rest of the PROM data looks like junk rather than valid colors
@@ -78,27 +76,29 @@ PALETTE_INIT_MEMBER(calomega_state, calomega)
// TODO: hook pots up as PORT_ADJUSTERs instead of hard coding them here
// let's make the BG a little darker than FG blue
- const int r_pot = 0x00;
- const int g_pot = 0x00;
- const int b_pot = 0xc0;
+ constexpr int r_pot = 0x00;
+ constexpr int g_pot = 0x00;
+ constexpr int b_pot = 0xc0;
- /* 00000BGR */
- if (color_prom == nullptr) return;
+ // 00000BGR
+ uint8_t const *const color_prom = memregion("proms")->base();
+ if (!color_prom)
+ return;
- for (int i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int nibble = color_prom[i];
+ int const nibble = color_prom[i];
- int fg = BIT(nibble, 3);
+ int const fg = BIT(nibble, 3);
- /* red component */
- int r = BIT(nibble, 0) * (fg ? 0xff : r_pot);
+ // red component
+ int const r = BIT(nibble, 0) * (fg ? 0xff : r_pot);
- /* green component */
- int g = BIT(nibble, 1) * (fg ? 0xff : g_pot);
+ // green component
+ int const g = BIT(nibble, 1) * (fg ? 0xff : g_pot);
- /* blue component */
- int b = BIT(nibble, 2) * (fg ? 0xff : b_pot);
+ // blue component
+ int const b = BIT(nibble, 2) * (fg ? 0xff : b_pot);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/carpolo.cpp b/src/mame/video/carpolo.cpp
index f0e04dcf23b..d6fa254cb69 100644
--- a/src/mame/video/carpolo.cpp
+++ b/src/mame/video/carpolo.cpp
@@ -66,27 +66,27 @@
*
**************************************************************************/
-PALETTE_INIT_MEMBER(carpolo_state, carpolo)
+void carpolo_state::carpolo_palette(palette_device &palette) const
{
- const uint8_t *color_prom = m_proms->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/* thanks to Jarek Burczynski for analyzing the circuit */
/* static const float MAX_VOLTAGE = 6.9620f; */
- static const float MIN_VOLTAGE = 1.7434f;
- static const float MAX_VOLTAGE = 5.5266f;
+ static constexpr float MIN_VOLTAGE = 1.7434f;
+ static constexpr float MAX_VOLTAGE = 5.5266f;
- static const float r_voltage[] =
+ static constexpr float r_voltage[] =
{
1.7434f, 2.1693f, 2.5823f, 3.0585f, 3.4811f, 4.0707f, 4.7415f, 5.4251f
};
- static const float g_voltage[] =
+ static constexpr float g_voltage[] =
{
1.7434f, 2.1693f, 2.5823f, 3.0585f, 3.4811f, 4.0707f, 4.7415f, 5.4251f
/* 4.7871f, 5.0613f, 5.3079f, 5.6114f, 5.7940f, 6.1608f, 6.5436f, 6.9620f */
};
- static const float b_voltage[] =
+ static constexpr float b_voltage[] =
{
1.9176f, 2.8757f, 3.9825f, 5.5266f
};
@@ -95,6 +95,7 @@ PALETTE_INIT_MEMBER(carpolo_state, carpolo)
for (int i = 0; i < palette.entries(); i++)
{
uint8_t pen;
+
if (i < 0x18)
{
/* sprites */
@@ -112,10 +113,10 @@ PALETTE_INIT_MEMBER(carpolo_state, carpolo)
{
case (0x00 | (0x07 ^ 0x0f)): pen = LEFT_GOAL_COLOR; break;
case (0x00 | (0x0d ^ 0x0f)): pen = NET_COLOR; break;
- case (0x00 | (0x09 ^ 0x0f)): pen = NET_COLOR; break; /* score */
+ case (0x00 | (0x09 ^ 0x0f)): pen = NET_COLOR; break; // score
case (0x10 | (0x07 ^ 0x0f)): pen = RIGHT_GOAL_COLOR; break;
case (0x10 | (0x0d ^ 0x0f)): pen = NET_COLOR; break;
- case (0x10 | (0x09 ^ 0x0f)): pen = NET_COLOR; break; /* score */
+ case (0x10 | (0x09 ^ 0x0f)): pen = NET_COLOR; break; // score
default: pen = 0; break;
}
}
diff --git a/src/mame/video/cave.cpp b/src/mame/video/cave.cpp
index a0273c9a098..d27f9802db5 100644
--- a/src/mame/video/cave.cpp
+++ b/src/mame/video/cave.cpp
@@ -68,109 +68,95 @@ Note: if MAME_DEBUG is defined, pressing:
***************************************************************************/
-void cave_state::palette_init_cave(palette_device &palette)
+void cave_state::cave_palette(palette_device &palette)
{
for (int chip = 0; chip < 4; chip++)
{
- /* create a 1:1 palette map covering everything */
+ // create a 1:1 palette map covering everything
m_palette_map[chip] = std::make_unique<uint16_t[]>(palette.entries());
- int maxpens = m_paletteram[chip].bytes() / 2;
- if (!maxpens)
- continue;
-
- for (int pen = 0; pen < palette.entries(); pen++)
- m_palette_map[chip][pen] = pen % maxpens;
+ int const maxpens = m_paletteram[chip].bytes() / 2;
+ if (maxpens)
+ {
+ for (int pen = 0; pen < palette.entries(); pen++)
+ m_palette_map[chip][pen] = pen % maxpens;
+ }
}
}
-void cave_state::palette_init_dfeveron(palette_device &palette)
+void cave_state::dfeveron_palette(palette_device &palette)
{
- int color, pen;
-
/* Fill the 0-3fff range, used by sprites ($40 color codes * $100 pens)
Here sprites have 16 pens, but the sprite drawing routine always
multiplies the color code by $100 (for consistency).
That's why we need this function. */
- palette_init_cave(palette);
+ cave_palette(palette);
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x10; pen++)
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x10; pen++)
m_palette_map[0][(color << 8) | pen] = (color << 4) | pen;
}
-void cave_state::palette_init_mazinger(palette_device &palette)
+void cave_state::mazinger_palette(palette_device &palette)
{
- int color, pen;
-
- palette_init_cave(palette);
+ cave_palette(palette);
- /* sprites (encrypted) are 4 bit deep */
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x100; pen++)
- m_palette_map[0][(color << 8) | pen] = (color << 4) + pen; /* yes, PLUS, not OR */
+ // sprites (encrypted) are 4 bit deep
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x100; pen++)
+ m_palette_map[0][(color << 8) | pen] = (color << 4) + pen; // yes, PLUS, not OR
- /* layer 0 is 6 bit deep, there are 64 color codes but only $400
- colors are actually addressable */
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x40; pen++)
+ // layer 0 is 6 bit deep, there are 64 color codes but only $400 colors are actually addressable
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x40; pen++)
m_palette_map[0][0x4400 + ((color << 6) | pen)] = 0x400 | ((color & 0x0f) << 6) | pen;
}
-void cave_state::palette_init_sailormn(palette_device &palette)
+void cave_state::sailormn_palette(palette_device &palette)
{
- int color, pen;
+ cave_palette(palette);
- palette_init_cave(palette);
+ // sprites (encrypted) are 4 bit deep
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x100; pen++)
+ m_palette_map[0][(color << 8) | pen] = (color << 4) + pen; // yes, PLUS, not OR
- /* sprites (encrypted) are 4 bit deep */
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x100; pen++)
- m_palette_map[0][(color << 8) | pen] = (color << 4) + pen; /* yes, PLUS, not OR */
-
- /* layer 2 is 6 bit deep, there are 64 color codes but only $400
- colors are actually addressable */
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x40; pen++)
+ // layer 2 is 6 bit deep, there are 64 color codes but only $400 colors are actually addressable
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x40; pen++)
m_palette_map[0][0x4c00 + ((color << 6) | pen)] = 0xc00 | ((color & 0x0f) << 6) | pen;
}
-void cave_state::palette_init_pwrinst2(palette_device &palette)
+void cave_state::pwrinst2_palette(palette_device &palette)
{
- int color, pen;
-
- palette_init_cave(palette);
+ cave_palette(palette);
- for (color = 0; color < 0x80; color++)
- for (pen = 0; pen < 0x10; pen++)
+ for (int color = 0; color < 0x80; color++)
+ for (int pen = 0; pen < 0x10; pen++)
m_palette_map[0][(color << 8) | pen] = (color << 4) | pen;
- for (pen = 0x8000; pen < 0xa800; pen++)
- m_palette_map[0][pen] = pen - 0x8000;
+ for (int pen = 0x8000; pen < 0xa800; pen++)
+ m_palette_map[0][pen] = pen - 0x8000;
}
-void cave_state::palette_init_korokoro(palette_device &palette)
+void cave_state::korokoro_palette(palette_device &palette)
{
- int color, pen;
-
- palette_init_cave(palette);
+ cave_palette(palette);
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x10; pen++)
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x10; pen++)
m_palette_map[0][(color << 8) | pen] = 0x3c00 | (color << 4) | pen;
}
void cave_state::set_pens(int chip)
{
- int pen;
-
- for (pen = 0; pen < m_palette->entries(); pen++)
+ for (int pen = 0; pen < m_palette->entries(); pen++)
{
- uint16_t data = m_paletteram[chip][m_palette_map[chip][pen]];
+ uint16_t const data = m_paletteram[chip][m_palette_map[chip][pen]];
- rgb_t color = rgb_t(pal5bit(data >> 5), pal5bit(data >> 10), pal5bit(data >> 0));
+ rgb_t const color(pal5bit(data >> 5), pal5bit(data >> 10), pal5bit(data >> 0));
m_palette->set_pen_color(pen, color);
}
@@ -1579,22 +1565,20 @@ void cave_state::device_post_load()
// Poka Poka Satan: 3 screens * (1 Sprite chip + 1 Tilemap chip)
-void cave_state::palette_init_ppsatan(palette_device &palette)
+void cave_state::ppsatan_palette(palette_device &palette)
{
- int color, pen;
-
- palette_init_cave(palette);
+ cave_palette(palette);
for (int chip = 0; chip < 3; chip++)
{
// Sprites: 0x987800 - 0x988fff
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x10; pen++)
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x10; pen++)
m_palette_map[chip][(color << 8) | pen] = 0x7800/2 + ((color << 4) | pen);
// Tiles: 0x980000 - 0x9803ff
- for (color = 0; color < 0x40; color++)
- for (pen = 0; pen < 0x10; pen++)
+ for (int color = 0; color < 0x40; color++)
+ for (int pen = 0; pen < 0x10; pen++)
m_palette_map[chip][0x4000 + ((color << 4) | pen)] = ((color << 4) | pen);
}
}
diff --git a/src/mame/video/cclimber.cpp b/src/mame/video/cclimber.cpp
index f2aeac11cfe..370f2987f09 100644
--- a/src/mame/video/cclimber.cpp
+++ b/src/mame/video/cclimber.cpp
@@ -36,41 +36,39 @@
bit 0 -- 1 kohm resistor -- RED
***************************************************************************/
-PALETTE_INIT_MEMBER(cclimber_state,cclimber)
+void cclimber_state::cclimber_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_rg[3], weights_b[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 0, 0,
2, resistances_b, weights_b, 0, 0,
0, nullptr, nullptr, 0, 0);
- for (i = 0;i < palette.entries(); i++)
+ for (int i = 0;i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -113,67 +111,64 @@ PALETTE_INIT_MEMBER(cclimber_state,cclimber)
***************************************************************************/
-PALETTE_INIT_MEMBER(cclimber_state,swimmer)
+void cclimber_state::swimmer_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i + 0x000], 0);
+ bit1 = BIT(color_prom[i + 0x000], 1);
+ bit2 = BIT(color_prom[i + 0x000], 2);
+ int const r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
- /* green component */
- bit0 = (color_prom[i + 0x000] >> 3) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 1) & 0x01;
- g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i + 0x000], 3);
+ bit1 = BIT(color_prom[i + 0x100], 0);
+ bit2 = BIT(color_prom[i + 0x100], 1);
+ int const g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 3) & 0x01;
- b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ bit1 = BIT(color_prom[i + 0x100], 2);
+ bit2 = BIT(color_prom[i + 0x100], 3);
+ int const b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
color_prom += 0x200;
- /* big sprite */
- for (i = 0; i < 0x20; i++)
+ // big sprite
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x20 * bit0 + 0x40 * bit1 + 0x80 * bit2;
palette.set_pen_color(i + 0x100, rgb_t(r, g, b));
}
- /* side panel backgrond pen */
+ // side panel backgrond pen
#if 0
// values calculated from the resistors don't seem to match the real board
palette.set_pen_color(SWIMMER_SIDE_BG_PEN, rgb_t(0x24, 0x5d, 0x4e));
@@ -182,101 +177,96 @@ PALETTE_INIT_MEMBER(cclimber_state,swimmer)
}
-PALETTE_INIT_MEMBER(cclimber_state,yamato)
+void cclimber_state::yamato_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* chars - 12 bits RGB */
- for (i = 0; i < 0x40; i++)
+ // chars - 12 bits RGB
+ for (int i = 0; i < 0x40; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x00] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x00] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x00] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x00] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- /* green component */
- bit0 = (color_prom[i + 0x00] >> 4) & 0x01;
- bit1 = (color_prom[i + 0x00] >> 5) & 0x01;
- bit2 = (color_prom[i + 0x00] >> 6) & 0x01;
- bit3 = (color_prom[i + 0x00] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- /* blue component */
- bit0 = (color_prom[i + 0x40] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x40] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x40] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x40] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i + 0x00], 0);
+ bit1 = BIT(color_prom[i + 0x00], 1);
+ bit2 = BIT(color_prom[i + 0x00], 2);
+ bit3 = BIT(color_prom[i + 0x00], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // green component
+ bit0 = BIT(color_prom[i + 0x00], 4);
+ bit1 = BIT(color_prom[i + 0x00], 5);
+ bit2 = BIT(color_prom[i + 0x00], 6);
+ bit3 = BIT(color_prom[i + 0x00], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x40], 0);
+ bit1 = BIT(color_prom[i + 0x40], 1);
+ bit2 = BIT(color_prom[i + 0x40], 2);
+ bit3 = BIT(color_prom[i + 0x40], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
}
- /* big sprite - 8 bits RGB */
- for (i = 0; i < 0x20; i++)
+ // big sprite - 8 bits RGB
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i + 0x80] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x80] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x80] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i + 0x80], 0);
+ bit1 = BIT(color_prom[i + 0x80], 1);
+ bit2 = BIT(color_prom[i + 0x80], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i + 0x80] >> 3) & 0x01;
- bit1 = (color_prom[i + 0x80] >> 4) & 0x01;
- bit2 = (color_prom[i + 0x80] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i + 0x80], 3);
+ bit1 = BIT(color_prom[i + 0x80], 4);
+ bit2 = BIT(color_prom[i + 0x80], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i + 0x80] >> 6) & 0x01;
- bit2 = (color_prom[i + 0x80] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i + 0x80], 6);
+ bit2 = BIT(color_prom[i + 0x80], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i + 0x40, rgb_t(r, g, b));
}
- /* fake colors for bg gradient */
- for (i = 0; i < 0x100; i++)
+ // fake colors for bg gradient
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_color(YAMATO_SKY_PEN_BASE + i, rgb_t(0, 0, i));
}
-PALETTE_INIT_MEMBER(cclimber_state,toprollr)
+void cclimber_state::toprollr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0xa0; i++)
+ for (int i = 0; i < 0xa0; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/centiped.cpp b/src/mame/video/centiped.cpp
index 0918e4df3bd..689cd6059a6 100644
--- a/src/mame/video/centiped.cpp
+++ b/src/mame/video/centiped.cpp
@@ -282,15 +282,13 @@ WRITE8_MEMBER(centiped_state::centiped_paletteram_w)
***************************************************************************/
-PALETTE_INIT_MEMBER(centiped_state,warlords)
+void centiped_state::warlords_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (unsigned i = 0; i < palette.entries(); i++)
{
uint8_t pen;
- int r, g, b;
if (i < 0x20)
/* characters */
@@ -299,16 +297,16 @@ PALETTE_INIT_MEMBER(centiped_state,warlords)
/* sprites */
pen = (((i - 0x20) & 0x1c) << 2) | (((i - 0x20) & 0x03) << 2);
- r = ((color_prom[pen] >> 2) & 0x01) * 0xff;
- g = ((color_prom[pen] >> 1) & 0x01) * 0xff;
- b = ((color_prom[pen] >> 0) & 0x01) * 0xff;
+ int r = ((color_prom[pen] >> 2) & 0x01) * 0xff;
+ int g = ((color_prom[pen] >> 1) & 0x01) * 0xff;
+ int b = ((color_prom[pen] >> 0) & 0x01) * 0xff;
/* colors 0x40-0x7f are converted to grey scale as it's used on the
upright version that had an overlay */
if (pen >= 0x40)
{
/* use the standard ratios: r = 30%, g = 59%, b = 11% */
- int grey = (r * 0x4d / 0xff) + (g * 0x96 / 0xff) + (b * 0x1c / 0xff);
+ int const grey = (r * 0x4d / 0xff) + (g * 0x96 / 0xff) + (b * 0x1c / 0xff);
r = g = b = grey;
}
diff --git a/src/mame/video/cgc7900.cpp b/src/mame/video/cgc7900.cpp
index ef37b82ea70..5668b63a75f 100644
--- a/src/mame/video/cgc7900.cpp
+++ b/src/mame/video/cgc7900.cpp
@@ -25,7 +25,7 @@
#define OVERLAY_CURSOR_BLINK BIT(m_roll_overlay[0], 14)
#define OVERLAY_CHARACTER_BLINK BIT(m_roll_overlay[0], 15)
-PALETTE_INIT_MEMBER(cgc7900_state, cgc7900)
+void cgc7900_state::cgc7900_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t(0x00, 0x00, 0xff));
@@ -236,9 +236,8 @@ MACHINE_CONFIG_START(cgc7900_state::cgc7900_video)
MCFG_SCREEN_VISIBLE_AREA(0, 1024-1, 0, 768-1)
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, cgc7900_state, irq<0xc>))
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_cgc7900)
- MCFG_PALETTE_ADD("palette", 8)
- MCFG_PALETTE_INIT_OWNER(cgc7900_state, cgc7900)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_cgc7900)
+ PALETTE(config, m_palette, FUNC(cgc7900_state::cgc7900_palette), 8);
MCFG_TIMER_DRIVER_ADD_PERIODIC("blink", cgc7900_state, blink_tick, attotime::from_hz(XTAL(28'480'000)/7500000))
MACHINE_CONFIG_END
diff --git a/src/mame/video/chaknpop.cpp b/src/mame/video/chaknpop.cpp
index 2c4619b539c..bfdf5341300 100644
--- a/src/mame/video/chaknpop.cpp
+++ b/src/mame/video/chaknpop.cpp
@@ -24,34 +24,33 @@
palette decode
***************************************************************************/
-PALETTE_INIT_MEMBER(chaknpop_state, chaknpop)
+void chaknpop_state::chaknpop_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < 1024; i++)
{
- int col, r, g, b;
int bit0, bit1, bit2;
- col = (color_prom[i] & 0x0f) + ((color_prom[i + 1024] & 0x0f) << 4);
+ int const col = (color_prom[i] & 0x0f) | ((color_prom[i + 1024] & 0x0f) << 4);
- /* red component */
- bit0 = (col >> 0) & 0x01;
- bit1 = (col >> 1) & 0x01;
- bit2 = (col >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(col, 0);
+ bit1 = BIT(col, 1);
+ bit2 = BIT(col, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (col >> 3) & 0x01;
- bit1 = (col >> 4) & 0x01;
- bit2 = (col >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(col, 3);
+ bit1 = BIT(col, 4);
+ bit2 = BIT(col, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (col >> 6) & 0x01;
- bit2 = (col >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(col, 6);
+ bit2 = BIT(col, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/champbas.cpp b/src/mame/video/champbas.cpp
index 671d2680f87..8357dfa7581 100644
--- a/src/mame/video/champbas.cpp
+++ b/src/mame/video/champbas.cpp
@@ -28,14 +28,14 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(champbas_state,champbas)
+void champbas_state::champbas_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
static const int resistances_rg[3] = { 1000, 470, 220 };
static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
/* compute the color output resistor weights */
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
@@ -45,24 +45,23 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
/* blue component */
bit0 = (color_prom[i] >> 6) & 0x01;
bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -71,13 +70,13 @@ PALETTE_INIT_MEMBER(champbas_state,champbas)
for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i & 0xff] & 0x0f) | ((i & 0x100) >> 4);
+ uint8_t const ctabentry = (color_prom[i & 0xff] & 0x0f) | ((i & 0x100) >> 4);
palette.set_pen_indirect(i, ctabentry);
}
}
-PALETTE_INIT_MEMBER(exctsccr_state,exctsccr)
+void exctsccr_state::exctsccr_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -85,25 +84,24 @@ PALETTE_INIT_MEMBER(exctsccr_state,exctsccr)
for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
/* red component */
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -114,15 +112,15 @@ PALETTE_INIT_MEMBER(exctsccr_state,exctsccr)
/* characters / sprites (3bpp) */
for (int i = 0; i < 0x100; i++)
{
- int swapped_i = bitswap<8>(i, 2, 7, 6, 5, 4, 3, 1, 0);
- uint8_t ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3);
+ int const swapped_i = bitswap<8>(i, 2, 7, 6, 5, 4, 3, 1, 0);
+ uint8_t const ctabentry = (color_prom[swapped_i] & 0x0f) | ((i & 0x80) >> 3);
palette.set_pen_indirect(i, ctabentry);
}
/* sprites (4bpp) */
for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[0x100 + i] & 0x0f) | 0x10;
palette.set_pen_indirect(i + 0x100, ctabentry);
}
}
diff --git a/src/mame/video/channelf.cpp b/src/mame/video/channelf.cpp
index c9d716acaff..c9d47bf65fd 100644
--- a/src/mame/video/channelf.cpp
+++ b/src/mame/video/channelf.cpp
@@ -3,16 +3,16 @@
#include "emu.h"
#include "includes/channelf.h"
-static const rgb_t channelf_palette[] =
+static constexpr rgb_t channelf_pens[] =
{
- rgb_t(0x10, 0x10, 0x10), /* black */
- rgb_t(0xfd, 0xfd, 0xfd), /* white */
- rgb_t(0xff, 0x31, 0x53), /* red */
- rgb_t(0x02, 0xcc, 0x5d), /* green */
- rgb_t(0x4b, 0x3f, 0xf3), /* blue */
- rgb_t(0xe0, 0xe0, 0xe0), /* ltgray */
- rgb_t(0x91, 0xff, 0xa6), /* ltgreen */
- rgb_t(0xce, 0xd0, 0xff) /* ltblue */
+ { 0x10, 0x10, 0x10 }, // black
+ { 0xfd, 0xfd, 0xfd }, // white
+ { 0xff, 0x31, 0x53 }, // red
+ { 0x02, 0xcc, 0x5d }, // green
+ { 0x4b, 0x3f, 0xf3 }, // blue
+ { 0xe0, 0xe0, 0xe0 }, // ltgray
+ { 0x91, 0xff, 0xa6 }, // ltgreen
+ { 0xce, 0xd0, 0xff } // ltblue
};
#define BLACK 0
@@ -32,9 +32,9 @@ static const uint16_t colormap[] = {
};
/* Initialise the palette */
-PALETTE_INIT_MEMBER(channelf_state, channelf)
+void channelf_state::channelf_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, channelf_palette, ARRAY_LENGTH(channelf_palette));
+ palette.set_pen_colors(0, channelf_pens);
}
void channelf_state::video_start()
diff --git a/src/mame/video/cheekyms.cpp b/src/mame/video/cheekyms.cpp
index 7c7470c13aa..8930b3cb2e0 100644
--- a/src/mame/video/cheekyms.cpp
+++ b/src/mame/video/cheekyms.cpp
@@ -11,29 +11,31 @@ Functions to emulate the video hardware of the machine.
#include "emu.h"
#include "includes/cheekyms.h"
-/* bit 3 and 7 of the char color PROMs are used for something -- not currently emulated -
- thus GAME_IMPERFECT_GRAPHICS */
+// bit 3 and 7 of the char color PROMs are used for something -- not currently emulated - thus GAME_IMPERFECT_GRAPHICS
-PALETTE_INIT_MEMBER(cheekyms_state, cheekyms)
+void cheekyms_state::cheekyms_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, j, bit, r, g, b;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 6; i++)
+ for (int i = 0; i < 6; i++)
{
- for (j = 0; j < 0x20; j++)
+ for (int j = 0; j < 0x20; j++)
{
- /* red component */
- bit = (color_prom[0x20 * (i / 2) + j] >> ((4 * (i & 1)) + 0)) & 0x01;
- r = 0xff * bit;
- /* green component */
- bit = (color_prom[0x20 * (i / 2) + j] >> ((4 * (i & 1)) + 1)) & 0x01;
- g = 0xff * bit;
- /* blue component */
- bit = (color_prom[0x20 * (i / 2) + j] >> ((4 * (i & 1)) + 2)) & 0x01;
- b = 0xff * bit;
-
- palette.set_pen_color((i * 0x20) + j, rgb_t(r,g,b));
+ int bit;
+
+ // red component
+ bit = BIT(color_prom[0x20 * (i / 2) + j], (4 * (i & 1)) + 0);
+ int const r = 0xff * bit;
+
+ // green component
+ bit = BIT(color_prom[0x20 * (i / 2) + j], (4 * (i & 1)) + 1);
+ int const g = 0xff * bit;
+
+ // blue component
+ bit = BIT(color_prom[0x20 * (i / 2) + j], (4 * (i & 1)) + 2);
+ int const b = 0xff * bit;
+
+ palette.set_pen_color((i * 0x20) + j, rgb_t(r, g, b));
}
}
}
diff --git a/src/mame/video/circusc.cpp b/src/mame/video/circusc.cpp
index 72e0b3ba133..f8d06ff65b7 100644
--- a/src/mame/video/circusc.cpp
+++ b/src/mame/video/circusc.cpp
@@ -32,60 +32,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(circusc_state, circusc)
+void circusc_state::circusc_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- /* characters map to the upper 16 palette entries */
- for (i = 0; i < 0x100; i++)
+ // characters map to the upper 16 palette entries
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry + 0x10);
}
- /* sprites map to the lower 16 palette entries */
- for (i = 0x100; i < 0x200; i++)
+ // sprites map to the lower 16 palette entries
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
@@ -100,13 +98,14 @@ PALETTE_INIT_MEMBER(circusc_state, circusc)
TILE_GET_INFO_MEMBER(circusc_state::get_tile_info)
{
- uint8_t attr = m_colorram[tile_index];
- tileinfo.category = (attr & 0x10) >> 4;
-
- SET_TILE_INFO_MEMBER(0,
- m_videoram[tile_index] + ((attr & 0x20) << 3),
- attr & 0x0f,
- TILE_FLIPYX((attr & 0xc0) >> 6));
+ uint8_t const attr = m_colorram[tile_index];
+ tileinfo.category = BIT(attr, 4);
+
+ SET_TILE_INFO_MEMBER(
+ 0,
+ m_videoram[tile_index] + ((attr & 0x20) << 3),
+ attr & 0x0f,
+ TILE_FLIPYX((attr & 0xc0) >> 6));
}
diff --git a/src/mame/video/clshroad.cpp b/src/mame/video/clshroad.cpp
index 6e6e14b5730..9b2389fb46a 100644
--- a/src/mame/video/clshroad.cpp
+++ b/src/mame/video/clshroad.cpp
@@ -42,42 +42,42 @@ WRITE_LINE_MEMBER(clshroad_state::flipscreen_w)
}
-PALETTE_INIT_MEMBER(clshroad_state,clshroad)
+void clshroad_state::clshroad_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < 256;i++)
- palette.set_pen_color(i, pal4bit(color_prom[i + 256 * 0]),
- pal4bit(color_prom[i + 256 * 1]),
- pal4bit(color_prom[i + 256 * 2]));
+ for (int i = 0; i < 256; i++)
+ {
+ palette.set_pen_color(i,
+ pal4bit(color_prom[i | 0x000]),
+ pal4bit(color_prom[i | 0x100]),
+ pal4bit(color_prom[i | 0x200]));
+ }
}
-PALETTE_INIT_MEMBER(clshroad_state,firebatl)
+void clshroad_state::firebatl_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i | 0x000]);
+ int const g = pal4bit(color_prom[i | 0x100]);
+ int const b = pal4bit(color_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- for (i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
palette.set_pen_indirect(i, i & 0xff);
- for (i = 0x200; i < 0x300; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = ((color_prom[(i - 0x200) + 0x000] & 0x0f) << 4) |
- (color_prom[(i - 0x200) + 0x100] & 0x0f);
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t const ctabentry = ((color_prom[i | 0x000] & 0x0f) << 4) | (color_prom[i | 0x100] & 0x0f);
+ palette.set_pen_indirect(i | 0x200, ctabentry);
}
}
diff --git a/src/mame/video/combatsc.cpp b/src/mame/video/combatsc.cpp
index ab23f4d1440..c7598bb4b83 100644
--- a/src/mame/video/combatsc.cpp
+++ b/src/mame/video/combatsc.cpp
@@ -12,40 +12,39 @@
#include "includes/combatsc.h"
-PALETTE_INIT_MEMBER(combatsc_state,combatsc)
+void combatsc_state::combatsc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int pal;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (pal = 0; pal < 8; pal++)
+ for (int pal = 0; pal < 8; pal++)
{
- int i, clut;
+ int clut;
switch (pal)
{
- default:
- case 0: /* other sprites */
- case 2: /* other sprites(alt) */
- clut = 1; /* 0 is wrong for Firing Range III targets */
+ default:
+ case 0: // other sprites
+ case 2: // other sprites(alt)
+ clut = 1; // 0 is wrong for Firing Range III targets
break;
- case 4: /* player sprites */
- case 6: /* player sprites(alt) */
+ case 4: // player sprites
+ case 6: // player sprites(alt)
clut = 2;
break;
- case 1: /* background */
- case 3: /* background(alt) */
+ case 1: // background
+ case 3: // background(alt)
clut = 1;
break;
- case 5: /* foreground tiles */
- case 7: /* foreground tiles(alt) */
+ case 5: // foreground tiles
+ case 7: // foreground tiles(alt)
clut = 3;
break;
}
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
uint8_t ctabentry;
@@ -60,25 +59,22 @@ PALETTE_INIT_MEMBER(combatsc_state,combatsc)
}
-PALETTE_INIT_MEMBER(combatsc_state,combatscb)
+void combatsc_state::combatscb_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int pal;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (pal = 0; pal < 8; pal++)
+ for (int pal = 0; pal < 8; pal++)
{
- int i;
-
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
uint8_t ctabentry;
if ((pal & 1) == 0)
- /* sprites */
+ // sprites
ctabentry = (pal << 4) | (~color_prom[i] & 0x0f);
else
- /* chars - no lookup? */
- ctabentry = (pal << 4) | (i & 0x0f); /* no lookup? */
+ // chars - no lookup?
+ ctabentry = (pal << 4) | (i & 0x0f); // no lookup?
palette.set_pen_indirect((pal << 8) | i, ctabentry);
}
diff --git a/src/mame/video/compgolf.cpp b/src/mame/video/compgolf.cpp
index 0fc7a196e93..5d5a026d44c 100644
--- a/src/mame/video/compgolf.cpp
+++ b/src/mame/video/compgolf.cpp
@@ -11,28 +11,27 @@
#include "includes/compgolf.h"
-PALETTE_INIT_MEMBER(compgolf_state, compgolf)
+void compgolf_state::compgolf_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
+ int bit0,bit1,bit2;
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/contra.cpp b/src/mame/video/contra.cpp
index ef97ba765a7..9756dfeb528 100644
--- a/src/mame/video/contra.cpp
+++ b/src/mame/video/contra.cpp
@@ -21,21 +21,17 @@
**
***************************************************************************/
-PALETTE_INIT_MEMBER(contra_state, contra)
+void contra_state::contra_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int chip;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (chip = 0; chip < 2; chip++)
+ for (int chip = 0; chip < 2; chip++)
{
- int pal;
-
- for (pal = 0; pal < 8; pal++)
+ for (int pal = 0; pal < 8; pal++)
{
- int i;
- int clut = (chip << 1) | (pal & 1);
+ int const clut = (chip << 1) | (pal & 1);
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
uint8_t ctabentry;
diff --git a/src/mame/video/cop01.cpp b/src/mame/video/cop01.cpp
index 694fee7bc06..cdf9c478d4a 100644
--- a/src/mame/video/cop01.cpp
+++ b/src/mame/video/cop01.cpp
@@ -12,43 +12,41 @@
#include "includes/cop01.h"
-PALETTE_INIT_MEMBER(cop01_state, cop01)
+void cop01_state::cop01_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x00-0x0f (or 0x00-0x7f, but the eight rows are identical) */
- for (i = 0; i < 0x10; i++)
+ // characters use colors 0x00-0x0f (or 0x00-0x7f, but the eight rows are identical)
+ for (int i = 0; i < 0x10; i++)
palette.set_pen_indirect(i, i);
- /* background tiles use colors 0xc0-0xff */
- /* I don't know how much of the lookup table PROM is hooked up, */
- /* I'm only using the first 32 bytes because the rest is empty. */
- for (i = 0x10; i < 0x90; i++)
+ // background tiles use colors 0xc0-0xff
+ // I don't know how much of the lookup table PROM is hooked up,
+ // I'm only using the first 32 bytes because the rest is empty.
+ for (int i = 0; i < 0x80; i++)
{
- uint8_t ctabentry = 0xc0 | ((i - 0x10) & 0x30) |
- (color_prom[(((i - 0x10) & 0x40) >> 2) | ((i - 0x10) & 0x0f)] & 0x0f);
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t const ctabentry = 0xc0 | (i & 0x30) | (color_prom[((i & 0x40) >> 2) | (i & 0x0f)] & 0x0f);
+ palette.set_pen_indirect(i + 0x10, ctabentry);
}
- /* sprites use colors 0x80-0x8f (or 0x80-0xbf, but the four rows are identical) */
- for (i = 0x90; i < 0x190; i++)
+ // sprites use colors 0x80-0x8f (or 0x80-0xbf, but the four rows are identical)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = 0x80 | (color_prom[i - 0x90 + 0x100] & 0x0f);
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t ctabentry = 0x80 | (color_prom[i + 0x100] & 0x0f);
+ palette.set_pen_indirect(i + 0x90, ctabentry);
}
}
diff --git a/src/mame/video/cosmic.cpp b/src/mame/video/cosmic.cpp
index ee5d79cb955..970b21e1732 100644
--- a/src/mame/video/cosmic.cpp
+++ b/src/mame/video/cosmic.cpp
@@ -73,31 +73,27 @@ pen_t cosmic_state::magspot_map_color( uint8_t x, uint8_t y )
* (1k to ground) so second version of table has blue set to 2/3
*/
-PALETTE_INIT_MEMBER(cosmic_state,panic)
+void cosmic_state::panic_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
- int r = pal1bit(i >> 0);
- int g = pal1bit(i >> 1);
- int b = ((i & 0x0c) == 0x08) ? 0xaa : pal1bit(i >> 2);
+ int const r = pal1bit(i >> 0);
+ int const g = pal1bit(i >> 1);
+ int const b = ((i & 0x0c) == 0x08) ? 0xaa : pal1bit(i >> 2);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* background uses colors 0x00-0x0f */
- for (i = 0; i < 0x0f; i++)
+ // background uses colors 0x00-0x0f
+ for (int i = 0; i < 0x0f; i++)
palette.set_pen_indirect(i, i);
- /* sprites use colors 0x00-0x07 */
- for (i = 0x10; i < 0x30; i++)
- {
- uint8_t ctabentry = color_prom[i - 0x10] & 0x07;
- palette.set_pen_indirect(i, ctabentry);
- }
+ // sprites use colors 0x00-0x07
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i + 0x10, color_prom[i] & 0x07);
m_map_color = &cosmic_state::panic_map_color;
}
@@ -112,31 +108,22 @@ PALETTE_INIT_MEMBER(cosmic_state,panic)
*
*/
-PALETTE_INIT_MEMBER(cosmic_state,cosmica)
+void cosmic_state::cosmica_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x08; i++)
- {
- rgb_t color = rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
- palette.set_indirect_color(i, color);
- }
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x08; i++)
+ palette.set_indirect_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)));
- /* background and sprites use colors 0x00-0x07 */
- for (i = 0; i < 0x08; i++)
+ // background and sprites use colors 0x00-0x07
+ for (int i = 0; i < 0x08; i++)
palette.set_pen_indirect(i, i);
- for (i = 0x08; i < 0x28; i++)
+ for (int i = 0; i < 0x20; i++)
{
- uint8_t ctabentry;
-
- ctabentry = (color_prom[i - 0x08] >> 0) & 0x07;
- palette.set_pen_indirect(i + 0x00, ctabentry);
-
- ctabentry = (color_prom[i - 0x08] >> 4) & 0x07;
- palette.set_pen_indirect(i + 0x20, ctabentry);
+ palette.set_pen_indirect(i + 0x08, (color_prom[i] >> 0) & 0x07);
+ palette.set_pen_indirect(i + 0x28, (color_prom[i] >> 4) & 0x07);
}
m_map_color = &cosmic_state::cosmica_map_color;
@@ -152,15 +139,13 @@ PALETTE_INIT_MEMBER(cosmic_state,cosmica)
* It's possible that the background is dark gray and not black, as the
* resistor chain would never drop to zero, Anybody know ?
*/
-PALETTE_INIT_MEMBER(cosmic_state,cosmicg)
+void cosmic_state::cosmicg_palette(palette_device &palette)
{
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int r = (i > 8) ? 0xff : 0xaa * ((i >> 0) & 1);
- int g = 0xaa * ((i >> 1) & 1);
- int b = 0xaa * ((i >> 2) & 1);
+ int const r = (i > 8) ? 0xff : 0xaa * BIT(i, 0);
+ int const g = 0xaa * BIT(i, 1);
+ int const b = 0xaa * BIT(i, 2);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -169,59 +154,51 @@ PALETTE_INIT_MEMBER(cosmic_state,cosmicg)
}
-PALETTE_INIT_MEMBER(cosmic_state,magspot)
+void cosmic_state::magspot_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
- int r = ((i & 0x09) == 0x08) ? 0xaa : pal1bit(i >> 0);
- int g = pal1bit(i >> 1);
- int b = pal1bit(i >> 2);
+ int const r = ((i & 0x09) == 0x08) ? 0xaa : pal1bit(i >> 0);
+ int const g = pal1bit(i >> 1);
+ int const b = pal1bit(i >> 2);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* background uses colors 0x00-0x0f */
- for (i = 0; i < 0x0f; i++)
+ // background uses colors 0x00-0x0f
+ for (int i = 0; i < 0x0f; i++)
palette.set_pen_indirect(i, i);
- /* sprites use colors 0x00-0x0f */
- for (i = 0x10; i < 0x30; i++)
- {
- uint8_t ctabentry = color_prom[i - 0x10] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
- }
+ // sprites use colors 0x00-0x0f
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i + 0x10, color_prom[i] & 0x0f);
m_map_color = &cosmic_state::magspot_map_color;
m_magspot_pen_mask = 0x0f;
}
-PALETTE_INIT_MEMBER(cosmic_state,nomnlnd)
+void cosmic_state::nomnlnd_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
- rgb_t color = rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
+ rgb_t const color = rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
palette.set_indirect_color(i, color);
}
- /* background uses colors 0x00-0x07 */
- for (i = 0; i < 0x07; i++)
+ // background uses colors 0x00-0x07
+ for (int i = 0; i < 0x07; i++)
palette.set_pen_indirect(i, i);
- /* sprites use colors 0x00-0x07 */
- for (i = 0x10; i < 0x30; i++)
- {
- uint8_t ctabentry = color_prom[i - 0x10] & 0x07;
- palette.set_pen_indirect(i, ctabentry);
- }
+ // sprites use colors 0x00-0x07 */
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i + 0x10, color_prom[i] & 0x07);
m_map_color = &cosmic_state::magspot_map_color;
m_magspot_pen_mask = 0x07;
@@ -236,19 +213,16 @@ WRITE8_MEMBER(cosmic_state::cosmic_background_enable_w)
void cosmic_state::draw_bitmap( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
- offs_t offs;
-
- for (offs = 0; offs < m_videoram.bytes(); offs++)
+ for (offs_t offs = 0; offs < m_videoram.bytes(); offs++)
{
- int i;
uint8_t data = m_videoram[offs];
uint8_t x = offs << 3;
- uint8_t y = offs >> 5;
+ uint8_t const y = offs >> 5;
pen_t pen = (this->*m_map_color)(x, y);
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
if (data & 0x80)
{
diff --git a/src/mame/video/crbaloon.cpp b/src/mame/video/crbaloon.cpp
index da45c7dfda3..3f9771afb23 100644
--- a/src/mame/video/crbaloon.cpp
+++ b/src/mame/video/crbaloon.cpp
@@ -25,24 +25,16 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(crbaloon_state, crbaloon)
+void crbaloon_state::crbaloon_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- uint8_t pen;
- int h, r, g, b;
-
- if (i & 0x01)
- pen = i >> 1;
- else
- pen = 0x0f;
-
- h = (~pen & 0x08) ? 0xff : 0x55;
- r = h * ((~pen >> 0) & 1);
- g = h * ((~pen >> 1) & 1);
- b = h * ((~pen >> 2) & 1);
+ uint8_t const pen = BIT(i, 0) ? (i >> 1) : 0x0f;
+
+ int const h = BIT(~pen, 3) ? 0xff : 0x55;
+ int const r = h * BIT(~pen, 0);
+ int const g = h * BIT(~pen, 1);
+ int const b = h * BIT(~pen, 2);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/crgolf.cpp b/src/mame/video/crgolf.cpp
index 5f1572eba0a..a12e514fc68 100644
--- a/src/mame/video/crgolf.cpp
+++ b/src/mame/video/crgolf.cpp
@@ -23,39 +23,38 @@
*
*************************************/
-PALETTE_INIT_MEMBER(crgolf_state, crgolf)
+void crgolf_state::crgolf_palette(palette_device &palette) const
{
- offs_t offs;
- const uint8_t *prom = memregion("proms")->base();
+ uint8_t const *const prom = memregion("proms")->base();
- for (offs = 0; offs < NUM_PENS; offs++)
+ for (offs_t offs = 0; offs < NUM_PENS; offs++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- uint8_t data = prom[offs];
+ uint8_t const data = prom[offs];
- /* red component */
- bit0 = (data >> 0) & 0x01;
- bit1 = (data >> 1) & 0x01;
- bit2 = (data >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(data, 0);
+ bit1 = BIT(data, 1);
+ bit2 = BIT(data, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (data >> 3) & 0x01;
- bit1 = (data >> 4) & 0x01;
- bit2 = (data >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(data, 3);
+ bit1 = BIT(data, 4);
+ bit2 = BIT(data, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (data >> 6) & 0x01;
- bit1 = (data >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
+ // blue component
+ bit0 = BIT(data, 6);
+ bit1 = BIT(data, 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
m_palette->set_pen_color(offs, r, g, b);
}
}
-PALETTE_INIT_MEMBER(crgolf_state, mastrglf)
+void crgolf_state::mastrglf_palette(palette_device &palette) const
{
}
diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp
index 150abc6ead9..0dc5d7ef7a1 100644
--- a/src/mame/video/cvs.cpp
+++ b/src/mame/video/cvs.cpp
@@ -26,27 +26,26 @@
* colours are taken from SRAM and are programmable *
******************************************************/
-PALETTE_INIT_MEMBER(cvs_state,cvs)
+void cvs_state::cvs_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, attr;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* color mapping PROM */
- for (attr = 0; attr < 0x100; attr++)
+ // color mapping PROM
+ for (int attr = 0; attr < 0x100; attr++)
{
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
uint8_t ctabentry = color_prom[(i << 8) | attr] & 0x07;
- /* bits 0 and 2 are swapped */
- ctabentry = bitswap<8>(ctabentry,7,6,5,4,3,0,1,2);
+ // bits 0 and 2 are swapped
+ ctabentry = bitswap<8>(ctabentry, 7, 6, 5, 4, 3, 0, 1, 2);
palette.set_pen_indirect((attr << 3) | i, ctabentry);
}
}
- /* background collision map */
- for (i = 0; i < 8; i++)
+ // background collision map
+ for (int i = 0; i < 8; i++)
{
palette.set_pen_indirect(0x800 + i, 0);
palette.set_pen_indirect(0x808 + i, i & 0x04);
@@ -54,11 +53,11 @@ PALETTE_INIT_MEMBER(cvs_state,cvs)
palette.set_pen_indirect(0x818 + i, i & 0x06);
}
- /* sprites */
- for (i = 0; i < 8; i++)
+ // sprites
+ for (int i = 0; i < 8; i++)
palette.set_pen_indirect(SPRITE_PEN_BASE + i, i | 0x08);
- /* bullet */
+ // bullet
palette.set_pen_indirect(BULLET_STAR_PEN, 7);
}
diff --git a/src/mame/video/dai.cpp b/src/mame/video/dai.cpp
index e6e60522f18..77f507957eb 100644
--- a/src/mame/video/dai.cpp
+++ b/src/mame/video/dai.cpp
@@ -21,40 +21,30 @@
#define LOG_DAI_VIDEO_LINE(_mode, _unit, _resolution, _repeat, _scan) do { if (DEBUG_DAI_VIDEO) logerror ("Mode: %02x, Unit: %02x, Resolution: %02x, Repeat: %d, Current line: %d\n", _mode, _unit, _resolution, _repeat, _scan); } while (0)
-const unsigned char dai_palette[16*3] =
+const rgb_t dai_state::s_palette[16] =
{
- 0x00, 0x00, 0x00, /* 0 Black */
- 0x00, 0x00, 0x8b, /* 1 Dark Blue */
- 0xb1, 0x00, 0x95, /* 2 Purple Red */
- 0xff, 0x00, 0x00, /* 3 Red */
- 0x75, 0x2e, 0x50, /* 4 Purple Brown */
- 0x00, 0xb2, 0x38, /* 5 Emerald Green */
- 0x98, 0x62, 0x00, /* 6 Kakhi Brown */
- 0xae, 0x7a, 0x00, /* 7 Mustard Brown */
- 0x89, 0x89, 0x89, /* 8 Grey */
- 0xa1, 0x6f, 0xff, /* 9 Middle Blue */
- 0xff, 0xa5, 0x00, /* 10 Orange */
- 0xff, 0x99, 0xff, /* 11 Pink */
- 0x9e, 0xf4, 0xff, /* 12 Light Blue */
- 0xb3, 0xff, 0xbb, /* 13 Light Green */
- 0xff, 0xff, 0x28, /* 14 Light Yellow */
- 0xff, 0xff, 0xff, /* 15 White */
+ { 0x00, 0x00, 0x00 }, // 0 Black
+ { 0x00, 0x00, 0x8b }, // 1 Dark Blue
+ { 0xb1, 0x00, 0x95 }, // 2 Purple Red
+ { 0xff, 0x00, 0x00 }, // 3 Red
+ { 0x75, 0x2e, 0x50 }, // 4 Purple Brown
+ { 0x00, 0xb2, 0x38 }, // 5 Emerald Green
+ { 0x98, 0x62, 0x00 }, // 6 Kakhi Brown
+ { 0xae, 0x7a, 0x00 }, // 7 Mustard Brown
+ { 0x89, 0x89, 0x89 }, // 8 Grey
+ { 0xa1, 0x6f, 0xff }, // 9 Middle Blue
+ { 0xff, 0xa5, 0x00 }, // 10 Orange
+ { 0xff, 0x99, 0xff }, // 11 Pink
+ { 0x9e, 0xf4, 0xff }, // 12 Light Blue
+ { 0xb3, 0xff, 0xbb }, // 13 Light Green
+ { 0xff, 0xff, 0x28 }, // 14 Light Yellow
+ { 0xff, 0xff, 0xff } // 15 White
};
-PALETTE_INIT_MEMBER(dai_state, dai)
-{
- int i;
-
- for ( i = 0; i < sizeof(dai_palette) / 3; i++ )
- {
- m_palette->set_pen_color(i, dai_palette[i * 3], dai_palette[i * 3 + 1], dai_palette[i * 3 + 2]);
- }
-}
-
-
-void dai_state::video_start()
+void dai_state::dai_palette(palette_device &palette) const
{
+ palette.set_pen_colors(0, s_palette);
}
uint32_t dai_state::screen_update_dai(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/video/darkmist.cpp b/src/mame/video/darkmist.cpp
index d6abdc78034..ba2f90efc7b 100644
--- a/src/mame/video/darkmist.cpp
+++ b/src/mame/video/darkmist.cpp
@@ -61,39 +61,27 @@ TILE_GET_INFO_MEMBER(darkmist_state::get_txttile_info)
0);
}
-PALETTE_INIT_MEMBER(darkmist_state, darkmist)
+void darkmist_state::darkmist_palette(palette_device &palette) const
{
-// palette.set_indirect_color(0x100, rgb_t::black());
+ //palette.set_indirect_color(0x100, rgb_t::black());
- for (int i = 0; i < 0x400; i++)
- {
- int ctabentry;
- uint8_t clut = 0;
-
- switch (i & 0x300)
- {
- case 0x000: clut = m_bg_clut[i&0xff]; break;
- case 0x100: clut = m_fg_clut[i&0xff]; break;
- case 0x200: clut = m_spr_clut[i&0xff]; break;
- case 0x300: clut = m_tx_clut[i&0xff]; break;
- }
+ std::pair<uint8_t const *, uint8_t> const planes[4]{
+ { &m_bg_clut[0], 0x80 },
+ { &m_fg_clut[0], 0x00 },
+ { &m_spr_clut[0], 0x40 },
+ { &m_tx_clut[0], 0xc0 } };
-// if (clut & 0x40) // 0x40 indicates transparent pen
-// ctabentry = 0x100;
-// else
+ for (unsigned plane = 0; ARRAY_LENGTH(planes) > plane; ++plane)
+ {
+ for (unsigned i = 0; 0x100 > i; ++i)
{
- ctabentry = (clut & 0x3f);
-
- switch (i & 0x300)
- {
- case 0x000: ctabentry = ctabentry | 0x80; break;
- case 0x100: ctabentry = ctabentry | 0x00; break;
- case 0x200: ctabentry = ctabentry | 0x40; break;
- case 0x300: ctabentry = ctabentry | 0xc0; break;
- }
+ uint8_t const clut = planes[plane].first[i];
+// if (clut & 0x40) // 0x40 indicates transparent pen
+// ctabentry = 0x100;
+// else
+ int const ctabentry = (clut & 0x3f) | planes[plane].second;
+ palette.set_pen_indirect((plane << 8) | i, ctabentry);
}
-
- palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/dcheese.cpp b/src/mame/video/dcheese.cpp
index 4c57d67479a..8e4e1d5b1ff 100644
--- a/src/mame/video/dcheese.cpp
+++ b/src/mame/video/dcheese.cpp
@@ -27,11 +27,11 @@
*
*************************************/
-PALETTE_INIT_MEMBER(dcheese_state, dcheese)
+void dcheese_state::dcheese_palette(palette_device &palette) const
{
for (int i = 0; i < 65536; i++)
{
- int data = m_palrom[i];
+ int const data = m_palrom[i];
palette.set_pen_color(i, pal6bit(data >> 0), pal5bit(data >> 6), pal5bit(data >> 11));
}
}
diff --git a/src/mame/video/dday.cpp b/src/mame/video/dday.cpp
index 43fa2cc6811..bf90fd389e9 100644
--- a/src/mame/video/dday.cpp
+++ b/src/mame/video/dday.cpp
@@ -47,28 +47,26 @@ void dday_state::start_countdown_timer()
***************************************************************************/
-PALETTE_INIT_MEMBER(dday_state, dday)
+void dday_state::dday_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
palette.set_shadow_factor(1.0 / 8);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
- /* HACK!!! This table is handgenerated, but it matches the screenshot.
- I have no clue how it really works */
+ // HACK!!! This table is handgenerated, but it matches the screenshot. I have no clue how it really works
palette.set_pen_indirect(0*8+0+0, 0x00);
palette.set_pen_indirect(0*8+0+1, 0x01);
palette.set_pen_indirect(0*8+0+2, 0x15);
diff --git a/src/mame/video/ddribble.cpp b/src/mame/video/ddribble.cpp
index 43b43f485e5..477e49db2de 100644
--- a/src/mame/video/ddribble.cpp
+++ b/src/mame/video/ddribble.cpp
@@ -12,19 +12,18 @@
#include "includes/ddribble.h"
-PALETTE_INIT_MEMBER(ddribble_state, ddribble)
+void ddribble_state::ddribble_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0x10; i < 0x40; i++)
+ for (int i = 0x10; i < 0x40; i++)
palette.set_pen_indirect(i, i);
- /* sprite #2 uses pens 0x00-0x0f */
- for (i = 0x40; i < 0x140; i++)
+ // sprite #2 uses pens 0x00-0x0f
+ for (int i = 0x0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i - 0x40] & 0x0f;
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i + 0x40, ctabentry);
}
}
diff --git a/src/mame/video/digdug.cpp b/src/mame/video/digdug.cpp
index bfd31abe377..14cfd0d7c79 100644
--- a/src/mame/video/digdug.cpp
+++ b/src/mame/video/digdug.cpp
@@ -24,45 +24,44 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(digdug_state,digdug)
+void digdug_state::digdug_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < 32;i++)
+ for (int i = 0; i < 32; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
- /* characters - direct mapping */
- for (i = 0; i < 16; i++)
+ // characters - direct mapping
+ for (int i = 0; i < 16; i++)
{
- palette.set_pen_indirect(i*2+0, 0);
- palette.set_pen_indirect(i*2+1, i);
+ palette.set_pen_indirect((i << 1) | 0, 0);
+ palette.set_pen_indirect((i << 1) | 1, i);
}
- /* sprites */
- for (i = 0;i < 0x100;i++)
- palette.set_pen_indirect(16*2+i, (*color_prom++ & 0x0f) + 0x10);
+ // sprites
+ for (int i = 0; i < 0x100; i++)
+ palette.set_pen_indirect(16*2 + i, (*color_prom++ & 0x0f) | 0x10);
- /* bg_select */
- for (i = 0;i < 0x100;i++)
- palette.set_pen_indirect(16*2+256+i, *color_prom++ & 0x0f);
+ // bg_select
+ for (int i = 0; i < 0x100; i++)
+ palette.set_pen_indirect(16*2 + 256 + i, *color_prom++ & 0x0f);
}
diff --git a/src/mame/video/divebomb.cpp b/src/mame/video/divebomb.cpp
index c1b58941930..801f8940794 100644
--- a/src/mame/video/divebomb.cpp
+++ b/src/mame/video/divebomb.cpp
@@ -91,44 +91,43 @@ WRITE8_MEMBER(divebomb_state::rozcpu_pal_w)
*
*************************************/
-void divebomb_state::decode_proms(const uint8_t * rgn, int size, int index, bool inv)
+void divebomb_state::decode_proms(palette_device &palette, const uint8_t * rgn, int size, int index, bool inv)
{
- static const int resistances[4] = { 2000, 1000, 470, 220 };
+ static constexpr int resistances[4] = { 2000, 1000, 470, 220 };
+ // compute the color output resistor weights
double rweights[4], gweights[4], bweights[4];
-
- /* compute the color output resistor weights */
compute_resistor_weights(0, 255, -1.0,
- 4, resistances, rweights, 0, 0,
- 4, resistances, gweights, 0, 0,
- 4, resistances, bweights, 0, 0);
+ 4, resistances, rweights, 0, 0,
+ 4, resistances, gweights, 0, 0,
+ 4, resistances, bweights, 0, 0);
- /* create a lookup table for the palette */
+ // create a lookup table for the palette
for (uint32_t i = 0; i < size; ++i)
{
- uint32_t rdata = rgn[i + size*2] & 0x0f;
- uint32_t r = combine_4_weights(rweights, BIT(rdata, 0), BIT(rdata, 1), BIT(rdata, 2), BIT(rdata, 3));
+ uint32_t const rdata = rgn[i + size*2] & 0x0f;
+ uint32_t const r = combine_4_weights(rweights, BIT(rdata, 0), BIT(rdata, 1), BIT(rdata, 2), BIT(rdata, 3));
- uint32_t gdata = rgn[i + size] & 0x0f;
- uint32_t g = combine_4_weights(gweights, BIT(gdata, 0), BIT(gdata, 1), BIT(gdata, 2), BIT(gdata, 3));
+ uint32_t const gdata = rgn[i + size] & 0x0f;
+ uint32_t const g = combine_4_weights(gweights, BIT(gdata, 0), BIT(gdata, 1), BIT(gdata, 2), BIT(gdata, 3));
- uint32_t bdata = rgn[i] & 0x0f;
- uint32_t b = combine_4_weights(bweights, BIT(bdata, 0), BIT(bdata, 1), BIT(bdata, 2), BIT(bdata, 3));
+ uint32_t const bdata = rgn[i] & 0x0f;
+ uint32_t const b = combine_4_weights(bweights, BIT(bdata, 0), BIT(bdata, 1), BIT(bdata, 2), BIT(bdata, 3));
if (!inv)
- m_palette->set_pen_color(index + i, rgb_t(r, g, b));
+ palette.set_pen_color(index + i, rgb_t(r, g, b));
else
- m_palette->set_pen_color(index + (i ^ 0xff), rgb_t(r, g, b));
+ palette.set_pen_color(index + (i ^ 0xff), rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(divebomb_state, divebomb)
+void divebomb_state::divebomb_palette(palette_device &palette) const
{
- decode_proms(memregion("spr_proms")->base(), 0x100, 0x400 + 0x400 + 0x400, false);
- decode_proms(memregion("fg_proms")->base(), 0x400, 0x400 + 0x400, false);
- decode_proms(memregion("k051316_1_pr")->base(), 0x400, 0, true);
- decode_proms(memregion("k051316_2_pr")->base(), 0x400, 0x400, true);
+ decode_proms(palette, memregion("spr_proms")->base(), 0x100, 0x400 + 0x400 + 0x400, false);
+ decode_proms(palette, memregion("fg_proms")->base(), 0x400, 0x400 + 0x400, false);
+ decode_proms(palette, memregion("k051316_1_pr")->base(), 0x400, 0, true);
+ decode_proms(palette, memregion("k051316_2_pr")->base(), 0x400, 0x400, true);
}
diff --git a/src/mame/video/dkong.cpp b/src/mame/video/dkong.cpp
index 9db63239907..fe043a54a8c 100644
--- a/src/mame/video/dkong.cpp
+++ b/src/mame/video/dkong.cpp
@@ -198,196 +198,185 @@ static const res_net_info radarscp_grid_net_info =
}
};
-PALETTE_INIT_MEMBER(dkong_state,dkong2b)
+void dkong_state::dkong2b_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- std::vector<rgb_t> rgb;
- int i;
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, dkong_decode_info, dkong_net_info);
palette.set_pen_colors(0, rgb);
- /* Now treat tri-state black background generation */
-
- for (i=0;i<256;i++)
- if ( (i & 0x03) == 0x00 ) /* NOR => CS=1 => Tristate => real black */
+ // Now treat tri-state black background generation
+ for (int i = 0; i < 256; i++)
+ if ((i & 0x03) == 0x00) // NOR => CS=1 => Tristate => real black
{
- int r,g,b;
- r = compute_res_net( 1, 0, dkong_net_bck_info );
- g = compute_res_net( 1, 1, dkong_net_bck_info );
- b = compute_res_net( 1, 2, dkong_net_bck_info );
- palette.set_pen_color(i,r,g,b);
+ int const r = compute_res_net(1, 0, dkong_net_bck_info);
+ int const g = compute_res_net(1, 1, dkong_net_bck_info);
+ int const b = compute_res_net(1, 2, dkong_net_bck_info);
+ palette.set_pen_color(i, r, g, b);
}
palette.palette()->normalize_range(0, 255);
color_prom += 512;
- /* color_prom now points to the beginning of the character color codes */
- m_color_codes = color_prom; /* we'll need it later */
+ // color_prom now points to the beginning of the character color codes
+ m_color_codes = color_prom; // we'll need it later
}
#ifdef UNUSED_FUNCTION
-PALETTE_INIT_MEMBER(dkong_state,dkong4b)
+void dkong_state::dkong4b_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int r,g,b;
- for (i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- /* red component */
- r = compute_res_net( (color_prom[256]>>1) & 0x07, 0, radarscp_net_info );
- /* green component */
- g = compute_res_net( ((color_prom[256]<<2) & 0x04) | ((color_prom[0]>>2) & 0x03), 1, radarscp_net_info );
- /* blue component */
- b = compute_res_net( (color_prom[0]>>0) & 0x03, 2, radarscp_net_info );
-
- palette.set_pen_color(i,r,g,b);
+ // red component
+ int const r = compute_res_net((color_prom[256] >> 1) & 0x07, 0, radarscp_net_info);
+ // green component
+ int const g = compute_res_net(((color_prom[256] << 2) & 0x04) | ((color_prom[0] >> 2) & 0x03), 1, radarscp_net_info);
+ // blue component
+ int const b = compute_res_net((color_prom[0] >> 0) & 0x03, 2, radarscp_net_info);
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
- /* Now treat tri-state black background generation */
+ // Now treat tri-state black background generation
- for (i=0;i<256;i++)
- if ( (i & 0x03) == 0x00 ) /* NOR => CS=1 => Tristate => real black */
+ for (int i = 0; i < 256; i++)
+ if ((i & 0x03) == 0x00) // NOR => CS=1 => Tristate => real black
{
- r = compute_res_net( 1, 0, radarscp_net_bck_info );
- g = compute_res_net( 1, 1, radarscp_net_bck_info );
- b = compute_res_net( 1, 2, radarscp_net_bck_info );
- palette.set_pen_color(i,r,g,b);
+ int const r = compute_res_net(1, 0, radarscp_net_bck_info);
+ int const g = compute_res_net(1, 1, radarscp_net_bck_info);
+ int const b = compute_res_net(1, 2, radarscp_net_bck_info);
+ palette.set_pen_color(i, r, g, b);
}
palette.palette()->normalize_range(0, 255);
color_prom += 256;
- /* color_prom now points to the beginning of the character color codes */
- m_color_codes = color_prom; /* we'll need it later */
+ // color_prom now points to the beginning of the character color codes
+ m_color_codes = color_prom; // we'll need it later
}
#endif
-PALETTE_INIT_MEMBER(dkong_state,radarscp)
+void dkong_state::radarscp_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int r,g,b;
- for (i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- /* red component */
- r = compute_res_net( (color_prom[256]>>1) & 0x07, 0, radarscp_net_info );
- /* green component */
- g = compute_res_net( ((color_prom[256]<<2) & 0x04) | ((color_prom[0]>>2) & 0x03), 1, radarscp_net_info );
- /* blue component */
- b = compute_res_net( (color_prom[0]>>0) & 0x03, 2, radarscp_net_info );
-
- palette.set_pen_color(i,r,g,b);
+ // red component
+ int const r = compute_res_net((color_prom[256] >> 1) & 0x07, 0, radarscp_net_info);
+ // green component
+ int const g = compute_res_net(((color_prom[256] << 2) & 0x04) | ((color_prom[0] >> 2) & 0x03), 1, radarscp_net_info);
+ // blue component
+ int const b = compute_res_net((color_prom[0] >> 0) & 0x03, 2, radarscp_net_info);
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
- /* Now treat tri-state black background generation */
-
- for (i=0;i<256;i++)
- if ( (m_vidhw != DKONG_RADARSCP_CONVERSION) && ( (i & 0x03) == 0x00 )) /* NOR => CS=1 => Tristate => real black */
+ // Now treat tri-state black background generation
+ for (int i = 0; i < 256; i++)
+ if ((m_vidhw != DKONG_RADARSCP_CONVERSION) && ((i & 0x03) == 0x00)) // NOR => CS=1 => Tristate => real black
{
- r = compute_res_net( 1, 0, radarscp_net_bck_info );
- g = compute_res_net( 1, 1, radarscp_net_bck_info );
- b = compute_res_net( 1, 2, radarscp_net_bck_info );
+ int const r = compute_res_net(1, 0, radarscp_net_bck_info);
+ int const g = compute_res_net(1, 1, radarscp_net_bck_info);
+ int const b = compute_res_net(1, 2, radarscp_net_bck_info);
palette.set_pen_color(i,r,g,b);
}
- /* Star color */
- r = compute_res_net( 1, 0, radarscp_stars_net_info );
- g = compute_res_net( 0, 1, radarscp_stars_net_info );
- b = compute_res_net( 0, 2, radarscp_stars_net_info );
- palette.set_pen_color(RADARSCP_STAR_COL,r,g,b);
+ // Star color
+ palette.set_pen_color(RADARSCP_STAR_COL,
+ compute_res_net(1, 0, radarscp_stars_net_info),
+ compute_res_net(0, 1, radarscp_stars_net_info),
+ compute_res_net(0, 2, radarscp_stars_net_info));
- /* Oscillating background */
- for (i = 0;i < 256;i++)
+ // Oscillating background
+ for (int i = 0; i < 256; i++)
{
- r = compute_res_net( 0, 0, radarscp_blue_net_info );
- g = compute_res_net( 0, 1, radarscp_blue_net_info );
- b = compute_res_net( i, 2, radarscp_blue_net_info );
+ int const r = compute_res_net(0, 0, radarscp_blue_net_info);
+ int const g = compute_res_net(0, 1, radarscp_blue_net_info);
+ int const b = compute_res_net(i, 2, radarscp_blue_net_info);
- palette.set_pen_color(RADARSCP_BCK_COL_OFFSET + i,r,g,b);
+ palette.set_pen_color(RADARSCP_BCK_COL_OFFSET + i, r, g, b);
}
- /* Grid */
- for (i = 0;i < 8;i++)
+ // Grid
+ for (int i = 0; i < 8; i++)
{
- r = compute_res_net( i & 1, 0, radarscp_grid_net_info );
- g = compute_res_net( (i>>1) & 1, 1, radarscp_grid_net_info );
- b = compute_res_net( (i>>2) & 1, 2, radarscp_grid_net_info );
+ int const r = compute_res_net(BIT(i, 0), 0, radarscp_grid_net_info);
+ int const g = compute_res_net(BIT(i, 1), 1, radarscp_grid_net_info);
+ int const b = compute_res_net(BIT(i, 2), 2, radarscp_grid_net_info);
- palette.set_pen_color(RADARSCP_GRID_COL_OFFSET + i,r,g,b);
+ palette.set_pen_color(RADARSCP_GRID_COL_OFFSET + i, r, g, b);
}
- palette.palette()->normalize_range(0, RADARSCP_GRID_COL_OFFSET+7);
+ palette.palette()->normalize_range(0, RADARSCP_GRID_COL_OFFSET + 7);
color_prom += 256;
- /* color_prom now points to the beginning of the character color codes */
- m_color_codes = color_prom; /* we'll need it later */
+ // color_prom now points to the beginning of the character color codes
+ m_color_codes = color_prom; // we'll need it later
}
-PALETTE_INIT_MEMBER(dkong_state,radarscp1)
+void dkong_state::radarscp1_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int r,g,b;
- for (i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- /* red component */
- r = compute_res_net( color_prom[512], 0, radarscp1_net_info );
- /* green component */
- g = compute_res_net( color_prom[256], 1, radarscp1_net_info );
- /* blue component */
- b = compute_res_net( color_prom[0], 2, radarscp1_net_info );
-
- palette.set_pen_color(i,r,g,b);
+ // red component
+ int const r = compute_res_net(color_prom[512], 0, radarscp1_net_info);
+ // green component
+ int const g = compute_res_net(color_prom[256], 1, radarscp1_net_info);
+ // blue component
+ int const b = compute_res_net(color_prom[0], 2, radarscp1_net_info);
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
- /* Now treat tri-state black background generation */
-
- for (i=0;i<256;i++)
- if ( (i & 0x03) == 0x00 ) /* NOR => CS=1 => Tristate => real black */
+ // Now treat tri-state black background generation
+ for (int i = 0; i < 256; i++)
+ if ((i & 0x03) == 0x00) // NOR => CS=1 => Tristate => real black
{
- r = compute_res_net( 0, 0, radarscp1_net_info );
- g = compute_res_net( 0, 1, radarscp1_net_info );
- b = compute_res_net( 0, 2, radarscp1_net_info );
- palette.set_pen_color(i,r,g,b);
+ int const r = compute_res_net(0, 0, radarscp1_net_info);
+ int const g = compute_res_net(0, 1, radarscp1_net_info);
+ int const b = compute_res_net(0, 2, radarscp1_net_info);
+ palette.set_pen_color(i, r, g, b);
}
- /* Star color */
- r = compute_res_net( 1, 0, radarscp_stars_net_info );
- g = compute_res_net( 0, 1, radarscp_stars_net_info );
- b = compute_res_net( 0, 2, radarscp_stars_net_info );
- palette.set_pen_color(RADARSCP_STAR_COL,r,g,b);
+ // Star color
+ palette.set_pen_color(RADARSCP_STAR_COL,
+ compute_res_net(1, 0, radarscp_stars_net_info),
+ compute_res_net(0, 1, radarscp_stars_net_info),
+ compute_res_net(0, 2, radarscp_stars_net_info));
/* Oscillating background */
- for (i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- r = compute_res_net( 0, 0, radarscp_blue_net_info );
- g = compute_res_net( 0, 1, radarscp_blue_net_info );
- b = compute_res_net( i, 2, radarscp_blue_net_info );
+ int const r = compute_res_net(0, 0, radarscp_blue_net_info);
+ int const g = compute_res_net(0, 1, radarscp_blue_net_info);
+ int const b = compute_res_net(i, 2, radarscp_blue_net_info);
- palette.set_pen_color(RADARSCP_BCK_COL_OFFSET + i,r,g,b);
+ palette.set_pen_color(RADARSCP_BCK_COL_OFFSET + i, r, g, b);
}
- /* Grid */
- for (i = 0;i < 8;i++)
+ // Grid
+ for (int i = 0; i < 8; i++)
{
- r = compute_res_net( i & 1, 0, radarscp_grid_net_info );
- g = compute_res_net( (i>>1) & 1, 1, radarscp_grid_net_info );
- b = compute_res_net( (i>>2) & 1, 2, radarscp_grid_net_info );
+ int const r = compute_res_net(BIT(i, 0), 0, radarscp_grid_net_info);
+ int const g = compute_res_net(BIT(i, 1), 1, radarscp_grid_net_info);
+ int const b = compute_res_net(BIT(i, 2), 2, radarscp_grid_net_info);
- palette.set_pen_color(RADARSCP_GRID_COL_OFFSET + i,r,g,b);
+ palette.set_pen_color(RADARSCP_GRID_COL_OFFSET + i, r, g, b);
}
- palette.palette()->normalize_range(0, RADARSCP_GRID_COL_OFFSET+7);
+ palette.palette()->normalize_range(0, RADARSCP_GRID_COL_OFFSET + 7);
color_prom += 512;
- /* color_prom now points to the beginning of the character color codes */
- m_color_codes = color_prom; /* we'll need it later */
+ // color_prom now points to the beginning of the character color codes
+ m_color_codes = color_prom; // we'll need it later
}
@@ -427,18 +416,18 @@ PALETTE_INIT_MEMBER(dkong_state,radarscp1)
***************************************************************************/
-PALETTE_INIT_MEMBER(dkong_state,dkong3)
+void dkong_state::dkong3_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- std::vector<rgb_t> rgb;
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, dkong3_decode_info, dkong3_net_info);
palette.set_pen_colors(0, rgb);
palette.palette()->normalize_range(0, 255);
color_prom += 1024;
- /* color_prom now points to the beginning of the character color codes */
- m_color_codes = color_prom; /* we'll need it later */
+ // color_prom now points to the beginning of the character color codes
+ m_color_codes = color_prom; // we'll need it later
}
TILE_GET_INFO_MEMBER(dkong_state::dkong_bg_tile_info)
@@ -898,10 +887,10 @@ void dkong_state::check_palette()
switch (newset)
{
case DKONG_RADARSCP_CONVERSION:
- PALETTE_INIT_NAME(radarscp)(*m_palette);
+ radarscp_palette(*m_palette);
break;
case DKONG_BOARD:
- PALETTE_INIT_NAME(dkong2b)(*m_palette);
+ dkong2b_palette(*m_palette);
break;
}
}
diff --git a/src/mame/video/docastle.cpp b/src/mame/video/docastle.cpp
index 38ed7995853..4bad4c21b5d 100644
--- a/src/mame/video/docastle.cpp
+++ b/src/mame/video/docastle.cpp
@@ -30,37 +30,37 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(docastle_state, docastle)
+void docastle_state::docastle_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 5) & 0x01;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- r = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
- /* green component */
- bit0 = (*color_prom >> 2) & 0x01;
- bit1 = (*color_prom >> 3) & 0x01;
- bit2 = (*color_prom >> 4) & 0x01;
- g = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 3);
+ bit2 = BIT(color_prom[i], 4);
+ int const g = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 0) & 0x01;
- bit2 = (*color_prom >> 1) & 0x01;
- b = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
+ bit1 = BIT(color_prom[i], 0);
+ bit2 = BIT(color_prom[i], 1);
+ int const b = 0x23 * bit0 + 0x4b * bit1 + 0x91 * bit2;
/* because the graphics are decoded as 4bpp with the top bit used for transparency
or priority, we create matching 3bpp sets of palette entries, which effectively
ignores the value of the top bit */
- palette.set_pen_color(((i & 0xf8) << 1) | 0x00 | (i & 0x07), rgb_t(r,g,b));
- palette.set_pen_color(((i & 0xf8) << 1) | 0x08 | (i & 0x07), rgb_t(r,g,b));
- color_prom++;
+ palette.set_pen_color(((i & 0xf8) << 1) | 0x00 | (i & 0x07), rgb_t(r, g, b));
+ palette.set_pen_color(((i & 0xf8) << 1) | 0x08 | (i & 0x07), rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/dogfgt.cpp b/src/mame/video/dogfgt.cpp
index 919f37754a0..fffe0ff4e55 100644
--- a/src/mame/video/dogfgt.cpp
+++ b/src/mame/video/dogfgt.cpp
@@ -13,33 +13,34 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(dogfgt_state, dogfgt)
+void dogfgt_state::dogfgt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* first 16 colors are RAM */
+ // first 16 colors are RAM
for (int i = 0; i < 64; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i + 16, rgb_t(r,g,b));
- color_prom++;
+ palette.set_pen_color(i + 16, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/drgnmst.cpp b/src/mame/video/drgnmst.cpp
index 0f4ae5cf2a6..4f3449830e0 100644
--- a/src/mame/video/drgnmst.cpp
+++ b/src/mame/video/drgnmst.cpp
@@ -8,7 +8,7 @@
#include "includes/drgnmst.h"
-PALETTE_DECODER_MEMBER(drgnmst_state, drgnmst_IIIIRRRRGGGGBBBB)
+rgb_t drgnmst_state::drgnmst_IIIIRRRRGGGGBBBB(uint32_t raw)
{
int const bright = 0x5 + ((raw >> 12) & 0xf); // TODO : verify brightness value from real pcb
int r = (pal4bit((raw >> 8) & 0x0f) * bright) / 0x14;
@@ -21,6 +21,7 @@ PALETTE_DECODER_MEMBER(drgnmst_state, drgnmst_IIIIRRRRGGGGBBBB)
if (g > 0xff) g = 0xff;
if (b < 0) b = 0;
if (b > 0xff) b = 0xff;
+
return rgb_t(r, g, b);
}
diff --git a/src/mame/video/dribling.cpp b/src/mame/video/dribling.cpp
index 6a1be5c09d1..80305f182ac 100644
--- a/src/mame/video/dribling.cpp
+++ b/src/mame/video/dribling.cpp
@@ -17,12 +17,11 @@
*
*************************************/
-PALETTE_INIT_MEMBER(dribling_state, dribling)
+void dribling_state::dribling_palette(palette_device &palette) const
{
- const uint8_t *prom = memregion("proms")->base() + 0x400;
- int i;
+ uint8_t const *const prom = memregion("proms")->base() + 0x400;
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
int r = (~prom[i] >> 0) & 1; // 220
int g = (~prom[i] >> 1) & 3; // 820 + 560 (332 max)
@@ -32,7 +31,7 @@ PALETTE_INIT_MEMBER(dribling_state, dribling)
g *= 0x55;
b *= 0xff;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/drmicro.cpp b/src/mame/video/drmicro.cpp
index 500c2c03eff..aea10c37bc9 100644
--- a/src/mame/video/drmicro.cpp
+++ b/src/mame/video/drmicro.cpp
@@ -58,44 +58,42 @@ TILE_GET_INFO_MEMBER(drmicro_state::get_bg2_tile_info)
/****************************************************************************/
-PALETTE_INIT_MEMBER(drmicro_state, drmicro)
+void drmicro_state::drmicro_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- for (i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp
index 94933026f61..671dcdfcce0 100644
--- a/src/mame/video/dynax.cpp
+++ b/src/mame/video/dynax.cpp
@@ -23,42 +23,42 @@
#include "includes/dynax.h"
// Log Blitter
-#define VERBOSE 0
-#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
+//#define VERBOSE 1
+#include "logmacro.h"
-/* x B01234 G01234 R01234 */
-PALETTE_INIT_MEMBER(dynax_state,sprtmtch)
+// x B01234 G01234 R01234
+void dynax_state::sprtmtch_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
if (!color_prom)
return;
for (int i = 0; i < palette.entries(); i++)
{
- int x = (color_prom[i] << 8) + color_prom[0x200 + i];
- /* The bits are in reverse order! */
- int r = bitswap<8>((x >> 0) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int g = bitswap<8>((x >> 5) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int b = bitswap<8>((x >> 10) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
+ int const x = (color_prom[i] << 8) | color_prom[0x200 + i];
+ // The bits are in reverse order!
+ int const r = bitswap<5>((x >> 0) & 0x1f, 0, 1, 2, 3, 4);
+ int const g = bitswap<5>((x >> 5) & 0x1f, 0, 1, 2, 3, 4);
+ int const b = bitswap<5>((x >> 10) & 0x1f, 0, 1, 2, 3, 4);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-/* x xB0123 xG0123 xR0123 */
-PALETTE_INIT_MEMBER(dynax_state,janyuki)
+// x xB0123 xG0123 xR0123
+void dynax_state::janyuki_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
if (!color_prom)
return;
for (int i = 0; i < palette.entries(); i++)
{
- int x = (color_prom[i] << 8) + color_prom[0x200 + i];
- /* The bits are in reverse order! */
- int r = bitswap<8>((x >> 0) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
- int g = bitswap<8>((x >> 5) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
- int b = bitswap<8>((x >> 10) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
+ int const x = (color_prom[i] << 8) + color_prom[0x200 + i];
+ // The bits are in reverse order!
+ int const r = bitswap<4>((x >> 0) & 0x0f, 0, 1, 2, 3);
+ int const g = bitswap<4>((x >> 5) & 0x0f, 0, 1, 2, 3);
+ int const b = bitswap<4>((x >> 10) & 0x0f, 0, 1, 2, 3);
palette.set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b));
}
}
@@ -95,13 +95,13 @@ WRITE8_MEMBER(dynax_state::dynax_blit_dest_w)
if (m_layer_layout == LAYOUT_HNORIDUR)
m_blit_dest = bitswap<8>(m_blit_dest ^ 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
- LOG(("D=%02X ", data));
+ LOG("D=%02X ", data);
}
WRITE8_MEMBER(dynax_state::dynax_blit2_dest_w)
{
m_blit2_dest = data;
- LOG(("D'=%02X ", data));
+ LOG("D'=%02X ", data);
}
WRITE8_MEMBER(dynax_state::tenkai_blit_dest_w)
@@ -123,7 +123,7 @@ WRITE8_MEMBER(dynax_state::mjembase_blit_dest_w)
WRITE8_MEMBER(dynax_state::dynax_blit_backpen_w)
{
m_blit_backpen = data;
- LOG(("B=%02X ", data));
+ LOG("B=%02X ", data);
}
@@ -134,13 +134,13 @@ WRITE8_MEMBER(dynax_state::dynax_blit_palette01_w)
m_blit_palettes = (m_blit_palettes & 0x00ff) | ((data & 0x0f) << 12) | ((data & 0xf0) << 4);
else
m_blit_palettes = (m_blit_palettes & 0xff00) | data;
- LOG(("P01=%02X ", data));
+ LOG("P01=%02X ", data);
}
WRITE8_MEMBER(dynax_state::tenkai_blit_palette01_w)
{
m_blit_palettes = (m_blit_palettes & 0xff00) | data;
- LOG(("P01=%02X ", data));
+ LOG("P01=%02X ", data);
}
@@ -151,7 +151,7 @@ WRITE8_MEMBER(dynax_state::dynax_blit_palette45_w)
m_blit2_palettes = (m_blit2_palettes & 0x00ff) | ((data & 0x0f) << 12) | ((data & 0xf0) << 4);
else
m_blit2_palettes = (m_blit2_palettes & 0xff00) | data;
- LOG(("P45=%02X ", data));
+ LOG("P45=%02X ", data);
}
@@ -162,13 +162,13 @@ WRITE8_MEMBER(dynax_state::dynax_blit_palette23_w)
m_blit_palettes = (m_blit_palettes & 0xff00) | ((data & 0x0f) << 4) | ((data & 0xf0) >> 4);
else
m_blit_palettes = (m_blit_palettes & 0x00ff) | (data << 8);
- LOG(("P23=%02X ", data));
+ LOG("P23=%02X ", data);
}
WRITE8_MEMBER(dynax_state::tenkai_blit_palette23_w)
{
m_blit_palettes = (m_blit_palettes & 0x00ff) | ((data & 0x0f) << 12) | ((data & 0xf0) << 4);
- LOG(("P23=%02X ", data));
+ LOG("P23=%02X ", data);
}
WRITE8_MEMBER(dynax_state::mjembase_blit_palette23_w)
@@ -184,7 +184,7 @@ WRITE8_MEMBER(dynax_state::dynax_blit_palette67_w)
m_blit2_palettes = (m_blit2_palettes & 0xff00) | ((data & 0x0f) << 4) | ((data & 0xf0) >> 4);
else
m_blit2_palettes = (m_blit2_palettes & 0x00ff) | (data << 8);
- LOG(("P67=%02X ", data));
+ LOG("P67=%02X ", data);
}
@@ -192,13 +192,13 @@ WRITE8_MEMBER(dynax_state::dynax_blit_palette67_w)
WRITE_LINE_MEMBER(dynax_state::blit_palbank_w)
{
m_blit_palbank = state;
- LOG(("PB=%d ", state));
+ LOG("PB=%d ", state);
}
WRITE_LINE_MEMBER(dynax_state::blit2_palbank_w)
{
m_blit2_palbank = state;
- LOG(("PB'=%d ", state));
+ LOG("PB'=%d ", state);
}
WRITE8_MEMBER(dynax_state::hnoridur_palbank_w)
@@ -212,7 +212,7 @@ WRITE8_MEMBER(dynax_state::hnoridur_palbank_w)
WRITE_LINE_MEMBER(dynax_state::layer_half_w)
{
m_hanamai_layer_half = !state;
- LOG(("H=%d ", state));
+ LOG("H=%d ", state);
}
@@ -220,7 +220,7 @@ WRITE_LINE_MEMBER(dynax_state::layer_half_w)
WRITE_LINE_MEMBER(dynax_state::layer_half2_w)
{
m_hnoridur_layer_half2 = !state;
- LOG(("H2=%d ", state));
+ LOG("H2=%d ", state);
}
WRITE_LINE_MEMBER(dynax_state::mjdialq2_blit_dest0_w)
@@ -242,7 +242,7 @@ WRITE_LINE_MEMBER(dynax_state::mjdialq2_blit_dest1_w)
WRITE8_MEMBER(dynax_state::dynax_layer_enable_w)
{
m_layer_enable = data;
- LOG(("E=%02X ", data));
+ LOG("E=%02X ", data);
}
WRITE8_MEMBER(dynax_state::jantouki_layer_enable_w)
@@ -270,7 +270,7 @@ WRITE_LINE_MEMBER(dynax_state::mjdialq2_layer1_enable_w)
WRITE_LINE_MEMBER(dynax_state::flipscreen_w)
{
m_flipscreen = state;
- LOG(("F=%d ", state));
+ LOG("F=%d ", state);
}
@@ -280,14 +280,14 @@ WRITE8_MEMBER(dynax_state::dynax_blit_romregion_w)
{
if (data < 8)
m_blitter->set_rom_bank(data);
- LOG(("GFX%X ", data + 1));
+ LOG("GFX%X ", data + 1);
}
WRITE8_MEMBER(dynax_state::dynax_blit2_romregion_w)
{
if (data + 1 < 8)
m_blitter2->set_rom_bank(data);
- LOG(("GFX%X' ", data + 2));
+ LOG("GFX%X' ", data + 2);
}
diff --git a/src/mame/video/epos.cpp b/src/mame/video/epos.cpp
index a73baff8ea3..731f22ac437 100644
--- a/src/mame/video/epos.cpp
+++ b/src/mame/video/epos.cpp
@@ -24,41 +24,40 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(epos_state,epos)
+void epos_state::epos_palette(palette_device &palette) const
{
- offs_t i;
- const uint8_t *color_prom = memregion("proms")->base();
- int len = memregion("proms")->bytes();
+ uint8_t const *const color_prom = memregion("proms")->base();
+ int const len = memregion("proms")->bytes();
- for (i = 0; i < len; i++)
- set_pal_color(i, color_prom[i]);
+ for (offs_t i = 0; i < len; i++)
+ set_pal_color(palette, i, color_prom[i]);
}
-void epos_state::set_pal_color( uint8_t offset, uint8_t data )
+void epos_state::set_pal_color(palette_device &palette, uint8_t offset, uint8_t data)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- bit0 = (data >> 7) & 0x01;
- bit1 = (data >> 6) & 0x01;
- bit2 = (data >> 5) & 0x01;
- r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
+ bit0 = BIT(data, 7);
+ bit1 = BIT(data, 6);
+ bit2 = BIT(data, 5);
+ int const r = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
- bit0 = (data >> 4) & 0x01;
- bit1 = (data >> 3) & 0x01;
- bit2 = (data >> 2) & 0x01;
- g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
+ bit0 = BIT(data, 4);
+ bit1 = BIT(data, 3);
+ bit2 = BIT(data, 2);
+ int const g = 0x92 * bit0 + 0x4a * bit1 + 0x23 * bit2;
- bit0 = (data >> 1) & 0x01;
- bit1 = (data >> 0) & 0x01;
- b = 0xad * bit0 + 0x52 * bit1;
+ bit0 = BIT(data, 1);
+ bit1 = BIT(data, 0);
+ int const b = 0xad * bit0 + 0x52 * bit1;
- m_palette->set_pen_color(offset, rgb_t(r,g,b));
+ palette.set_pen_color(offset, rgb_t(r, g, b));
}
// later (tristar 9000) games uses a dynamic palette instead of prom
WRITE8_MEMBER(epos_state::dealer_pal_w)
{
- set_pal_color(offset,data);
+ set_pal_color(*m_palette, offset, data);
}
WRITE8_MEMBER(epos_state::port_1_w)
@@ -81,11 +80,9 @@ WRITE8_MEMBER(epos_state::port_1_w)
uint32_t epos_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- offs_t offs;
-
- for (offs = 0; offs < m_videoram.bytes(); offs++)
+ for (offs_t offs = 0; offs < m_videoram.bytes(); offs++)
{
- uint8_t data = m_videoram[offs];
+ uint8_t const data = m_videoram[offs];
int x = (offs % 136) * 2;
int y = (offs / 136);
diff --git a/src/mame/video/equites.cpp b/src/mame/video/equites.cpp
index 82dec063f58..55ef68af119 100644
--- a/src/mame/video/equites.cpp
+++ b/src/mame/video/equites.cpp
@@ -18,45 +18,43 @@
*
*************************************/
-PALETTE_INIT_MEMBER(equites_state,equites)
+void equites_state::equites_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
palette.set_indirect_color(i, rgb_t(pal4bit(color_prom[i]), pal4bit(color_prom[i + 0x100]), pal4bit(color_prom[i + 0x200])));
// point to the CLUT
color_prom += 0x380;
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
palette.set_pen_indirect(i, i);
- for (i = 0; i < 0x80; i++)
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i + 0x100, color_prom[i]);
}
-PALETTE_INIT_MEMBER(splndrbt_state,splndrbt)
+void splndrbt_state::splndrbt_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
palette.set_indirect_color(i, rgb_t(pal4bit(color_prom[i]), pal4bit(color_prom[i + 0x100]), pal4bit(color_prom[i + 0x200])));
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
// point to the bg CLUT
color_prom += 0x300;
- for (i = 0; i < 0x80; i++)
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i + 0x100, color_prom[i] + 0x10);
// point to the sprite CLUT
color_prom += 0x100;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i + 0x180, color_prom[i]);
}
diff --git a/src/mame/video/espial.cpp b/src/mame/video/espial.cpp
index 1a969eb45d7..642a9d1532a 100644
--- a/src/mame/video/espial.cpp
+++ b/src/mame/video/espial.cpp
@@ -31,32 +31,31 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(espial_state, espial)
+void espial_state::espial_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i + palette.entries()] >> 0) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i + palette.entries()], 0);
+ bit2 = BIT(color_prom[i + palette.entries()], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i + palette.entries()] >> 2) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i + palette.entries()], 2);
+ bit2 = BIT(color_prom[i + palette.entries()], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/exedexes.cpp b/src/mame/video/exedexes.cpp
index d9b62ee3a26..bf54cc9c22b 100644
--- a/src/mame/video/exedexes.cpp
+++ b/src/mame/video/exedexes.cpp
@@ -33,49 +33,48 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(exedexes_state, exedexes)
+void exedexes_state::exedexes_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0xc0-0xcf */
- for (i = 0; i < 0x100; i++)
+ // characters use colors 0xc0-0xcf
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] | 0xc0;
+ uint8_t const ctabentry = color_prom[i] | 0xc0;
palette.set_pen_indirect(i, ctabentry);
}
- /* 32x32 tiles use colors 0-0x0f */
- for (i = 0x100; i < 0x200; i++)
+ // 32x32 tiles use colors 0-0x0f
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i];
+ uint8_t const ctabentry = color_prom[i];
palette.set_pen_indirect(i, ctabentry);
}
- /* 16x16 tiles use colors 0x40-0x4f */
- for (i = 0x200; i < 0x300; i++)
+ // 16x16 tiles use colors 0x40-0x4f
+ for (int i = 0x200; i < 0x300; i++)
{
- uint8_t ctabentry = color_prom[i] | 0x40;
+ uint8_t const ctabentry = color_prom[i] | 0x40;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites use colors 0x80-0xbf in four banks */
- for (i = 0x300; i < 0x400; i++)
+ // sprites use colors 0x80-0xbf in four banks
+ for (int i = 0x300; i < 0x400; i++)
{
- uint8_t ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80;
+ uint8_t const ctabentry = color_prom[i] | (color_prom[i + 0x100] << 4) | 0x80;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/exerion.cpp b/src/mame/video/exerion.cpp
index 370063bf5e6..feaaa9246f4 100644
--- a/src/mame/video/exerion.cpp
+++ b/src/mame/video/exerion.cpp
@@ -36,61 +36,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(exerion_state, exerion)
+void exerion_state::exerion_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* fg chars and sprites */
- for (i = 0; i < 0x200; i++)
+ // fg chars and sprites
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry = 0x10 | (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f);
+ uint8_t const ctabentry = 0x10 | (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f);
palette.set_pen_indirect(i, ctabentry);
}
- /* bg chars (this is not the full story... there are four layers mixed */
- /* using another PROM */
- for (i = 0x200; i < 0x300; i++)
+ // bg chars (this is not the full story... there are four layers mixed using another PROM
+ for (int i = 0x200; i < 0x300; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/exterm.cpp b/src/mame/video/exterm.cpp
index 871cfcb4626..7a6373fdff4 100644
--- a/src/mame/video/exterm.cpp
+++ b/src/mame/video/exterm.cpp
@@ -16,9 +16,9 @@
*
*************************************/
-PALETTE_INIT_MEMBER(exterm_state, exterm)
+void exterm_state::exterm_palette(palette_device &palette) const
{
- /* initialize 555 RGB lookup */
+ // initialize 555 RGB lookup
for (int i = 0; i < 32768; i++)
palette.set_pen_color(i + 0x800, pal5bit(i >> 10), pal5bit(i >> 5), pal5bit(i >> 0));
}
diff --git a/src/mame/video/fastfred.cpp b/src/mame/video/fastfred.cpp
index c32c7eefe1c..73aad7722d0 100644
--- a/src/mame/video/fastfred.cpp
+++ b/src/mame/video/fastfred.cpp
@@ -25,51 +25,49 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(fastfred_state,fastfred)
+void fastfred_state::fastfred_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 1000, 470, 220, 100 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 1000, 470, 220, 100 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 470, 0,
4, resistances, gweights, 470, 0,
4, resistances, bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* characters and sprites use the same palette */
- for (i = 0; i < 0x100; i++)
+ // characters and sprites use the same palette
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
}
diff --git a/src/mame/video/fastlane.cpp b/src/mame/video/fastlane.cpp
index ef4a91248ea..e9b212245f4 100644
--- a/src/mame/video/fastlane.cpp
+++ b/src/mame/video/fastlane.cpp
@@ -4,18 +4,14 @@
#include "includes/fastlane.h"
-PALETTE_INIT_MEMBER(fastlane_state, fastlane)
+void fastlane_state::fastlane_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int pal;
-
- for (pal = 0; pal < 0x10; pal++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int pal = 0; pal < 0x10; pal++)
{
- int i;
-
- for (i = 0; i < 0x400; i++)
+ for (int i = 0; i < 0x400; i++)
{
- uint8_t ctabentry = (i & 0x3f0) | color_prom[(pal << 4) | (i & 0x0f)];
+ uint8_t const ctabentry = (i & 0x3f0) | color_prom[(pal << 4) | (i & 0x0f)];
palette.set_pen_indirect((pal << 10) | i, ctabentry);
}
}
diff --git a/src/mame/video/fcombat.cpp b/src/mame/video/fcombat.cpp
index 80f0e6764f9..d221b24536a 100644
--- a/src/mame/video/fcombat.cpp
+++ b/src/mame/video/fcombat.cpp
@@ -39,53 +39,50 @@ TILE_GET_INFO_MEMBER(fcombat_state::get_bg_tile_info)
***************************************************************************/
-PALETTE_INIT_MEMBER(fcombat_state, fcombat)
+void fcombat_state::fcombat_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* fg chars/sprites */
- for (i = 0; i < 0x200; i++)
+ // fg chars/sprites
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[(i & 0x1c0) | ((i & 3) << 4) | ((i >> 2) & 0x0f)] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- /* bg chars (this is not the full story... there are four layers mixed */
- /* using another PROM */
- for (i = 0x200; i < 0x300; i++)
+ // bg chars (this is not the full story... there are four layers mixed using another PROM
+ for (int i = 0x200; i < 0x300; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/finalizr.cpp b/src/mame/video/finalizr.cpp
index e133389ffb3..279e77bced8 100644
--- a/src/mame/video/finalizr.cpp
+++ b/src/mame/video/finalizr.cpp
@@ -35,61 +35,59 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(finalizr_state, finalizr)
+void finalizr_state::finalizr_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2200, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, &resistances[0], rweights, 470, 0,
4, &resistances[0], gweights, 470, 0,
4, &resistances[0], bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 5) & 0x01;
- bit2 = (color_prom[i] >> 6) & 0x01;
- bit3 = (color_prom[i] >> 7) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x20] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x20] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x20] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x20] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ bit2 = BIT(color_prom[i], 6);
+ bit3 = BIT(color_prom[i], 7);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x20], 0);
+ bit1 = BIT(color_prom[i + 0x20], 1);
+ bit2 = BIT(color_prom[i + 0x20], 2);
+ bit3 = BIT(color_prom[i + 0x20], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x40;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x100; i < 0x200; i++)
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/firetrap.cpp b/src/mame/video/firetrap.cpp
index dbcceb95ea6..d395c85a5fa 100644
--- a/src/mame/video/firetrap.cpp
+++ b/src/mame/video/firetrap.cpp
@@ -36,34 +36,31 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(firetrap_state, firetrap)
+void firetrap_state::firetrap_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
-
+ int bit0, bit1, bit2, bit3;
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[i] >> 4) & 0x01;
bit1 = (color_prom[i] >> 5) & 0x01;
bit2 = (color_prom[i] >> 6) & 0x01;
bit3 = (color_prom[i] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[i + palette.entries()] >> 0) & 0x01;
bit1 = (color_prom[i + palette.entries()] >> 1) & 0x01;
bit2 = (color_prom[i + palette.entries()] >> 2) & 0x01;
bit3 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/firetrk.cpp b/src/mame/video/firetrk.cpp
index d59c205aab7..29c92d3afbd 100644
--- a/src/mame/video/firetrk.cpp
+++ b/src/mame/video/firetrk.cpp
@@ -12,11 +12,9 @@ Atari Fire Truck + Super Bug + Monte Carlo video emulation
static const rectangle playfield_window(0x02a, 0x115, 0x000, 0x0ff);
-PALETTE_INIT_MEMBER(firetrk_state, firetrk)
+void firetrk_state::firetrk_palette(palette_device &palette)
{
- int i;
-
- static const uint8_t colortable_source[] =
+ static constexpr uint8_t colortable_source[] =
{
0, 0, 1, 0,
2, 0, 3, 0,
@@ -26,7 +24,7 @@ PALETTE_INIT_MEMBER(firetrk_state, firetrk)
2, 0, 0, 3,
3, 0, 0, 3
};
- static const rgb_t palette_source[] =
+ static constexpr rgb_t palette_source[] =
{
rgb_t::black(),
rgb_t(0x5b, 0x5b, 0x5b),
@@ -36,7 +34,7 @@ PALETTE_INIT_MEMBER(firetrk_state, firetrk)
m_color1_mask = m_color2_mask = 0;
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
+ for (int i = 0; i < ARRAY_LENGTH(colortable_source); i++)
{
uint8_t color = colortable_source[i];
@@ -56,12 +54,11 @@ void firetrk_state::prom_to_palette(int number, uint8_t val)
}
-PALETTE_INIT_MEMBER(firetrk_state,montecar)
+void firetrk_state::montecar_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const uint8_t colortable_source[] =
+ static constexpr uint8_t colortable_source[] =
{
0x00, 0x00, 0x00, 0x01,
0x00, 0x02, 0x00, 0x03,
@@ -96,7 +93,7 @@ PALETTE_INIT_MEMBER(firetrk_state,montecar)
m_color1_mask = m_color2_mask = 0;
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
+ for (int i = 0; i < ARRAY_LENGTH(colortable_source); i++)
{
uint8_t color = colortable_source[i];
diff --git a/src/mame/video/funkybee.cpp b/src/mame/video/funkybee.cpp
index 08bdaf7f3a4..b762dd4e256 100644
--- a/src/mame/video/funkybee.cpp
+++ b/src/mame/video/funkybee.cpp
@@ -11,33 +11,32 @@
#include "emu.h"
#include "includes/funkybee.h"
-PALETTE_INIT_MEMBER(funkybee_state, funkybee)
+void funkybee_state::funkybee_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* first, the character/sprite palette */
- for (i = 0; i < 32; i++)
+ // first, the character/sprite palette
+ for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/funworld.cpp b/src/mame/video/funworld.cpp
index 4c390c42e9a..cd8b298c8af 100644
--- a/src/mame/video/funworld.cpp
+++ b/src/mame/video/funworld.cpp
@@ -50,40 +50,38 @@
#include "includes/funworld.h"
-PALETTE_INIT_MEMBER(funworld_state,funworld)
+void funworld_state::funworld_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rb[3] = { 1000, 470, 220 };
- static const int resistances_g [2] = { 470, 220 };
- double weights_r[3], weights_b[3], weights_g[2];
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rb[3] = { 1000, 470, 220 };
+ static constexpr int resistances_g [2] = { 470, 220 };
+ double weights_r[3], weights_b[3], weights_g[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rb, weights_r, 100, 0,
3, resistances_rb, weights_b, 100, 0,
2, resistances_g, weights_g, 100, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = combine_3_weights(weights_b, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- g = combine_2_weights(weights_g, bit0, bit1);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ // blue component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = combine_3_weights(weights_b, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const g = combine_2_weights(weights_g, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -111,11 +109,11 @@ WRITE8_MEMBER(funworld_state::funworld_colorram_w)
TILE_GET_INFO_MEMBER(funworld_state::get_bg_tile_info)
{
-/* - bits -
- 7654 3210
- xxxx ---- tiles color.
- ---- xxxx unused.
-*/
+ /* - bits -
+ 7654 3210
+ xxxx ---- tiles color.
+ ---- xxxx unused.
+ */
int offs = tile_index;
int attr = m_videoram[offs] + (m_colorram[offs] << 8);
int code = attr & 0xfff;
@@ -125,19 +123,19 @@ TILE_GET_INFO_MEMBER(funworld_state::get_bg_tile_info)
}
-VIDEO_START_MEMBER(funworld_state, funworld)
+void funworld_state::video_start()
{
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(funworld_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 96, 29);
}
-VIDEO_START_MEMBER(funworld_state, magicrd2)
+void magicrd2_state::video_start()
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(funworld_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 112, 34);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(magicrd2_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 112, 34);
}
-VIDEO_START_MEMBER(funworld_state, chinatow)
+void chinatow_state::video_start()
{
- m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(funworld_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 96, 31);
+ m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(chinatow_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 4, 8, 96, 31);
}
diff --git a/src/mame/video/funybubl.cpp b/src/mame/video/funybubl.cpp
index 586a3639b3b..1e9103156b2 100644
--- a/src/mame/video/funybubl.cpp
+++ b/src/mame/video/funybubl.cpp
@@ -10,7 +10,7 @@ todo - convert to tilemap
#include "emu.h"
#include "includes/funybubl.h"
-PALETTE_DECODER_MEMBER(funybubl_state, funybubl_R6B6G6)
+rgb_t funybubl_state::funybubl_R6B6G6(uint32_t raw)
{
return rgb_t(pal6bit(raw >> 12), pal6bit(raw >> 0), pal6bit(raw >> 6));
}
diff --git a/src/mame/video/fuukifg.h b/src/mame/video/fuukifg.h
index 2aac6391cda..cb206635143 100644
--- a/src/mame/video/fuukifg.h
+++ b/src/mame/video/fuukifg.h
@@ -6,11 +6,16 @@
#pragma once
-class fuukivid_device : public device_t,
- public device_video_interface
+class fuukivid_device : public device_t, public device_video_interface
{
public:
fuukivid_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <typename T>
+ fuukivid_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&gfx)
+ : fuukivid_device(mconfig, tag, owner, clock)
+ {
+ set_gfxdecode_tag(std::forward<T>(gfx));
+ }
// configuration
template <typename T> void set_gfxdecode_tag(T &&tag) { m_gfxdecode.set_tag(std::forward<T>(tag)); }
diff --git a/src/mame/video/fuukifg2.cpp b/src/mame/video/fuukifg2.cpp
index c931183a79b..595bf113309 100644
--- a/src/mame/video/fuukifg2.cpp
+++ b/src/mame/video/fuukifg2.cpp
@@ -64,15 +64,11 @@ TILE_GET_INFO_MEMBER(fuuki16_state::get_tile_info)
/* Not used atm, seems to be fine without clearing pens? */
#if 0
-PALETTE_INIT_MEMBER(fuuki16_state,fuuki16)
+void fuuki16_state::fuuki16_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int pen;
-
- /* The game does not initialise the palette at startup. It should
- be totally black */
- for (pen = 0; pen < palette.entries(); pen++)
- palette.set_pen_color(pen,rgb_t(0,0,0));
+ // The game does not initialise the palette at startup. It should be totally black
+ for (int pen = 0; pen < palette.entries(); pen++)
+ palette.set_pen_color(pen, rgb_t:black());
}
#endif
diff --git a/src/mame/video/galaga.cpp b/src/mame/video/galaga.cpp
index d3841af9ece..e7ed005f62f 100644
--- a/src/mame/video/galaga.cpp
+++ b/src/mame/video/galaga.cpp
@@ -33,7 +33,7 @@ There are 63 stars in each set, 126 displayed at any one time
*/
-struct galaga_state::star const galaga_state::s_star_seed_tab[252]=
+galaga_state::star const galaga_state::s_star_seed_tab[252]=
{
/* also shared by Bosconian */
@@ -325,60 +325,55 @@ struct galaga_state::star const galaga_state::s_star_seed_tab[252]=
***************************************************************************/
-PALETTE_INIT_MEMBER(galaga_state,galaga)
+void galaga_state::galaga_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* core palette */
- for (i = 0;i < 32;i++)
+ // core palette
+ for (int i = 0; i < 32; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- bit0 = ((*color_prom) >> 0) & 0x01;
- bit1 = ((*color_prom) >> 1) & 0x01;
- bit2 = ((*color_prom) >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = ((*color_prom) >> 3) & 0x01;
- bit1 = ((*color_prom) >> 4) & 0x01;
- bit2 = ((*color_prom) >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
- bit1 = ((*color_prom) >> 6) & 0x01;
- bit2 = ((*color_prom) >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
- /* palette for the stars */
- for (i = 0;i < 64;i++)
+ // palette for the stars
+ for (int i = 0; i < 64; i++)
{
- int bits,r,g,b;
- static const int map[4] = { 0x00, 0x47, 0x97 ,0xde };
+ static constexpr int map[4] = { 0x00, 0x47, 0x97 ,0xde };
- bits = (i >> 0) & 0x03;
- r = map[bits];
- bits = (i >> 2) & 0x03;
- g = map[bits];
- bits = (i >> 4) & 0x03;
- b = map[bits];
+ int const r = map[(i >> 0) & 0x03];
+ int const g = map[(i >> 2) & 0x03];
+ int const b = map[(i >> 4) & 0x03];
- palette.set_indirect_color(32 + i,rgb_t(r,g,b));
+ palette.set_indirect_color(32 + i, rgb_t(r, g, b));
}
- /* characters */
- for (i = 0;i < 64*4;i++)
- palette.set_pen_indirect(i, (*(color_prom++) & 0x0f) + 0x10); /* chars */
+ // characters
+ for (int i = 0; i < 64*4; i++)
+ palette.set_pen_indirect(i, (*color_prom++ & 0x0f) | 0x10);
- /* sprites */
- for (i = 0;i < 64*4;i++)
- palette.set_pen_indirect(64*4+i, (*(color_prom++) & 0x0f));
+ // sprites
+ for (int i = 0; i < 64*4; i++)
+ palette.set_pen_indirect(64*4 + i, *color_prom++ & 0x0f);
- /* now the stars */
- for (i = 0;i < 64;i++)
- palette.set_pen_indirect(64*4+64*4+i, 32 + i);
+ // now the stars
+ for (int i = 0; i < 64; i++)
+ palette.set_pen_indirect(64*4 + 64*4 + i, 32 + i);
}
diff --git a/src/mame/video/galaxia.cpp b/src/mame/video/galaxia.cpp
index 77d743ae8f2..bbb46547e2b 100644
--- a/src/mame/video/galaxia.cpp
+++ b/src/mame/video/galaxia.cpp
@@ -19,10 +19,10 @@
// Colors are 3bpp, but how they are generated is a mystery
// there's no color prom on the pcb, nor palette ram
-PALETTE_INIT_MEMBER(galaxia_state,galaxia)
+void galaxia_state::galaxia_palette(palette_device &palette) const
{
// estimated with video/photo references
- const int lut_clr[0x18] = {
+ constexpr int lut_clr[0x18] = {
// background
0, 1, 4, 5,
0, 3, 6, 2,
@@ -41,10 +41,10 @@ PALETTE_INIT_MEMBER(galaxia_state,galaxia)
palette.set_pen_color(BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
}
-PALETTE_INIT_MEMBER(galaxia_state,astrowar)
+void galaxia_state::astrowar_palette(palette_device &palette) const
{
// no reference material available(?), except for Data East astrof
- const int lut_clr[8] = { 7, 3, 5, 1, 4, 2, 6, 7 };
+ constexpr int lut_clr[8] = { 7, 3, 5, 1, 4, 2, 6, 7 };
for (int i = 0; i < 8; i++)
{
diff --git a/src/mame/video/galaxian.cpp b/src/mame/video/galaxian.cpp
index 5fd0583c61a..3f42cc2fde6 100644
--- a/src/mame/video/galaxian.cpp
+++ b/src/mame/video/galaxian.cpp
@@ -235,13 +235,10 @@ H=B0: 0C,0C,0D,0D,0E,0E,0F,0F 0C,0C,2D,2D,0E,0E,2F,2F
*
*************************************/
-PALETTE_INIT_MEMBER(galaxian_state, galaxian)
+void galaxian_state::galaxian_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
static const int rgb_resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i, minval, midval, maxval, len;
- uint8_t starmap[4];
/*
Sprite/tilemap colors are mapped through a color PROM as follows:
@@ -273,35 +270,36 @@ PALETTE_INIT_MEMBER(galaxian_state, galaxian)
of the main game would be very low to allow for all the oversaturation
of the stars and shells/missiles.
*/
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, RGB_MAXIMUM, -1.0,
3, &rgb_resistances[0], rweights, 470, 0,
3, &rgb_resistances[0], gweights, 470, 0,
2, &rgb_resistances[1], bweights, 470, 0);
- /* decode the palette first */
- len = memregion("proms")->bytes();
- for (i = 0; i < len; i++)
+ // decode the palette first
+ int const len = memregion("proms")->bytes();
+ for (int i = 0; i < len; i++)
{
- uint8_t bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = BIT(color_prom[i],0);
- bit1 = BIT(color_prom[i],1);
- bit2 = BIT(color_prom[i],2);
- r = combine_3_weights(rweights, bit0, bit1, bit2);
-
- /* green component */
- bit0 = BIT(color_prom[i],3);
- bit1 = BIT(color_prom[i],4);
- bit2 = BIT(color_prom[i],5);
- g = combine_3_weights(gweights, bit0, bit1, bit2);
-
- /* blue component */
- bit0 = BIT(color_prom[i],6);
- bit1 = BIT(color_prom[i],7);
- b = combine_2_weights(bweights, bit0, bit1);
-
- palette.set_pen_color(i, rgb_t(r,g,b));
+ uint8_t bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
/*
@@ -319,52 +317,53 @@ PALETTE_INIT_MEMBER(galaxian_state, galaxian)
Since we can't saturate that high, we instead approximate this
by compressing the values proportionally into the 194->255 range.
*/
- minval = RGB_MAXIMUM * 130 / 150;
- midval = RGB_MAXIMUM * 130 / 100;
- maxval = RGB_MAXIMUM * 130 / 60;
-
- /* compute the values for each of 4 possible star values */
- starmap[0] = 0;
- starmap[1] = minval;
- starmap[2] = minval + (255 - minval) * (midval - minval) / (maxval - minval);
- starmap[3] = 255;
-
- /* generate the colors for the stars */
- for (i = 0; i < 64; i++)
+ int const minval = RGB_MAXIMUM * 130 / 150;
+ int const midval = RGB_MAXIMUM * 130 / 100;
+ int const maxval = RGB_MAXIMUM * 130 / 60;
+
+ // compute the values for each of 4 possible star values
+ uint8_t const starmap[4]{
+ 0,
+ minval,
+ minval + (255 - minval) * (midval - minval) / (maxval - minval),
+ 255 };
+
+ // generate the colors for the stars
+ for (int i = 0; i < 64; i++)
{
- uint8_t bit0, bit1, r, g, b;
+ uint8_t bit0, bit1;
- /* bit 5 = red @ 150 Ohm, bit 4 = red @ 100 Ohm */
- bit0 = BIT(i,5);
- bit1 = BIT(i,4);
- r = starmap[(bit1 << 1) | bit0];
+ // bit 5 = red @ 150 Ohm, bit 4 = red @ 100 Ohm
+ bit0 = BIT(i, 5);
+ bit1 = BIT(i, 4);
+ int const r = starmap[(bit1 << 1) | bit0];
- /* bit 3 = green @ 150 Ohm, bit 2 = green @ 100 Ohm */
- bit0 = BIT(i,3);
- bit1 = BIT(i,2);
- g = starmap[(bit1 << 1) | bit0];
+ // bit 3 = green @ 150 Ohm, bit 2 = green @ 100 Ohm
+ bit0 = BIT(i, 3);
+ bit1 = BIT(i, 2);
+ int const g = starmap[(bit1 << 1) | bit0];
- /* bit 1 = blue @ 150 Ohm, bit 0 = blue @ 100 Ohm */
- bit0 = BIT(i,1);
- bit1 = BIT(i,0);
- b = starmap[(bit1 << 1) | bit0];
+ // bit 1 = blue @ 150 Ohm, bit 0 = blue @ 100 Ohm
+ bit0 = BIT(i, 1);
+ bit1 = BIT(i, 0);
+ int const b = starmap[(bit1 << 1) | bit0];
- /* set the RGB color */
+ // set the RGB color
m_star_color[i] = rgb_t(r, g, b);
}
- /* default bullet colors are white for the first 7, and yellow for the last one */
- for (i = 0; i < 7; i++)
- m_bullet_color[i] = rgb_t(0xff,0xff,0xff);
+ // default bullet colors are white for the first 7, and yellow for the last one
+ for (int i = 0; i < 7; i++)
+ m_bullet_color[i] = rgb_t(0xff, 0xff, 0xff);
m_bullet_color[7] = rgb_t(0xff,0xff,0x00);
}
-PALETTE_INIT_MEMBER(galaxian_state,moonwar)
+void galaxian_state::moonwar_palette(palette_device &palette)
{
- PALETTE_INIT_NAME(galaxian)(palette);
+ galaxian_palette(palette);
- /* wire mod to connect the bullet blue output to the 220 ohm resistor */
- m_bullet_color[7] = rgb_t(0xef,0xef,0x97);
+ // wire mod to connect the bullet blue output to the 220 ohm resistor
+ m_bullet_color[7] = rgb_t(0xef, 0xef, 0x97);
}
/*************************************
diff --git a/src/mame/video/galaxold.cpp b/src/mame/video/galaxold.cpp
index b8787b288c5..ab84d622edc 100644
--- a/src/mame/video/galaxold.cpp
+++ b/src/mame/video/galaxold.cpp
@@ -45,65 +45,55 @@
The RGB outputs have a 470 ohm pull-down each.
***************************************************************************/
-PALETTE_INIT_MEMBER(galaxold_state,galaxold)
+void galaxold_state::galaxold_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i, len;
-
- /* first, the character/sprite palette */
- len = memregion("proms")->bytes();
- for (i = 0;i < len;i++)
+ // first, the character/sprite palette
+ int const len = memregion("proms")->bytes();
+ for (int i = 0; i < len; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = BIT(*color_prom,0);
- bit1 = BIT(*color_prom,1);
- bit2 = BIT(*color_prom,2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = BIT(*color_prom,3);
- bit1 = BIT(*color_prom,4);
- bit2 = BIT(*color_prom,5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = BIT(*color_prom,6);
- bit1 = BIT(*color_prom,7);
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,r,g,b);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
-
galaxold_init_stars(STARS_COLOR_BASE);
-
- /* bullets - yellow and white */
- palette.set_pen_color(BULLETS_COLOR_BASE+0,rgb_t(0xef,0xef,0x00));
- palette.set_pen_color(BULLETS_COLOR_BASE+1,rgb_t(0xef,0xef,0xef));
+ // bullets - yellow and white
+ palette.set_pen_color(BULLETS_COLOR_BASE + 0, rgb_t(0xef, 0xef, 0x00));
+ palette.set_pen_color(BULLETS_COLOR_BASE + 1, rgb_t(0xef, 0xef, 0xef));
}
-PALETTE_INIT_MEMBER(galaxold_state,scrambold)
+void galaxold_state::scrambold_palette(palette_device &palette)
{
- PALETTE_INIT_NAME(galaxold)(palette);
+ galaxold_palette(palette);
-
- /* blue background - 390 ohm resistor */
- palette.set_pen_color(BACKGROUND_COLOR_BASE,rgb_t(0,0,0x56));
+ // blue background - 390 ohm resistor
+ palette.set_pen_color(BACKGROUND_COLOR_BASE, rgb_t(0, 0, 0x56));
}
-PALETTE_INIT_MEMBER(galaxold_state,stratgyx)
+void galaxold_state::stratgyx_palette(palette_device &palette)
{
- int base = BACKGROUND_COLOR_BASE;
- int i;
-
-
- PALETTE_INIT_NAME(galaxold)(palette);
-
+ galaxold_palette(palette);
/* The background color generator is connected this way:
@@ -111,47 +101,46 @@ PALETTE_INIT_MEMBER(galaxold_state,stratgyx)
GREEN - 560 ohm resistor
BLUE - 470 ohm resistor */
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
- int r = BIT(i,0) * 0x7c;
- int g = BIT(i,1) * 0x3c;
- int b = BIT(i,2) * 0x47;
+ int const r = BIT(i, 0) * 0x7c;
+ int const g = BIT(i, 1) * 0x3c;
+ int const b = BIT(i, 2) * 0x47;
- palette.set_pen_color(base+i,r,g,b);
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
}
-PALETTE_INIT_MEMBER(galaxold_state,rockclim)
+void galaxold_state::rockclim_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i, len;
-
- /* first, the character/sprite palette */
- len = memregion("proms")->bytes();
- for (i = 0;i < len;i++)
+ // first, the character/sprite palette
+ int const len = memregion("proms")->bytes();
+ for (int i = 0; i < len; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = BIT(*color_prom,0);
- bit1 = BIT(*color_prom,1);
- bit2 = BIT(*color_prom,2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = BIT(*color_prom,3);
- bit1 = BIT(*color_prom,4);
- bit2 = BIT(*color_prom,5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = BIT(*color_prom,6);
- bit1 = BIT(*color_prom,7);
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,r,g,b);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
}
+
/***************************************************************************
Convert the color PROMs into a more useable format.
@@ -170,103 +159,84 @@ PALETTE_INIT_MEMBER(galaxold_state,rockclim)
The RGB outputs have a 470 ohm pull-down each.
***************************************************************************/
-PALETTE_INIT_MEMBER(galaxold_state,darkplnt)
+void galaxold_state::darkplnt_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
-
- /* first, the character/sprite palette */
- for (i = 0;i < 32;i++)
+ // first, the character/sprite palette
+ for (int i = 0; i < 32; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = BIT(*color_prom,0);
- bit1 = BIT(*color_prom,1);
- bit2 = BIT(*color_prom,2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- g = 0x00;
- /* blue component */
- bit0 = BIT(*color_prom,3);
- bit1 = BIT(*color_prom,4);
- bit2 = BIT(*color_prom,5);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_pen_color(i,r,g,b);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ int const g = 0x00;
+ // blue component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
-
- /* bullets - red and blue */
- palette.set_pen_color(BULLETS_COLOR_BASE+0,rgb_t(0xef,0x00,0x00));
- palette.set_pen_color(BULLETS_COLOR_BASE+1,rgb_t(0x00,0x00,0xef));
+ // bullets - red and blue
+ palette.set_pen_color(BULLETS_COLOR_BASE + 0, rgb_t(0xef, 0x00, 0x00));
+ palette.set_pen_color(BULLETS_COLOR_BASE + 1, rgb_t(0x00, 0x00, 0xef));
}
-PALETTE_INIT_MEMBER(galaxold_state,minefld)
+void galaxold_state::minefld_palette(palette_device &palette)
{
- int base = BACKGROUND_COLOR_BASE;
- int i;
+ galaxold_palette(palette);
+ // set up background colors
- PALETTE_INIT_NAME(galaxold)(palette);
+ // graduated blue
-
- /* set up background colors */
-
- /* graduated blue */
-
- for (i = 0; i < 128; i++)
+ for (int i = 0; i < 128; i++)
{
- int r = 0;
- int g = i;
- int b = i * 2;
- palette.set_pen_color(base+i,r,g,b);
+ int const r = 0;
+ int const g = i;
+ int const b = i * 2;
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
- /* graduated brown */
+ // graduated brown
- for (i = 0; i < 128; i++)
+ for (int i = 0; i < 128; i++)
{
- int r = i * 1.5;
- int g = i * 0.75;
- int b = i / 2;
- palette.set_pen_color(base+128+i,r,g,b);
+ int const r = i * 1.5;
+ int const g = i * 0.75;
+ int const b = i / 2;
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + 128 + i, r, g, b);
}
}
-PALETTE_INIT_MEMBER(galaxold_state,rescue)
+void galaxold_state::rescue_palette(palette_device &palette)
{
- int base = BACKGROUND_COLOR_BASE;
- int i;
-
-
- PALETTE_INIT_NAME(galaxold)(palette);
+ galaxold_palette(palette);
+ // set up background colors
- /* set up background colors */
-
- /* graduated blue */
+ // graduated blue
- for (i = 0; i < 128; i++)
+ for (int i = 0; i < 128; i++)
{
- int r = 0;
- int g = i;
- int b = i * 2;
- palette.set_pen_color(base+i,r,g,b);
+ int const r = 0;
+ int const g = i;
+ int const b = i * 2;
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
}
-PALETTE_INIT_MEMBER(galaxold_state,mariner)
+void galaxold_state::mariner_palette(palette_device &palette)
{
- int base = BACKGROUND_COLOR_BASE;
- int i;
-
-
- PALETTE_INIT_NAME(galaxold)(palette);
-
+ galaxold_palette(palette);
/* set up background colors */
@@ -277,58 +247,51 @@ PALETTE_INIT_MEMBER(galaxold_state,mariner)
-- 1 kohm resistor
bit 0 -- .47 kohm resistor */
- for (i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
- int r,g,b;
-
- r = 0;
- g = 0;
- b = 0x0e * BIT(i,0) + 0x1f * BIT(i,1) + 0x43 * BIT(i,2) + 0x8f * BIT(i,3);
+ int const r = 0;
+ int const g = 0;
+ int const b = 0x0e * BIT(i, 0) + 0x1f * BIT(i, 1) + 0x43 * BIT(i, 2) + 0x8f * BIT(i, 3);
- palette.set_pen_color(base+i,r,g,b);
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
}
-/* swapped r/g/b hook-up */
-PALETTE_INIT_MEMBER(galaxold_state,dambustr)
+// swapped r/g/b hook-up
+void galaxold_state::dambustr_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int base = BACKGROUND_COLOR_BASE;
- int i, len;
-
- /* first, the character/sprite palette */
- len = memregion("proms")->bytes();
- for (i = 0;i < len;i++)
+ // first, the character/sprite palette
+ int const len = memregion("proms")->bytes();
+ for (int i = 0; i < len; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = BIT(*color_prom,0);
- bit1 = BIT(*color_prom,1);
- bit2 = BIT(*color_prom,2);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = BIT(*color_prom,3);
- bit1 = BIT(*color_prom,4);
- bit2 = BIT(*color_prom,5);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = BIT(*color_prom,6);
- bit1 = BIT(*color_prom,7);
- g = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,r,g,b);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const g = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, r, g, b);
color_prom++;
}
-
galaxold_init_stars(STARS_COLOR_BASE);
-
- /* bullets - yellow and white */
- palette.set_pen_color(BULLETS_COLOR_BASE+0,rgb_t(0xef,0xef,0x00));
- palette.set_pen_color(BULLETS_COLOR_BASE+1,rgb_t(0xef,0xef,0xef));
+ // bullets - yellow and white
+ palette.set_pen_color(BULLETS_COLOR_BASE + 0, rgb_t(0xef, 0xef, 0x00));
+ palette.set_pen_color(BULLETS_COLOR_BASE + 1, rgb_t(0xef, 0xef, 0xef));
/*
Assumption (not clear from the schematics):
@@ -338,25 +301,19 @@ PALETTE_INIT_MEMBER(galaxold_state,dambustr)
GREEN - 470 ohm resistor
BLUE - 470 ohm resistor */
-
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
- int r = BIT(i,0) * 0x47;
- int g = BIT(i,1) * 0x47;
- int b = BIT(i,2) * 0x4f;
- palette.set_pen_color(base+i,r,g,b);
+ int const r = BIT(i, 0) * 0x47;
+ int const g = BIT(i, 1) * 0x47;
+ int const b = BIT(i, 2) * 0x4f;
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
}
-PALETTE_INIT_MEMBER(galaxold_state,turtles)
+void galaxold_state::turtles_palette(palette_device &palette)
{
- int base = BACKGROUND_COLOR_BASE;
- int i;
-
-
- PALETTE_INIT_NAME(galaxold)(palette);
-
+ galaxold_palette(palette);
/* The background color generator is connected this way:
@@ -364,13 +321,13 @@ PALETTE_INIT_MEMBER(galaxold_state,turtles)
GREEN - 470 ohm resistor
BLUE - 390 ohm resistor */
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
- int r = BIT(i,0) * 0x55;
- int g = BIT(i,1) * 0x47;
- int b = BIT(i,2) * 0x55;
+ int const r = BIT(i, 0) * 0x55;
+ int const g = BIT(i, 1) * 0x47;
+ int const b = BIT(i, 2) * 0x55;
- palette.set_pen_color(base+i,r,g,b);
+ palette.set_pen_color(BACKGROUND_COLOR_BASE + i, r, g, b);
}
}
diff --git a/src/mame/video/galivan.cpp b/src/mame/video/galivan.cpp
index a5ccf0ad347..747a026bfed 100644
--- a/src/mame/video/galivan.cpp
+++ b/src/mame/video/galivan.cpp
@@ -54,58 +54,45 @@ background: 0x4000 bytes of ROM: 76543210 tile code low bits
***************************************************************************/
-PALETTE_INIT_MEMBER(galivan_state, galivan)
+void galivan_state::galivan_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0-0x7f */
- for (i = 0; i < 0x80; i++)
+ // characters use colors 0-0x7f
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i, i);
- /* I think that */
- /* background tiles use colors 0xc0-0xff in four banks */
- /* the bottom two bits of the color code select the palette bank for */
- /* pens 0-7; the top two bits for pens 8-15. */
- for (i = 0; i < 0x100; i++)
+ // I think that background tiles use colors 0xc0-0xff in four banks
+ // the bottom two bits of the color code select the palette bank for pens 0-7;
+ // the top two bits for pens 8-15.
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
-
- if (i & 0x08)
- ctabentry = 0xc0 | (i & 0x0f) | ((i & 0xc0) >> 2);
- else
- ctabentry = 0xc0 | (i & 0x0f) | ((i & 0x30) >> 0);
+ uint8_t const ctabentry = 0xc0 | (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30);
palette.set_pen_indirect(0x80 + i, ctabentry);
}
- /* sprites use colors 0x80-0xbf in four banks */
- /* The lookup table tells which colors to pick from the selected bank */
- /* the bank is selected by another PROM and depends on the top 7 bits of */
- /* the sprite code. The PROM selects the bank *separately* for pens 0-7 and */
- /* 8-15 (like for tiles). */
- for (i = 0; i < 0x1000; i++)
+ // sprites use colors 0x80-0xbf in four banks
+ // The lookup table tells which colors to pick from the selected bank
+ // the bank is selected by another PROM and depends on the top 7 bits of the sprite code.
+ // The PROM selects the bank *separately* for pens 0-7 and 8-15 (like for tiles).
+ for (int i = 0; i < 0x1000; i++)
{
- uint8_t ctabentry;
- int i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4);
-
- if (i & 0x80)
- ctabentry = 0x80 | ((i & 0x0c) << 2) | (color_prom[i >> 4] & 0x0f);
- else
- ctabentry = 0x80 | ((i & 0x03) << 4) | (color_prom[i >> 4] & 0x0f);
+ uint8_t const ctabentry = 0x80 | ((i << ((i & 0x80) ? 2 : 4)) & 0x30) | (color_prom[i >> 4] & 0x0f);
+ int const i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4);
palette.set_pen_indirect(0x180 + i_swapped, ctabentry);
}
diff --git a/src/mame/video/galpani2.cpp b/src/mame/video/galpani2.cpp
index 83d8c831e43..d8d24b2a9e5 100644
--- a/src/mame/video/galpani2.cpp
+++ b/src/mame/video/galpani2.cpp
@@ -63,29 +63,6 @@ WRITE16_MEMBER( galpani2_bg8_regs_1_w ) { galpani2_bg8_regs_w(space, offset, dat
/***************************************************************************
- Video Init Functions
-
-
-***************************************************************************/
-
-PALETTE_INIT_MEMBER(galpani2_state, galpani2)
-{
- int i;
- /* first $4200 colors are dynamic */
-
- /* initialize 555 RGB lookup */
- for (i = 0; i < 0x8000; i++)
- palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
-}
-
-void galpani2_state::video_start()
-{
-}
-
-
-/***************************************************************************
-
-
Screen Drawing
diff --git a/src/mame/video/galpanic.cpp b/src/mame/video/galpanic.cpp
index ea17a014cae..8e3de1cfb16 100644
--- a/src/mame/video/galpanic.cpp
+++ b/src/mame/video/galpanic.cpp
@@ -12,13 +12,13 @@ void galpanic_state::video_start()
save_item(NAME(m_bitmap));
}
-PALETTE_INIT_MEMBER(galpanic_state,galpanic)
+void galpanic_state::galpanic_palette(palette_device &palette) const
{
- /* first 1024 colors are dynamic */
+ // first 1024 colors are dynamic
- /* initialize 555 RGB lookup */
- for (int i = 0;i < 32768;i++)
- palette.set_pen_color(i+1024,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
+ // initialize 555 GRB lookup
+ for (int i = 0; i < 32768; i++)
+ palette.set_pen_color(i + 1024, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0));
}
WRITE16_MEMBER(galpanic_state::bgvideoram_w)
diff --git a/src/mame/video/galspnbl.cpp b/src/mame/video/galspnbl.cpp
index 1c7308ff402..553315790d9 100644
--- a/src/mame/video/galspnbl.cpp
+++ b/src/mame/video/galspnbl.cpp
@@ -4,12 +4,10 @@
#include "includes/galspnbl.h"
-PALETTE_INIT_MEMBER(galspnbl_state, galspnbl)
+void galspnbl_state::galspnbl_palette(palette_device &palette) const
{
- int i;
-
- /* initialize 555 RGB lookup */
- for (i = 0; i < 32768; i++)
+ // initialize 555 RGB lookup
+ for (int i = 0; i < 32768; i++)
palette.set_pen_color(i + 1024, pal5bit(i >> 5), pal5bit(i >> 10), pal5bit(i >> 0));
}
@@ -17,14 +15,12 @@ PALETTE_INIT_MEMBER(galspnbl_state, galspnbl)
void galspnbl_state::draw_background( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
- offs_t offs;
-
-// int screenscroll = 4 - (m_scroll[0] & 0xff);
+// int const screenscroll = 4 - (m_scroll[0] & 0xff);
- for (offs = 0; offs < 0x20000; offs++)
+ for (offs_t offs = 0; offs < 0x20000; offs++)
{
- int y = offs >> 9;
- int x = offs & 0x1ff;
+ int const y = offs >> 9;
+ int const x = offs & 0x1ff;
bitmap.pix16(y, x) = 1024 + (m_bgvideoram[offs] >> 1);
}
diff --git a/src/mame/video/gamate.cpp b/src/mame/video/gamate.cpp
index 5bb9a1e771d..67e0272c8aa 100644
--- a/src/mame/video/gamate.cpp
+++ b/src/mame/video/gamate.cpp
@@ -293,7 +293,7 @@ static const unsigned char palette_gamate[] = {
0x6B, 0xA6, 0x4A, 0x43, 0x7A, 0x63, 0x25, 0x59, 0x55, 0x12, 0x42, 0x4C
};
-PALETTE_INIT_MEMBER(gamate_video_device, gamate)
+void gamate_video_device::gamate_palette(palette_device &palette) const
{
for (int i = 0; i < 4; i++)
palette.set_pen_color(i, palette_gamate[i * 3 + 0], palette_gamate[i * 3 + 1], palette_gamate[i * 3 + 2]);
@@ -315,8 +315,7 @@ MACHINE_CONFIG_START(gamate_video_device::device_add_mconfig)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) // close approximate until we use timers to emulate exact video update
MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
- MCFG_PALETTE_ADD("palette", 4)
- MCFG_PALETTE_INIT_OWNER(gamate_video_device,gamate)
+ PALETTE(config, "palette", FUNC(gamate_video_device::gamate_palette), 4);
MACHINE_CONFIG_END
void gamate_video_device::device_start()
diff --git a/src/mame/video/gamate.h b/src/mame/video/gamate.h
index a4e2e3bc0fe..4482c90bcbc 100644
--- a/src/mame/video/gamate.h
+++ b/src/mame/video/gamate.h
@@ -28,18 +28,18 @@ public:
void regs_map(address_map &map);
void vram_map(address_map &map);
- DECLARE_PALETTE_INIT(gamate);
-
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
virtual void device_reset() override;
virtual space_config_vector memory_space_config() const override;
+
address_space *m_vramspace;
private:
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
+ void gamate_palette(palette_device &palette) const;
const address_space_config m_vram_space_config;
required_shared_ptr<uint8_t> m_vram;
diff --git a/src/mame/video/gaplus.cpp b/src/mame/video/gaplus.cpp
index 4f9e6be9fcb..875affd31da 100644
--- a/src/mame/video/gaplus.cpp
+++ b/src/mame/video/gaplus.cpp
@@ -25,38 +25,41 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(gaplus_base_state, gaplus)
+void gaplus_base_state::gaplus_palette(palette_device &palette) const
{
const uint8_t *color_prom = m_proms_region->base();
for (int i = 0; i < 256; i++)
{
- /* red component */
- int bit0 = BIT(color_prom[i], 0);
- int bit1 = BIT(color_prom[i], 1);
- int bit2 = BIT(color_prom[i], 2);
- int bit3 = BIT(color_prom[i], 3);
- int r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- /* green component */
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // green component
bit0 = BIT(color_prom[i + 0x100], 0);
bit1 = BIT(color_prom[i + 0x100], 1);
bit2 = BIT(color_prom[i + 0x100], 2);
bit3 = BIT(color_prom[i + 0x100], 3);
- int g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // blue component
bit0 = BIT(color_prom[i + 0x200], 0);
bit1 = BIT(color_prom[i + 0x200], 1);
bit2 = BIT(color_prom[i + 0x200], 2);
bit3 = BIT(color_prom[i + 0x200], 3);
- int b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
color_prom += 0x300;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
- /* characters use colors 0xf0-0xff */
+ // characters use colors 0xf0-0xff
for (int i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++)
palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i, 0xf0 + (*color_prom++ & 0x0f));
diff --git a/src/mame/video/gberet.cpp b/src/mame/video/gberet.cpp
index 37b5a1e999a..f2affc95070 100644
--- a/src/mame/video/gberet.cpp
+++ b/src/mame/video/gberet.cpp
@@ -23,56 +23,48 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(gberet_state,gberet)
+void gberet_state::gberet_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x100; i < 0x200; i++)
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry;
-
- if (color_prom[i] & 0x0f)
- ctabentry = color_prom[i] & 0x0f;
- else
- ctabentry = 0;
-
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/gic.h b/src/mame/video/gic.h
index 0f0f1553e5c..7735535d122 100644
--- a/src/mame/video/gic.h
+++ b/src/mame/video/gic.h
@@ -16,8 +16,6 @@
#pragma once
-#include "emupal.h"
-
/***************************************************************************
TYPE DEFINITIONS
@@ -51,8 +49,6 @@ public:
// configuration helpers
auto ram_callback() { return m_ram.bind(); }
- DECLARE_PALETTE_INIT(gic);
-
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline bitmap_ind16 *get_bitmap() { return &m_bitmap; }
diff --git a/src/mame/video/gomoku.cpp b/src/mame/video/gomoku.cpp
index 5ab4917fc5a..b2f697b8035 100644
--- a/src/mame/video/gomoku.cpp
+++ b/src/mame/video/gomoku.cpp
@@ -20,29 +20,29 @@
******************************************************************************/
-PALETTE_INIT_MEMBER(gomoku_state, gomoku)
+void gomoku_state::gomoku_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0, bit1, bit2, r, g, b;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
diff --git a/src/mame/video/gotya.cpp b/src/mame/video/gotya.cpp
index 1addafdcbea..0fe00462fc9 100644
--- a/src/mame/video/gotya.cpp
+++ b/src/mame/video/gotya.cpp
@@ -11,52 +11,50 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(gotya_state, gotya)
+void gotya_state::gotya_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- for (i = 0; i < 0x40; i++)
+ for (int i = 0; i < 0x40; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x07;
+ uint8_t const ctabentry = color_prom[i] & 0x07;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/grchamp.cpp b/src/mame/video/grchamp.cpp
index a1c1863e75c..b95d3e2846a 100644
--- a/src/mame/video/grchamp.cpp
+++ b/src/mame/video/grchamp.cpp
@@ -13,40 +13,39 @@
#define RGB_MAX 191
-PALETTE_INIT_MEMBER(grchamp_state, grchamp)
+void grchamp_state::grchamp_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 100, 270, 470 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 100, 270, 470 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, RGB_MAX, -1.0,
- 3, &resistances[0], rweights, 0, 100,
- 3, &resistances[0], gweights, 0, 100,
- 2, &resistances[0], bweights, 0, 100);
+ 3, &resistances[0], rweights, 0, 100,
+ 3, &resistances[0], gweights, 0, 100,
+ 2, &resistances[0], bweights, 0, 100);
- /* initialize the palette with these colors */
- for (i = 0; i < 0x20; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 0x20; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 1;
- bit1 = (color_prom[i] >> 1) & 1;
- bit2 = (color_prom[i] >> 2) & 1;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
-
- /* green component */
- bit0 = (color_prom[i] >> 3) & 1;
- bit1 = (color_prom[i] >> 4) & 1;
- bit2 = (color_prom[i] >> 5) & 1;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
-
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 1;
- bit1 = (color_prom[i] >> 7) & 1;
- b = combine_2_weights(bweights, bit0, bit1);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/gridlee.cpp b/src/mame/video/gridlee.cpp
index 80cbfeae5f1..95efb8525b1 100644
--- a/src/mame/video/gridlee.cpp
+++ b/src/mame/video/gridlee.cpp
@@ -20,14 +20,13 @@
*
*************************************/
-PALETTE_INIT_MEMBER(gridlee_state, gridlee)
+void gridlee_state::gridlee_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- palette.set_pen_color(i,pal4bit(color_prom[0x0000]),pal4bit(color_prom[0x0800]),pal4bit(color_prom[0x1000]));
+ palette.set_pen_color(i, pal4bit(color_prom[0x0000]), pal4bit(color_prom[0x0800]), pal4bit(color_prom[0x1000]));
color_prom++;
}
}
@@ -42,13 +41,10 @@ PALETTE_INIT_MEMBER(gridlee_state, gridlee)
void gridlee_state::expand_pixels()
{
- uint8_t *videoram = m_videoram;
- int offset = 0;
-
- for(offset = 0; offset < 0x77ff; offset++)
+ for (int offset = 0; offset < 0x77ff; offset++)
{
- m_local_videoram[offset * 2 + 0] = videoram[offset] >> 4;
- m_local_videoram[offset * 2 + 1] = videoram[offset] & 15;
+ m_local_videoram[offset * 2 + 0] = m_videoram[offset] >> 4;
+ m_local_videoram[offset * 2 + 1] = m_videoram[offset] & 15;
}
}
diff --git a/src/mame/video/gsword.cpp b/src/mame/video/gsword.cpp
index a9b7fe22ef5..69436e9c790 100644
--- a/src/mame/video/gsword.cpp
+++ b/src/mame/video/gsword.cpp
@@ -119,7 +119,7 @@ void gsword_state_base::draw_sprites(bitmap_ind16 &bitmap, const rectangle &clip
}
}
-uint32_t gsword_state_base::screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
+u32 gsword_state_base::screen_update_gsword(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
draw_sprites(bitmap, cliprect);
@@ -127,64 +127,56 @@ uint32_t gsword_state_base::screen_update_gsword(screen_device &screen, bitmap_i
}
-PALETTE_INIT_MEMBER(gsword_state, gsword)
+void gsword_state::gsword_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ u8 const *const color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
+ // create a lookup table for the palette
for (unsigned i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = BIT(color_prom[i + 0x100], 0);
- bit1 = BIT(color_prom[i + 0x100], 1);
- bit2 = BIT(color_prom[i + 0x100], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = BIT(color_prom[i + 0x100], 3);
- bit1 = BIT(color_prom[i + 0x000], 0);
- bit2 = BIT(color_prom[i + 0x000], 1);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 3);
+ bit1 = BIT(color_prom[i | 0x000], 0);
+ bit2 = BIT(color_prom[i | 0x000], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = BIT(color_prom[i + 0x000], 2);
- bit2 = BIT(color_prom[i + 0x000], 3);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i | 0x000], 2);
+ bit2 = BIT(color_prom[i | 0x000], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
- }
- /* color_prom now points to the beginning of the lookup table */
- color_prom += 0x200;
-
- /* characters */
- for (unsigned i = 0; i < 0x100; i++)
+ // characters
palette.set_pen_indirect(i, i);
- /* sprites */
- for (unsigned i = 0x100; i < 0x200; i++)
- {
- uint8_t ctabentry = (bitswap<8>(color_prom[i - 0x100],7,6,5,4,0,1,2,3) & 0x0f) | 0x80;
- palette.set_pen_indirect(i, ctabentry);
+ // sprites
+ u8 const ctabentry = bitswap<4>(color_prom[i | 0x200], 0, 1, 2, 3) | 0x80;
+ palette.set_pen_indirect(i + 0x100, ctabentry);
}
}
-PALETTE_INIT_MEMBER(josvolly_state, josvolly)
+void josvolly_state::josvolly_palette(palette_device &palette) const
{
u8 const *const color_prom = memregion("proms")->base();
// create a lookup table for the palette
for (unsigned i = 0; i < 0x100; i++)
{
- u8 const r = pal4bit(color_prom[i + 0x000]);
- u8 const g = pal4bit(color_prom[i + 0x100]);
- u8 const b = pal4bit(color_prom[i + 0x200]);
+ u8 const r = pal4bit(color_prom[i | 0x000]);
+ u8 const g = pal4bit(color_prom[i | 0x100]);
+ u8 const b = pal4bit(color_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
@@ -192,7 +184,7 @@ PALETTE_INIT_MEMBER(josvolly_state, josvolly)
palette.set_pen_indirect(i, i);
// sprites
- u8 const ctabentry = bitswap(color_prom[i + 0x300], 0, 1, 2, 3) | 0x80;
+ u8 const ctabentry = bitswap<4>(color_prom[i | 0x300], 0, 1, 2, 3) | 0x80;
palette.set_pen_indirect(i + 0x100, ctabentry);
}
}
diff --git a/src/mame/video/gunsmoke.cpp b/src/mame/video/gunsmoke.cpp
index f8066e0d97b..1706da7eda1 100644
--- a/src/mame/video/gunsmoke.cpp
+++ b/src/mame/video/gunsmoke.cpp
@@ -18,42 +18,41 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(gunsmoke_state, gunsmoke)
+void gunsmoke_state::gunsmoke_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x40-0x4f */
- for (i = 0; i < 0x80; i++)
+ // characters use colors 0x40-0x4f
+ for (int i = 0; i < 0x80; i++)
{
- uint8_t ctabentry = color_prom[i] | 0x40;
+ uint8_t const ctabentry = color_prom[i] | 0x40;
palette.set_pen_indirect(i, ctabentry);
}
- /* background tiles use colors 0-0x3f */
- for (i = 0x100; i < 0x200; i++)
+ // background tiles use colors 0-0x3f
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x03) << 4);
+ uint8_t const ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x03) << 4);
palette.set_pen_indirect(i - 0x80, ctabentry);
}
- /* sprites use colors 0x80-0xff */
- for (i = 0x300; i < 0x400; i++)
+ // sprites use colors 0x80-0xff
+ for (int i = 0x300; i < 0x400; i++)
{
- uint8_t ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x07) << 4) | 0x80;
+ uint8_t const ctabentry = color_prom[i] | ((color_prom[i + 0x100] & 0x07) << 4) | 0x80;
palette.set_pen_indirect(i - 0x180, ctabentry);
}
}
diff --git a/src/mame/video/gyruss.cpp b/src/mame/video/gyruss.cpp
index d20ff38ef5a..61ddfee37b2 100644
--- a/src/mame/video/gyruss.cpp
+++ b/src/mame/video/gyruss.cpp
@@ -31,61 +31,59 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(gyruss_state, gyruss)
+void gyruss_state::gyruss_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_rg[3], weights_b[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights_rg[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_rg, 470, 0,
2, resistances_b, weights_b, 470, 0,
0, nullptr, nullptr, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- /* sprites map to the lower 16 palette entries */
- for (i = 0; i < 0x100; i++)
+ // sprites map to the lower 16 palette entries
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters map to the upper 16 palette entries */
- for (i = 0x100; i < 0x140; i++)
+ // characters map to the upper 16 palette entries
+ for (int i = 0x100; i < 0x140; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
- palette.set_pen_indirect(i, ctabentry + 0x10);
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
+ palette.set_pen_indirect(i, ctabentry | 0x10);
}
}
diff --git a/src/mame/video/hanaawas.cpp b/src/mame/video/hanaawas.cpp
index 85badce3e8b..2ac87f5288d 100644
--- a/src/mame/video/hanaawas.cpp
+++ b/src/mame/video/hanaawas.cpp
@@ -17,47 +17,44 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(hanaawas_state, hanaawas)
+void hanaawas_state::hanaawas_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
/* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
/* blue component */
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* character lookup table. The 1bpp tiles really only use colors 0-0x0f and the
- 3bpp ones 0x10-0x1f */
- for (i = 0; i < 0x100; i++)
+ // character lookup table. The 1bpp tiles really only use colors 0-0x0f and the 3bpp ones 0x10-0x1f
+ for (int i = 0; i < 0x100; i++)
{
- int swapped_i = bitswap<8>(i,2,7,6,5,4,3,1,0);
- uint8_t ctabentry = color_prom[swapped_i] & 0x0f;
+ int const swapped_i = bitswap<8>(i, 2,7,6,5,4,3,1,0);
+ uint8_t const ctabentry = color_prom[swapped_i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/hcastle.cpp b/src/mame/video/hcastle.cpp
index dba402278e4..72deaece319 100644
--- a/src/mame/video/hcastle.cpp
+++ b/src/mame/video/hcastle.cpp
@@ -11,21 +11,16 @@
#include "screen.h"
-PALETTE_INIT_MEMBER(hcastle_state, hcastle)
+void hcastle_state::hcastle_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int chip;
-
- for (chip = 0; chip < 2; chip++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int chip = 0; chip < 2; chip++)
{
- int pal;
-
- for (pal = 0; pal < 8; pal++)
+ for (int pal = 0; pal < 8; pal++)
{
- int i;
- int clut = (chip << 1) | (pal & 1);
+ int const clut = (chip << 1) | (pal & 1);
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
uint8_t ctabentry;
diff --git a/src/mame/video/higemaru.cpp b/src/mame/video/higemaru.cpp
index 128314e1685..28087b2f83d 100644
--- a/src/mame/video/higemaru.cpp
+++ b/src/mame/video/higemaru.cpp
@@ -21,52 +21,50 @@ WRITE8_MEMBER(higemaru_state::higemaru_colorram_w)
***************************************************************************/
-PALETTE_INIT_MEMBER(higemaru_state, higemaru)
+void higemaru_state::higemaru_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters use colors 0-15 */
- for (i = 0; i < 0x80; i++)
+ // characters use colors 0-15
+ for (int i = 0; i < 0x80; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites use colors 16-31 */
- for (i = 0x80; i < 0x180; i++)
+ // sprites use colors 16-31
+ for (int i = 0x80; i < 0x180; i++)
{
- uint8_t ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i + 0x80] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
@@ -101,21 +99,18 @@ void higemaru_state::video_start()
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(higemaru_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32);
}
-void higemaru_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
+void higemaru_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *spriteram = m_spriteram;
- int offs;
- for (offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
+ for (int offs = m_spriteram.bytes() - 16; offs >= 0; offs -= 16)
{
- int code,col,sx,sy,flipx,flipy;
-
- code = spriteram[offs] & 0x7f;
- col = spriteram[offs + 4] & 0x0f;
- sx = spriteram[offs + 12];
- sy = spriteram[offs + 8];
- flipx = spriteram[offs + 4] & 0x10;
- flipy = spriteram[offs + 4] & 0x20;
+ int const code = spriteram[offs] & 0x7f;
+ int col = spriteram[offs + 4] & 0x0f;
+ int sx = spriteram[offs + 12];
+ int sy = spriteram[offs + 8];
+ int flipx = spriteram[offs + 4] & 0x10;
+ int flipy = spriteram[offs + 4] & 0x20;
if (flip_screen())
{
sx = 240 - sx;
diff --git a/src/mame/video/homedata.cpp b/src/mame/video/homedata.cpp
index 7ef82a6564e..36c9de30cce 100644
--- a/src/mame/video/homedata.cpp
+++ b/src/mame/video/homedata.cpp
@@ -315,86 +315,78 @@ finish:
***************************************************************************/
-PALETTE_INIT_MEMBER(homedata_state,mrokumei)
+void homedata_state::mrokumei_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* initialize 555 RGB palette */
- for (i = 0; i < 0x8000; i++)
+ // initialize 555 RGB palette
+ for (int i = 0; i < 0x8000; i++)
{
- int r,g,b;
- int color = color_prom[i*2] * 256 + color_prom[i*2+1];
+ int const color = color_prom[i*2] * 256 + color_prom[i*2+1];
/* xxxx--------x--- red
* ----xxxx-----x-- green
* --------xxxx--x- blue
* ---------------x unused
*/
- r = ((color >> 11) & 0x1e) | ((color >> 3) & 1);
- g = ((color >> 7) & 0x1e) | ((color >> 2) & 1);
- b = ((color >> 3) & 0x1e) | ((color >> 1) & 1);
+ int const r = ((color >> 11) & 0x1e) | ((color >> 3) & 1);
+ int const g = ((color >> 7) & 0x1e) | ((color >> 2) & 1);
+ int const b = ((color >> 3) & 0x1e) | ((color >> 1) & 1);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(homedata_state,reikaids)
+void homedata_state::reikaids_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* initialize 555 RGB palette */
- for (i = 0; i < 0x8000; i++)
+ // initialize 555 RGB palette
+ for (int i = 0; i < 0x8000; i++)
{
- int r,g,b;
- int color = color_prom[i*2] * 256 + color_prom[i*2+1];
+ int const color = color_prom[i*2] * 256 + color_prom[i*2+1];
/* xxxx--------x--- green
* ----xxxx-----x-- red
* --------xxxx--x- blue
* ---------------x unused
*/
- g = ((color >> 11) & 0x1e) | ((color >> 3) & 1);
- r = ((color >> 7) & 0x1e) | ((color >> 2) & 1);
- b = ((color >> 3) & 0x1e) | ((color >> 1) & 1);
+ int const g = ((color >> 11) & 0x1e) | ((color >> 3) & 1);
+ int const r = ((color >> 7) & 0x1e) | ((color >> 2) & 1);
+ int const b = ((color >> 3) & 0x1e) | ((color >> 1) & 1);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(homedata_state,pteacher)
+void homedata_state::pteacher_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* initialize 555 RGB palette */
- for (i = 0; i < 0x8000; i++)
+ // initialize 555 RGB palette
+ for (int i = 0; i < 0x8000; i++)
{
- int r,g,b;
- int color = color_prom[i*2] * 256 + color_prom[i*2+1];
+ int const color = color_prom[i*2] * 256 + color_prom[i*2+1];
/* xxxxx----------- green
* -----xxxxx------ red
* ----------xxxxx- blue
* ---------------x unused
*/
- g = ((color >> 11) & 0x1f);
- r = ((color >> 6) & 0x1f);
- b = ((color >> 1) & 0x1f);
+ int const g = ((color >> 11) & 0x1f);
+ int const r = ((color >> 6) & 0x1f);
+ int const b = ((color >> 1) & 0x1f);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(homedata_state,mirderby)
+void homedata_state::mirderby_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- int r,g,b;
- r = color_prom[0x000+i];
- g = color_prom[0x100+i];
- b = color_prom[0x200+i];
+ int const r = color_prom[0x000+i];
+ int const g = color_prom[0x100+i];
+ int const b = color_prom[0x200+i];
palette.set_pen_color(i,pal4bit(r),pal4bit(g),pal4bit(b));
}
diff --git a/src/mame/video/hp48.cpp b/src/mame/video/hp48.cpp
index 6bf25707d51..0f224bae73d 100644
--- a/src/mame/video/hp48.cpp
+++ b/src/mame/video/hp48.cpp
@@ -26,13 +26,13 @@
GLOBAL VARIABLES & CONSTANTS
***************************************************************************/
-/* base colors */
-static const int hp48_bg_color[3] = { 136, 147, 109 }; /* yellow */
-static const int hp48_fg_color[3] = { 0, 0, 64 }; /* dark blue */
+// base colors
+static constexpr int hp48_bg_color[3] = { 136, 147, 109 }; // yellow
+static constexpr int hp48_fg_color[3] = { 0, 0, 64 }; // dark blue
-/* color mixing */
-#define mix(c1,c2,x) (c1)*(1-(x))+(c2)*(x)
-#define mix2(i,x) mix(hp48_bg_color[i],hp48_fg_color[i],x)
+// color mixing
+constexpr float mix(int c1, int c2, float x) { return (c1 * (1 - x)) + (c2 * x); }
+inline float mix2(int i, float x) { return mix(hp48_bg_color[i], hp48_fg_color[i], x); }
@@ -41,13 +41,12 @@ static const int hp48_fg_color[3] = { 0, 0, 64 }; /* dark blue */
FUNCTIONS
***************************************************************************/
-PALETTE_INIT_MEMBER(hp48_state, hp48)
+void hp48_state::hp48_palette(palette_device &palette) const
{
- int i;
- for ( i = 0; i < 255; i++ )
+ for (int i = 0; i < 256; i++)
{
- float c = i/255.;
- m_palette->set_pen_color( i, rgb_t( 0, mix2(0,c), mix2(1,c), mix2(2,c) ) );
+ float const c = i / 255.;
+ m_palette->set_pen_color(i, rgb_t(mix2(0, c), mix2(1, c), mix2(2, c)));
}
}
diff --git a/src/mame/video/hyperspt.cpp b/src/mame/video/hyperspt.cpp
index 6b268069dc7..95ae4941cdf 100644
--- a/src/mame/video/hyperspt.cpp
+++ b/src/mame/video/hyperspt.cpp
@@ -31,60 +31,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(hyperspt_state, hyperspt)
+void hyperspt_state::hyperspt_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b[2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b[2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites */
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters */
- for (i = 0x100; i < 0x200; i++)
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/ikki.cpp b/src/mame/video/ikki.cpp
index 05fcf068b34..4ae5b8ce720 100644
--- a/src/mame/video/ikki.cpp
+++ b/src/mame/video/ikki.cpp
@@ -13,32 +13,31 @@ Video hardware driver by Uki
#include "emu.h"
#include "includes/ikki.h"
-PALETTE_INIT_MEMBER(ikki_state, ikki)
+void ikki_state::ikki_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i | 0x000]);
+ int const g = pal4bit(color_prom[i | 0x100]);
+ int const b = pal4bit(color_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* sprites lookup table */
- for (i = 0; i < 0x200; i++)
+ // sprites lookup table
+ for (int i = 0; i < 0x200; i++)
{
uint16_t ctabentry = color_prom[i] ^ 0xff;
if (((i & 0x07) == 0x07) && (ctabentry == 0))
{
- /* punch through */
+ // punch through
m_punch_through_pen = i;
ctabentry = 0x100;
}
@@ -46,35 +45,31 @@ PALETTE_INIT_MEMBER(ikki_state, ikki)
palette.set_pen_indirect(i, ctabentry);
}
- /* bg lookup table */
- for (i = 0x200; i < 0x400; i++)
+ // bg lookup table
+ for (int i = 0x200; i < 0x400; i++)
{
- uint8_t ctabentry = color_prom[i];
+ uint8_t const ctabentry = color_prom[i];
palette.set_pen_indirect(i, ctabentry);
}
}
WRITE8_MEMBER(ikki_state::ikki_scrn_ctrl_w)
{
- m_flipscreen = (data >> 2) & 1;
+ m_flipscreen = BIT(data, 2);
}
void ikki_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
{
- uint8_t *spriteram = m_spriteram;
- int y;
- offs_t offs;
-
m_sprite_bitmap.fill(m_punch_through_pen, cliprect);
- for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
+ for (offs_t offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
- int code = (spriteram[offs + 2] & 0x80) | (spriteram[offs + 1] >> 1);
- int color = spriteram[offs + 2] & 0x3f;
+ int code = (m_spriteram[offs + 2] & 0x80) | (m_spriteram[offs + 1] >> 1);
+ int color = m_spriteram[offs + 2] & 0x3f;
- int x = spriteram[offs + 3];
- y = spriteram[offs + 0];
+ int x = m_spriteram[offs + 3];
+ int y = m_spriteram[offs + 0];
if (m_flipscreen)
x = 240 - x;
@@ -97,14 +92,12 @@ void ikki_state::draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect )
m_palette->transpen_mask(*m_gfxdecode->gfx(1), color, 0));
}
- /* copy the sprite bitmap into the main bitmap, skipping the transparent pixels */
- for (y = cliprect.min_y; y <= cliprect.max_y; y++)
+ // copy the sprite bitmap into the main bitmap, skipping the transparent pixels
+ for (int y = cliprect.min_y; y <= cliprect.max_y; y++)
{
- int x;
-
- for (x = cliprect.min_x; x <= cliprect.max_x; x++)
+ for (int x = cliprect.min_x; x <= cliprect.max_x; x++)
{
- uint16_t pen = m_sprite_bitmap.pix16(y, x);
+ uint16_t const pen = m_sprite_bitmap.pix16(y, x);
if (m_palette->pen_indirect(pen) != 0x100)
bitmap.pix16(y, x) = pen;
@@ -122,44 +115,39 @@ void ikki_state::video_start()
uint32_t ikki_state::screen_update_ikki(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- offs_t offs;
uint8_t *VIDEOATTR = memregion("user1")->base();
- /* draw bg layer */
-
- for (offs = 0; offs < (m_videoram.bytes() / 2); offs++)
+ // draw bg layer
+ for (offs_t offs = 0; offs < (m_videoram.bytes() / 2); offs++)
{
- int color, bank;
-
- int sx = offs / 32;
- int sy = offs % 32;
+ int const sx = offs / 32;
+ int const sy = offs % 32;
int y = sy*8;
int x = sx*8;
- int d = VIDEOATTR[sx];
-
+ int const d = VIDEOATTR[sx];
switch (d)
{
- case 0x02: /* scroll area */
+ case 0x02: // scroll area
x = sx * 8 - m_scroll[1];
if (x < 0)
x += 8 * 22;
y = (sy * 8 + ~m_scroll[0]) & 0xff;
break;
- case 0x03: /* non-scroll area */
+ case 0x03: // non-scroll area
break;
- case 0x00: /* sprite disable? */
+ case 0x00: // sprite disable?
break;
- case 0x0d: /* sprite disable? */
+ case 0x0d: // sprite disable?
break;
- case 0x0b: /* non-scroll area (?) */
+ case 0x0b: // non-scroll area (?)
break;
- case 0x0e: /* unknown */
+ case 0x0e: // unknown
break;
}
@@ -169,32 +157,28 @@ uint32_t ikki_state::screen_update_ikki(screen_device &screen, bitmap_ind16 &bit
y = 248 - y;
}
- color = m_videoram[offs * 2];
- bank = (color & 0xe0) << 3;
- color = ((color & 0x1f)<<0) | ((color & 0x80) >> 2);
+ int color = m_videoram[offs * 2];
+ int const bank = (color & 0xe0) << 3;
+ color = ((color & 0x1f) << 0) | ((color & 0x80) >> 2);
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,
- m_videoram[offs * 2 + 1] + bank,
- color,
- m_flipscreen,m_flipscreen,
- x,y);
+ m_videoram[offs * 2 + 1] + bank,
+ color,
+ m_flipscreen,m_flipscreen,
+ x,y);
}
draw_sprites(bitmap, cliprect);
- /* mask sprites */
-
- for (offs = 0; offs < (m_videoram.bytes() / 2); offs++)
+ // mask sprites
+ for (offs_t offs = 0; offs < (m_videoram.bytes() / 2); offs++)
{
- int sx = offs / 32;
- int sy = offs % 32;
-
- int d = VIDEOATTR[sx];
+ int const sx = offs / 32;
+ int const sy = offs % 32;
+ int const d = VIDEOATTR[sx];
if ((d == 0) || (d == 0x0d))
{
- int color, bank;
-
int y = sy * 8;
int x = sx * 8;
@@ -204,15 +188,15 @@ uint32_t ikki_state::screen_update_ikki(screen_device &screen, bitmap_ind16 &bit
y = 248 - y;
}
- color = m_videoram[offs * 2];
- bank = (color & 0xe0) << 3;
+ int color = m_videoram[offs * 2];
+ int const bank = (color & 0xe0) << 3;
color = ((color & 0x1f)<<0) | ((color & 0x80) >> 2);
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,
- m_videoram[offs * 2 + 1] + bank,
- color,
- m_flipscreen,m_flipscreen,
- x,y);
+ m_videoram[offs * 2 + 1] + bank,
+ color,
+ m_flipscreen,m_flipscreen,
+ x,y);
}
}
diff --git a/src/mame/video/irobot.cpp b/src/mame/video/irobot.cpp
index 1ff2031e48e..c1a7f83a7f1 100644
--- a/src/mame/video/irobot.cpp
+++ b/src/mame/video/irobot.cpp
@@ -39,21 +39,20 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(irobot_state, irobot)
+void irobot_state::irobot_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* convert the color prom for the text palette */
- for (i = 0; i < 32; i++)
+ // convert the color prom for the text palette
+ for (unsigned i = 0; i < 32; i++)
{
- int intensity = color_prom[i] & 0x03;
+ int const intensity = color_prom[i] & 0x03;
- int r = 28 * ((color_prom[i] >> 6) & 0x03) * intensity;
- int g = 28 * ((color_prom[i] >> 4) & 0x03) * intensity;
- int b = 28 * ((color_prom[i] >> 2) & 0x03) * intensity;
+ int const r = 28 * ((color_prom[i] >> 6) & 0x03) * intensity;
+ int const g = 28 * ((color_prom[i] >> 4) & 0x03) * intensity;
+ int const b = 28 * ((color_prom[i] >> 2) & 0x03) * intensity;
- int swapped_i = bitswap<8>(i,7,6,5,4,3,0,1,2);
+ int const swapped_i = bitswap<8>(i,7,6,5,4,3,0,1,2);
palette.set_pen_color(swapped_i + 64, rgb_t(r, g, b));
}
diff --git a/src/mame/video/ironhors.cpp b/src/mame/video/ironhors.cpp
index 16434bbdf86..973d0f0318f 100644
--- a/src/mame/video/ironhors.cpp
+++ b/src/mame/video/ironhors.cpp
@@ -18,61 +18,56 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(ironhors_state, ironhors)
+void ironhors_state::ironhors_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2000, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2000, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 1000, 0,
4, resistances, gweights, 1000, 0,
4, resistances, bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table,*/
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x10-0x1f of each 0x20 color bank,
- while sprites use colors 0-0x0f */
- for (i = 0; i < 0x200; i++)
+ // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f
+ for (int i = 0; i < 0x200; i++)
{
- int j;
-
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- uint8_t ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
}
}
diff --git a/src/mame/video/jack.cpp b/src/mame/video/jack.cpp
index 745dd151df6..cf79dc5adb0 100644
--- a/src/mame/video/jack.cpp
+++ b/src/mame/video/jack.cpp
@@ -140,28 +140,27 @@ WRITE8_MEMBER(jack_state::joinem_scroll_w)
/**************************************************************************/
-PALETTE_INIT_MEMBER(jack_state,joinem)
+void jack_state::joinem_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
bit0 = (color_prom[i] >> 0) & 0x01;
bit1 = (color_prom[i] >> 1) & 0x01;
bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = (color_prom[i] >> 3) & 0x01;
bit1 = (color_prom[i] >> 4) & 0x01;
bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
bit1 = (color_prom[i] >> 6) & 0x01;
bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/jackal.cpp b/src/mame/video/jackal.cpp
index f40953f0984..a234e847098 100644
--- a/src/mame/video/jackal.cpp
+++ b/src/mame/video/jackal.cpp
@@ -13,26 +13,25 @@
#include "includes/jackal.h"
-PALETTE_INIT_MEMBER(jackal_state, jackal)
+void jackal_state::jackal_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint16_t ctabentry = i | 0x100;
+ uint16_t const ctabentry = i | 0x100;
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x100; i < 0x200; i++)
+ for (int i = 0x100; i < 0x200; i++)
{
- uint16_t ctabentry = color_prom[i - 0x100] & 0x0f;
+ uint16_t const ctabentry = color_prom[i - 0x100] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x200; i < 0x300; i++)
+ for (int i = 0x200; i < 0x300; i++)
{
- uint16_t ctabentry = (color_prom[i - 0x100] & 0x0f) | 0x10;
+ uint16_t const ctabentry = (color_prom[i - 0x100] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/jailbrek.cpp b/src/mame/video/jailbrek.cpp
index 70aea04dc40..943c34629fa 100644
--- a/src/mame/video/jailbrek.cpp
+++ b/src/mame/video/jailbrek.cpp
@@ -3,33 +3,32 @@
#include "emu.h"
#include "includes/jailbrek.h"
-PALETTE_INIT_MEMBER(jailbrek_state, jailbrek)
+void jailbrek_state::jailbrek_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
- int r = pal4bit(color_prom[i + 0x00] >> 0);
- int g = pal4bit(color_prom[i + 0x00] >> 4);
- int b = pal4bit(color_prom[i + 0x20] >> 0);
+ int const r = pal4bit(color_prom[i + 0x00] >> 0);
+ int const g = pal4bit(color_prom[i + 0x00] >> 4);
+ int const b = pal4bit(color_prom[i + 0x20] >> 0);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x40;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x100; i < 0x200; i++)
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/k1ge.cpp b/src/mame/video/k1ge.cpp
index 3c24f92264b..6ad542616e5 100644
--- a/src/mame/video/k1ge.cpp
+++ b/src/mame/video/k1ge.cpp
@@ -14,30 +14,26 @@
#include "screen.h"
-PALETTE_INIT_MEMBER(k1ge_device, k1ge)
+void k1ge_device::k1ge_palette(palette_device &palette) const
{
- int i;
-
- for ( i = 0; i < 8; i++ )
+ for (int i = 0; i < 8; i++)
{
- int j = ( i << 5 ) | ( i << 2 ) | ( i >> 1 );
+ int const j = pal3bit(i);
- palette.set_pen_color( 7-i, j, j, j );
+ palette.set_pen_color(7 - i, j, j, j);
}
}
-PALETTE_INIT_MEMBER(k2ge_device, k2ge)
+void k2ge_device::k2ge_palette(palette_device &palette) const
{
- int r,g,b;
-
- for ( b = 0; b < 16; b++ )
+ for (int b = 0; b < 16; b++ )
{
- for ( g = 0; g < 16; g++ )
+ for (int g = 0; g < 16; g++ )
{
- for ( r = 0; r < 16; r++ )
+ for (int r = 0; r < 16; r++ )
{
- palette.set_pen_color( ( b << 8 ) | ( g << 4 ) | r, ( r << 4 ) | r, ( g << 4 ) | g, ( b << 4 ) | b );
+ palette.set_pen_color((b << 8) | (g << 4) | r, (r << 4) | r, (g << 4) | g, (b << 4) | b);
}
}
}
@@ -882,10 +878,10 @@ k1ge_device::k1ge_device(const machine_config &mconfig, device_type type, const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(k1ge_device::device_add_mconfig)
- MCFG_PALETTE_ADD("palette", 8 )
- MCFG_PALETTE_INIT_OWNER(k1ge_device, k1ge)
-MACHINE_CONFIG_END
+void k1ge_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, "palette", FUNC(k1ge_device::k1ge_palette), 8);
+}
DEFINE_DEVICE_TYPE(K2GE, k2ge_device, "k2ge", "K2GE Color Graphics + LCD")
@@ -899,7 +895,7 @@ k2ge_device::k2ge_device(const machine_config &mconfig, const char *tag, device_
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(k2ge_device::device_add_mconfig)
- MCFG_PALETTE_ADD("palette", 4096 )
- MCFG_PALETTE_INIT_OWNER(k2ge_device, k2ge)
-MACHINE_CONFIG_END
+void k2ge_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, "palette", FUNC(k2ge_device::k2ge_palette), 4096);
+}
diff --git a/src/mame/video/k1ge.h b/src/mame/video/k1ge.h
index de314b98d9a..5af21e4bc85 100644
--- a/src/mame/video/k1ge.h
+++ b/src/mame/video/k1ge.h
@@ -61,7 +61,7 @@ protected:
TIMER_CALLBACK_MEMBER( timer_callback );
private:
- DECLARE_PALETTE_INIT(k1ge);
+ void k1ge_palette(palette_device &palette) const;
};
@@ -88,7 +88,7 @@ protected:
void k1ge_draw_sprite_plane( uint16_t *p, uint16_t priority, int line, int scroll_x, int scroll_y );
private:
- DECLARE_PALETTE_INIT(k2ge);
+ void k2ge_palette(palette_device &palette) const;
};
DECLARE_DEVICE_TYPE(K1GE, k1ge_device)
diff --git a/src/mame/video/kaneko16.cpp b/src/mame/video/kaneko16.cpp
index 20fefcb1f56..f5c33626e22 100644
--- a/src/mame/video/kaneko16.cpp
+++ b/src/mame/video/kaneko16.cpp
@@ -102,17 +102,6 @@ uint32_t kaneko16_state::screen_update_kaneko16(screen_device &screen, bitmap_in
/* Berlwall and Gals Panic have an additional hi-color layers */
-PALETTE_INIT_MEMBER(kaneko16_berlwall_state,berlwall)
-{
- int i;
-
- /* first 2048 colors are dynamic */
-
- /* initialize 555 RGB lookup */
- for (i = 0; i < 32768; i++)
- palette.set_pen_color(i,pal5bit(i >> 5),pal5bit(i >> 10),pal5bit(i >> 0));
-}
-
VIDEO_START_MEMBER(kaneko16_berlwall_state,berlwall)
{
uint8_t *RAM = memregion("gfx3")->base();
diff --git a/src/mame/video/kaypro.cpp b/src/mame/video/kaypro.cpp
index 86ca79a7506..95a542532d2 100644
--- a/src/mame/video/kaypro.cpp
+++ b/src/mame/video/kaypro.cpp
@@ -13,11 +13,11 @@
************************************************************/
-PALETTE_INIT_MEMBER(kaypro_state,kaypro)
+void kaypro_state::kaypro_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
- palette.set_pen_color(1, rgb_t(0, 220, 0)); /* green */
- palette.set_pen_color(2, rgb_t(0, 110, 0)); /* low intensity green */
+ palette.set_pen_color(1, rgb_t(0, 220, 0)); // green
+ palette.set_pen_color(2, rgb_t(0, 110, 0)); // low intensity green
}
uint32_t kaypro_state::screen_update_kayproii(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/video/kc.cpp b/src/mame/video/kc.cpp
index 7371c8513af..52b37fbbe3b 100644
--- a/src/mame/video/kc.cpp
+++ b/src/mame/video/kc.cpp
@@ -15,45 +15,44 @@
// 3 bit colour value. bit 2->green, bit 1->red, bit 0->blue
-static const uint8_t kc85_palette[KC85_PALETTE_SIZE * 3] =
+static constexpr rgb_t kc85_pens[KC85_PALETTE_SIZE] =
{
// foreground colours, "full" of each component
- 0x00, 0x00, 0x00, // black
- 0x00, 0x00, 0xd0, // blue
- 0xd0, 0x00, 0x00, // red
- 0xd0, 0x00, 0xd0, // magenta
- 0x00, 0xd0, 0x00, // green
- 0x00, 0xd0, 0xd0, // cyan
- 0xd0, 0xd0, 0x00, // yellow
- 0xd0, 0xd0, 0xd0, // white
+ { 0x00, 0x00, 0x00 }, // black
+ { 0x00, 0x00, 0xd0 }, // blue
+ { 0xd0, 0x00, 0x00 }, // red
+ { 0xd0, 0x00, 0xd0 }, // magenta
+ { 0x00, 0xd0, 0x00 }, // green
+ { 0x00, 0xd0, 0xd0 }, // cyan
+ { 0xd0, 0xd0, 0x00 }, // yellow
+ { 0xd0, 0xd0, 0xd0 }, // white
// full of each component + half of another component
- 0x00, 0x00, 0x00, // black
- 0x60, 0x00, 0xa0, // violet
- 0xa0, 0x60, 0x00, // brown
- 0xa0, 0x00, 0x60, // red/purple
- 0x00, 0xa0, 0x60, // pastel green
- 0x00, 0x60, 0xa0, // sky blue
- 0xa0, 0xa0, 0x60, // yellow/green
- 0xd0, 0xd0, 0xd0, // white
+ { 0x00, 0x00, 0x00 }, // black
+ { 0x60, 0x00, 0xa0 }, // violet
+ { 0xa0, 0x60, 0x00 }, // brown
+ { 0xa0, 0x00, 0x60 }, // red/purple
+ { 0x00, 0xa0, 0x60 }, // pastel green
+ { 0x00, 0x60, 0xa0 }, // sky blue
+ { 0xa0, 0xa0, 0x60 }, // yellow/green
+ { 0xd0, 0xd0, 0xd0 }, // white
// background colours are slightly darker than foreground colours
- 0x00, 0x00, 0x00, // black
- 0x00, 0x00, 0xa0, // dark blue
- 0xa0, 0x00, 0x00, // dark red
- 0xa0, 0x00, 0xa0, // dark magenta
- 0x00, 0xa0, 0x00, // dark green
- 0x00, 0xa0, 0xa0, // dark cyan
- 0xa0, 0xa0, 0x00, // dark yellow
- 0xa0, 0xa0, 0xa0 // dark white (grey)
+ { 0x00, 0x00, 0x00 }, // black
+ { 0x00, 0x00, 0xa0 }, // dark blue
+ { 0xa0, 0x00, 0x00 }, // dark red
+ { 0xa0, 0x00, 0xa0 }, // dark magenta
+ { 0x00, 0xa0, 0x00 }, // dark green
+ { 0x00, 0xa0, 0xa0 }, // dark cyan
+ { 0xa0, 0xa0, 0x00 }, // dark yellow
+ { 0xa0, 0xa0, 0xa0 } // dark white (grey)
};
-/* Initialise the palette */
-PALETTE_INIT_MEMBER(kc_state,kc85)
+// Initialise the palette
+void kc_state::kc85_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(kc85_palette) / 3; i++ )
- palette.set_pen_color(i, kc85_palette[i*3], kc85_palette[i*3+1], kc85_palette[i*3+2]);
+ palette.set_pen_colors(0, kc85_pens);
}
/* set new blink state */
diff --git a/src/mame/video/kchamp.cpp b/src/mame/video/kchamp.cpp
index 2e3e608627e..c1590075173 100644
--- a/src/mame/video/kchamp.cpp
+++ b/src/mame/video/kchamp.cpp
@@ -12,16 +12,14 @@
#include "includes/kchamp.h"
-PALETTE_INIT_MEMBER(kchamp_state, kchamp)
+void kchamp_state::kchamp_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, red, green, blue;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- red = color_prom[i];
- green = color_prom[palette.entries() + i];
- blue = color_prom[2 * palette.entries() + i];
+ int const red = color_prom[i];
+ int const green = color_prom[palette.entries() + i];
+ int const blue = color_prom[2 * palette.entries() + i];
palette.set_pen_color(i, pal4bit(red), pal4bit(green), pal4bit(blue));
}
diff --git a/src/mame/video/kingobox.cpp b/src/mame/video/kingobox.cpp
index 9a81d46f9d1..a4a10cbda46 100644
--- a/src/mame/video/kingobox.cpp
+++ b/src/mame/video/kingobox.cpp
@@ -104,7 +104,7 @@ void kingofb_state::palette_init_common( palette_device &palette, const uint8_t
}
-void kingofb_state::kingofb_get_rgb_data( const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data )
+void kingofb_state::kingofb_get_rgb_data(const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data)
{
*r_data = color_prom[i + 0x000] & 0x0f;
*g_data = color_prom[i + 0x100] & 0x0f;
@@ -112,7 +112,7 @@ void kingofb_state::kingofb_get_rgb_data( const uint8_t *color_prom, int i, int
}
-void kingofb_state::ringking_get_rgb_data( const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data )
+void kingofb_state::ringking_get_rgb_data(const uint8_t *color_prom, int i, int *r_data, int *g_data, int *b_data)
{
*r_data = (color_prom[i + 0x000] >> 4) & 0x0f;
*g_data = (color_prom[i + 0x000] >> 0) & 0x0f;
@@ -120,13 +120,13 @@ void kingofb_state::ringking_get_rgb_data( const uint8_t *color_prom, int i, int
}
-PALETTE_INIT_MEMBER(kingofb_state,kingofb)
+void kingofb_state::kingofb_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
palette_init_common(palette, color_prom, &kingofb_state::kingofb_get_rgb_data);
}
-PALETTE_INIT_MEMBER(kingofb_state,ringking)
+void kingofb_state::ringking_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
palette_init_common(palette, color_prom, &kingofb_state::ringking_get_rgb_data);
diff --git a/src/mame/video/kncljoe.cpp b/src/mame/video/kncljoe.cpp
index 8fbd2c256a4..a8fd628aea9 100644
--- a/src/mame/video/kncljoe.cpp
+++ b/src/mame/video/kncljoe.cpp
@@ -16,59 +16,57 @@ Knuckle Joe - (c) 1985 Taito Corporation
***************************************************************************/
-PALETTE_INIT_MEMBER(kncljoe_state, kncljoe)
+void kncljoe_state::kncljoe_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x80; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x80; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0x80; i < 0x90; i++)
+ for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[(i - 0x80) + 0x300] >> 6) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x300] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[(i - 0x80) + 0x300] >> 3) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x300] >> 4) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x300] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[(i - 0x80) + 0x300] >> 0) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x300] >> 1) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x300] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
+ bit1 = BIT(color_prom[i + 0x300], 6);
+ bit2 = BIT(color_prom[i + 0x300], 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i + 0x300], 3);
+ bit1 = BIT(color_prom[i + 0x300], 4);
+ bit2 = BIT(color_prom[i + 0x300], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x300], 0);
+ bit1 = BIT(color_prom[i + 0x300], 1);
+ bit2 = BIT(color_prom[i + 0x300], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_indirect_color(i + 0x80, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x320;
- /* chars */
- for (i = 0; i < 0x80; i++)
+ // chars
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i, i);
- /* sprite lookup table */
- for (i = 0x80; i < 0x100; i++)
+ // sprite lookup table
+ for (int i = 0; i < 0x80; i++)
{
- uint8_t ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80;
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x80;
+ palette.set_pen_indirect(i + 0x80, ctabentry);
}
}
diff --git a/src/mame/video/kopunch.cpp b/src/mame/video/kopunch.cpp
index 50538bfc934..15479271459 100644
--- a/src/mame/video/kopunch.cpp
+++ b/src/mame/video/kopunch.cpp
@@ -12,7 +12,7 @@
#include "includes/kopunch.h"
-PALETTE_INIT_MEMBER(kopunch_state, kopunch)
+void kopunch_state::kopunch_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -20,23 +20,23 @@ PALETTE_INIT_MEMBER(kopunch_state, kopunch)
for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
diff --git a/src/mame/video/ksayakyu.cpp b/src/mame/video/ksayakyu.cpp
index d89b17ba725..dd070aa039d 100644
--- a/src/mame/video/ksayakyu.cpp
+++ b/src/mame/video/ksayakyu.cpp
@@ -32,16 +32,15 @@ WRITE8_MEMBER(ksayakyu_state::ksayakyu_videoctrl_w)
m_tilemap->set_flip((data & 2) ? TILEMAP_FLIPX : 0);
}
-PALETTE_INIT_MEMBER(ksayakyu_state, ksayakyu)
+void ksayakyu_state::ksayakyu_palette(palette_device &palette) const
{
- const uint8_t *prom = memregion("proms")->base();
- int r, g, b, i;
+ uint8_t const *const prom = memregion("proms")->base();
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- r = (prom[i] & 0x07) >> 0;
- g = (prom[i] & 0x38) >> 3;
- b = (prom[i] & 0xc0) >> 6;
+ int const r = (prom[i] >> 0) & 0x07;
+ int const g = (prom[i] >> 3) & 0x07;
+ int const b = (prom[i] >> 6) & 0x03;
palette.set_pen_color(i, pal3bit(r), pal3bit(g), pal2bit(b));
}
diff --git a/src/mame/video/kyocera.cpp b/src/mame/video/kyocera.cpp
index ba34a0a5e84..eb0659c0683 100644
--- a/src/mame/video/kyocera.cpp
+++ b/src/mame/video/kyocera.cpp
@@ -6,13 +6,13 @@
#include "screen.h"
-PALETTE_INIT_MEMBER(kc85_state,kc85)
+void kc85_state::kc85_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
}
-PALETTE_INIT_MEMBER(tandy200_state,tandy200)
+void tandy200_state::tandy200_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(138, 146, 148));
palette.set_pen_color(1, rgb_t(92, 83, 88));
@@ -55,8 +55,7 @@ MACHINE_CONFIG_START(kc85_state::kc85_video)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 64-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(kc85_state,kc85)
+ PALETTE(config, "palette", FUNC(kc85_state::kc85_palette), 2);
MCFG_HD44102_ADD(HD44102_0_TAG, SCREEN_TAG, 0, 0)
MCFG_HD44102_ADD(HD44102_1_TAG, SCREEN_TAG, 50, 0)
@@ -81,8 +80,7 @@ MACHINE_CONFIG_START(tandy200_state::tandy200_video)
MCFG_SCREEN_VISIBLE_AREA(0, 240-1, 0, 128-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(tandy200_state,tandy200)
+ PALETTE(config, "palette", FUNC(tandy200_state::tandy200_palette), 2);
MCFG_DEVICE_ADD(HD61830_TAG, HD61830, XTAL(4'915'200)/2/2)
MCFG_DEVICE_ADDRESS_MAP(0, tandy200_lcdc)
diff --git a/src/mame/video/labyrunr.cpp b/src/mame/video/labyrunr.cpp
index 61c2602a11a..c8017a5ed42 100644
--- a/src/mame/video/labyrunr.cpp
+++ b/src/mame/video/labyrunr.cpp
@@ -4,34 +4,24 @@
#include "includes/labyrunr.h"
-PALETTE_INIT_MEMBER(labyrunr_state, labyrunr)
+void labyrunr_state::labyrunr_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int pal;
- for (pal = 0; pal < 8; pal++)
+ for (int pal = 0; pal < 8; pal++)
{
- /* chars, no lookup table */
if (pal & 1)
{
- int i;
-
- for (i = 0; i < 0x100; i++)
+ // chars, no lookup table
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect((pal << 8) | i, (pal << 4) | (i & 0x0f));
}
- /* sprites */
else
{
- int i;
-
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
-
- if (color_prom[i] == 0)
- ctabentry = 0;
- else
- ctabentry = (pal << 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = !color_prom[i] ? 0 : ((pal << 4) | (color_prom[i] & 0x0f));
palette.set_pen_indirect((pal << 8) | i, ctabentry);
}
diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp
index ddb0f709924..b6b0c4f5878 100644
--- a/src/mame/video/ladybug.cpp
+++ b/src/mame/video/ladybug.cpp
@@ -275,68 +275,65 @@ void zerohour_stars_device::device_reset()
void ladybug_base_state::palette_init_common(palette_device &palette, const uint8_t *color_prom,
int r_bit0, int r_bit1, int g_bit0, int g_bit1, int b_bit0, int b_bit1) const
{
- static const int resistances[2] = { 470, 220 };
- double rweights[2], gweights[2], bweights[2];
- int i;
+ static constexpr int resistances[2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[2], gweights[2], bweights[2];
compute_resistor_weights(0, 255, -1.0,
2, resistances, rweights, 470, 0,
2, resistances, gweights, 470, 0,
2, resistances, bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = (~color_prom[i] >> r_bit0) & 0x01;
- bit1 = (~color_prom[i] >> r_bit1) & 0x01;
- r = combine_2_weights(rweights, bit0, bit1);
+ // red component
+ bit0 = BIT(~color_prom[i], r_bit0);
+ bit1 = BIT(~color_prom[i], r_bit1);
+ int const r = combine_2_weights(rweights, bit0, bit1);
- /* green component */
- bit0 = (~color_prom[i] >> g_bit0) & 0x01;
- bit1 = (~color_prom[i] >> g_bit1) & 0x01;
- g = combine_2_weights(gweights, bit0, bit1);
+ // green component
+ bit0 = BIT(~color_prom[i], g_bit0);
+ bit1 = BIT(~color_prom[i], g_bit1);
+ int const g = combine_2_weights(gweights, bit0, bit1);
- /* blue component */
- bit0 = (~color_prom[i] >> b_bit0) & 0x01;
- bit1 = (~color_prom[i] >> b_bit1) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(~color_prom[i], b_bit0);
+ bit1 = BIT(~color_prom[i], b_bit1);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters */
- for (i = 0; i < 0x20; i++)
+ // characters
+ for (int i = 0; i < 0x20; i++)
{
- uint8_t ctabentry = ((i << 3) & 0x18) | ((i >> 2) & 0x07);
+ uint8_t const ctabentry = ((i << 3) & 0x18) | ((i >> 2) & 0x07);
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites */
- for (i = 0x20; i < 0x40; i++)
+ // sprites
+ for (int i = 0; i < 0x20; i++)
{
- uint8_t ctabentry = color_prom[(i - 0x20) >> 1];
+ uint8_t ctabentry;
- ctabentry = bitswap<8>((color_prom[i - 0x20] >> 0) & 0x0f, 7,6,5,4,0,1,2,3);
- palette.set_pen_indirect(i + 0x00, ctabentry);
-
- ctabentry = bitswap<8>((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
+ ctabentry = bitswap<4>((color_prom[i] >> 0) & 0x0f, 0,1,2,3);
palette.set_pen_indirect(i + 0x20, ctabentry);
+
+ ctabentry = bitswap<4>((color_prom[i] >> 4) & 0x0f, 0,1,2,3);
+ palette.set_pen_indirect(i + 0x40, ctabentry);
}
}
-PALETTE_INIT_MEMBER(ladybug_state, ladybug)
+void ladybug_state::ladybug_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- palette_init_common(palette, color_prom, 0, 5, 2, 6, 4, 7);
+ palette_init_common(palette, memregion("proms")->base(), 0, 5, 2, 6, 4, 7);
}
WRITE_LINE_MEMBER(ladybug_state::flipscreen_w)
@@ -356,7 +353,7 @@ uint32_t ladybug_state::screen_update_ladybug(screen_device &screen, bitmap_ind1
}
-PALETTE_INIT_MEMBER(sraider_state, sraider)
+void sraider_state::sraider_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
@@ -364,30 +361,29 @@ PALETTE_INIT_MEMBER(sraider_state, sraider)
palette_init_common(palette, color_prom, 3, 0, 5, 4, 7, 6);
// star colors
- for (int i = 0x20; i < 0x40; i++)
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1;
- int r, g, b;
// red component
- bit0 = ((i - 0x20) >> 3) & 0x01;
- bit1 = ((i - 0x20) >> 4) & 0x01;
- b = 0x47 * bit0 + 0x97 * bit1;
+ bit0 = BIT(i, 3);
+ bit1 = BIT(i, 4);
+ int const b = 0x47 * bit0 + 0x97 * bit1;
// green component
- bit0 = ((i - 0x20) >> 1) & 0x01;
- bit1 = ((i - 0x20) >> 2) & 0x01;
- g = 0x47 * bit0 + 0x97 * bit1;
+ bit0 = BIT(i, 1);
+ bit1 = BIT(i, 2);
+ int const g = 0x47 * bit0 + 0x97 * bit1;
// blue component
- bit0 = ((i - 0x20) >> 0) & 0x01;
- r = 0x47 * bit0;
+ bit0 = BIT(i, 0);
+ int const r = 0x47 * bit0;
- palette.set_indirect_color(i, rgb_t(r, g, b));
+ palette.set_indirect_color(i + 0x20, rgb_t(r, g, b));
}
- for (int i = 0x60; i < 0x80; i++)
- palette.set_pen_indirect(i, (i - 0x60) + 0x20);
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i + 0x60, i + 0x20);
// stationary part of grid
palette.set_pen_indirect(0x81, 0x40);
diff --git a/src/mame/video/laserbat.cpp b/src/mame/video/laserbat.cpp
index 2c6ed3fcb37..c13e900cdd6 100644
--- a/src/mame/video/laserbat.cpp
+++ b/src/mame/video/laserbat.cpp
@@ -74,9 +74,9 @@
and sprites is right, judging from gameplay. I'm not sure about
alignment with the effect layers.
- There are definitely alignment problems with the PVI opjects, but
+ There are definitely alignment problems with the PVI objects, but
that may be a bug in the S2636 implementation. I need to check it
- more detail
+ in more detail.
*/
#include "emu.h"
@@ -326,7 +326,7 @@ TIMER_CALLBACK_MEMBER(laserbat_state_base::video_line)
}
-PALETTE_INIT_MEMBER(laserbat_state, laserbat)
+void laserbat_state::laserbat_palette(palette_device &palette) const
{
/*
Uses GRBGRBGR pixel format. The two topmost bist are the LSBs
@@ -378,7 +378,7 @@ PALETTE_INIT_MEMBER(laserbat_state, laserbat)
}
-PALETTE_INIT_MEMBER(catnmous_state, catnmous)
+void catnmous_state::catnmous_palette(palette_device &palette) const
{
/*
Uses GRBGRBGR pixel format. The two topmost bist are the LSBs
diff --git a/src/mame/video/lasso.cpp b/src/mame/video/lasso.cpp
index ab49ebd86da..7a083823229 100644
--- a/src/mame/video/lasso.cpp
+++ b/src/mame/video/lasso.cpp
@@ -40,76 +40,65 @@
***************************************************************************/
-rgb_t lasso_state::get_color( int data )
+rgb_t lasso_state::get_color(int data)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (data >> 0) & 0x01;
- bit1 = (data >> 1) & 0x01;
- bit2 = (data >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(data, 0);
+ bit1 = BIT(data, 1);
+ bit2 = BIT(data, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (data >> 3) & 0x01;
- bit1 = (data >> 4) & 0x01;
- bit2 = (data >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(data, 3);
+ bit1 = BIT(data, 4);
+ bit2 = BIT(data, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (data >> 6) & 0x01;
- bit1 = (data >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
+ // blue component
+ bit0 = BIT(data, 6);
+ bit1 = BIT(data, 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
return rgb_t(r, g, b);
}
-PALETTE_INIT_MEMBER(lasso_state, lasso)
+void lasso_state::lasso_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x40; i++)
+ for (int i = 0; i < 0x40; i++)
palette.set_pen_color(i, get_color(color_prom[i]));
}
-PALETTE_INIT_MEMBER(lasso_state,wwjgtin)
+void lasso_state::wwjgtin_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x40; i++)
+ for (int i = 0; i < 0x40; i++)
palette.set_indirect_color(i, get_color(color_prom[i]));
- /* characters/sprites */
- for (i = 0; i < 0x40; i++)
+ // characters/sprites
+ for (int i = 0; i < 0x40; i++)
palette.set_pen_indirect(i, i);
- /* track */
- for (i = 0x40; i < 0x140; i++)
+ // track
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
- int raw_pen = i - 0x40;
+ uint8_t const ctabentry = (i & 0x03) ? ((((i & 0xf0) >> 2) + (i & 0x03)) & 0x3f) : 0;
- if (raw_pen & 0x03)
- ctabentry = (((raw_pen & 0xf0) >> 2) + (raw_pen & 0x03)) & 0x3f;
- else
- ctabentry = 0;
-
- palette.set_pen_indirect(i, ctabentry);
+ palette.set_pen_indirect(i + 0x40, ctabentry);
}
}
void lasso_state::wwjgtin_set_last_four_colors()
{
- int i;
-
- /* the last palette entries can be changed */
- for(i = 0; i < 3; i++)
+ // the last palette entries can be changed
+ for (int i = 0; i < 3; i++)
m_palette->set_indirect_color(0x3d + i, get_color(m_last_colors[i]));
}
diff --git a/src/mame/video/lastduel.cpp b/src/mame/video/lastduel.cpp
index a1e0cd67c5f..3410c948120 100644
--- a/src/mame/video/lastduel.cpp
+++ b/src/mame/video/lastduel.cpp
@@ -146,7 +146,7 @@ WRITE16_MEMBER(lastduel_state::txram_w)
m_tx_tilemap->mark_tile_dirty(offset);
}
-PALETTE_DECODER_MEMBER(lastduel_state, lastduel_RRRRGGGGBBBBIIII)
+rgb_t lastduel_state::lastduel_RRRRGGGGBBBBIIII(uint32_t raw)
{
// Brightness parameter interpreted same way as CPS1
int const bright = 0x10 + (raw & 0x0f);
diff --git a/src/mame/video/leland.cpp b/src/mame/video/leland.cpp
index 6408f1d1d9d..6d5b817d4c6 100644
--- a/src/mame/video/leland.cpp
+++ b/src/mame/video/leland.cpp
@@ -513,8 +513,7 @@ GFXDECODE_END
MACHINE_CONFIG_START(leland_state::leland_video)
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_leland)
- MCFG_PALETTE_ADD("palette", 1024)
- MCFG_PALETTE_FORMAT(BBGGGRRR)
+ PALETTE(config, m_palette).set_format(palette_device::BGR_233, 1024);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE)
@@ -522,13 +521,12 @@ MACHINE_CONFIG_START(leland_state::leland_video)
MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 30*8-1)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_UPDATE_DRIVER(leland_state, screen_update)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
MACHINE_CONFIG_END
MACHINE_CONFIG_START(ataxx_state::ataxx_video)
leland_video(config);
MCFG_DEVICE_REPLACE("gfxdecode", GFXDECODE, "palette", gfx_ataxx)
- MCFG_PALETTE_MODIFY("palette")
- MCFG_PALETTE_FORMAT(xxxxRRRRGGGGBBBB)
+ m_palette->set_format(palette_device::xRGB_444, 1024);
MACHINE_CONFIG_END
diff --git a/src/mame/video/liberate.cpp b/src/mame/video/liberate.cpp
index 618d0f29f81..35b1fbf6f57 100644
--- a/src/mame/video/liberate.cpp
+++ b/src/mame/video/liberate.cpp
@@ -243,35 +243,35 @@ VIDEO_START_MEMBER(liberate_state,prosport)
/***************************************************************************/
-PALETTE_INIT_MEMBER(liberate_state,liberate)
+void liberate_state::liberate_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i, bit0, bit1, bit2, g, r, b;
-
- for (i = 0;i < 32;i++)
+ for (int i = 0; i < 32; i++)
{
- /* red component */
+ int bit0, bit1, bit2;
+
+ // red component
bit0 = (*color_prom >> 0) & 0x01;
bit1 = (*color_prom >> 1) & 0x01;
bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = (*color_prom >> 3) & 0x01;
bit1 = (*color_prom >> 4) & 0x01;
bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = (*color_prom >> 6) & 0x01;
bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
color_prom++;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
- palette.set_pen_color(32,rgb_t(0,0,0)); /* Allocate black for when no background is displayed */
+ palette.set_pen_color(32, rgb_t::black()); // Allocate black for when no background is displayed
}
/***************************************************************************/
diff --git a/src/mame/video/lockon.cpp b/src/mame/video/lockon.cpp
index ce93ebc96f9..1b8365a4e75 100644
--- a/src/mame/video/lockon.cpp
+++ b/src/mame/video/lockon.cpp
@@ -98,16 +98,15 @@ static const res_net_info lockon_pd_net_info =
}
};
-PALETTE_INIT_MEMBER(lockon_state, lockon)
+void lockon_state::lockon_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 1024; ++i)
+ for (int i = 0; i < 1024; ++i)
{
uint8_t r, g, b;
- uint8_t p1 = color_prom[i];
- uint8_t p2 = color_prom[i + 0x400];
+ uint8_t const p1 = color_prom[i];
+ uint8_t const p2 = color_prom[i + 0x400];
if (p2 & 0x80)
{
diff --git a/src/mame/video/lucky74.cpp b/src/mame/video/lucky74.cpp
index 309c71df8ef..b295311e6c2 100644
--- a/src/mame/video/lucky74.cpp
+++ b/src/mame/video/lucky74.cpp
@@ -125,74 +125,70 @@ WRITE8_MEMBER(lucky74_state::lucky74_bg_colorram_w)
}
-PALETTE_INIT_MEMBER(lucky74_state, lucky74)
-/*
- There are 2 states (see the technical notes).
- We're constructing a double-sized palette with one half for each state.
-*/
+void lucky74_state::lucky74_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rgb[4] = { 2000, 1000, 470, 220 };
- double weights_r[4], weights_g[4], weights_b[4];
+ // There are 2 states (see the technical notes).
+ // We're constructing a double-sized palette with one half for each state.
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rgb[4] = { 2000, 1000, 470, 220 };
+ double weights_r[4], weights_g[4], weights_b[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances_rgb, weights_r, 1000, 0,
4, resistances_rgb, weights_g, 1000, 0,
4, resistances_rgb, weights_b, 1000, 0);
-
- for (i = 0; i < 256; i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, bit3, r1, g1, b1, r2, g2, b2;
-
- /* red component (this 1, PROM E6) */
- bit0 = (color_prom[0x000 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x000 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x000 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x000 + i] >> 3) & 0x01;
- r1 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
-
- /* red component (this 2, PROM E7) */
- bit0 = (color_prom[0x100 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x100 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x100 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x100 + i] >> 3) & 0x01;
- r2 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
-
- /* green component (this 1, PROM D6) */
- bit0 = (color_prom[0x200 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x200 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x200 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x200 + i] >> 3) & 0x01;
- g1 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
-
- /* green component (this 2, PROM D7) */
- bit0 = (color_prom[0x300 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x300 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x300 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x300 + i] >> 3) & 0x01;
- g2 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
-
- /* blue component (this 1, PROM C6) */
- bit0 = (color_prom[0x400 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x400 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x400 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x400 + i] >> 3) & 0x01;
- b1 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
-
- /* blue component (this 2, PROM C7) */
- bit0 = (color_prom[0x500 + i] >> 0) & 0x01;
- bit1 = (color_prom[0x500 + i] >> 1) & 0x01;
- bit2 = (color_prom[0x500 + i] >> 2) & 0x01;
- bit3 = (color_prom[0x500 + i] >> 3) & 0x01;
- b2 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
-
-
- /* PROMs circuitry, 1st state */
+ int bit0, bit1, bit2, bit3;
+
+ // red component (this 1, PROM E6)
+ bit0 = BIT(color_prom[0x000 + i], 0);
+ bit1 = BIT(color_prom[0x000 + i], 1);
+ bit2 = BIT(color_prom[0x000 + i], 2);
+ bit3 = BIT(color_prom[0x000 + i], 3);
+ int const r1 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
+
+ // red component (this 2, PROM E7)
+ bit0 = BIT(color_prom[0x100 + i], 0);
+ bit1 = BIT(color_prom[0x100 + i], 1);
+ bit2 = BIT(color_prom[0x100 + i], 2);
+ bit3 = BIT(color_prom[0x100 + i], 3);
+ int const r2 = combine_4_weights(weights_r, bit0, bit1, bit2, bit3);
+
+ // green component (this 1, PROM D6)
+ bit0 = BIT(color_prom[0x200 + i], 0);
+ bit1 = BIT(color_prom[0x200 + i], 1);
+ bit2 = BIT(color_prom[0x200 + i], 2);
+ bit3 = BIT(color_prom[0x200 + i], 3);
+ int const g1 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
+
+ // green component (this 2, PROM D7)
+ bit0 = BIT(color_prom[0x300 + i], 0);
+ bit1 = BIT(color_prom[0x300 + i], 1);
+ bit2 = BIT(color_prom[0x300 + i], 2);
+ bit3 = BIT(color_prom[0x300 + i], 3);
+ int const g2 = combine_4_weights(weights_g, bit0, bit1, bit2, bit3);
+
+ // blue component (this 1, PROM C6)
+ bit0 = BIT(color_prom[0x400 + i], 0);
+ bit1 = BIT(color_prom[0x400 + i], 1);
+ bit2 = BIT(color_prom[0x400 + i], 2);
+ bit3 = BIT(color_prom[0x400 + i], 3);
+ int const b1 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
+
+ // blue component (this 2, PROM C7)
+ bit0 = BIT(color_prom[0x500 + i], 0);
+ bit1 = BIT(color_prom[0x500 + i], 1);
+ bit2 = BIT(color_prom[0x500 + i], 2);
+ bit3 = BIT(color_prom[0x500 + i], 3);
+ int const b2 = combine_4_weights(weights_b, bit0, bit1, bit2, bit3);
+
+
+ // PROMs circuitry, 1st state
palette.set_pen_color(i, rgb_t(r1, g1, b1));
- /* PROMs circuitry, 2nd state */
+ // PROMs circuitry, 2nd state
palette.set_pen_color(i + 256, rgb_t(r2, g2, b2));
}
}
diff --git a/src/mame/video/lvcards.cpp b/src/mame/video/lvcards.cpp
index d1d3200710a..73cd04be87a 100644
--- a/src/mame/video/lvcards.cpp
+++ b/src/mame/video/lvcards.cpp
@@ -12,37 +12,36 @@
#include "includes/lvcards.h"
-PALETTE_INIT_MEMBER(lvcards_state, lvcards)//Ever so slightly different, but different enough.
+void lvcards_state::lvcards_palette(palette_device &palette) const//Ever so slightly different, but different enough.
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for ( i = 0; i < palette.entries(); i++ )
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
+ int bit0, bit1, bit2, bit3;
- /* red component */
+ // red component
bit0 = (color_prom[0] >> 0) & 0x11;
bit1 = (color_prom[0] >> 1) & 0x11;
bit2 = (color_prom[0] >> 2) & 0x11;
bit3 = (color_prom[0] >> 3) & 0x11;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
+ // green component
bit0 = (color_prom[palette.entries()] >> 0) & 0x11;
bit1 = (color_prom[palette.entries()] >> 1) & 0x11;
bit2 = (color_prom[palette.entries()] >> 2) & 0x11;
bit3 = (color_prom[palette.entries()] >> 3) & 0x11;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
- bit0 = (color_prom[2*palette.entries()] >> 0) & 0x11;
- bit1 = (color_prom[2*palette.entries()] >> 1) & 0x11;
- bit2 = (color_prom[2*palette.entries()] >> 2) & 0x11;
- bit3 = (color_prom[2*palette.entries()] >> 3) & 0x11;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
+ bit0 = (color_prom[2 * palette.entries()] >> 0) & 0x11;
+ bit1 = (color_prom[2 * palette.entries()] >> 1) & 0x11;
+ bit2 = (color_prom[2 * palette.entries()] >> 2) & 0x11;
+ bit3 = (color_prom[2 * palette.entries()] >> 3) & 0x11;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
diff --git a/src/mame/video/lviv.cpp b/src/mame/video/lviv.cpp
index 4fa8e63bf05..badba3e4637 100644
--- a/src/mame/video/lviv.cpp
+++ b/src/mame/video/lviv.cpp
@@ -13,25 +13,22 @@
#include "emu.h"
#include "includes/lviv.h"
-const uint8_t lviv_state::s_palette[8*3] =
+const rgb_t lviv_state::s_palette[8] =
{
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0xa4,
- 0x00, 0xa4, 0x00,
- 0x00, 0xa4, 0xa4,
- 0xa4, 0x00, 0x00,
- 0xa4, 0x00, 0xa4,
- 0xa4, 0xa4, 0x00,
- 0xa4, 0xa4, 0xa4
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0xa4 },
+ { 0x00, 0xa4, 0x00 },
+ { 0x00, 0xa4, 0xa4 },
+ { 0xa4, 0x00, 0x00 },
+ { 0xa4, 0x00, 0xa4 },
+ { 0xa4, 0xa4, 0x00 },
+ { 0xa4, 0xa4, 0xa4 }
};
-PALETTE_INIT_MEMBER(lviv_state, lviv)
+void lviv_state::lviv_palette(palette_device &palette) const
{
- for (int i = 0; i < sizeof(s_palette) / 3; i++)
- {
- m_palette->set_pen_color(i, s_palette[i*3], s_palette[i*3+1], s_palette[i*3+2]);
- }
+ palette.set_pen_colors(0, s_palette);
}
diff --git a/src/mame/video/m52.cpp b/src/mame/video/m52.cpp
index 340af4093fc..5d73df8fcd6 100644
--- a/src/mame/video/m52.cpp
+++ b/src/mame/video/m52.cpp
@@ -88,9 +88,9 @@ void m52_state::init_sprite_palette(const int *resistances_3, const int *resista
/* compute palette information for sprites */
compute_resistor_weights(0, 255, scale,
- 2, resistances_2, weights_r, 470, 0,
- 3, resistances_3, weights_g, 470, 0,
- 3, resistances_3, weights_b, 470, 0);
+ 2, resistances_2, weights_r, 470, 0,
+ 3, resistances_3, weights_g, 470, 0,
+ 3, resistances_3, weights_b, 470, 0);
/* sprite palette */
for (int i = 0; i < 32; i++)
diff --git a/src/mame/video/m57.cpp b/src/mame/video/m57.cpp
index d1d64f0d2a7..52abd052a73 100644
--- a/src/mame/video/m57.cpp
+++ b/src/mame/video/m57.cpp
@@ -32,71 +32,69 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(m57_state, m57)
+void m57_state::m57_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* character palette */
- for (i = 0; i < 256; i++)
+ // character palette
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[256] >> 2) & 0x01;
- bit2 = (color_prom[256] >> 3) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[0] >> 3) & 0x01;
- bit1 = (color_prom[256] >> 0) & 0x01;
- bit2 = (color_prom[256] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_indirect_color(i, rgb_t(r,g,b));
+ bit1 = BIT(color_prom[256], 2);
+ bit2 = BIT(color_prom[256], 3);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[0], 3);
+ bit1 = BIT(color_prom[256], 0);
+ bit2 = BIT(color_prom[256], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
palette.set_pen_indirect(i, i);
color_prom++;
}
color_prom += 256;
- /* color_prom now points to the beginning of the sprite palette */
+ // color_prom now points to the beginning of the sprite palette
- /* sprite palette */
- for (i = 0; i < 16; i++)
+ // sprite palette
+ for (int i = 0; i < 16; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- palette.set_indirect_color(i + 256, rgb_t(r,g,b));
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ palette.set_indirect_color(i + 256, rgb_t(r, g, b));
color_prom++;
}
color_prom += 16;
- /* color_prom now points to the beginning of the sprite lookup table */
+ // color_prom now points to the beginning of the sprite lookup table
-
- /* sprite lookup table */
- for (i = 0; i < 32 * 8; i++)
+ // sprite lookup table
+ for (int i = 0; i < 32 * 8; i++)
{
palette.set_pen_indirect(i + 32 * 8, 256 + (~*color_prom & 0x0f));
color_prom++;
diff --git a/src/mame/video/m58.cpp b/src/mame/video/m58.cpp
index 352f57c31c7..55dca247574 100644
--- a/src/mame/video/m58.cpp
+++ b/src/mame/video/m58.cpp
@@ -19,78 +19,77 @@
*
*************************************/
-PALETTE_INIT_MEMBER(m58_state, m58)
+void m58_state::m58_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- const uint8_t *char_lopal = color_prom + 0x000;
- const uint8_t *char_hipal = color_prom + 0x100;
- const uint8_t *sprite_pal = color_prom + 0x200;
- const uint8_t *sprite_table = color_prom + 0x220;
- const uint8_t *radar_lopal = color_prom + 0x320;
- const uint8_t *radar_hipal = color_prom + 0x420;
- static const int resistances_3[3] = { 1000, 470, 220 };
- static const int resistances_2[2] = { 470, 220 };
+ uint8_t const *const color_prom = memregion("proms")->base();
+ uint8_t const *const char_lopal = color_prom + 0x000;
+ uint8_t const *const char_hipal = color_prom + 0x100;
+ uint8_t const *const sprite_pal = color_prom + 0x200;
+ uint8_t const *const sprite_table = color_prom + 0x220;
+ uint8_t const *const radar_lopal = color_prom + 0x320;
+ uint8_t const *const radar_hipal = color_prom + 0x420;
+ static constexpr int resistances_3[3] = { 1000, 470, 220 };
+ static constexpr int resistances_2[2] = { 470, 220 };
double weights_r[3], weights_g[3], weights_b[3], scale;
- int i;
- /* compute palette information for characters/radar */
+ // compute palette information for characters/radar
scale = compute_resistor_weights(0, 255, -1.0,
2, resistances_2, weights_r, 0, 0,
3, resistances_3, weights_g, 0, 0,
3, resistances_3, weights_b, 0, 0);
- /* character palette */
- for (i = 0; i < 256; i++)
+ // character palette
+ for (int i = 0; i < 256; i++)
{
- uint8_t promval = (char_lopal[i] & 0x0f) | (char_hipal[i] << 4);
- int r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
+ uint8_t const promval = (char_lopal[i] & 0x0f) | (char_hipal[i] << 4);
+ int const r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
+ int const g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
+ int const b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
- palette.set_indirect_color(i, rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* radar palette */
- for (i = 0; i < 256; i++)
+ // radar palette
+ for (int i = 0; i < 256; i++)
{
- uint8_t promval = (radar_lopal[i] & 0x0f) | (radar_hipal[i] << 4);
- int r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
+ uint8_t const promval = (radar_lopal[i] & 0x0f) | (radar_hipal[i] << 4);
+ int const r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
+ int const g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
+ int const b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
- palette.set_indirect_color(256+i, rgb_t(r,g,b));
+ palette.set_indirect_color(256 + i, rgb_t(r, g, b));
}
- /* compute palette information for sprites */
+ // compute palette information for sprites
scale = compute_resistor_weights(0, 255, scale,
2, resistances_2, weights_r, 470, 0,
3, resistances_3, weights_g, 470, 0,
3, resistances_3, weights_b, 470, 0);
- /* sprite palette */
- for (i = 0; i < 16; i++)
+ // sprite palette
+ for (int i = 0; i < 16; i++)
{
- uint8_t promval = sprite_pal[i];
- int r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
- int g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
- int b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
+ uint8_t const promval = sprite_pal[i];
+ int const r = combine_2_weights(weights_r, BIT(promval,6), BIT(promval,7));
+ int const g = combine_3_weights(weights_g, BIT(promval,3), BIT(promval,4), BIT(promval,5));
+ int const b = combine_3_weights(weights_b, BIT(promval,0), BIT(promval,1), BIT(promval,2));
- palette.set_indirect_color(256+256+i, rgb_t(r,g,b));
+ palette.set_indirect_color(256 + 256 + i, rgb_t(r, g, b));
}
- /* character lookup table */
- for (i = 0; i < 256; i++)
+ // character lookup table
+ for (int i = 0; i < 256; i++)
palette.set_pen_indirect(i, i);
- /* radar lookup table */
- for (i = 0; i < 256; i++)
- palette.set_pen_indirect(256+i, 256+i);
+ // radar lookup table
+ for (int i = 0; i < 256; i++)
+ palette.set_pen_indirect(256 + i, 256 + i);
- /* sprite lookup table */
- for (i = 0; i < 256; i++)
+ // sprite lookup table
+ for (int i = 0; i < 256; i++)
{
- uint8_t promval = sprite_table[i] & 0x0f;
- palette.set_pen_indirect(256+256+i, 256+256+promval);
+ uint8_t const promval = sprite_table[i] & 0x0f;
+ palette.set_pen_indirect(256 + 256 + i, 256 + 256 + promval);
}
}
diff --git a/src/mame/video/m62.cpp b/src/mame/video/m62.cpp
index e250bd8c1ac..08adb59e029 100644
--- a/src/mame/video/m62.cpp
+++ b/src/mame/video/m62.cpp
@@ -175,21 +175,21 @@ void m62_state::m62_amplify_contrast(bool include_fg)
}
}
-PALETTE_INIT_MEMBER(m62_state, m62_spr)
+void m62_state::m62_spr(palette_device &palette) const
{
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, m_sprite_color_proms, m62_decode_info, m62_sprite_net_info);
palette.set_pen_colors(0x000, rgb);
}
-PALETTE_INIT_MEMBER(m62_state, m62_chr)
+void m62_state::m62_chr(palette_device &palette) const
{
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, m_chr_color_proms, m62_decode_info, m62_tile_net_info);
palette.set_pen_colors(0x000, rgb);
}
-PALETTE_INIT_MEMBER(m62_state, m62_lotlot_fg)
+void m62_state::m62_lotlot_fg(palette_device &palette) const
{
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, m_fg_color_proms, m62_decode_info, m62_tile_net_info);
@@ -197,7 +197,7 @@ PALETTE_INIT_MEMBER(m62_state, m62_lotlot_fg)
}
-PALETTE_INIT_MEMBER(m62_state,m62_battroad_fg)
+void m62_state::m62_battroad_fg(palette_device &palette) const
{
// custom palette for foreground
std::vector<rgb_t> rgb;
@@ -206,7 +206,7 @@ PALETTE_INIT_MEMBER(m62_state,m62_battroad_fg)
}
-PALETTE_INIT_MEMBER(m62_state,spelunk2)
+void m62_state::spelunk2_palette(palette_device &palette) const
{
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, m_chr_color_proms, spelunk2_tile_decode_info, m62_tile_net_info);
@@ -214,7 +214,7 @@ PALETTE_INIT_MEMBER(m62_state,spelunk2)
}
-void m62_state::register_savestate( )
+void m62_state::register_savestate()
{
save_item(NAME(m_flipscreen));
save_item(NAME(m_m62_background_hscroll));
diff --git a/src/mame/video/mac.cpp b/src/mame/video/mac.cpp
index 0b354c7dfba..ea9dbc1f132 100644
--- a/src/mame/video/mac.cpp
+++ b/src/mame/video/mac.cpp
@@ -59,14 +59,8 @@ Apple color FPD 01 11 10 (FPD = Full Page Display)
#include "machine/ram.h"
#include "render.h"
-void mac_state::palette_init_mac(palette_device &palette)
-{
- palette.set_pen_color(0, 0xff, 0xff, 0xff);
- palette.set_pen_color(1, 0x00, 0x00, 0x00);
-}
-
// 4-level grayscale
-void mac_state::palette_init_macgsc(palette_device &palette)
+void mac_state::macgsc_palette(palette_device &palette) const
{
palette.set_pen_color(0, 0xff, 0xff, 0xff);
palette.set_pen_color(1, 0x7f, 0x7f, 0x7f);
diff --git a/src/mame/video/madalien.cpp b/src/mame/video/madalien.cpp
index 152efa864e6..fa699674374 100644
--- a/src/mame/video/madalien.cpp
+++ b/src/mame/video/madalien.cpp
@@ -17,12 +17,11 @@
#define PIXEL_CLOCK (MADALIEN_MAIN_CLOCK / 2)
-PALETTE_INIT_MEMBER(madalien_state,madalien)
+void madalien_state::madalien_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x20; i++)
+ for (int i = 0; i < 0x20; i++)
{
int r = 0;
int g = 0;
@@ -44,10 +43,10 @@ PALETTE_INIT_MEMBER(madalien_state,madalien)
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0; i < 0x10; i++)
+ for (int i = 0; i < 0x10; i++)
palette.set_pen_indirect(i, i);
- for (i = 0x10; i < 0x20; i++)
+ for (int i = 0x10; i < 0x20; i++)
{
uint8_t ctabentry = i - 0x10;
@@ -60,7 +59,7 @@ PALETTE_INIT_MEMBER(madalien_state,madalien)
palette.set_pen_indirect(i, ctabentry);
}
- for (i = 0x20; i < 0x30; i++)
+ for (int i = 0x20; i < 0x30; i++)
palette.set_pen_indirect(i, (i - 0x20) | 0x10);
}
@@ -369,12 +368,10 @@ MACHINE_CONFIG_START(madalien_state::madalien_video)
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, 336, 0, 256, 288, 0, 256)
MCFG_SCREEN_UPDATE_DRIVER(madalien_state, screen_update_madalien)
- MCFG_SCREEN_PALETTE("palette")
+ MCFG_SCREEN_PALETTE(m_palette)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_madalien)
- MCFG_PALETTE_ADD("palette", 0x30)
- MCFG_PALETTE_INDIRECT_ENTRIES(0x20)
- MCFG_PALETTE_INIT_OWNER(madalien_state,madalien)
+ MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, m_palette, gfx_madalien)
+ PALETTE(config, m_palette, FUNC(madalien_state::madalien_palette), 0x30, 0x20);
MCFG_VIDEO_START_OVERRIDE(madalien_state,madalien)
mc6845_device &crtc(MC6845(config, "crtc", PIXEL_CLOCK / 8));
diff --git a/src/mame/video/magmax.cpp b/src/mame/video/magmax.cpp
index d3a04f03441..06d8643b448 100644
--- a/src/mame/video/magmax.cpp
+++ b/src/mame/video/magmax.cpp
@@ -26,37 +26,37 @@ Additional tweaking by Jarek Burczynski
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
-PALETTE_INIT_MEMBER(magmax_state, magmax)
+void magmax_state::magmax_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
+ // create a lookup table for the palette
for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0-0x0f */
+ // characters use colors 0-0x0f
for (int i = 0; i < 0x10; i++)
palette.set_pen_indirect(i, i);
- /*sprites use colors 0x10-0x1f, color 0x1f being transparent*/
- for (int i = 0x10; i < 0x110; i++)
+ // sprites use colors 0x10-0x1f, color 0x1f being transparen
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i - 0x10] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i + 0x10, ctabentry);
}
- /* background uses all colors (no lookup table) */
- for (int i = 0x110; i < 0x210; i++)
- palette.set_pen_indirect(i, i - 0x110);
+ // background uses all colors (no lookup table)
+ for (int i = 0; i < 0x100; i++)
+ palette.set_pen_indirect(i + 0x110, i);
}
diff --git a/src/mame/video/mainsnk.cpp b/src/mame/video/mainsnk.cpp
index ee9b93eee52..3d7e4344013 100644
--- a/src/mame/video/mainsnk.cpp
+++ b/src/mame/video/mainsnk.cpp
@@ -4,35 +4,34 @@
#include "includes/mainsnk.h"
-PALETTE_INIT_MEMBER(mainsnk_state, mainsnk)
+void mainsnk_state::mainsnk_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int num_colors = 0x400;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ constexpr int num_colors = 0x400;
- for( i=0; i<num_colors; i++ )
+ for (int i = 0; i < num_colors; i++)
{
- int bit0=0,bit1,bit2,bit3,r,g,b;
-
- bit0 = (color_prom[i + 2*num_colors] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[i + 2*num_colors] >> 2) & 0x01;
- bit1 = (color_prom[i + num_colors] >> 2) & 0x01;
- bit2 = (color_prom[i + num_colors] >> 3) & 0x01;
- bit3 = (color_prom[i] >> 0) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[i + 2*num_colors] >> 0) & 0x01;
- bit1 = (color_prom[i + 2*num_colors] >> 1) & 0x01;
- bit2 = (color_prom[i + num_colors] >> 0) & 0x01;
- bit3 = (color_prom[i + num_colors] >> 1) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 3);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 2);
+ bit1 = BIT(color_prom[i + num_colors], 2);
+ bit2 = BIT(color_prom[i + num_colors], 3);
+ bit3 = BIT(color_prom[i], 0);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 0);
+ bit1 = BIT(color_prom[i + 2*num_colors], 1);
+ bit2 = BIT(color_prom[i + num_colors], 0);
+ bit3 = BIT(color_prom[i + num_colors], 1);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -85,7 +84,6 @@ void mainsnk_state::video_start()
WRITE8_MEMBER(mainsnk_state::c600_w)
{
- int bank;
int total_elements = m_gfxdecode->gfx(0)->elements();
flip_screen_set(BIT(data, 7));
@@ -93,7 +91,7 @@ WRITE8_MEMBER(mainsnk_state::c600_w)
m_bg_tilemap->set_palette_offset((data & 0x07) << 4);
m_tx_tilemap->set_palette_offset((data & 0x07) << 4);
- bank = 0;
+ int bank = 0;
if (total_elements == 0x400) // mainsnk
bank = ((data & 0x30) >> 4);
else if (total_elements == 0x800) // canvas
diff --git a/src/mame/video/mappy.cpp b/src/mame/video/mappy.cpp
index fafc84915ad..81828b961a7 100644
--- a/src/mame/video/mappy.cpp
+++ b/src/mame/video/mappy.cpp
@@ -32,116 +32,112 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(mappy_state,superpac)
+void mappy_state::superpac_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 0, 0,
3, &resistances[0], gweights, 0, 0,
2, &resistances[1], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 32; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- /* characters map to the upper 16 palette entries */
- for (i = 0; i < 64*4; i++)
+ // characters map to the upper 16 palette entries
+ for (int i = 0; i < 64*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, (ctabentry ^ 15) + 0x10);
}
- /* sprites map to the lower 16 palette entries */
- for (i = 64*4; i < 128*4; i++)
+ // sprites map to the lower 16 palette entries
+ for (int i = 64*4; i < 128*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
-PALETTE_INIT_MEMBER(mappy_state,mappy)
+void mappy_state::mappy_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 0, 0,
3, &resistances[0], gweights, 0, 0,
2, &resistances[1], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 32; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- /* characters map to the upper 16 palette entries */
- for (i = 0*4; i < 64*4; i++)
+ // characters map to the upper 16 palette entries
+ for (int i = 0*4; i < 64*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry + 0x10);
}
- /* sprites map to the lower 16 palette entries */
- for (i = 64*4; i < palette.entries(); i++)
+ // sprites map to the lower 16 palette entries
+ for (int i = 64*4; i < palette.entries(); i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
@@ -158,63 +154,61 @@ PALETTE_INIT_MEMBER(mappy_state,mappy)
***************************************************************************/
-PALETTE_INIT_MEMBER(mappy_state,phozon)
+void mappy_state::phozon_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2200, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, &resistances[0], rweights, 0, 0,
4, &resistances[0], gweights, 0, 0,
4, &resistances[0], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 32; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters map to the lower 16 palette entries */
- for (i = 0; i < 64*4; i++)
+ // characters map to the lower 16 palette entries
+ for (int i = 0; i < 64*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites map to the upper 16 palette entries */
- for (i = 64*4; i < 128*4; i++)
+ // sprites map to the upper 16 palette entries
+ for (int i = 64*4; i < 128*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry + 0x10);
}
}
diff --git a/src/mame/video/marineb.cpp b/src/mame/video/marineb.cpp
index 6404dd213af..11fd9de48fb 100644
--- a/src/mame/video/marineb.cpp
+++ b/src/mame/video/marineb.cpp
@@ -12,32 +12,31 @@
#include "includes/marineb.h"
-PALETTE_INIT_MEMBER(marineb_state, marineb)
+void marineb_state::marineb_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i + palette.entries()] >> 0) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3) & 0x01;
+ bit1 = BIT(color_prom[i + palette.entries()], 0);
+ bit2 = BIT(color_prom[i + palette.entries()], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i + palette.entries()] >> 2) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i + palette.entries()], 2);
+ bit2 = BIT(color_prom[i + palette.entries()], 3);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i, rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/mario.cpp b/src/mame/video/mario.cpp
index 0c94f827f0b..9619a59bc3e 100644
--- a/src/mame/video/mario.cpp
+++ b/src/mame/video/mario.cpp
@@ -64,15 +64,15 @@ static const res_net_info mario_net_info_std =
bit 0 -- 470 ohm resistor -- inverter -- BLUE
***************************************************************************/
-PALETTE_INIT_MEMBER(mario_state, mario)
+void mario_state::mario_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- std::vector<rgb_t> rgb;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ std::vector<rgb_t> rgb;
if (m_monitor == 0)
compute_res_net_all(rgb, color_prom, mario_decode_info, mario_net_info);
else
- compute_res_net_all(rgb, color_prom+256, mario_decode_info, mario_net_info_std);
+ compute_res_net_all(rgb, color_prom + 256, mario_decode_info, mario_net_info_std);
palette.set_pen_colors(0, rgb);
palette.palette()->normalize_range(0, 255);
@@ -212,13 +212,11 @@ void mario_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
uint32_t mario_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int t;
-
- t = ioport("MONITOR")->read();
+ int const t = ioport("MONITOR")->read();
if (t != m_monitor)
{
m_monitor = t;
- PALETTE_INIT_NAME(mario)(*m_palette);
+ mario_palette(*m_palette);
}
m_bg_tilemap->set_scrolly(0, m_gfx_scroll);
diff --git a/src/mame/video/markham.cpp b/src/mame/video/markham.cpp
index c1985c6e786..bced837ddf3 100644
--- a/src/mame/video/markham.cpp
+++ b/src/mame/video/markham.cpp
@@ -12,28 +12,27 @@
#include "emu.h"
#include "includes/markham.h"
-PALETTE_INIT_MEMBER(markham_state, markham)
+void markham_state::markham_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i | 0x000]);
+ int const g = pal4bit(color_prom[i | 0x100]);
+ int const b = pal4bit(color_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* sprites lookup table */
- for (i = 0; i < 0x400; i++)
+ // sprites lookup table
+ for (int i = 0; i < 0x400; i++)
{
- uint8_t ctabentry = color_prom[i];
+ uint8_t const ctabentry = color_prom[i];
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/matmania.cpp b/src/mame/video/matmania.cpp
index ac620671d11..57e55699573 100644
--- a/src/mame/video/matmania.cpp
+++ b/src/mame/video/matmania.cpp
@@ -44,31 +44,33 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(matmania_state, matmania)
+void matmania_state::matmania_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *color_prom = memregion("proms")->base();
for (int i = 0; i < 64; i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
+ int bit0, bit1, bit2, bit3;
bit0 = BIT(color_prom[0], 0);
bit1 = BIT(color_prom[0], 1);
bit2 = BIT(color_prom[0], 2);
bit3 = BIT(color_prom[0], 3);
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
bit0 = BIT(color_prom[0], 4);
bit1 = BIT(color_prom[0], 5);
bit2 = BIT(color_prom[0], 6);
bit3 = BIT(color_prom[0], 7);
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
bit0 = BIT(color_prom[64], 0);
bit1 = BIT(color_prom[64], 1);
bit2 = BIT(color_prom[64], 2);
bit3 = BIT(color_prom[64], 3);
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp
index deba6df738e..665e5fe75b1 100644
--- a/src/mame/video/mbee.cpp
+++ b/src/mame/video/mbee.cpp
@@ -417,24 +417,21 @@ MC6845_UPDATE_ROW( mbee_state::crtc_update_row )
*****************************************************************************************************/
-PALETTE_INIT_MEMBER( mbee_state, standard )
+void mbee_state::standard_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- uint8_t i=0, r, b, g, k, r1, g1, b1;
- uint8_t bglevel[] = { 0, 0x54, 0xa0, 0xff };
- uint8_t fglevel[] = { 0, 0xa0, 0xff, 0xff };
+ constexpr uint8_t bglevel[] = { 0, 0x54, 0xa0, 0xff };
+ constexpr uint8_t fglevel[] = { 0, 0xa0, 0xff, 0xff };
+ uint8_t i;
// set up background colours (00-63)
- for (b1 = 0; b1 < 4; b1++)
+ i = 0;
+ for (uint8_t b : bglevel)
{
- b = bglevel[b1];
- for (g1 = 0; g1 < 4; g1++)
+ for (uint8_t g : bglevel)
{
- g = bglevel[g1];
- for (r1 = 0; r1 < 4; r1++)
+ for (uint8_t r : bglevel)
{
- r = bglevel[r1];
- k = bitswap<8>(i, 7, 6, 5, 3, 1, 4, 2, 0);
+ uint8_t const k = bitswap<8>(i, 7, 6, 5, 3, 1, 4, 2, 0);
palette.set_pen_color(k, rgb_t(r, g, b));
i++;
}
@@ -442,12 +439,13 @@ PALETTE_INIT_MEMBER( mbee_state, standard )
}
// set up foreground palette (64-95) by reading the prom
+ uint8_t const *const color_prom = memregion("proms")->base();
for (i = 0; i < 32; i++)
{
- k = color_prom[i];
- r = fglevel[(BIT(k, 2))|(BIT(k, 5)<<1)];
- g = fglevel[(BIT(k, 1))|(BIT(k, 4)<<1)];
- b = fglevel[(BIT(k, 0))|(BIT(k, 3)<<1)];
+ uint8_t const k = color_prom[i];
+ uint8_t const r = fglevel[(BIT(k, 2))|(BIT(k, 5)<<1)];
+ uint8_t const g = fglevel[(BIT(k, 1))|(BIT(k, 4)<<1)];
+ uint8_t const b = fglevel[(BIT(k, 0))|(BIT(k, 3)<<1)];
palette.set_pen_color(i|64, rgb_t(r, g, b));
}
@@ -459,28 +457,26 @@ PALETTE_INIT_MEMBER( mbee_state, standard )
}
-PALETTE_INIT_MEMBER( mbee_state, premium )
+void mbee_state::premium_palette(palette_device &palette) const
{
- uint8_t i, r, b, g;
-
- /* set up 8 low intensity colours */
- for (i = 0; i < 7; i++)
+ // set up 8 low intensity colours
+ for (uint8_t i = 0; i < 7; i++)
{
- r = BIT(i, 0) ? 0xc0 : 0;
- g = BIT(i, 1) ? 0xc0 : 0;
- b = BIT(i, 2) ? 0xc0 : 0;
+ uint8_t const r = BIT(i, 0) ? 0xc0 : 0;
+ uint8_t const g = BIT(i, 1) ? 0xc0 : 0;
+ uint8_t const b = BIT(i, 2) ? 0xc0 : 0;
palette.set_pen_color(i, rgb_t(r, g, b));
}
// colour 8 is dark grey, rather than black
palette.set_pen_color(8, rgb_t(96, 96, 96));
- /* set up 8 high intensity colours */
- for (i = 9; i < 16; i++)
+ // set up 8 high intensity colours
+ for (uint8_t i = 9; i < 16; i++)
{
- r = BIT(i, 0) ? 0xff : 0;
- g = BIT(i, 1) ? 0xff : 0;
- b = BIT(i, 2) ? 0xff : 0;
+ uint8_t const r = BIT(i, 0) ? 0xff : 0;
+ uint8_t const g = BIT(i, 1) ? 0xff : 0;
+ uint8_t const b = BIT(i, 2) ? 0xff : 0;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/mcr3.cpp b/src/mame/video/mcr3.cpp
index f8b36f4d27c..261d5f66456 100644
--- a/src/mame/video/mcr3.cpp
+++ b/src/mame/video/mcr3.cpp
@@ -66,18 +66,16 @@ TILE_GET_INFO_MEMBER(mcr3_state::spyhunt_get_alpha_tile_info)
*
*************************************/
-PALETTE_INIT_MEMBER(mcr3_state,spyhunt)
+void mcr3_state::spyhunt_palette(palette_device &palette) const
{
for (int i = 0; i < palette.entries(); i++)
- {
- palette.set_pen_color(i,rgb_t::black());
- }
+ palette.set_pen_color(i, rgb_t::black());
- /* alpha colors are hard-coded */
- palette.set_pen_color(4*16+0,rgb_t(0x00,0x00,0x00));
- palette.set_pen_color(4*16+1,rgb_t(0x00,0xff,0x00));
- palette.set_pen_color(4*16+2,rgb_t(0x00,0x00,0xff));
- palette.set_pen_color(4*16+3,rgb_t(0xff,0xff,0xff));
+ // alpha colors are hard-coded
+ palette.set_pen_color(4 * 16 + 0, rgb_t(0x00, 0x00, 0x00));
+ palette.set_pen_color(4 * 16 + 1, rgb_t(0x00, 0xff, 0x00));
+ palette.set_pen_color(4 * 16 + 2, rgb_t(0x00, 0x00, 0xff));
+ palette.set_pen_color(4 * 16 + 3, rgb_t(0xff, 0xff, 0xff));
}
diff --git a/src/mame/video/megasys1.cpp b/src/mame/video/megasys1.cpp
index 5cd53bbea40..8b0d3dc577d 100644
--- a/src/mame/video/megasys1.cpp
+++ b/src/mame/video/megasys1.cpp
@@ -752,7 +752,7 @@ void megasys1_state::priority_create()
}
-PALETTE_INIT_MEMBER(megasys1_state,megasys1)
+void megasys1_state::megasys1_palette(palette_device &palette)
{
priority_create();
}
diff --git a/src/mame/video/megazone.cpp b/src/mame/video/megazone.cpp
index 7080e948617..fb3356010fa 100644
--- a/src/mame/video/megazone.cpp
+++ b/src/mame/video/megazone.cpp
@@ -38,60 +38,58 @@ Changes by Martin M. (pfloyd@gmx.net) 14.10.2001:
***************************************************************************/
-PALETTE_INIT_MEMBER(megazone_state, megazone)
+void megazone_state::megazone_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
+ // blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = combine_2_weights(bweights, bit0, bit1);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites */
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters */
- for (i = 0x100; i < 0x200; i++)
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/mermaid.cpp b/src/mame/video/mermaid.cpp
index 00a57d3c3f0..7b492537a6f 100644
--- a/src/mame/video/mermaid.cpp
+++ b/src/mame/video/mermaid.cpp
@@ -4,56 +4,49 @@
#include "includes/mermaid.h"
-PALETTE_INIT_MEMBER(mermaid_state, mermaid)
+void mermaid_state::common_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < 0x40; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x40; i++)
{
- int r = 0x21 * BIT(color_prom[i], 0) + 0x47 * BIT(color_prom[i], 1) + 0x97 * BIT(color_prom[i], 2);
- int g = 0x21 * BIT(color_prom[i], 3) + 0x47 * BIT(color_prom[i], 4) + 0x97 * BIT(color_prom[i], 5);
- int b = 0x47 * BIT(color_prom[i], 6) + 0x97 * BIT(color_prom[i], 7);
+ int const r = 0x21 * BIT(color_prom[i], 0) + 0x47 * BIT(color_prom[i], 1) + 0x97 * BIT(color_prom[i], 2);
+ int const g = 0x21 * BIT(color_prom[i], 3) + 0x47 * BIT(color_prom[i], 4) + 0x97 * BIT(color_prom[i], 5);
+ int const b = 0x47 * BIT(color_prom[i], 6) + 0x97 * BIT(color_prom[i], 7);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
+}
- /* blue background */
+void mermaid_state::mermaid_palette(palette_device &palette) const
+{
+ common_palette(palette);
+
+ // blue background
palette.set_indirect_color(0x40, rgb_t(0, 0, 0xff));
- /* char/sprite palette */
- for (i = 0; i < 0x40; i++)
+ // char/sprite palette
+ for (int i = 0; i < 0x40; i++)
palette.set_pen_indirect(i, i);
- /* background palette */
+ // background palette
palette.set_pen_indirect(0x40, 0x20);
palette.set_pen_indirect(0x41, 0x21);
palette.set_pen_indirect(0x42, 0x40);
palette.set_pen_indirect(0x43, 0x21);
}
-PALETTE_INIT_MEMBER(mermaid_state,rougien)
+void mermaid_state::rougien_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < 0x40; i++)
- {
- int r = 0x21 * BIT(color_prom[i], 0) + 0x47 * BIT(color_prom[i], 1) + 0x97 * BIT(color_prom[i], 2);
- int g = 0x21 * BIT(color_prom[i], 3) + 0x47 * BIT(color_prom[i], 4) + 0x97 * BIT(color_prom[i], 5);
- int b = 0x47 * BIT(color_prom[i], 6) + 0x97 * BIT(color_prom[i], 7);
-
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
+ common_palette(palette);
- /* blue background */
+ // black background
palette.set_indirect_color(0x40, rgb_t(0, 0, 0));
- /* char/sprite palette */
- for (i = 0; i < 0x40; i++)
+ // char/sprite palette
+ for (int i = 0; i < 0x40; i++)
palette.set_pen_indirect(i, i);
- /* background palette */
+ // background palette
palette.set_pen_indirect(0x40, 0x40);
palette.set_pen_indirect(0x41, 0x00);
palette.set_pen_indirect(0x42, 0x00);
diff --git a/src/mame/video/mikie.cpp b/src/mame/video/mikie.cpp
index b4875fddcec..ec37c32e220 100644
--- a/src/mame/video/mikie.cpp
+++ b/src/mame/video/mikie.cpp
@@ -28,60 +28,56 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(mikie_state, mikie)
+void mikie_state::mikie_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2200, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 470, 0,
4, resistances, gweights, 470, 0,
4, resistances, bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i + 0x000], 0);
+ bit1 = BIT(color_prom[i + 0x000], 1);
+ bit2 = BIT(color_prom[i + 0x000], 2);
+ bit3 = BIT(color_prom[i + 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i + 0x100], 0);
+ bit1 = BIT(color_prom[i + 0x100], 1);
+ bit2 = BIT(color_prom[i + 0x100], 2);
+ bit3 = BIT(color_prom[i + 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x200], 0);
+ bit1 = BIT(color_prom[i + 0x200], 1);
+ bit2 = BIT(color_prom[i + 0x200], 2);
+ bit3 = BIT(color_prom[i + 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table,*/
+ // color_prom now points to the beginning of the lookup table,
color_prom += 0x300;
- /* characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f */
- for (i = 0; i < 0x200; i++)
+ // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f
+ for (int i = 0; i < 0x200; i++)
{
- int j;
-
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- uint8_t ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
m_palette->set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
}
}
diff --git a/src/mame/video/mikromik.cpp b/src/mame/video/mikromik.cpp
index 678d37c8449..25bce3b9a97 100644
--- a/src/mame/video/mikromik.cpp
+++ b/src/mame/video/mikromik.cpp
@@ -117,11 +117,11 @@ static GFXDECODE_START( gfx_mm1 )
GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 )
GFXDECODE_END
-PALETTE_INIT_MEMBER( mm1_state, mm1 )
+void mm1_state::mm1_palette(palette_device &palette) const
{
- palette.set_pen_color(0, rgb_t(0x00,0x00,0x00));
- palette.set_pen_color(1, rgb_t(0x00,0x7F,0x0A)); // dark green ("highlight" mode color)
- palette.set_pen_color(2, rgb_t(0x08,0xD0,0x1A)); // bright green (normal color)
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00));
+ palette.set_pen_color(1, rgb_t(0x00, 0x7f, 0x0a)); // dark green ("highlight" mode color)
+ palette.set_pen_color(2, rgb_t(0x08, 0xd0, 0x1a)); // bright green (normal color)
}
@@ -137,9 +137,8 @@ MACHINE_CONFIG_START(mm1_state::mm1m6_video)
MCFG_SCREEN_VISIBLE_AREA( 0, 800-1, 0, 375-1 )
//MCFG_SCREEN_RAW_PARAMS(XTAL(18'720'000), ...)
- MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_mm1)
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(mm1_state, mm1)
+ GFXDECODE(config, "gfxdecode", m_palette, gfx_mm1);
+ PALETTE(config, m_palette, FUNC(mm1_state::mm1_palette), 3);
MCFG_DEVICE_ADD(I8275_TAG, I8275, XTAL(18'720'000)/8)
MCFG_I8275_CHARACTER_WIDTH(HORIZONTAL_CHARACTER_PIXELS)
diff --git a/src/mame/video/mouser.cpp b/src/mame/video/mouser.cpp
index f716464d970..09896fc4bf0 100644
--- a/src/mame/video/mouser.cpp
+++ b/src/mame/video/mouser.cpp
@@ -18,32 +18,32 @@
#include "emu.h"
#include "includes/mouser.h"
-PALETTE_INIT_MEMBER(mouser_state, mouser)
+void mouser_state::mouser_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = BIT(*color_prom, 0);
- bit1 = BIT(*color_prom, 1);
- bit2 = BIT(*color_prom, 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = BIT(*color_prom, 3);
- bit1 = BIT(*color_prom, 4);
- bit2 = BIT(*color_prom, 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = BIT(*color_prom, 6);
- bit1 = BIT(*color_prom, 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -59,38 +59,27 @@ WRITE_LINE_MEMBER(mouser_state::flip_screen_y_w)
uint32_t mouser_state::screen_update_mouser(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t *spriteram = m_spriteram;
- int offs;
- int sx, sy;
- int flipx, flipy;
+ uint8_t const *const spriteram = m_spriteram;
- /* for every character in the Video RAM */
- for (offs = 0x3ff; offs >= 0; offs--)
+ // for every character in the Video RAM
+ for (int offs = 0x3ff; offs >= 0; offs--)
{
- int scrolled_y_position;
- int color_offs;
-
- sx = offs % 32;
- sy = offs / 32;
-
+ int sx = offs % 32;
if (flip_screen_x())
- {
sx = 31 - sx;
- }
+ int sy = offs / 32;
if (flip_screen_y())
- {
sy = 31 - sy;
- }
/* This bit of spriteram appears to be for row scrolling */
/* Note: this is dependant on flipping in y */
- scrolled_y_position = (256 + 8*sy - spriteram[offs%32])%256;
+ int const scrolled_y_position = (256 + 8*sy - spriteram[offs%32])%256;
/* I think we still need to fetch the colorram bits to from the ram underneath, which is not scrolled */
/* Ideally we would merge these on a pixel-by-pixel basis, but it's ok to do this char-by-char, */
/* Since it's only for the MOUSER logo and it looks fine */
/* Note: this is _not_ dependant on flipping */
- color_offs = offs % 32 + ((256 + 8 * (offs / 32) - spriteram[offs % 32] )% 256) / 8 * 32;
+ int const color_offs = offs % 32 + ((256 + 8 * (offs / 32) - spriteram[offs % 32] )% 256) / 8 * 32;
m_gfxdecode->gfx(0)->opaque(bitmap,cliprect,
m_videoram[offs] | (m_colorram[color_offs] >> 5) * 256 | ((m_colorram[color_offs] >> 4) & 1) * 512,
@@ -99,64 +88,66 @@ uint32_t mouser_state::screen_update_mouser(screen_device &screen, bitmap_ind16
8*sx,scrolled_y_position);
}
- /* There seem to be two sets of sprites, each decoded identically */
+ // There seem to be two sets of sprites, each decoded identically
- /* This is the first set of 7 sprites */
- for(offs = 0x0084; offs < 0x00A0; offs += 4)
+ // This is the first set of 7 sprites
+ for (int offs = 0x0084; offs < 0x00a0; offs += 4)
{
- sx = spriteram[offs + 3];
- sy = 0xef - spriteram[offs + 2];
-
- flipx = BIT(spriteram[offs], 6);
- flipy = BIT(spriteram[offs], 7);
-
- if (flip_screen_x())
- {
- flipx = !flipx;
- sx = 240 - sx;
- }
-
- if (flip_screen_y())
+ if (BIT(spriteram[offs + 1], 4))
{
- flipy = !flipy;
- sy = 238 - sy;
- }
+ int flipx = BIT(spriteram[offs], 6);
+ int flipy = BIT(spriteram[offs], 7);
+
+ int sx = spriteram[offs + 3];
+ if (flip_screen_x())
+ {
+ flipx = !flipx;
+ sx = 240 - sx;
+ }
+
+ int sy = 0xef - spriteram[offs + 2];
+ if (flip_screen_y())
+ {
+ flipy = !flipy;
+ sy = 238 - sy;
+ }
- if (BIT(spriteram[offs + 1], 4))
m_gfxdecode->gfx(1+((spriteram[offs+1]&0x20)>>5))->transpen(bitmap,cliprect,
spriteram[offs]&0x3f,
spriteram[offs+1]%16,
flipx,flipy,
sx,sy,0);
+ }
}
- /* This is the second set of 8 sprites */
- for(offs = 0x00C4; offs < 0x00e4; offs += 4)
+ // This is the second set of 8 sprites
+ for (int offs = 0x00c4; offs < 0x00e4; offs += 4)
{
- sx = spriteram[offs + 3];
- sy = 0xef - spriteram[offs + 2];
-
- flipx = BIT(spriteram[offs], 6);
- flipy = BIT(spriteram[offs], 7);
-
- if (flip_screen_x())
- {
- flipx = !flipx;
- sx = 240 - sx;
- }
-
- if (flip_screen_y())
+ if (BIT(spriteram[offs + 1], 4))
{
- flipy = !flipy;
- sy = 238 - sy;
- }
+ int flipx = BIT(spriteram[offs], 6);
+ int flipy = BIT(spriteram[offs], 7);
+
+ int sx = spriteram[offs + 3];
+ if (flip_screen_x())
+ {
+ flipx = !flipx;
+ sx = 240 - sx;
+ }
+
+ int sy = 0xef - spriteram[offs + 2];
+ if (flip_screen_y())
+ {
+ flipy = !flipy;
+ sy = 238 - sy;
+ }
- if (BIT(spriteram[offs + 1], 4))
m_gfxdecode->gfx(1+((spriteram[offs+1]&0x20)>>5))->transpen(bitmap,cliprect,
spriteram[offs]&0x3f,
spriteram[offs+1]%16,
flipx,flipy,
sx,sy,0);
+ }
}
return 0;
diff --git a/src/mame/video/mrdo.cpp b/src/mame/video/mrdo.cpp
index 62afb88916c..4917ff2d6a3 100644
--- a/src/mame/video/mrdo.cpp
+++ b/src/mame/video/mrdo.cpp
@@ -44,84 +44,83 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(mrdo_state, mrdo)
+void mrdo_state::mrdo_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ constexpr int R1 = 150;
+ constexpr int R2 = 120;
+ constexpr int R3 = 100;
+ constexpr int R4 = 75;
+ constexpr int pull = 220;
+ constexpr float potadjust = 0.7f; /* diode voltage drop */
- const int R1 = 150;
- const int R2 = 120;
- const int R3 = 100;
- const int R4 = 75;
- const int pull = 220;
float pot[16];
int weight[16];
- const float potadjust = 0.7f; /* diode voltage drop */
-
- for (i = 0x0f; i >= 0; i--)
+ for (int i = 0x0f; i >= 0; i--)
{
float par = 0;
- if (i & 1) par += 1.0f/(float)R1;
- if (i & 2) par += 1.0f/(float)R2;
- if (i & 4) par += 1.0f/(float)R3;
- if (i & 8) par += 1.0f/(float)R4;
+ if (i & 1) par += 1.0f / float(R1);
+ if (i & 2) par += 1.0f / float(R2);
+ if (i & 4) par += 1.0f / float(R3);
+ if (i & 8) par += 1.0f / float(R4);
if (par)
{
- par = 1/par;
+ par = 1 / par;
pot[i] = pull/(pull+par) - potadjust;
}
- else pot[i] = 0;
+ else
+ pot[i] = 0;
weight[i] = 0xff * pot[i] / pot[0x0f];
- if (weight[i] < 0) weight[i] = 0;
+ if (weight[i] < 0)
+ weight[i] = 0;
}
- for (i = 0; i < 0x100; i++)
+ const uint8_t *color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < 0x100; i++)
{
- int a1,a2;
int bits0, bits2;
- int r, g, b;
- a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 0x20;
- a2 = ((i >> 0) & 0x1c) + (i & 0x03);
+ int const a1 = ((i >> 3) & 0x1c) + (i & 0x03) + 0x20;
+ int const a2 = ((i >> 0) & 0x1c) + (i & 0x03);
- /* red component */
+ // red component
bits0 = (color_prom[a1] >> 0) & 0x03;
bits2 = (color_prom[a2] >> 0) & 0x03;
- r = weight[bits0 + (bits2 << 2)];
+ int const r = weight[bits0 + (bits2 << 2)];
- /* green component */
+ // green component
bits0 = (color_prom[a1] >> 2) & 0x03;
bits2 = (color_prom[a2] >> 2) & 0x03;
- g = weight[bits0 + (bits2 << 2)];
+ int const g = weight[bits0 + (bits2 << 2)];
- /* blue component */
+ // blue component
bits0 = (color_prom[a1] >> 4) & 0x03;
bits2 = (color_prom[a2] >> 4) & 0x03;
- b = weight[bits0 + (bits2 << 2)];
+ int const b = weight[bits0 + (bits2 << 2)];
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x40;
- /* characters */
- for (i = 0; i < 0x100; i++)
+ // characters
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
- /* sprites */
- for (i = 0x100; i < 0x140; i++)
+ // sprites
+ for (int i = 0; i < 0x40; i++)
{
- uint8_t ctabentry = color_prom[(i - 0x100) & 0x1f];
+ uint8_t ctabentry = color_prom[i & 0x1f];
- if ((i - 0x100) & 0x20)
- ctabentry >>= 4; /* high 4 bits are for sprite color n + 8 */
+ if (i & 0x20)
+ ctabentry >>= 4; // high 4 bits are for sprite color n + 8
else
- ctabentry &= 0x0f; /* low 4 bits are for sprite color n */
+ ctabentry &= 0x0f; // low 4 bits are for sprite color n
- palette.set_pen_indirect(i, ctabentry + ((ctabentry & 0x0c) << 3));
+ palette.set_pen_indirect(i + 0x100, ctabentry + ((ctabentry & 0x0c) << 3));
}
}
diff --git a/src/mame/video/mrjong.cpp b/src/mame/video/mrjong.cpp
index 52df49c5ba7..800758a9218 100644
--- a/src/mame/video/mrjong.cpp
+++ b/src/mame/video/mrjong.cpp
@@ -18,45 +18,43 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(mrjong_state, mrjong)
+void mrjong_state::mrjong_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
bit1 = BIT(color_prom[i], 6);
bit2 = BIT(color_prom[i], 7);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters/sprites */
- for (i = 0; i < 0x80; i++)
+ // characters/sprites
+ for (int i = 0; i < 0x80; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/munchmo.cpp b/src/mame/video/munchmo.cpp
index 652c63a0682..42f92b055fc 100644
--- a/src/mame/video/munchmo.cpp
+++ b/src/mame/video/munchmo.cpp
@@ -4,29 +4,30 @@
#include "includes/munchmo.h"
-PALETTE_INIT_MEMBER(munchmo_state, munchmo)
+void munchmo_state::munchmo_palette(palette_device &palette) const
{
- const u8 *color_prom = memregion("proms")->base();
- int i;
+ u8 const *const color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
+ // red component
bit0 = BIT(color_prom[i], 0);
bit1 = BIT(color_prom[i], 1);
bit2 = BIT(color_prom[i], 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
bit0 = BIT(color_prom[i], 3);
bit1 = BIT(color_prom[i], 4);
bit2 = BIT(color_prom[i], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
bit0 = BIT(color_prom[i], 6);
bit1 = BIT(color_prom[i], 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/n8080.cpp b/src/mame/video/n8080.cpp
index eab68ba12ca..05c6acec140 100644
--- a/src/mame/video/n8080.cpp
+++ b/src/mame/video/n8080.cpp
@@ -18,35 +18,31 @@ WRITE8_MEMBER(n8080_state::n8080_video_control_w)
}
-PALETTE_INIT_MEMBER(n8080_state,n8080)
+void n8080_state::n8080_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
palette.set_pen_color(i, pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
}
-PALETTE_INIT_MEMBER(n8080_state,helifire)
+void n8080_state::helifire_palette(palette_device &palette) const
{
- int i;
-
- PALETTE_INIT_NAME(n8080)(palette);
+ n8080_palette(palette);
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- int level = 0xff * exp(-3 * i / 255.); /* capacitor discharge */
+ int const level = 0xff * exp(-3 * i / 255.); // capacitor discharge
- palette.set_pen_color(0x000 + 8 + i, rgb_t(0x00, 0x00, level)); /* shades of blue */
- palette.set_pen_color(0x100 + 8 + i, rgb_t(0x00, 0xC0, level)); /* shades of blue w/ green star */
+ palette.set_pen_color(0x000 + 8 + i, rgb_t(0x00, 0x00, level)); // shades of blue
+ palette.set_pen_color(0x100 + 8 + i, rgb_t(0x00, 0xc0, level)); // shades of blue w/ green star
- palette.set_pen_color(0x200 + 8 + i, rgb_t(level, 0x00, 0x00)); /* shades of red */
- palette.set_pen_color(0x300 + 8 + i, rgb_t(level, 0xC0, 0x00)); /* shades of red w/ green star */
+ palette.set_pen_color(0x200 + 8 + i, rgb_t(level, 0x00, 0x00)); // shades of red
+ palette.set_pen_color(0x300 + 8 + i, rgb_t(level, 0xc0, 0x00)); // shades of red w/ green star
}
}
-void n8080_state::spacefev_start_red_cannon( )
+void n8080_state::spacefev_start_red_cannon()
{
m_spacefev_red_cannon = 1;
m_cannon_timer->adjust(attotime::from_usec(550 * 68 * 10));
diff --git a/src/mame/video/namcos86.cpp b/src/mame/video/namcos86.cpp
index 0d97fac415b..803270d78e6 100644
--- a/src/mame/video/namcos86.cpp
+++ b/src/mame/video/namcos86.cpp
@@ -35,50 +35,49 @@ Namco System 86 Video Hardware
***************************************************************************/
-PALETTE_INIT_MEMBER(namcos86_state, namcos86)
+void namcos86_state::namcos86_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- rgb_t palette_val[512];
- for (i = 0;i < 512;i++)
+ rgb_t palette_val[512];
+ for (int i = 0; i < 512; i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
-
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- bit2 = (color_prom[0] >> 6) & 0x01;
- bit3 = (color_prom[0] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[512] >> 0) & 0x01;
- bit1 = (color_prom[512] >> 1) & 0x01;
- bit2 = (color_prom[512] >> 2) & 0x01;
- bit3 = (color_prom[512] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette_val[i] = rgb_t(r,g,b);
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 5);
+ bit2 = BIT(color_prom[0], 6);
+ bit3 = BIT(color_prom[0], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[512], 0);
+ bit1 = BIT(color_prom[512], 1);
+ bit2 = BIT(color_prom[512], 2);
+ bit3 = BIT(color_prom[512], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette_val[i] = rgb_t(r, g, b);
color_prom++;
}
color_prom += 512;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
- /* tiles lookup table */
- for (i = 0;i < 2048;i++)
+ // tiles lookup table
+ for (int i = 0; i < 2048; i++)
palette.set_pen_color(i, palette_val[*color_prom++]);
- /* sprites lookup table */
- for (i = 0;i < 2048;i++)
+ // sprites lookup table
+ for (int i = 0; i < 2048; i++)
palette.set_pen_color(2048 + i, palette_val[256 + *color_prom++]);
- /* color_prom now points to the beginning of the tile address decode PROM */
+ // color_prom now points to the beginning of the tile address decode PROM
- m_tile_address_prom = color_prom; /* we'll need this at run time */
+ m_tile_address_prom = color_prom; // we'll need this at run time
}
diff --git a/src/mame/video/naughtyb.cpp b/src/mame/video/naughtyb.cpp
index c5b0fb924eb..650183619bb 100644
--- a/src/mame/video/naughtyb.cpp
+++ b/src/mame/video/naughtyb.cpp
@@ -59,39 +59,38 @@ static const res_net_info naughtyb_net_info =
***************************************************************************/
-PALETTE_INIT_MEMBER(naughtyb_state, naughtyb)
+void naughtyb_state::naughtyb_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[2] = { 270, 130 };
- double weights[2];
+ static constexpr int resistances[2] = { 270, 130 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights[2];
compute_resistor_weights(0, 255, -1.0,
2, resistances, weights, 0, 0,
- 2, resistances, weights, 0, 0,
+ 2, resistances, weights, 0, 0, // FIXME: same destination twice?
0, nullptr, nullptr, 0, 0);
for (int i = 0;i < palette.entries(); i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i+0x100] >> 0) & 0x01;
- r = combine_2_weights(weights, bit0, bit1);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i+0x100], 0);
+ int const r = combine_2_weights(weights, bit0, bit1);
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i+0x100] >> 2) & 0x01;
- g = combine_2_weights(weights, bit0, bit1);
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i+0x100], 2);
+ int const g = combine_2_weights(weights, bit0, bit1);
- /* blue component */
- bit0 = (color_prom[i] >> 1) & 0x01;
- bit1 = (color_prom[i+0x100] >> 1) & 0x01;
- b = combine_2_weights(weights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 1);
+ bit1 = BIT(color_prom[i+0x100], 1);
+ int const b = combine_2_weights(weights, bit0, bit1);
- palette.set_pen_color(bitswap<8>(i,5,7,6,2,1,0,4,3), rgb_t(r, g, b));
+ palette.set_pen_color(bitswap<8>(i, 5, 7, 6, 2, 1, 0, 4, 3), rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/nbmj8688.cpp b/src/mame/video/nbmj8688.cpp
index 9a2f3a88c8b..87e0764490d 100644
--- a/src/mame/video/nbmj8688.cpp
+++ b/src/mame/video/nbmj8688.cpp
@@ -36,69 +36,62 @@ enum
******************************************************************************/
-PALETTE_INIT_MEMBER(nbmj8688_state,mbmj8688_8bit)
+void nbmj8688_state::mbmj8688_8bit(palette_device &palette) const
{
- int i;
- int bit0, bit1, bit2, r, g, b;
-
- /* initialize 332 RGB lookup */
- for (i = 0; i < 0x100; i++)
+ // initialize 332 RGB lookup
+ for (int i = 0; i < 0x100; i++)
{
+ int bit0, bit1, bit2;
+
// xxxxxxxx_bbgggrrr
- /* red component */
- bit0 = ((i >> 0) & 0x01);
- bit1 = ((i >> 1) & 0x01);
- bit2 = ((i >> 2) & 0x01);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = ((i >> 3) & 0x01);
- bit1 = ((i >> 4) & 0x01);
- bit2 = ((i >> 5) & 0x01);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // red component
+ bit0 = BIT(i, 0);
+ bit1 = BIT(i, 1);
+ bit2 = BIT(i, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(i, 3);
+ bit1 = BIT(i, 4);
+ bit2 = BIT(i, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = ((i >> 6) & 0x01);
- bit2 = ((i >> 7) & 0x01);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(i, 6);
+ bit2 = BIT(i, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(nbmj8688_state,mbmj8688_12bit)
+void nbmj8688_state::mbmj8688_12bit(palette_device &palette) const
{
- int i;
- int r, g, b;
-
- /* initialize 444 RGB lookup */
- for (i = 0; i < 0x1000; i++)
+ // initialize 444 RGB lookup
+ for (int i = 0; i < 0x1000; i++)
{
// high and low bytes swapped for convenience
- r = ((i & 0x07) << 1) | (((i >> 8) & 0x01) >> 0);
- g = ((i & 0x38) >> 2) | (((i >> 8) & 0x02) >> 1);
- b = ((i & 0xc0) >> 4) | (((i >> 8) & 0x0c) >> 2);
+ int const r = ((i & 0x07) << 1) | (((i >> 8) & 0x01) >> 0);
+ int const g = ((i & 0x38) >> 2) | (((i >> 8) & 0x02) >> 1);
+ int const b = ((i & 0xc0) >> 4) | (((i >> 8) & 0x0c) >> 2);
palette.set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b));
}
}
-PALETTE_INIT_MEMBER(nbmj8688_state,mbmj8688_16bit)
+void nbmj8688_state::mbmj8688_16bit(palette_device &palette) const
{
- int i;
- int r, g, b;
-
- /* initialize 655 RGB lookup */
- for (i = 0; i < 0x10000; i++)
+ // initialize 655 RGB lookup
+ for (int i = 0; i < 0x10000; i++)
{
- r = (((i & 0x0700) >> 5) | ((i & 0x0007) >> 0)); // R 6bit
- g = (((i & 0x3800) >> 9) | ((i & 0x0018) >> 3)); // G 5bit
- b = (((i & 0xc000) >> 11) | ((i & 0x00e0) >> 5)); // B 5bit
+ int const r = (((i & 0x0700) >> 5) | ((i & 0x0007) >> 0)); // R 6bit
+ int const g = (((i & 0x3800) >> 9) | ((i & 0x0018) >> 3)); // G 5bit
+ int const b = (((i & 0xc000) >> 11) | ((i & 0x00e0) >> 5)); // B 5bit
palette.set_pen_color(i, pal6bit(r), pal5bit(g), pal5bit(b));
}
}
-PALETTE_INIT_MEMBER(nbmj8688_state,mbmj8688_lcd)
+void nbmj8688_state::mbmj8688_lcd(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(28, 123, 57));
palette.set_pen_color(1, rgb_t(0, 0, 0));
diff --git a/src/mame/video/nc.cpp b/src/mame/video/nc.cpp
index 6298bdf2ecb..4770ee94f7c 100644
--- a/src/mame/video/nc.cpp
+++ b/src/mame/video/nc.cpp
@@ -39,9 +39,9 @@ static const rgb_t nc_palette[NC_NUM_COLOURS] =
/* Initialise the palette */
-PALETTE_INIT_MEMBER(nc_state, nc)
+void nc_state::nc_colours(palette_device &palette) const
{
- palette.set_pen_colors(0, nc_palette, ARRAY_LENGTH(nc_palette));
+ palette.set_pen_colors(0, nc_palette);
}
diff --git a/src/mame/video/newbrain.cpp b/src/mame/video/newbrain.cpp
index a24bd35f6f9..c829acc2e90 100644
--- a/src/mame/video/newbrain.cpp
+++ b/src/mame/video/newbrain.cpp
@@ -193,7 +193,7 @@ MACHINE_CONFIG_START(newbrain_state::newbrain_video)
MCFG_SCREEN_SIZE(640, 250)
MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_newbrain)
MACHINE_CONFIG_END
diff --git a/src/mame/video/nova2001.cpp b/src/mame/video/nova2001.cpp
index c39c7db04e8..8061ab4b477 100644
--- a/src/mame/video/nova2001.cpp
+++ b/src/mame/video/nova2001.cpp
@@ -10,61 +10,44 @@
*
*************************************/
-PALETTE_INIT_MEMBER(nova2001_state,nova2001)
+void nova2001_state::nova2001_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- /* Color #1 is used for palette animation. */
-
- /* To handle this, color entries 0-15 are based on */
- /* the primary 16 colors, while color entries 16-31 */
- /* are based on the secondary set. */
-
- /* The only difference between 0-15 and 16-31 is that */
- /* color #1 changes each time */
-
- for (i = 0; i < 0x200; ++i)
+ uint8_t const *const color_prom = memregion("proms")->base();
+
+ /*
+ Color #1 is used for palette animation.
+ To handle this, color entries 0-15 are based on
+ the primary 16 colors, while color entries 16-31
+ are based on the secondary set.
+
+ The only difference between 0-15 and 16-31 is that
+ color #1 changes each time
+ */
+ for (int i = 0; i < 0x200; ++i)
{
int entry;
- int intensity,r,g,b;
-
if ((i & 0xf) == 1)
- {
entry = ((i & 0xf0) >> 4) | ((i & 0x100) >> 4);
- }
else
- {
entry = ((i & 0x0f) >> 0) | ((i & 0x100) >> 4);
- }
- intensity = (color_prom[entry] >> 0) & 0x03;
- /* red component */
- r = (((color_prom[entry] >> 0) & 0x0c) | intensity) * 0x11;
- /* green component */
- g = (((color_prom[entry] >> 2) & 0x0c) | intensity) * 0x11;
- /* blue component */
- b = (((color_prom[entry] >> 4) & 0x0c) | intensity) * 0x11;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, BBGGRRII(color_prom[entry]));
}
}
-PALETTE_DECODER_MEMBER( nova2001_state, BBGGRRII )
+rgb_t nova2001_state::BBGGRRII(uint32_t raw)
{
- uint8_t i = raw & 3;
- uint8_t r = (raw >> 0) & 0x0c;
- uint8_t g = (raw >> 2) & 0x0c;
- uint8_t b = (raw >> 4) & 0x0c;
+ uint8_t const i = raw & 3;
+ uint8_t const r = ((raw >> 0) & 0x0c) | i;
+ uint8_t const g = ((raw >> 2) & 0x0c) | i;
+ uint8_t const b = ((raw >> 4) & 0x0c) | i;
- return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i));
+ return rgb_t(r | (r << 4), g | (g << 4), b | (b << 4));
}
WRITE8_MEMBER(nova2001_state::ninjakun_paletteram_w)
{
- int i;
-
- m_palette->write8(space,offset,data);
+ m_palette->write8(space, offset, data);
// expand the sprite palette to full length
if (offset < 16)
@@ -73,7 +56,7 @@ WRITE8_MEMBER(nova2001_state::ninjakun_paletteram_w)
if (offset != 1)
{
- for (i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
m_palette->write8(space, 0x200 + offset + i * 16, data);
}
diff --git a/src/mame/video/ojankohs.cpp b/src/mame/video/ojankohs.cpp
index 8e3fa06c6c8..2391dae1c5a 100644
--- a/src/mame/video/ojankohs.cpp
+++ b/src/mame/video/ojankohs.cpp
@@ -19,32 +19,33 @@
******************************************************************************/
-PALETTE_INIT_MEMBER(ojankohs_state,ojankoy)
+void ojankohs_state::ojankoy_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0, bit1, bit2, bit3, bit4, r, g, b;
+ int bit0, bit1, bit2, bit3, bit4;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
bit0 = BIT(color_prom[0], 2);
bit1 = BIT(color_prom[0], 3);
bit2 = BIT(color_prom[0], 4);
bit3 = BIT(color_prom[0], 5);
bit4 = BIT(color_prom[0], 6);
- r = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
+ int const r = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
+
bit0 = BIT(color_prom[palette.entries()], 5);
bit1 = BIT(color_prom[palette.entries()], 6);
bit2 = BIT(color_prom[palette.entries()], 7);
bit3 = BIT(color_prom[0], 0);
bit4 = BIT(color_prom[0], 1);
- g = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
+ int const g = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
+
bit0 = BIT(color_prom[palette.entries()], 0);
bit1 = BIT(color_prom[palette.entries()], 1);
bit2 = BIT(color_prom[palette.entries()], 2);
bit3 = BIT(color_prom[palette.entries()], 3);
bit4 = BIT(color_prom[palette.entries()], 4);
- b = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
+ int const b = 0x08 * bit0 + 0x11 * bit1 + 0x21 * bit2 + 0x43 * bit3 + 0x82 * bit4;
palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
@@ -53,53 +54,47 @@ PALETTE_INIT_MEMBER(ojankohs_state,ojankoy)
WRITE8_MEMBER(ojankohs_state::ojankohs_palette_w)
{
- int r, g, b;
-
m_paletteram[offset] = data;
offset &= 0x7fe;
- r = (m_paletteram[offset + 0] & 0x7c) >> 2;
- g = ((m_paletteram[offset + 0] & 0x03) << 3) | ((m_paletteram[offset + 1] & 0xe0) >> 5);
- b = (m_paletteram[offset + 1] & 0x1f) >> 0;
+ int const r = (m_paletteram[offset + 0] & 0x7c) >> 2;
+ int const g = ((m_paletteram[offset + 0] & 0x03) << 3) | ((m_paletteram[offset + 1] & 0xe0) >> 5);
+ int const b = (m_paletteram[offset + 1] & 0x1f) >> 0;
m_palette->set_pen_color(offset >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
}
WRITE8_MEMBER(ojankohs_state::ccasino_palette_w)
{
- int r, g, b;
-
offset = bitswap<11>(offset, 2, 1, 0, 15, 14, 13, 12, 11, 10, 9, 8);
m_paletteram[offset] = data;
offset &= 0x7fe;
- r = (m_paletteram[offset + 0] & 0x7c) >> 2;
- g = ((m_paletteram[offset + 0] & 0x03) << 3) | ((m_paletteram[offset + 1] & 0xe0) >> 5);
- b = (m_paletteram[offset + 1] & 0x1f) >> 0;
+ int const r = (m_paletteram[offset + 0] & 0x7c) >> 2;
+ int const g = ((m_paletteram[offset + 0] & 0x03) << 3) | ((m_paletteram[offset + 1] & 0xe0) >> 5);
+ int const b = (m_paletteram[offset + 1] & 0x1f) >> 0;
m_palette->set_pen_color(offset >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
}
WRITE8_MEMBER(ojankohs_state::ojankoc_palette_w)
{
- int r, g, b, color;
-
- if (m_paletteram[offset] == data)
- return;
-
- m_paletteram[offset] = data;
- m_screen_refresh = 1;
+ if (m_paletteram[offset] != data)
+ {
+ m_paletteram[offset] = data;
+ m_screen_refresh = 1;
- color = (m_paletteram[offset & 0x1e] << 8) | m_paletteram[offset | 0x01];
+ int const color = (m_paletteram[offset & 0x1e] << 8) | m_paletteram[offset | 0x01];
- r = (color >> 10) & 0x1f;
- g = (color >> 5) & 0x1f;
- b = (color >> 0) & 0x1f;
+ int const r = (color >> 10) & 0x1f;
+ int const g = (color >> 5) & 0x1f;
+ int const b = (color >> 0) & 0x1f;
- m_palette->set_pen_color(offset >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
+ m_palette->set_pen_color(offset >> 1, pal5bit(r), pal5bit(g), pal5bit(b));
+ }
}
diff --git a/src/mame/video/orca40c.cpp b/src/mame/video/orca40c.cpp
index 9c7d7c4d80c..f0a7149deac 100644
--- a/src/mame/video/orca40c.cpp
+++ b/src/mame/video/orca40c.cpp
@@ -280,7 +280,5 @@ void orca_ovg_40c_device::device_add_mconfig(machine_config &config)
screen.set_screen_update(DEVICE_SELF, FUNC(orca_ovg_40c_device::screen_update));
screen.set_palette("palette");
- PALETTE(config, m_palette, 4*8+2*8+2*1);
- m_palette->set_indirect_entries(48+1);
- m_palette->set_init(DEVICE_SELF, FUNC(orca_ovg_40c_device::palette_init));
+ PALETTE(config, m_palette, FUNC(orca_ovg_40c_device::palette_init), 4*8+2*8+2*1, 48+1);
}
diff --git a/src/mame/video/orion.cpp b/src/mame/video/orion.cpp
index 7edea6ec578..eeb3a2e7a3a 100644
--- a/src/mame/video/orion.cpp
+++ b/src/mame/video/orion.cpp
@@ -83,28 +83,28 @@ uint32_t orion_state::screen_update_orion128(screen_device &screen, bitmap_ind16
return 0;
}
-static const rgb_t orion128_palette[18] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0xc0), // 1
- rgb_t(0x00, 0xc0, 0x00), // 2
- rgb_t(0x00, 0xc0, 0xc0), // 3
- rgb_t(0xc0, 0x00, 0x00), // 4
- rgb_t(0xc0, 0x00, 0xc0), // 5
- rgb_t(0xc0, 0xc0, 0x00), // 6
- rgb_t(0xc0, 0xc0, 0xc0), // 7
- rgb_t(0x80, 0x80, 0x80), // 8
- rgb_t(0x00, 0x00, 0xff), // 9
- rgb_t(0x00, 0xff, 0x00), // A
- rgb_t(0x00, 0xff, 0xff), // B
- rgb_t(0xff, 0x00, 0x00), // C
- rgb_t(0xff, 0x00, 0xff), // D
- rgb_t(0xff, 0xff, 0x00), // E
- rgb_t(0xff, 0xff, 0xff), // F
- rgb_t(0xc8, 0xb4, 0x28), // 10
- rgb_t(0x32, 0xfa, 0xfa) // 11
+static constexpr rgb_t orion128_pens[18] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0xc0 }, // 1
+ { 0x00, 0xc0, 0x00 }, // 2
+ { 0x00, 0xc0, 0xc0 }, // 3
+ { 0xc0, 0x00, 0x00 }, // 4
+ { 0xc0, 0x00, 0xc0 }, // 5
+ { 0xc0, 0xc0, 0x00 }, // 6
+ { 0xc0, 0xc0, 0xc0 }, // 7
+ { 0x80, 0x80, 0x80 }, // 8
+ { 0x00, 0x00, 0xff }, // 9
+ { 0x00, 0xff, 0x00 }, // A
+ { 0x00, 0xff, 0xff }, // B
+ { 0xff, 0x00, 0x00 }, // C
+ { 0xff, 0x00, 0xff }, // D
+ { 0xff, 0xff, 0x00 }, // E
+ { 0xff, 0xff, 0xff }, // F
+ { 0xc8, 0xb4, 0x28 }, // 10
+ { 0x32, 0xfa, 0xfa } // 11
};
-PALETTE_INIT_MEMBER(orion_state,orion128 )
+void orion_state::orion128_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, orion128_palette, ARRAY_LENGTH(orion128_palette));
+ palette.set_pen_colors(0, orion128_pens);
}
diff --git a/src/mame/video/osi.cpp b/src/mame/video/osi.cpp
index 827c93dc859..f23b83f5c4d 100644
--- a/src/mame/video/osi.cpp
+++ b/src/mame/video/osi.cpp
@@ -6,7 +6,7 @@
/* Palette Initialization */
-PALETTE_INIT_MEMBER(sb2m600_state, osi630)
+void sb2m600_state::osi630_palette(palette_device &palette) const
{
/* black and white */
palette.set_pen_color(0, 0x00, 0x00, 0x00); // black
@@ -27,15 +27,13 @@ PALETTE_INIT_MEMBER(sb2m600_state, osi630)
void sb2m600_state::video_start()
{
- uint16_t addr;
-
- /* randomize video memory contents */
- for (addr = 0; addr < OSI600_VIDEORAM_SIZE; addr++)
+ // randomize video memory contents
+ for (uint16_t addr = 0; addr < OSI600_VIDEORAM_SIZE; addr++)
m_video_ram[addr] = machine().rand() & 0xff;
- /* randomize color memory contents */
+ // randomize color memory contents
if (m_color_ram)
- for (addr = 0; addr < OSI630_COLORRAM_SIZE; addr++)
+ for (uint16_t addr = 0; addr < OSI630_COLORRAM_SIZE; addr++)
m_color_ram[addr] = machine().rand() & 0x0f;
}
@@ -43,23 +41,21 @@ void sb2m600_state::video_start()
uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int y, bit, sx;
-
if (m_32)
{
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
uint16_t videoram_addr = (y >> 4) * 64;
- int line = (y >> 1) & 0x07;
+ int const line = (y >> 1) & 0x07;
int x = 0;
- for (sx = 0; sx < 64; sx++)
+ for (int sx = 0; sx < 64; sx++)
{
uint8_t videoram_data = m_video_ram[videoram_addr];
uint16_t charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
uint8_t charrom_data = m_p_chargen[charrom_addr];
- for (bit = 0; bit < 8; bit++)
+ for (int bit = 0; bit < 8; bit++)
{
bool color = BIT(charrom_data, 7);
@@ -80,19 +76,19 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
}
else
{
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
uint16_t videoram_addr = (y >> 3) * 32;
- int line = y & 0x07;
+ int const line = y & 0x07;
int x = 0;
- for (sx = 0; sx < 32; sx++)
+ for (int sx = 0; sx < 32; sx++)
{
uint8_t videoram_data = m_video_ram[videoram_addr];
- uint16_t charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
+ uint16_t const charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
uint8_t charrom_data = m_p_chargen[charrom_addr];
- for (bit = 0; bit < 8; bit++)
+ for (int bit = 0; bit < 8; bit++)
{
bool color = BIT(charrom_data, 7);
@@ -118,21 +114,19 @@ uint32_t sb2m600_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
uint32_t uk101_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int y, bit, sx;
-
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
uint16_t videoram_addr = (y >> 4) * 64;
- int line = (y >> 1) & 0x07;
+ int const line = (y >> 1) & 0x07;
int x = 0;
- for (sx = 0; sx < 64; sx++)
+ for (int sx = 0; sx < 64; sx++)
{
uint8_t videoram_data = m_video_ram[videoram_addr++];
- uint16_t charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
+ uint16_t const charrom_addr = ((videoram_data << 3) | line) & 0x7ff;
uint8_t charrom_data = m_p_chargen[charrom_addr];
- for (bit = 0; bit < 8; bit++)
+ for (int bit = 0; bit < 8; bit++)
{
bitmap.pix16(y, x) = BIT(charrom_data, 7);
x++;
@@ -154,7 +148,7 @@ MACHINE_CONFIG_START(sb2m600_state::osi600_video)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0, 32*8-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(uk101_state::uk101_video)
@@ -165,7 +159,7 @@ MACHINE_CONFIG_START(uk101_state::uk101_video)
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD_MONOCHROME("palette")
+ PALETTE(config, "palette", palette_device::MONOCHROME);
MACHINE_CONFIG_END
MACHINE_CONFIG_START(sb2m600_state::osi630_video)
@@ -176,6 +170,5 @@ MACHINE_CONFIG_START(sb2m600_state::osi630_video)
MCFG_SCREEN_VISIBLE_AREA(0, 64*8-1, 0, 16*16-1)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 8+2)
- MCFG_PALETTE_INIT_OWNER(sb2m600_state, osi630)
+ PALETTE(config, "palette", FUNC(sb2m600_state::osi630_palette), 8+2);
MACHINE_CONFIG_END
diff --git a/src/mame/video/pacland.cpp b/src/mame/video/pacland.cpp
index c74b6904a79..ebc34135338 100644
--- a/src/mame/video/pacland.cpp
+++ b/src/mame/video/pacland.cpp
@@ -89,7 +89,7 @@ void pacland_state::switch_palette()
}
}
-PALETTE_INIT_MEMBER(pacland_state, pacland)
+void pacland_state::pacland_palette(palette_device &palette)
{
uint8_t const *color_prom = &m_color_prom[0];
@@ -111,19 +111,19 @@ PALETTE_INIT_MEMBER(pacland_state, pacland)
m_palette_bank = 0;
switch_palette();
- /* precalculate transparency masks for sprites */
+ // precalculate transparency masks for sprites
m_transmask[0] = std::make_unique<uint32_t[]>(64);
m_transmask[1] = std::make_unique<uint32_t[]>(64);
m_transmask[2] = std::make_unique<uint32_t[]>(64);
for (int i = 0; i < 64; i++)
{
- /* start with no transparency */
+ // start with no transparency
m_transmask[0][i] = m_transmask[1][i] = m_transmask[2][i] = 0;
- /* iterate over all palette entries except the last one */
+ // iterate over all palette entries except the last one
for (int palentry = 0; palentry < 0x100; palentry++)
{
- uint32_t mask = palette.transpen_mask(*m_gfxdecode->gfx(2), i, palentry);
+ uint32_t const mask = palette.transpen_mask(*m_gfxdecode->gfx(2), i, palentry);
/* transmask[0] is a mask that is used to draw only high priority sprite pixels; thus, pens
$00-$7F are opaque, and others are transparent */
diff --git a/src/mame/video/pacman.cpp b/src/mame/video/pacman.cpp
index e46ae8cbb75..6325500b408 100644
--- a/src/mame/video/pacman.cpp
+++ b/src/mame/video/pacman.cpp
@@ -63,58 +63,56 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(pacman_state,pacman)
+void pacman_state::pacman_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 0, 0,
3, &resistances[0], gweights, 0, 0,
2, &resistances[1], bweights, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 32; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 32; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 32;
- /* allocate the colortable */
- for (i = 0; i < 64*4; i++)
+ // allocate the colortable
+ for (int i = 0; i < 64*4; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
- /* first palette bank */
+ // first palette bank
palette.set_pen_indirect(i, ctabentry);
- /* second palette bank */
- palette.set_pen_indirect(i + 64*4, 0x10 + ctabentry);
+ // second palette bank
+ palette.set_pen_indirect(i + 64*4, 0x10 | ctabentry);
}
}
diff --git a/src/mame/video/pandoras.cpp b/src/mame/video/pandoras.cpp
index 9464063fef0..bf2afb944f8 100644
--- a/src/mame/video/pandoras.cpp
+++ b/src/mame/video/pandoras.cpp
@@ -23,60 +23,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(pandoras_state, pandoras)
+void pandoras_state::pandoras_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites */
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters */
- for (i = 0x100; i < 0x200; i++)
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/pastelg.cpp b/src/mame/video/pastelg.cpp
index e53cbc9b8c2..99d8e4b6667 100644
--- a/src/mame/video/pastelg.cpp
+++ b/src/mame/video/pastelg.cpp
@@ -15,31 +15,31 @@
******************************************************************************/
-PALETTE_INIT_MEMBER(pastelg_state, pastelg)
+void pastelg_state::pastelg_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0, bit1, bit2, bit3, r, g, b;
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- bit2 = (color_prom[0] >> 6) & 0x01;
- bit3 = (color_prom[0] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 5);
+ bit2 = BIT(color_prom[0], 6);
+ bit3 = BIT(color_prom[0], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[palette.entries()], 0);
+ bit1 = BIT(color_prom[palette.entries()], 1);
+ bit2 = BIT(color_prom[palette.entries()], 2);
+ bit3 = BIT(color_prom[palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/pc6001.cpp b/src/mame/video/pc6001.cpp
index 3b9f17f257e..8dcb5121ed0 100644
--- a/src/mame/video/pc6001.cpp
+++ b/src/mame/video/pc6001.cpp
@@ -17,60 +17,56 @@
*
****************************************/
-static const rgb_t defcolors[] =
+static constexpr rgb_t defcolors[] =
{
- rgb_t(0x07, 0xff, 0x00), /* GREEN */
- rgb_t(0xff, 0xff, 0x00), /* YELLOW */
- rgb_t(0x3b, 0x08, 0xff), /* BLUE */
- rgb_t(0xcc, 0x00, 0x3b), /* RED */
- rgb_t(0xff, 0xff, 0xff), /* BUFF */
- rgb_t(0x07, 0xe3, 0x99), /* CYAN */
- rgb_t(0xff, 0x1c, 0xff), /* MAGENTA */
- rgb_t(0xff, 0x81, 0x00), /* ORANGE */
-
- /* MC6847 specific */
- rgb_t(0x00, 0x7c, 0x00), /* ALPHANUMERIC DARK GREEN */
- rgb_t(0x07, 0xff, 0x00), /* ALPHANUMERIC BRIGHT GREEN */
- rgb_t(0x91, 0x00, 0x00), /* ALPHANUMERIC DARK ORANGE */
- rgb_t(0xff, 0x81, 0x00) /* ALPHANUMERIC BRIGHT ORANGE */
+ rgb_t(0x07, 0xff, 0x00), // GREEN
+ rgb_t(0xff, 0xff, 0x00), // YELLOW
+ rgb_t(0x3b, 0x08, 0xff), // BLUE
+ rgb_t(0xcc, 0x00, 0x3b), // RED
+ rgb_t(0xff, 0xff, 0xff), // BUFF
+ rgb_t(0x07, 0xe3, 0x99), // CYAN
+ rgb_t(0xff, 0x1c, 0xff), // MAGENTA
+ rgb_t(0xff, 0x81, 0x00), // ORANGE
+
+ // MC6847 specific
+ rgb_t(0x00, 0x7c, 0x00), // ALPHANUMERIC DARK GREEN
+ rgb_t(0x07, 0xff, 0x00), // ALPHANUMERIC BRIGHT GREEN
+ rgb_t(0x91, 0x00, 0x00), // ALPHANUMERIC DARK ORANGE
+ rgb_t(0xff, 0x81, 0x00) // ALPHANUMERIC BRIGHT ORANGE
};
-static const rgb_t mk2_defcolors[] =
+static constexpr rgb_t mk2_defcolors[] =
{
- rgb_t(0x00, 0x00, 0x00), /* BLACK */
- rgb_t(0xff, 0xaf, 0x00), /* ORANGE */
- rgb_t(0x00, 0xff, 0xaf), /* tone of GREEN */
- rgb_t(0xaf, 0xff, 0x00), /* tone of GREEN */
- rgb_t(0xaf, 0x00, 0xff), /* VIOLET */
- rgb_t(0xff, 0x00, 0xaf), /* SCARLET */
- rgb_t(0x00, 0xaf, 0xff), /* LIGHT BLUE */
- rgb_t(0xaf, 0xaf, 0xaf), /* GRAY */
- rgb_t(0x00, 0x00, 0x00), /* BLACK */
- rgb_t(0xff, 0x00, 0x00), /* RED */
- rgb_t(0x00, 0xff, 0x00), /* GREEN */
- rgb_t(0xff, 0xff, 0x00), /* YELLOW */
- rgb_t(0x00, 0x00, 0xff), /* BLUE */
- rgb_t(0xff, 0x00, 0xff), /* PINK */
- rgb_t(0x00, 0xff, 0xff), /* CYAN */
- rgb_t(0xff, 0xff, 0xff) /* WHITE */
+ rgb_t(0x00, 0x00, 0x00), // BLACK
+ rgb_t(0xff, 0xaf, 0x00), // ORANGE
+ rgb_t(0x00, 0xff, 0xaf), // tone of GREEN
+ rgb_t(0xaf, 0xff, 0x00), // tone of GREEN
+ rgb_t(0xaf, 0x00, 0xff), // VIOLET
+ rgb_t(0xff, 0x00, 0xaf), // SCARLET
+ rgb_t(0x00, 0xaf, 0xff), // LIGHT BLUE
+ rgb_t(0xaf, 0xaf, 0xaf), // GRAY
+ rgb_t(0x00, 0x00, 0x00), // BLACK
+ rgb_t(0xff, 0x00, 0x00), // RED
+ rgb_t(0x00, 0xff, 0x00), // GREEN
+ rgb_t(0xff, 0xff, 0x00), // YELLOW
+ rgb_t(0x00, 0x00, 0xff), // BLUE
+ rgb_t(0xff, 0x00, 0xff), // PINK
+ rgb_t(0x00, 0xff, 0xff), // CYAN
+ rgb_t(0xff, 0xff, 0xff) // WHITE
};
-PALETTE_INIT_MEMBER(pc6001_state, pc6001)
+void pc6001_state::pc6001_palette(palette_device &palette) const
{
- int i;
-
- for(i=0;i<8+4;i++)
+ for(int i=0;i<8+4;i++)
palette.set_pen_color(i+8,defcolors[i]);
}
-PALETTE_INIT_MEMBER(pc6001mk2_state,pc6001mk2)
+void pc6001mk2_state::pc6001mk2_palette(palette_device &palette) const
{
- int i;
-
- for(i=0;i<8;i++)
+ for(int i=0;i<8;i++)
palette.set_pen_color(i+8,defcolors[i]);
- for(i=0x10;i<0x20;i++)
+ for(int i=0x10;i<0x20;i++)
palette.set_pen_color(i,mk2_defcolors[i-0x10]);
}
diff --git a/src/mame/video/pc8401a.cpp b/src/mame/video/pc8401a.cpp
index 3fe9cb23624..0c38ce83c39 100644
--- a/src/mame/video/pc8401a.cpp
+++ b/src/mame/video/pc8401a.cpp
@@ -7,7 +7,7 @@
/* PC-8401A */
-PALETTE_INIT_MEMBER(pc8401a_state,pc8401a)
+void pc8401a_state::pc8401a_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(39, 108, 51));
palette.set_pen_color(1, rgb_t(16, 37, 84));
@@ -61,8 +61,7 @@ void pc8401a_state::pc8500_lcdc(address_map &map)
MACHINE_CONFIG_START(pc8401a_state::pc8401a_video)
// config.set_default_layout(layout_pc8401a);
- MCFG_PALETTE_ADD("palette", 2)
- MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a)
+ PALETTE(config, "palette", FUNC(pc8401a_state::pc8401a_palette), 2);
/* LCD */
MCFG_SCREEN_ADD(SCREEN_TAG, LCD)
@@ -80,8 +79,7 @@ MACHINE_CONFIG_END
MACHINE_CONFIG_START(pc8500_state::pc8500_video)
config.set_default_layout(layout_pc8500);
- MCFG_PALETTE_ADD("palette", 2+8)
- MCFG_PALETTE_INIT_OWNER(pc8401a_state,pc8401a)
+ PALETTE(config, "palette", FUNC(pc8500_state::pc8401a_palette), 2 + 8);
/* LCD */
MCFG_SCREEN_ADD(SCREEN_TAG, LCD)
diff --git a/src/mame/video/pc_t1t.cpp b/src/mame/video/pc_t1t.cpp
index f3b58993b6e..02248cc9a67 100644
--- a/src/mame/video/pc_t1t.cpp
+++ b/src/mame/video/pc_t1t.cpp
@@ -33,8 +33,8 @@ enum
DEFINE_DEVICE_TYPE(PCVIDEO_T1000, pcvideo_t1000_device, "tandy_1000_graphics", "Tandy 1000 Graphics Adapter")
DEFINE_DEVICE_TYPE(PCVIDEO_PCJR, pcvideo_pcjr_device, "pcjr_graphics", "PC Jr Graphics Adapter")
-pc_t1t_device::pc_t1t_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
- : device_t(mconfig, type, tag, owner, clock),
+pc_t1t_device::pc_t1t_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
+ device_t(mconfig, type, tag, owner, clock),
device_video_interface(mconfig, *this),
m_mc6845(*this, T1000_MC6845_NAME),
m_mode_control(0),
@@ -122,8 +122,7 @@ void pcvideo_t1000_device::device_add_mconfig(machine_config &config)
screen.set_raw(XTAL(14'318'181),912,0,640,262,0,200);
screen.set_screen_update(T1000_MC6845_NAME, FUNC(mc6845_device::screen_update));
- palette_device &palette(PALETTE(config, "palette", 32));
- palette.set_init(palette_init_delegate(FUNC(pc_t1t_device::palette_init_pcjr), this));
+ PALETTE(config, m_palette, FUNC(pcvideo_t1000_device::pcjr_palette), 32);
MC6845(config, m_mc6845, XTAL(14'318'181)/8);
m_mc6845->set_screen(T1000_SCREEN_NAME);
@@ -143,8 +142,7 @@ void pcvideo_pcjr_device::device_add_mconfig(machine_config &config)
screen.set_raw(XTAL(14'318'181), 912, 0, 640, 262, 0, 200);
screen.set_screen_update(T1000_MC6845_NAME, FUNC(mc6845_device::screen_update));
- palette_device &palette(PALETTE(config, "palette", 32));
- palette.set_init(palette_init_delegate(FUNC(pc_t1t_device::palette_init_pcjr), this));
+ PALETTE(config, m_palette, FUNC(pcvideo_pcjr_device::pcjr_palette), 32);
MC6845(config, m_mc6845, XTAL(14'318'181)/16);
m_mc6845->set_screen(T1000_SCREEN_NAME);
@@ -165,24 +163,23 @@ void pcvideo_pcjr_device::device_add_mconfig(machine_config &config)
***************************************************************************/
/* Initialise the cga palette */
-PALETTE_INIT_MEMBER( pc_t1t_device, pcjr )
+void pc_t1t_device::pcjr_palette(palette_device &palette) const
{
- const static unsigned char tga_palette[16][3] =
+ static constexpr rgb_t tga_palette[16] =
{
{ 0x00, 0x00, 0x00 }, { 0x00, 0x00, 0xaa }, { 0x00, 0xaa, 0x00 }, { 0x00, 0xaa, 0xaa },
{ 0xaa, 0x00, 0x00 }, { 0xaa, 0x00, 0xaa }, { 0xaa, 0x55, 0x00 }, { 0xaa, 0xaa, 0xaa },
{ 0x55, 0x55, 0x55 }, { 0x55, 0x55, 0xff }, { 0x55, 0xff, 0x55 }, { 0x55, 0xff, 0xff },
{ 0xff, 0x55, 0x55 }, { 0xff, 0x55, 0xff }, { 0xff, 0xff, 0x55 }, { 0xff, 0xff, 0xff }
};
- int i;
- /* colors */
- for(i = 0; i < 16; i++)
- palette.set_pen_color(i, tga_palette[i][0], tga_palette[i][1], tga_palette[i][2]);
+ // colors
+ for (int i = 0; i < 16; i++)
+ palette.set_pen_color(i, tga_palette[i]);
/* b/w mode shades */
- for(i = 0; i < 16; i++)
- palette.set_pen_color(16+i, ( i << 4 ) | i, ( i << 4 ) | i, ( i << 4 ) | i );
+ for (int i = 0; i < 16; i++)
+ palette.set_pen_color(16+i, pal4bit(i), pal4bit(i), pal4bit(i));
}
@@ -190,10 +187,9 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_inten_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
uint32_t *p = &bitmap.pix32(y);
- int i;
if ( y == 0 ) logerror("t1000_text_inten_update_row\n");
- for ( i = 0; i < x_count; i++ )
+ for (int i = 0; i < x_count; i++)
{
uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff;
uint8_t chr = m_displayram[ offset ];
@@ -223,9 +219,8 @@ MC6845_UPDATE_ROW( pc_t1t_device::t1000_text_blink_update_row )
{
const rgb_t *palette = m_palette->palette()->entry_list_raw();
uint32_t *p = &bitmap.pix32(y);
- int i;
- for ( i = 0; i < x_count; i++ )
+ for (int i = 0; i < x_count; i++)
{
uint16_t offset = ( ( ma + i ) << 1 ) & 0x3fff;
uint8_t chr = m_displayram[ offset ];
@@ -493,7 +488,7 @@ MC6845_UPDATE_ROW( pcvideo_pcjr_device::crtc_update_row )
}
-void pcvideo_t1000_device::mode_switch( void )
+void pcvideo_t1000_device::mode_switch()
{
switch( m_mode_control & 0x3B )
{
@@ -634,7 +629,7 @@ void pcvideo_t1000_device::mode_control_w(int data)
mode_switch();
}
-int pc_t1t_device::mode_control_r(void)
+int pc_t1t_device::mode_control_r()
{
int data = m_mode_control;
return data;
@@ -650,7 +645,7 @@ void pc_t1t_device::color_select_w(int data)
m_color_select = data;
}
-int pc_t1t_device::color_select_r(void)
+int pc_t1t_device::color_select_r()
{
int data = m_color_select;
return data;
@@ -672,7 +667,7 @@ int pc_t1t_device::color_select_r(void)
* =1 memory access without interfering with display
* (Genoa SuperEGA) horizontal or vertical retrace
*/
-int pc_t1t_device::status_r(void)
+int pc_t1t_device::status_r()
{
int data = m_vsync | m_status | m_display_enable;
/* HACK HACK HACK */
@@ -762,7 +757,7 @@ void pcvideo_pcjr_device::pc_pcjr_vga_data_w(int data)
}
-int pc_t1t_device::vga_data_r(void)
+int pc_t1t_device::vga_data_r()
{
int data = m_reg.data[m_reg.index];
@@ -863,7 +858,7 @@ void pcvideo_pcjr_device::pc_pcjx_bank_w(int data)
pc_pcjr_mode_switch();
}
-int pc_t1t_device::bank_r(void)
+int pc_t1t_device::bank_r()
{
return m_bank;
}
diff --git a/src/mame/video/pc_t1t.h b/src/mame/video/pc_t1t.h
index 7ed2ad4e378..4a42f4b7dc0 100644
--- a/src/mame/video/pc_t1t.h
+++ b/src/mame/video/pc_t1t.h
@@ -3,6 +3,8 @@
#ifndef MAME_VIDEO_PC_T1T_H
#define MAME_VIDEO_PC_T1T_H
+#pragma once
+
#include "video/mc6845.h"
#include "machine/ram.h"
#include "machine/bankdev.h"
@@ -15,8 +17,6 @@
class pc_t1t_device : public device_t, public device_video_interface
{
public:
- DECLARE_PALETTE_INIT( pcjr );
-
DECLARE_WRITE_LINE_MEMBER( t1000_de_changed );
DECLARE_READ8_MEMBER( read );
@@ -78,14 +78,16 @@ protected:
uint8_t m_vsync;
uint8_t m_palette_base;
- int mode_control_r(void);
+ void pcjr_palette(palette_device &palette) const;
+
+ int mode_control_r();
void color_select_w(int data);
- int color_select_r(void);
- int status_r(void);
+ int color_select_r();
+ int status_r();
void lightpen_strobe_w(int data);
void vga_index_w(int data);
- int vga_data_r(void);
- int bank_r(void);
+ int vga_data_r();
+ int bank_r();
required_device<palette_device> m_palette;
required_device<ram_device> m_ram;
@@ -100,12 +102,13 @@ public:
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( disable_w );
+
protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual void device_start() override;
private:
- void mode_switch( void );
+ void mode_switch();
void vga_data_w(int data);
void bank_w(int data);
void mode_control_w(int data);
diff --git a/src/mame/video/pcd.cpp b/src/mame/video/pcd.cpp
index 12d6f62a323..2b3a4fe8604 100644
--- a/src/mame/video/pcd.cpp
+++ b/src/mame/video/pcd.cpp
@@ -110,8 +110,7 @@ MACHINE_CONFIG_START(pcd_video_device::device_add_mconfig)
screen.set_raw(16_MHz_XTAL, 832, 0, 640, 381, 0, 350);
screen.set_screen_update("crtc", FUNC(scn2674_device::screen_update));
- MCFG_PALETTE_ADD("palette", 3)
- MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx)
+ PALETTE(config, "palette", FUNC(pcd_video_device::pcdx_palette), 3);
SCN2674(config, m_crtc, 16_MHz_XTAL / 16);
m_crtc->set_character_width(16);
@@ -160,7 +159,7 @@ void pcx_video_device::device_add_mconfig(machine_config &config)
screen.set_raw(24_MHz_XTAL, 1272, 0, 960, 381, 0, 350);
screen.set_screen_update("crtc", FUNC(scn2672_device::screen_update));
- PALETTE(config, "palette", 2).set_init("palette", FUNC(palette_device::palette_init_monochrome));
+ PALETTE(config, "palette", palette_device::MONOCHROME);
SCN2672(config, m_crtc, 24_MHz_XTAL / 12); // used with SCB2673B
m_crtc->intr_callback().set_inputline("graphics", MCS51_INT0_LINE);
@@ -240,7 +239,7 @@ SCN2672_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels)
}
}
-PALETTE_INIT_MEMBER(pcdx_video_device, pcdx)
+void pcdx_video_device::pcdx_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t::black());
palette.set_pen_color(1, rgb_t::white());
diff --git a/src/mame/video/pcd.h b/src/mame/video/pcd.h
index b4b38fc97db..6bbcf76f3a0 100644
--- a/src/mame/video/pcd.h
+++ b/src/mame/video/pcd.h
@@ -1,6 +1,5 @@
// license:BSD-3-Clause
// copyright-holders:Carl
-
#ifndef MAME_VIDEO_PCD_H
#define MAME_VIDEO_PCD_H
@@ -20,11 +19,12 @@ public:
virtual void map(address_map &map) = 0;
DECLARE_READ8_MEMBER(detect_r);
DECLARE_WRITE8_MEMBER(detect_w);
- DECLARE_PALETTE_INIT(pcdx);
protected:
pcdx_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ void pcdx_palette(palette_device &palette) const;
+
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_mcu;
required_device<pic8259_device> m_pic2;
diff --git a/src/mame/video/pcktgal.cpp b/src/mame/video/pcktgal.cpp
index 171c62ec430..6a12dd2f4de 100644
--- a/src/mame/video/pcktgal.cpp
+++ b/src/mame/video/pcktgal.cpp
@@ -3,31 +3,31 @@
#include "emu.h"
#include "includes/pcktgal.h"
-PALETTE_INIT_MEMBER(pcktgal_state, pcktgal)
+void pcktgal_state::pcktgal_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (int i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
+ int bit0, bit1, bit2, bit3;
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 5) & 0x01;
- bit2 = (color_prom[i] >> 6) & 0x01;
- bit3 = (color_prom[i] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[i + palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[i + palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ bit2 = BIT(color_prom[i], 6);
+ bit3 = BIT(color_prom[i], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ bit0 = BIT(color_prom[i + palette.entries()], 0);
+ bit1 = BIT(color_prom[i + palette.entries()], 1);
+ bit2 = BIT(color_prom[i + palette.entries()], 2);
+ bit3 = BIT(color_prom[i + palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/pcw.cpp b/src/mame/video/pcw.cpp
index ead37173e91..c7779d5f2ce 100644
--- a/src/mame/video/pcw.cpp
+++ b/src/mame/video/pcw.cpp
@@ -38,17 +38,17 @@ static const unsigned short pcw_colour_table[PCW_NUM_COLOURS] =
#endif
/* black/white */
-static const rgb_t pcw_palette[PCW_NUM_COLOURS] =
+static constexpr rgb_t pcw_palette[PCW_NUM_COLOURS] =
{
- rgb_t(0x000, 0x000, 0x000),
- rgb_t(0x0ff, 0x0ff, 0x0ff)
+ { 0x000, 0x000, 0x000 },
+ { 0x0ff, 0x0ff, 0x0ff }
};
/* Initialise the palette */
-PALETTE_INIT_MEMBER(pcw_state, pcw)
+void pcw_state::pcw_colours(palette_device &palette) const
{
- palette.set_pen_colors(0, pcw_palette, ARRAY_LENGTH(pcw_palette));
+ palette.set_pen_colors(0, pcw_palette);
}
/***************************************************************************
diff --git a/src/mame/video/pcw16.cpp b/src/mame/video/pcw16.cpp
index f3754095141..35177c807b8 100644
--- a/src/mame/video/pcw16.cpp
+++ b/src/mame/video/pcw16.cpp
@@ -16,40 +16,40 @@ static const unsigned short pcw16_colour_table[PCW16_NUM_COLOURS] =
};
#endif
-static const rgb_t pcw16_palette[PCW16_NUM_COLOURS] =
+static constexpr rgb_t pcw16_palette[PCW16_NUM_COLOURS] =
{
- rgb_t(0x080, 0x080, 0x080), /* light grey */
- rgb_t(0x080, 0x080, 0x080), /* light grey */
- rgb_t(0x000, 0x080, 0x080), /* magenta */
- rgb_t(0x000, 0x080, 0x080), /* magenta */
- rgb_t(0x080, 0x080, 0x080), /* light grey */
- rgb_t(0x080, 0x080, 0x080), /* light grey */
- rgb_t(0x0ff, 0x080, 0x080), /* pastel green */
- rgb_t(0x0ff, 0x080, 0x080), /* pastel green */
- rgb_t(0x000, 0x000, 0x080), /* blue */
- rgb_t(0x000, 0x000, 0x000), /* black */
- rgb_t(0x000, 0x080, 0x0ff), /* mauve */
- rgb_t(0x000, 0x000, 0x0ff), /* bright blue */
- rgb_t(0x000, 0x080, 0x000), /* red */
- rgb_t(0x000, 0x0ff, 0x000), /* bright red */
- rgb_t(0x000, 0x0ff, 0x080), /* purple */
- rgb_t(0x000, 0x0ff, 0x0ff), /* bright magenta */
- rgb_t(0x0ff, 0x000, 0x080), /* sea green */
- rgb_t(0x0ff, 0x000, 0x0ff), /* bright green */
- rgb_t(0x0ff, 0x080, 0x0ff), /* pastel cyan */
- rgb_t(0x0ff, 0x000, 0x0ff), /* bright cyan */
- rgb_t(0x0ff, 0x080, 0x000), /* lime green */
- rgb_t(0x0ff, 0x0ff, 0x000), /* bright yellow */
- rgb_t(0x0ff, 0x0ff, 0x080), /* pastel yellow */
- rgb_t(0x0ff, 0x0ff, 0x0ff), /* bright white */
- rgb_t(0x080, 0x000, 0x080), /* cyan */
- rgb_t(0x080, 0x000, 0x000), /* green */
- rgb_t(0x080, 0x080, 0x0ff), /* pastel blue */
- rgb_t(0x080, 0x000, 0x0ff), /* sky blue */
- rgb_t(0x080, 0x080, 0x000), /* yellow */
- rgb_t(0x080, 0x0ff, 0x000), /* orange */
- rgb_t(0x080, 0x0ff, 0x080), /* pink */
- rgb_t(0x080, 0x0ff, 0x0ff), /* pastel magenta */
+ { 0x080, 0x080, 0x080 }, // light grey
+ { 0x080, 0x080, 0x080 }, // light grey
+ { 0x000, 0x080, 0x080 }, // magenta
+ { 0x000, 0x080, 0x080 }, // magenta
+ { 0x080, 0x080, 0x080 }, // light grey
+ { 0x080, 0x080, 0x080 }, // light grey
+ { 0x0ff, 0x080, 0x080 }, // pastel green
+ { 0x0ff, 0x080, 0x080 }, // pastel green
+ { 0x000, 0x000, 0x080 }, // blue
+ { 0x000, 0x000, 0x000 }, // black
+ { 0x000, 0x080, 0x0ff }, // mauve
+ { 0x000, 0x000, 0x0ff }, // bright blue
+ { 0x000, 0x080, 0x000 }, // red
+ { 0x000, 0x0ff, 0x000 }, // bright red
+ { 0x000, 0x0ff, 0x080 }, // purple
+ { 0x000, 0x0ff, 0x0ff }, // bright magenta
+ { 0x0ff, 0x000, 0x080 }, // sea green
+ { 0x0ff, 0x000, 0x0ff }, // bright green
+ { 0x0ff, 0x080, 0x0ff }, // pastel cyan
+ { 0x0ff, 0x000, 0x0ff }, // bright cyan
+ { 0x0ff, 0x080, 0x000 }, // lime green
+ { 0x0ff, 0x0ff, 0x000 }, // bright yellow
+ { 0x0ff, 0x0ff, 0x080 }, // pastel yellow
+ { 0x0ff, 0x0ff, 0x0ff }, // bright white
+ { 0x080, 0x000, 0x080 }, // cyan
+ { 0x080, 0x000, 0x000 }, // green
+ { 0x080, 0x080, 0x0ff }, // pastel blue
+ { 0x080, 0x000, 0x0ff }, // sky blue
+ { 0x080, 0x080, 0x000 }, // yellow
+ { 0x080, 0x0ff, 0x000 }, // orange
+ { 0x080, 0x0ff, 0x080 }, // pink
+ { 0x080, 0x0ff, 0x0ff } // pastel magenta
};
@@ -59,9 +59,9 @@ inline void pcw16_state::pcw16_plot_pixel(bitmap_ind16 &bitmap, int x, int y, ui
}
/* Initialise the palette */
-PALETTE_INIT_MEMBER(pcw16_state, pcw16)
+void pcw16_state::pcw16_colours(palette_device &palette) const
{
- palette.set_pen_colors(0, pcw16_palette, ARRAY_LENGTH(pcw16_palette));
+ palette.set_pen_colors(0, pcw16_palette);
}
void pcw16_state::video_start()
@@ -69,7 +69,7 @@ void pcw16_state::video_start()
}
/* 640, 1 bit per pixel */
-void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, uint8_t byte)
{
int b;
int local_byte;
@@ -92,7 +92,7 @@ void pcw16_state::pcw16_vh_decode_mode0(bitmap_ind16 &bitmap, int x, int y, unsi
}
/* 320, 2 bits per pixel */
-void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, uint8_t byte)
{
int b;
int px;
@@ -123,7 +123,7 @@ void pcw16_state::pcw16_vh_decode_mode1(bitmap_ind16 &bitmap, int x, int y, unsi
}
/* 160, 4 bits per pixel */
-void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, unsigned char byte)
+void pcw16_state::pcw16_vh_decode_mode2(bitmap_ind16 &bitmap, int x, int y, uint8_t byte)
{
int px;
int b;
diff --git a/src/mame/video/phoenix.cpp b/src/mame/video/phoenix.cpp
index 9eefeab0950..dcea2d63bd9 100644
--- a/src/mame/video/phoenix.cpp
+++ b/src/mame/video/phoenix.cpp
@@ -9,9 +9,9 @@
***************************************************************************/
#include "emu.h"
-#include "video/resnet.h"
#include "includes/phoenix.h"
+#include "video/resnet.h"
/***************************************************************************
@@ -77,53 +77,50 @@ static const res_net_info survival_net_info =
}
};
-PALETTE_INIT_MEMBER(phoenix_state,phoenix)
+void phoenix_state::phoenix_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- std::vector<rgb_t> rgb;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, phoenix_decode_info, phoenix_net_info);
- /* native order */
- for (i=0;i<256;i++)
+
+ // native order
+ for (int i = 0; i < 256; i++)
{
- int col;
- col = ((i << 3 ) & 0x18) | ((i>>2) & 0x07) | (i & 0x60);
- palette.set_pen_color(i,rgb[col]);
+ int const col = bitswap<7>(i, 6, 5, 1, 0, 4, 3, 2);
+ palette.set_pen_color(i, rgb[col]);
}
palette.palette()->normalize_range(0, 255);
}
-PALETTE_INIT_MEMBER(phoenix_state,survival)
+void phoenix_state::survival_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- std::vector<rgb_t> rgb;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, phoenix_decode_info, survival_net_info);
- /* native order */
- for (i=0;i<256;i++)
+
+ // native order
+ for (int i = 0; i < 256; i++)
{
- int col;
- col = ((i << 3 ) & 0x18) | ((i>>2) & 0x07) | (i & 0x60);
- palette.set_pen_color(i,rgb[col]);
+ int const col = bitswap<7>(i, 6, 5, 1, 0, 4, 3, 2);
+ palette.set_pen_color(i, rgb[col]);
}
palette.palette()->normalize_range(0, 255);
}
-PALETTE_INIT_MEMBER(phoenix_state,pleiads)
+void phoenix_state::pleiads_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- std::vector<rgb_t> rgb;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, phoenix_decode_info, pleiades_net_info);
- /* native order */
- for (i=0;i<256;i++)
+
+ // native order
+ for (int i = 0; i < 256; i++)
{
- int col;
- col = ((i << 3 ) & 0x18) | ((i>>2) & 0x07) | (i & 0xE0);
- palette.set_pen_color(i,rgb[col]);
+ int const col = bitswap<8>(i, 7, 6, 5, 1, 0, 4, 3, 2);
+ palette.set_pen_color(i, rgb[col]);
}
palette.palette()->normalize_range(0, 255);
}
diff --git a/src/mame/video/pingpong.cpp b/src/mame/video/pingpong.cpp
index cced6922ada..ab4170b0aa2 100644
--- a/src/mame/video/pingpong.cpp
+++ b/src/mame/video/pingpong.cpp
@@ -32,52 +32,50 @@
bit 0 -- 1 kohm resistor -- RED
***************************************************************************/
-PALETTE_INIT_MEMBER(pingpong_state, pingpong)
+void pingpong_state::pingpong_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters */
- for (i = 0; i < 0x100; i++)
+ // characters
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites */
- for (i = 0x100; i < 0x200; i++)
+ // sprites
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = bitswap<8>(color_prom[i],7,6,5,4,0,1,2,3);
+ uint8_t const ctabentry = bitswap<8>(color_prom[i],7,6,5,4,0,1,2,3);
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/pitnrun.cpp b/src/mame/video/pitnrun.cpp
index 65893c0128c..6d408cdab09 100644
--- a/src/mame/video/pitnrun.cpp
+++ b/src/mame/video/pitnrun.cpp
@@ -94,65 +94,76 @@ WRITE_LINE_MEMBER(pitnrun_state::color_select_w)
void pitnrun_state::spotlights()
{
- int x,y,i,b,datapix;
- uint8_t *ROM = memregion("spot")->base();
- for(i=0;i<4;i++)
- for(y=0;y<128;y++)
- for(x=0;x<16;x++)
- {
- datapix=ROM[128*16*i+x+y*16];
- for(b=0;b<8;b++)
+ uint8_t const *const ROM = memregion("spot")->base();
+ for (int i=0; i<4; i++)
+ {
+ for (int y=0; y<128; y++)
{
- m_tmp_bitmap[i]->pix16(y, x*8+(7-b)) = (datapix&1);
- datapix>>=1;
- }
+ for (int x=0; x<16; x++)
+ {
+ int datapix = ROM[128*16*i + x + y*16];
+ for(int b=0; b<8; b++)
+ {
+ m_tmp_bitmap[i]->pix16(y, x*8 + (7 - b)) = (datapix & 1);
+ datapix>>=1;
+ }
+ }
}
+ }
}
-PALETTE_INIT_MEMBER(pitnrun_state, pitnrun)
+void pitnrun_state::pitnrun_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int bit0,bit1,bit2,r,g,b;
- for (i = 0;i < 32*3; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+
+ for (int i = 0; i < 32*3; i++)
{
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
- /* fake bg palette for lightning effect*/
- for(i=2*16;i<2*16+16;i++)
+ // fake bg palette for lightning effect
+ for (int i = 2*16; i < 2*16 + 16; i++)
{
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int bit0, bit1, bit2;
+
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- r/=3;
- g/=3;
- b/=3;
-
- palette.set_pen_color(i+16,(r>0xff)?0xff:r,(g>0xff)?0xff:g,(b>0xff)?0xff:b);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ r /= 3;
+ g /= 3;
+ b /= 3;
+
+ palette.set_pen_color(i + 16, (r > 0xff) ? 0xff : r, (g > 0xff) ? 0xff : g, (b > 0xff) ? 0xff : b);
}
}
diff --git a/src/mame/video/pk8000.cpp b/src/mame/video/pk8000.cpp
index 291242e9922..5b7fda9fda2 100644
--- a/src/mame/video/pk8000.cpp
+++ b/src/mame/video/pk8000.cpp
@@ -63,28 +63,28 @@ WRITE8_MEMBER(pk8000_base_state::color_w)
m_color[offset] = data;
}
-static const rgb_t pk8000_palette[16] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0x00), // 1
- rgb_t(0x00, 0xc0, 0x00), // 2
- rgb_t(0x00, 0xff, 0x00), // 3
- rgb_t(0x00, 0x00, 0xc0), // 4
- rgb_t(0x00, 0x00, 0xff), // 5
- rgb_t(0x00, 0xc0, 0xc0), // 6
- rgb_t(0x00, 0xff, 0xff), // 7
- rgb_t(0xc0, 0x00, 0x00), // 8
- rgb_t(0xff, 0x00, 0x00), // 9
- rgb_t(0xc0, 0xc0, 0x00), // A
- rgb_t(0xff, 0xff, 0x00), // B
- rgb_t(0xc0, 0x00, 0xc0), // C
- rgb_t(0xff, 0x00, 0xff), // D
- rgb_t(0xc0, 0xc0, 0xc0), // E
- rgb_t(0xff, 0xff, 0xff), // F
+static constexpr rgb_t pk8000_pens[16] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0x00 }, // 1
+ { 0x00, 0xc0, 0x00 }, // 2
+ { 0x00, 0xff, 0x00 }, // 3
+ { 0x00, 0x00, 0xc0 }, // 4
+ { 0x00, 0x00, 0xff }, // 5
+ { 0x00, 0xc0, 0xc0 }, // 6
+ { 0x00, 0xff, 0xff }, // 7
+ { 0xc0, 0x00, 0x00 }, // 8
+ { 0xff, 0x00, 0x00 }, // 9
+ { 0xc0, 0xc0, 0x00 }, // A
+ { 0xff, 0xff, 0x00 }, // B
+ { 0xc0, 0x00, 0xc0 }, // C
+ { 0xff, 0x00, 0xff }, // D
+ { 0xc0, 0xc0, 0xc0 }, // E
+ { 0xff, 0xff, 0xff } // F
};
-PALETTE_INIT_MEMBER(pk8000_base_state, pk8000)
+void pk8000_base_state::pk8000_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, pk8000_palette, ARRAY_LENGTH(pk8000_palette));
+ palette.set_pen_colors(0, pk8000_pens);
}
READ8_MEMBER(pk8000_base_state::_84_porta_r)
@@ -99,7 +99,7 @@ WRITE8_MEMBER(pk8000_base_state::_84_porta_w)
WRITE8_MEMBER(pk8000_base_state::_84_portc_w)
{
- m_video_enable = BIT(data,4);
+ m_video_enable = BIT(data, 4);
}
uint32_t pk8000_base_state::video_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, uint8_t *videomem)
diff --git a/src/mame/video/pk8020.cpp b/src/mame/video/pk8020.cpp
index a863467bd24..c640cd501f9 100644
--- a/src/mame/video/pk8020.cpp
+++ b/src/mame/video/pk8020.cpp
@@ -45,10 +45,8 @@ uint32_t pk8020_state::screen_update_pk8020(screen_device &screen, bitmap_ind16
return 0;
}
-PALETTE_INIT_MEMBER(pk8020_state, pk8020)
+void pk8020_state::pk8020_palette(palette_device &palette) const
{
- int i;
- for(i=0;i<16;i++) {
- m_palette->set_pen_color( i, rgb_t(i*0x10,i*0x10,i*0x10) );
- }
+ for (int i = 0; i < 16; i++)
+ palette.set_pen_color(i, rgb_t(i * 0x10, i * 0x10, i * 0x10)); // FIXME: if this is supposed to be a 4-bit ramp it should be 0x11, not 0x10
}
diff --git a/src/mame/video/playch10.cpp b/src/mame/video/playch10.cpp
index 80e38fe7a07..990820cdfb4 100644
--- a/src/mame/video/playch10.cpp
+++ b/src/mame/video/playch10.cpp
@@ -17,41 +17,39 @@ WRITE8_MEMBER(playch10_state::playch10_videoram_w)
}
}
-PALETTE_INIT_MEMBER(playch10_state, playch10)
+void playch10_state::playch10_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
+ int bit0, bit1, bit2, bit3;
- /* red component */
+ // red component
+ bit0 = BIT(~color_prom[0], 0);
+ bit1 = BIT(~color_prom[0], 1);
+ bit2 = BIT(~color_prom[0], 2);
+ bit3 = BIT(~color_prom[0], 3);
- bit0 = ~(color_prom[0] >> 0) & 0x01;
- bit1 = ~(color_prom[0] >> 1) & 0x01;
- bit2 = ~(color_prom[0] >> 2) & 0x01;
- bit3 = ~(color_prom[0] >> 3) & 0x01;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // green component
+ bit0 = BIT(~color_prom[256], 0);
+ bit1 = BIT(~color_prom[256], 1);
+ bit2 = BIT(~color_prom[256], 2);
+ bit3 = BIT(~color_prom[256], 3);
- /* green component */
- bit0 = ~(color_prom[256] >> 0) & 0x01;
- bit1 = ~(color_prom[256] >> 1) & 0x01;
- bit2 = ~(color_prom[256] >> 2) & 0x01;
- bit3 = ~(color_prom[256] >> 3) & 0x01;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
+ bit0 = BIT(~color_prom[2 * 256], 0);
+ bit1 = BIT(~color_prom[2 * 256], 1);
+ bit2 = BIT(~color_prom[2 * 256], 2);
+ bit3 = BIT(~color_prom[2 * 256], 3);
- /* blue component */
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = ~(color_prom[2*256] >> 0) & 0x01;
- bit1 = ~(color_prom[2*256] >> 1) & 0x01;
- bit2 = ~(color_prom[2*256] >> 2) & 0x01;
- bit3 = ~(color_prom[2*256] >> 3) & 0x01;
-
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
diff --git a/src/mame/video/pocketc.cpp b/src/mame/video/pocketc.cpp
index b93c2bda448..dc845f029df 100644
--- a/src/mame/video/pocketc.cpp
+++ b/src/mame/video/pocketc.cpp
@@ -7,12 +7,12 @@
const rgb_t pocketc_state::indirect_palette[] =
{
- rgb_t( 99, 107, 99),
- rgb_t( 94, 111, 103),
- rgb_t(255, 255, 255),
- rgb_t(255, 255, 255),
- rgb_t( 60, 66, 60),
- rgb_t( 0, 0, 0)
+ { 99, 107, 99 },
+ { 94, 111, 103 },
+ { 255, 255, 255 },
+ { 255, 255, 255 },
+ { 60, 66, 60 },
+ { 0, 0, 0 }
};
const int pocketc_state::colortable[8][2] =
@@ -27,12 +27,12 @@ const int pocketc_state::colortable[8][2] =
{ 3, 5 }
};
-PALETTE_INIT_MEMBER(pocketc_state, pocketc)
+void pocketc_state::pocketc_palette(palette_device &palette) const
{
- for (int i = 0; i < 6; i++)
+ for (int i = 0; i < ARRAY_LENGTH(indirect_palette); i++)
palette.set_indirect_color(i, indirect_palette[i]);
- for (int i = 0; i < 8; i++)
+ for (int i = 0; i < ARRAY_LENGTH(colortable); i++)
{
palette.set_pen_indirect(i*2, colortable[i][0]);
palette.set_pen_indirect(i*2+1, colortable[i][1]);
diff --git a/src/mame/video/polepos.cpp b/src/mame/video/polepos.cpp
index 6856771ddd8..1cbcc846ddf 100644
--- a/src/mame/video/polepos.cpp
+++ b/src/mame/video/polepos.cpp
@@ -27,9 +27,9 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(polepos_state,polepos)
+void polepos_state::polepos_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/*******************************************************
* Color PROMs
@@ -52,28 +52,30 @@ PALETTE_INIT_MEMBER(polepos_state,polepos)
*******************************************************/
for (int i = 0; i < 128; i++)
{
- /* Sheet 15B: 136014-0137 red component */
- int bit0 = (color_prom[0x000 + i] >> 0) & 1;
- int bit1 = (color_prom[0x000 + i] >> 1) & 1;
- int bit2 = (color_prom[0x000 + i] >> 2) & 1;
- int bit3 = (color_prom[0x000 + i] >> 3) & 1;
- int r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- /* Sheet 15B: 136014-0138 green component */
- bit0 = (color_prom[0x100 + i] >> 0) & 1;
- bit1 = (color_prom[0x100 + i] >> 1) & 1;
- bit2 = (color_prom[0x100 + i] >> 2) & 1;
- bit3 = (color_prom[0x100 + i] >> 3) & 1;
- int g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- /* Sheet 15B: 136014-0139 blue component */
- bit0 = (color_prom[0x200 + i] >> 0) & 1;
- bit1 = (color_prom[0x200 + i] >> 1) & 1;
- bit2 = (color_prom[0x200 + i] >> 2) & 1;
- bit3 = (color_prom[0x200 + i] >> 3) & 1;
- int b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ // Sheet 15B: 136014-0137 red component
+ bit0 = BIT(color_prom[0x000 + i], 0);
+ bit1 = BIT(color_prom[0x000 + i], 1);
+ bit2 = BIT(color_prom[0x000 + i], 2);
+ bit3 = BIT(color_prom[0x000 + i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // Sheet 15B: 136014-0138 green component
+ bit0 = BIT(color_prom[0x100 + i], 0);
+ bit1 = BIT(color_prom[0x100 + i], 1);
+ bit2 = BIT(color_prom[0x100 + i], 2);
+ bit3 = BIT(color_prom[0x100 + i], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // Sheet 15B: 136014-0139 blue component
+ bit0 = BIT(color_prom[0x200 + i], 0);
+ bit1 = BIT(color_prom[0x200 + i], 1);
+ bit2 = BIT(color_prom[0x200 + i], 2);
+ bit3 = BIT(color_prom[0x200 + i], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
}
/*******************************************************
@@ -83,7 +85,7 @@ PALETTE_INIT_MEMBER(polepos_state,polepos)
*******************************************************/
for (int i = 0; i < 64*4; i++)
{
- int color = color_prom[0x300 + i];
+ int const color = color_prom[0x300 + i];
palette.set_pen_indirect(0x0000 + i, (color != 15) ? (0x020 + color) : 0x2f);
palette.set_pen_indirect(0x0100 + i, (color != 15) ? (0x060 + color) : 0x2f);
}
@@ -96,7 +98,7 @@ PALETTE_INIT_MEMBER(polepos_state,polepos)
*******************************************************/
for (int i = 0; i < 64*4; i++)
{
- int color = color_prom[0x400 + i];
+ int const color = color_prom[0x400 + i];
palette.set_pen_indirect(0x0200 + i, 0x000 + color);
}
@@ -107,7 +109,7 @@ PALETTE_INIT_MEMBER(polepos_state,polepos)
*******************************************************/
for (int i = 0; i < 64*16; i++)
{
- int color = color_prom[0xc00 + i];
+ int const color = color_prom[0xc00 + i];
palette.set_pen_indirect(0x0300 + i, (color != 15) ? (0x010 + color) : 0x1f);
palette.set_pen_indirect(0x0700 + i, (color != 15) ? (0x050 + color) : 0x1f);
}
@@ -120,14 +122,14 @@ PALETTE_INIT_MEMBER(polepos_state,polepos)
*******************************************************/
for (int i = 0; i < 64*16; i++)
{
- int color = color_prom[0x800 + i];
+ int const color = color_prom[0x800 + i];
palette.set_pen_indirect(0x0b00 + i, 0x040 + color);
}
/* 136014-142, 136014-143, 136014-144 Vertical position modifiers */
for (int i = 0; i < 256; i++)
{
- int j = color_prom[0x500 + i] + (color_prom[0x600 + i] << 4) + (color_prom[0x700 + i] << 8);
+ int const j = color_prom[0x500 + i] + (color_prom[0x600 + i] << 4) + (color_prom[0x700 + i] << 8);
m_vertical_position_modifier[i] = j;
}
}
diff --git a/src/mame/video/polyplay.cpp b/src/mame/video/polyplay.cpp
index e34e3acd98c..a8146e3f79d 100644
--- a/src/mame/video/polyplay.cpp
+++ b/src/mame/video/polyplay.cpp
@@ -15,18 +15,18 @@
#include "emu.h"
#include "includes/polyplay.h"
-PALETTE_INIT_MEMBER(polyplay_state, polyplay)
+void polyplay_state::polyplay_palette(palette_device &palette) const
{
- palette.set_pen_color(0,rgb_t(0x00,0x00,0x00));
- palette.set_pen_color(1,rgb_t(0xff,0xff,0xff));
- palette.set_pen_color(2,rgb_t(0x00,0x00,0x00));
- palette.set_pen_color(3,rgb_t(0xff,0x00,0x00));
- palette.set_pen_color(4,rgb_t(0x00,0xff,0x00));
- palette.set_pen_color(5,rgb_t(0xff,0xff,0x00));
- palette.set_pen_color(6,rgb_t(0x00,0x00,0xff));
- palette.set_pen_color(7,rgb_t(0xff,0x00,0xff));
- palette.set_pen_color(8,rgb_t(0x00,0xff,0xff));
- palette.set_pen_color(9,rgb_t(0xff,0xff,0xff));
+ palette.set_pen_color(0, rgb_t(0x00, 0x00, 0x00));
+ palette.set_pen_color(1, rgb_t(0xff, 0xff, 0xff));
+ palette.set_pen_color(2, rgb_t(0x00, 0x00, 0x00));
+ palette.set_pen_color(3, rgb_t(0xff, 0x00, 0x00));
+ palette.set_pen_color(4, rgb_t(0x00, 0xff, 0x00));
+ palette.set_pen_color(5, rgb_t(0xff, 0xff, 0x00));
+ palette.set_pen_color(6, rgb_t(0x00, 0x00, 0xff));
+ palette.set_pen_color(7, rgb_t(0xff, 0x00, 0xff));
+ palette.set_pen_color(8, rgb_t(0x00, 0xff, 0xff));
+ palette.set_pen_color(9, rgb_t(0xff, 0xff, 0xff));
}
WRITE8_MEMBER(polyplay_state::polyplay_characterram_w)
@@ -45,16 +45,15 @@ void polyplay_state::video_start()
uint32_t polyplay_state::screen_update_polyplay(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t *videoram = m_videoram;
- offs_t offs;
+ uint8_t const *const videoram = m_videoram;
- for (offs = 0; offs < 0x800; offs++)
+ for (offs_t offs = 0; offs < 0x800; offs++)
{
- int sx = (offs & 0x3f) << 3;
- int sy = offs >> 6 << 3;
- uint8_t code = videoram[offs];
+ int const sx = (offs & 0x3f) << 3;
+ int const sy = offs >> 6 << 3;
+ uint8_t const code = videoram[offs];
- m_gfxdecode->gfx((code >> 7) & 0x01)->opaque(bitmap, cliprect, code, 0, 0, 0, sx, sy);
+ m_gfxdecode->gfx(BIT(code, 7))->opaque(bitmap, cliprect, code, 0, 0, 0, sx, sy);
}
return 0;
diff --git a/src/mame/video/pooyan.cpp b/src/mame/video/pooyan.cpp
index 0e1210a5849..255c69324ce 100644
--- a/src/mame/video/pooyan.cpp
+++ b/src/mame/video/pooyan.cpp
@@ -29,60 +29,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(pooyan_state, pooyan)
+void pooyan_state::pooyan_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, rweights, 1000, 0,
3, resistances_rg, gweights, 1000, 0,
2, resistances_b, bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters */
- for (i = 0; i < 0x100; i++)
+ // characters
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites */
- for (i = 0x100; i < 0x200; i++)
+ // sprites
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/popeye.cpp b/src/mame/video/popeye.cpp
index 7e7c99ec69d..b5052e8a1b6 100644
--- a/src/mame/video/popeye.cpp
+++ b/src/mame/video/popeye.cpp
@@ -121,12 +121,12 @@ const res_net_info tnx1_state::obj_mb7052_net_info =
};
-PALETTE_INIT_MEMBER(tpp1_state, tnx1)
+void tpp1_state::tnx1_palette(palette_device &palette)
{
- /* Two of the PROM address pins are tied together */
+ // Two of the PROM address pins are tied together
for (int i = 0; i < 0x20; i++)
{
- int color = (i & 0xf) | ((i & 0x8) << 1);
+ int const color = (i & 0xf) | ((i & 0x8) << 1);
m_color_prom[i + 0x20] = m_color_prom[color + 0x20];
}
@@ -135,12 +135,12 @@ PALETTE_INIT_MEMBER(tpp1_state, tnx1)
update_palette();
}
-PALETTE_INIT_MEMBER(tnx1_state, tnx1)
+void tnx1_state::tnx1_palette(palette_device &palette)
{
- /* Two of the PROM address pins are tied together and one is not connected... */
+ // Two of the PROM address pins are tied together and one is not connected...
for (int i = 0;i < 0x100;i++)
{
- int color = (i & 0x3f) | ((i & 0x20) << 1);
+ int const color = (i & 0x3f) | ((i & 0x20) << 1);
m_color_prom_spr[i] = m_color_prom_spr[color];
}
diff --git a/src/mame/video/portrait.cpp b/src/mame/video/portrait.cpp
index e2b2b0df565..b7a387c8aa5 100644
--- a/src/mame/video/portrait.cpp
+++ b/src/mame/video/portrait.cpp
@@ -76,51 +76,41 @@ void portrait_state::video_start()
-PALETTE_INIT_MEMBER(portrait_state, portrait)
+void portrait_state::portrait_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- uint8_t* lookup = memregion("tileattr")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/*
- for (i = 0;i < 0x40;i++)
+ for (int i = 0; i < 0x40; i++)
{
- int r,g,b,data;
- data = color_prom[0];
+ int const data = color_prom[i];
-
- r = (data >> 0) & 0x7;
- g = (data >> 3) & 0x3;
- b = (data >> 5) & 0x7;
+ int const r = (data >> 0) & 0x7;
+ int const g = (data >> 3) & 0x3;
+ int const b = (data >> 5) & 0x7;
palette.set_indirect_color(i, rgb_t(pal3bit(r), pal2bit(g), pal3bit(b)));
-
- color_prom++;
}
*/
- for (i=0;i<0x20;i++)
+ for (int i = 0; i < 0x20; i++)
{
- int r,g,b,data;
- data = (color_prom[0]<<0) | (color_prom[0x20]<<8);
+ int const data = (color_prom[i + 0] << 0) | (color_prom[i + 0x20] << 8);
- r = (data >> 0) & 0x1f;
- g = (data >> 5) & 0x1f;
- b = (data >> 10) & 0x1f;
+ int const r = (data >> 0) & 0x1f;
+ int const g = (data >> 5) & 0x1f;
+ int const b = (data >> 10) & 0x1f;
palette.set_indirect_color(i, rgb_t(pal5bit(r), pal5bit(g), pal5bit(b)));
// ?? the lookup seems to reference 0x3f colours, unless 1 bit is priority or similar?
- palette.set_indirect_color(i+0x20, rgb_t(pal5bit(r>>1), pal5bit(g>>1), pal5bit(b>>1)));
-
- color_prom++;
+ palette.set_indirect_color(i + 0x20, rgb_t(pal5bit(r >> 1), pal5bit(g >> 1), pal5bit(b >> 1)));
}
-
-
- for (i = 0;i < 0x800;i++)
+ uint8_t const *const lookup = memregion("tileattr")->base();
+ for (int i = 0; i < 0x800; i++)
{
- uint8_t ctabentry = lookup[i]&0x3f;
+ uint8_t const ctabentry = lookup[i] & 0x3f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/pp01.cpp b/src/mame/video/pp01.cpp
index 7f82391f856..7593ed48026 100644
--- a/src/mame/video/pp01.cpp
+++ b/src/mame/video/pp01.cpp
@@ -18,40 +18,37 @@ void pp01_state::video_start()
uint32_t pp01_state::screen_update_pp01(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t code_r,code_g,code_b;
- uint8_t col;
- int y, x, b;
- uint8_t *ram = m_ram->pointer();
+ uint8_t const *const ram = m_ram->pointer();
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
- for (x = 0; x < 32; x++)
+ for (int x = 0; x < 32; x++)
{
- code_r = ram[0x6000 + ((y+m_video_scroll)&0xff)*32 + x];
- code_g = ram[0xa000 + ((y+m_video_scroll)&0xff)*32 + x];
- code_b = ram[0xe000 + ((y+m_video_scroll)&0xff)*32 + x];
- for (b = 0; b < 8; b++)
+ uint8_t const code_r = ram[0x6000 + ((y+m_video_scroll)&0xff)*32 + x];
+ uint8_t const code_g = ram[0xa000 + ((y+m_video_scroll)&0xff)*32 + x];
+ uint8_t const code_b = ram[0xe000 + ((y+m_video_scroll)&0xff)*32 + x];
+ for (int b = 0; b < 8; b++)
{
- col = (((code_r >> b) & 0x01) ? 4 : 0) + (((code_g >> b) & 0x01) ? 2 : 0) + (((code_b >> b) & 0x01) ? 1 : 0);
- bitmap.pix16(y, x*8+(7-b)) = col;
+ uint8_t const col = (BIT(code_r, b) << 2) | (BIT(code_g, b) << 1) | (BIT(code_b, b) << 0);
+ bitmap.pix16(y, x*8+(7-b)) = col;
}
}
}
return 0;
}
-static const rgb_t pp01_palette[8] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0x80), // 1
- rgb_t(0x00, 0x80, 0x00), // 2
- rgb_t(0x00, 0x80, 0x80), // 3
- rgb_t(0x80, 0x00, 0x00), // 4
- rgb_t(0x80, 0x00, 0x80), // 5
- rgb_t(0x80, 0x80, 0x00), // 6
- rgb_t(0x80, 0x80, 0x80), // 7
+static constexpr rgb_t pp01_pens[8] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0x80 }, // 1
+ { 0x00, 0x80, 0x00 }, // 2
+ { 0x00, 0x80, 0x80 }, // 3
+ { 0x80, 0x00, 0x00 }, // 4
+ { 0x80, 0x00, 0x80 }, // 5
+ { 0x80, 0x80, 0x00 }, // 6
+ { 0x80, 0x80, 0x80 } // 7
};
-PALETTE_INIT_MEMBER(pp01_state, pp01)
+void pp01_state::pp01_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, pp01_palette, ARRAY_LENGTH(pp01_palette));
+ palette.set_pen_colors(0, pp01_pens);
}
diff --git a/src/mame/video/prehisle.cpp b/src/mame/video/prehisle.cpp
index 111dae3a58a..dc4289e520d 100644
--- a/src/mame/video/prehisle.cpp
+++ b/src/mame/video/prehisle.cpp
@@ -10,6 +10,7 @@
#include "emu.h"
#include "includes/prehisle.h"
+
#include "screen.h"
diff --git a/src/mame/video/quasar.cpp b/src/mame/video/quasar.cpp
index 4b372b6b734..ad399cdd07c 100644
--- a/src/mame/video/quasar.cpp
+++ b/src/mame/video/quasar.cpp
@@ -20,71 +20,62 @@
#include "cpu/s2650/s2650.h"
#include "includes/quasar.h"
-PALETTE_INIT_MEMBER(quasar_state,quasar)
+void quasar_state::quasar_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* standard 1 bit per color palette (background and sprites) */
- for (i = 0; i < 8; i++)
- {
- rgb_t color = rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2));
- palette.set_indirect_color(i, color);
- }
+ // standard 1 bit per color palette (background and sprites)
+ for (int i = 0; i < 8; i++)
+ palette.set_indirect_color(i, rgb_t(pal1bit(i >> 0), pal1bit(i >> 1), pal1bit(i >> 2)));
- /* effects color map */
- for (i = 0; i < 0x100; i++)
+ // effects color map
+ for (int i = 0; i < 0x100; i++)
{
- rgb_t color;
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = BIT(i, 0);
bit1 = BIT(i, 1);
bit2 = BIT(i, 2);
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
+ // green component
bit0 = BIT(i, 3);
bit1 = BIT(i, 4);
bit2 = BIT(i, 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = BIT(i, 6);
bit1 = BIT(i, 7);
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
- /* intensity 0 */
+ // intensity 0
palette.set_indirect_color(0x100 + i, rgb_t::black());
- /* intensity 1 */
- color = rgb_t(r >> 2, g >> 2, b >> 2);
- palette.set_indirect_color(0x200 + i, color);
+ // intensity 1
+ palette.set_indirect_color(0x200 + i, rgb_t(r >> 2, g >> 2, b >> 2));
/* intensity 2 */
- color = rgb_t((r >> 2) + (r >> 3), (g >> 2) + (g >> 3), (b >> 2) + (b >> 2));
- palette.set_indirect_color(0x300 + i, color);
+ palette.set_indirect_color(0x300 + i, rgb_t((r >> 2) + (r >> 3), (g >> 2) + (g >> 3), (b >> 2) + (b >> 2)));
/* intensity 3 */
- color = rgb_t(r >> 1, g >> 1, b >> 1);
- palette.set_indirect_color(0x400 + i, color);
+ palette.set_indirect_color(0x400 + i, rgb_t(r >> 1, g >> 1, b >> 1));
}
// Address 0-2 from graphic rom
// 3-5 from color ram
// 6-8 from sprite chips (Used for priority)
- for (i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
palette.set_pen_indirect(i, color_prom[i] & 0x07);
- /* background for collision */
- for (i = 1; i < 8; i++)
+ // background for collision
+ for (int i = 1; i < 8; i++)
palette.set_pen_indirect(0x200 + i, 7);
palette.set_pen_indirect(0x200, 0);
- /* effects */
- for (i = 0; i < 0x400; i++)
+ // effects
+ for (int i = 0; i < 0x400; i++)
palette.set_pen_indirect(0x208 + i, 0x100 + i);
}
@@ -103,26 +94,23 @@ void quasar_state::video_start()
uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int offs;
-
- /* for every character in the video RAM */
- for (offs = 0; offs < 0x0400; offs++)
+ // for every character in the video RAM
+ for (int offs = 0; offs < 0x0400; offs++)
{
- int ox, oy;
- uint8_t code = m_video_ram[offs];
- uint8_t x = (offs & 0x1f) << 3;
- uint8_t y = (offs >> 5) << 3;
+ uint8_t const code = m_video_ram[offs];
+ uint8_t const x = (offs & 0x1f) << 3;
+ uint8_t const y = (offs >> 5) << 3;
// While we have the current character code, draw the effects layer
// intensity / on and off controlled by latch
- int forecolor = 0x208 + m_effectram[offs] + (256 * (((m_effectcontrol >> 4) ^ 3) & 3));
+ int const forecolor = 0x208 + m_effectram[offs] + (256 * (((m_effectcontrol >> 4) ^ 3) & 3));
- for (ox = 0; ox < 8; ox++)
- for (oy = 0; oy < 8; oy++)
+ for (int ox = 0; ox < 8; ox++)
+ for (int oy = 0; oy < 8; oy++)
bitmap.pix16(y + oy, x + ox) = forecolor;
- /* Main Screen */
+ // Main Screen
m_gfxdecode->gfx(0)->transpen(bitmap,cliprect,
code,
m_color_ram[offs] & 0x3f,
@@ -130,8 +118,8 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16
x,y,0);
- /* background for Collision Detection (it can only hit certain items) */
- if((m_color_ram[offs] & 7) == 0)
+ // background for Collision Detection (it can only hit certain items)
+ if ((m_color_ram[offs] & 7) == 0)
{
m_gfxdecode->gfx(0)->opaque(m_collision_background,cliprect,
code,
@@ -146,17 +134,16 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16
bitmap_ind16 const &s2636_1_bitmap = m_s2636[1]->update(cliprect);
bitmap_ind16 const &s2636_2_bitmap = m_s2636[2]->update(cliprect);
- /* Bullet Hardware */
- for (offs = 8; offs < 256; offs++ )
+ // Bullet Hardware
+ for (int offs = 8; offs < 256; offs++)
{
- if(m_bullet_ram[offs] != 0)
+ if (m_bullet_ram[offs] != 0)
{
- int ct;
- for (ct = 0; ct < 1; ct++)
+ for (int ct = 0; ct < 1; ct++)
{
- int bx = 255 - 9 - m_bullet_ram[offs] - ct;
+ int const bx = 255 - 9 - m_bullet_ram[offs] - ct;
- /* bullet/object Collision */
+ // bullet/object Collision
if (s2636_0_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x04;
if (s2636_2_bitmap.pix16(offs, bx) != 0) m_collision_register |= 0x08;
@@ -166,32 +153,26 @@ uint32_t quasar_state::screen_update_quasar(screen_device &screen, bitmap_ind16
}
- /* mix and copy the S2636 images into the main bitmap, also check for collision */
+ // mix and copy the S2636 images into the main bitmap, also check for collision
+ for (int y = cliprect.top(); y <= cliprect.bottom(); y++)
{
- int y;
-
- for (y = cliprect.top(); y <= cliprect.bottom(); y++)
+ for (int x = cliprect.left(); x <= cliprect.right(); x++)
{
- int x;
+ int const pixel0 = s2636_0_bitmap.pix16(y, x);
+ int const pixel1 = s2636_1_bitmap.pix16(y, x);
+ int const pixel2 = s2636_2_bitmap.pix16(y, x);
- for (x = cliprect.left(); x <= cliprect.right(); x++)
- {
- int pixel0 = s2636_0_bitmap.pix16(y, x);
- int pixel1 = s2636_1_bitmap.pix16(y, x);
- int pixel2 = s2636_2_bitmap.pix16(y, x);
+ int const pixel = pixel0 | pixel1 | pixel2;
- int pixel = pixel0 | pixel1 | pixel2;
+ if (S2636_IS_PIXEL_DRAWN(pixel))
+ {
+ bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel);
- if (S2636_IS_PIXEL_DRAWN(pixel))
+ /* S2636 vs. background collision detection */
+ if (m_palette->pen_indirect(m_collision_background.pix16(y, x)))
{
- bitmap.pix16(y, x) = S2636_PIXEL_COLOR(pixel);
-
- /* S2636 vs. background collision detection */
- if (m_palette->pen_indirect(m_collision_background.pix16(y, x)))
- {
- if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01;
- if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
- }
+ if (S2636_IS_PIXEL_DRAWN(pixel0)) m_collision_register |= 0x01;
+ if (S2636_IS_PIXEL_DRAWN(pixel2)) m_collision_register |= 0x02;
}
}
}
diff --git a/src/mame/video/rallyx.cpp b/src/mame/video/rallyx.cpp
index b41a5e74a4a..8df8741902d 100644
--- a/src/mame/video/rallyx.cpp
+++ b/src/mame/video/rallyx.cpp
@@ -58,149 +58,144 @@ needs more color combination to render its graphics.
***************************************************************************/
-PALETTE_INIT_MEMBER(rallyx_state,rallyx)
+void rallyx_state::rallyx_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 0, 0,
3, &resistances_rg[0], gweights, 0, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* character/sprites lookup table */
- for (i = 0x000; i < 0x100; i++)
+ // character/sprites lookup table
+ for (int i = 0x000; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* bullets use colors 0x10-0x13 */
- for (i = 0x100; i < 0x104; i++)
+ // bullets use colors 0x10-0x13
+ for (int i = 0x100; i < 0x104; i++)
palette.set_pen_indirect(i, (i - 0x100) | 0x10);
}
-PALETTE_INIT_MEMBER(rallyx_state,jungler)
+void rallyx_state::jungler_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- static const int resistances_star[3] = { 150, 100 };
- double rweights[3], gweights[3], bweights[2];
- double rweights_star[2], gweights_star[2], bweights_star[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+ static constexpr int resistances_star[3] = { 150, 100 };
- /* compute the color output resistor weights */
- double scale = compute_resistor_weights(0, 255, -1.0,
- 2, resistances_star, rweights_star, 0, 0,
- 2, resistances_star, gweights_star, 0, 0,
- 2, resistances_star, bweights_star, 0, 0);
+ // compute the color output resistor weights
+ double rweights_star[2], gweights_star[2], bweights_star[2];
+ double const scale = compute_resistor_weights(0, 255, -1.0,
+ 2, resistances_star, rweights_star, 0, 0,
+ 2, resistances_star, gweights_star, 0, 0,
+ 2, resistances_star, bweights_star, 0, 0);
- compute_resistor_weights(0, 255, scale,
- 3, resistances_rg, rweights, 1000, 0,
- 3, resistances_rg, gweights, 1000, 0,
- 2, resistances_b, bweights, 1000, 0);
+ double rweights[3], gweights[3], bweights[2];
+ compute_resistor_weights(0, 255, scale,
+ 3, resistances_rg, rweights, 1000, 0,
+ 3, resistances_rg, gweights, 1000, 0,
+ 2, resistances_b, bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* star pens */
- for (i = 0x20; i < 0x60; i++)
+ // star pens
+ for (int i = 0x20; i < 0x60; i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = ((i - 0x20) >> 0) & 0x01;
- bit1 = ((i - 0x20) >> 1) & 0x01;
- r = combine_2_weights(rweights_star, bit0, bit1);
+ // red component
+ bit0 = BIT((i - 0x20), 0);
+ bit1 = BIT((i - 0x20), 1);
+ int const r = combine_2_weights(rweights_star, bit0, bit1);
- /* green component */
- bit0 = ((i - 0x20) >> 2) & 0x01;
- bit1 = ((i - 0x20) >> 3) & 0x01;
- g = combine_2_weights(gweights_star, bit0, bit1);
+ // green component
+ bit0 = BIT(i - 0x20, 2);
+ bit1 = BIT(i - 0x20, 3);
+ int const g = combine_2_weights(gweights_star, bit0, bit1);
- /* blue component */
- bit0 = ((i - 0x20) >> 4) & 0x01;
- bit1 = ((i - 0x20) >> 5) & 0x01;
- b = combine_2_weights(bweights_star, bit0, bit1);
+ // blue component
+ bit0 = BIT(i - 0x20, 4);
+ bit1 = BIT(i - 0x20, 5);
+ int const b = combine_2_weights(bweights_star, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* character/sprites lookup table */
- for (i = 0x000; i < 0x100; i++)
+ // character/sprites lookup table
+ for (int i = 0x000; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* bullets use colors 0x10-0x13 */
- for (i = 0x100; i < 0x104; i++)
+ // bullets use colors 0x10-0x13
+ for (int i = 0x100; i < 0x104; i++)
palette.set_pen_indirect(i, (i - 0x100) | 0x10);
- /* stars */
- for (i = 0x104; i < 0x144; i++)
+ // stars
+ for (int i = 0x104; i < 0x144; i++)
palette.set_pen_indirect(i, (i - 0x104) + 0x20);
}
diff --git a/src/mame/video/redclash.cpp b/src/mame/video/redclash.cpp
index 32c4f0f3df0..c34f1314b6f 100644
--- a/src/mame/video/redclash.cpp
+++ b/src/mame/video/redclash.cpp
@@ -21,83 +21,80 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(redclash_state,redclash)
+void redclash_state::redclash_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 5) & 0x01;
- r = 0x47 * bit0 + 0x97 * bit1;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 5);
+ int const r = 0x47 * bit0 + 0x97 * bit1;
- /* green component */
- bit0 = (color_prom[i] >> 2) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- g = 0x47 * bit0 + 0x97 * bit1;
+ // green component
+ bit0 = BIT(color_prom[i], 2);
+ bit1 = BIT(color_prom[i], 6);
+ int const g = 0x47 * bit0 + 0x97 * bit1;
- /* blue component */
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = 0x47 * bit0 + 0x97 * bit1;
+ // blue component
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x47 * bit0 + 0x97 * bit1;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* star colors */
- for (i = 0x20; i < 0x40; i++)
+ // star colors
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1;
- int r, g, b;
- /* red component */
- bit0 = ((i - 0x20) >> 3) & 0x01;
- bit1 = ((i - 0x20) >> 4) & 0x01;
- b = 0x47 * bit0 + 0x97 * bit1;
+ // red component
+ bit0 = BIT(i, 3);
+ bit1 = BIT(i, 4);
+ int const b = 0x47 * bit0 + 0x97 * bit1;
- /* green component */
- bit0 = ((i - 0x20) >> 1) & 0x01;
- bit1 = ((i - 0x20) >> 2) & 0x01;
- g = 0x47 * bit0 + 0x97 * bit1;
+ // green component
+ bit0 = BIT(i, 1);
+ bit1 = BIT(i, 2);
+ int const g = 0x47 * bit0 + 0x97 * bit1;
- /* blue component */
- bit0 = ((i - 0x20) >> 0) & 0x01;
- r = 0x47 * bit0;
+ // blue component
+ bit0 = BIT(i, 0);
+ int const r = 0x47 * bit0;
- palette.set_indirect_color(i, rgb_t(r, g, b));
+ palette.set_indirect_color(i + 0x20, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* characters */
- for (i = 0; i < 0x20; i++)
+ // characters
+ for (int i = 0; i < 0x20; i++)
{
- uint8_t ctabentry = ((i << 3) & 0x18) | ((i >> 2) & 0x07);
+ uint8_t const ctabentry = ((i << 3) & 0x18) | ((i >> 2) & 0x07);
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites */
- for (i = 0x20; i < 0x40; i++)
+ // sprites
+ for (int i = 0; i < 0x20; i++)
{
- uint8_t ctabentry = color_prom[(i - 0x20) >> 1];
-
- ctabentry = bitswap<8>((color_prom[i - 0x20] >> 0) & 0x0f, 7,6,5,4,0,1,2,3);
- palette.set_pen_indirect(i + 0x00, ctabentry);
+ uint8_t ctabentry;
- ctabentry = bitswap<8>((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
+ ctabentry = bitswap<4>((color_prom[i] >> 0) & 0x0f, 0,1,2,3);
palette.set_pen_indirect(i + 0x20, ctabentry);
+
+ ctabentry = bitswap<4>((color_prom[i] >> 4) & 0x0f, 0,1,2,3);
+ palette.set_pen_indirect(i + 0x40, ctabentry);
}
- /* stars */
- for (i = 0x60; i < 0x80; i++)
- palette.set_pen_indirect(i, (i - 0x60) + 0x20);
+ // stars
+ for (int i = 0; i < 0x20; i++)
+ palette.set_pen_indirect(i + 60, i + 0x20);
}
diff --git a/src/mame/video/retofinv.cpp b/src/mame/video/retofinv.cpp
index 9495db81777..c539adae368 100644
--- a/src/mame/video/retofinv.cpp
+++ b/src/mame/video/retofinv.cpp
@@ -12,75 +12,63 @@
#include "includes/retofinv.h"
-PALETTE_INIT_MEMBER(retofinv_state, retofinv)
+void retofinv_state::retofinv_palette(palette_device &palette) const
{
- const uint8_t *palette_prom = memregion("palette")->base();
- const uint8_t *clut_prom = memregion("clut")->base();
- int i;
+ uint8_t const *const palette_prom = memregion("palette")->base();
+ uint8_t const *const clut_prom = memregion("clut")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(palette_prom[i + 0x000]);
- int g = pal4bit(palette_prom[i + 0x100]);
- int b = pal4bit(palette_prom[i + 0x200]);
+ int const r = pal4bit(palette_prom[i | 0x000]);
+ int const g = pal4bit(palette_prom[i | 0x100]);
+ int const b = pal4bit(palette_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* fg chars (1bpp) */
- for (i = 0; i < 0x200; i++)
+ // fg chars (1bpp)
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry;
-
- if (i & 0x01)
- ctabentry = i >> 1;
- else
- ctabentry = 0;
+ uint8_t const ctabentry = (i & 0x01) ? (i >> 1) : 0;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites and bg tiles clut */
- for (i = 0; i < 0x800; i++)
+ // sprites and bg tiles clut
+ for (int i = 0; i < 0x800; i++)
{
// descramble the address
- int j = bitswap<16>(i,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
+ int const j = bitswap<16>(i, 15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
palette.set_pen_indirect(i + 0x200, clut_prom[j]);
}
}
-PALETTE_INIT_MEMBER(retofinv_state, retofinv_bl)
+void retofinv_state::retofinv_bl_palette(palette_device &palette) const
{
- const uint8_t *palette_prom = memregion("palette")->base();
- const uint8_t *clut_prom = memregion("clut")->base();
- int i;
+ uint8_t const *const palette_prom = memregion("palette")->base();
+ uint8_t const *const clut_prom = memregion("clut")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(palette_prom[i + 0x000]);
- int g = pal4bit(palette_prom[i + 0x100]);
- int b = pal4bit(palette_prom[i + 0x200]);
+ int const r = pal4bit(palette_prom[i | 0x000]);
+ int const g = pal4bit(palette_prom[i | 0x100]);
+ int const b = pal4bit(palette_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* fg chars (1bpp) */
- for (i = 0; i < 0x200; i++)
+ // fg chars (1bpp)
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry;
-
- if (i & 0x01)
- ctabentry = i >> 1;
- else
- ctabentry = 0;
+ uint8_t const ctabentry = (i & 0x01) ? (i >> 1) : 0;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites and bg tiles clut */
- for (i = 0; i < 0x800; i++)
+ // sprites and bg tiles clut
+ for (int i = 0; i < 0x800; i++)
{
// descramble the data
palette.set_pen_indirect(i + 0x200, bitswap<8>(clut_prom[i], 4,5,6,7,3,2,1,0));
diff --git a/src/mame/video/rockrage.cpp b/src/mame/video/rockrage.cpp
index 8b1b26209a1..724991d86bb 100644
--- a/src/mame/video/rockrage.cpp
+++ b/src/mame/video/rockrage.cpp
@@ -3,15 +3,15 @@
#include "emu.h"
#include "includes/rockrage.h"
-PALETTE_INIT_MEMBER(rockrage_state, rockrage)
+void rockrage_state::rockrage_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < 256*3; i++)
{
// layer0 uses colors 0x00-0x0f; layer1 uses 0x10-0x1f; sprites use 0x20-0x2f
- uint8_t colorbase = (i / 256) * 16;
- uint8_t ctabentry = (color_prom[i] & 0x0f) | colorbase;
+ uint8_t const colorbase = (i / 256) * 16;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | colorbase;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/rocnrope.cpp b/src/mame/video/rocnrope.cpp
index 4e532a67dc8..b0b029b0903 100644
--- a/src/mame/video/rocnrope.cpp
+++ b/src/mame/video/rocnrope.cpp
@@ -31,53 +31,51 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(rocnrope_state, rocnrope)
+void rocnrope_state::rocnrope_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites and characters */
- for (i = 0; i < 0x200; i++)
+ // sprites and characters
+ for (int i = 0; i < 0x200; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/rollrace.cpp b/src/mame/video/rollrace.cpp
index 4a365cccb98..408a6aca06d 100644
--- a/src/mame/video/rollrace.cpp
+++ b/src/mame/video/rollrace.cpp
@@ -4,11 +4,11 @@
#include "includes/rollrace.h"
-
#define RA_FGCHAR_BASE 0
#define RA_BGCHAR_BASE 4
#define RA_SP_BASE 5
+
TILE_GET_INFO_MEMBER(rollrace_state::get_fg_tile_info)
{
int code = m_videoram[tile_index];
@@ -61,32 +61,33 @@ WRITE8_MEMBER(rollrace_state::cram_w)
bit 0 -- 1 kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
-PALETTE_INIT_MEMBER(rollrace_state, rollrace)
+void rollrace_state::rollrace_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
-
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
- bit0 = (color_prom[palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[palette.entries()] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
- bit0 = (color_prom[2*palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[2*palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[2*palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[2*palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
+
+ bit0 = BIT(color_prom[palette.entries()], 0);
+ bit1 = BIT(color_prom[palette.entries()], 1);
+ bit2 = BIT(color_prom[palette.entries()], 2);
+ bit3 = BIT(color_prom[palette.entries()], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
+
+ bit0 = BIT(color_prom[2 * palette.entries()], 0);
+ bit1 = BIT(color_prom[2 * palette.entries()], 1);
+ bit2 = BIT(color_prom[2 * palette.entries()], 2);
+ bit3 = BIT(color_prom[2 * palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x42 * bit2 + 0x90 * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
diff --git a/src/mame/video/sbasketb.cpp b/src/mame/video/sbasketb.cpp
index b549174940e..fb0381d0bb6 100644
--- a/src/mame/video/sbasketb.cpp
+++ b/src/mame/video/sbasketb.cpp
@@ -28,67 +28,63 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(sbasketb_state, sbasketb)
+void sbasketb_state::sbasketb_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2000, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2000, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 1000, 0,
4, resistances, gweights, 1000, 0,
4, resistances, bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table,*/
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0xf0-0xff */
- for (i = 0; i < 0x100; i++)
+ // characters use colors 0xf0-0xff
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0xf0;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0xf0;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites use colors 0-256 (?) in 16 banks */
- for (i = 0; i < 0x100; i++)
+ // sprites use colors 0-256 (?) in 16 banks
+ for (int i = 0; i < 0x100; i++)
{
- int j;
-
- for (j = 0; j < 0x10; j++)
+ for (int j = 0; j < 0x10; j++)
{
- uint8_t ctabentry = (j << 4) | (color_prom[i + 0x100] & 0x0f);
+ uint8_t const ctabentry = (j << 4) | (color_prom[i + 0x100] & 0x0f);
palette.set_pen_indirect(0x100 + ((j << 8) | i), ctabentry);
}
}
diff --git a/src/mame/video/sbugger.cpp b/src/mame/video/sbugger.cpp
index 521052513a5..168ac54788b 100644
--- a/src/mame/video/sbugger.cpp
+++ b/src/mame/video/sbugger.cpp
@@ -38,21 +38,18 @@ uint32_t sbugger_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
return 0;
}
-/* not right but so we can see things ok */
-PALETTE_INIT_MEMBER(sbugger_state, sbugger)
+// not right but so we can see things OK
+void sbugger_state::sbugger_palette(palette_device &palette) const
{
- /* just some random colours for now */
- int i;
-
- for (i = 0;i < 256;i++)
+ // just some random colours for now
+ for (int i = 0; i < 256; i++)
{
- int r = machine().rand()|0x80;
- int g = machine().rand()|0x80;
- int b = machine().rand()|0x80;
- if (i == 0) r = g = b = 0;
+ int const r = i ? (machine().rand() | 0x80) : 0;
+ int const g = i ? (machine().rand() | 0x80) : 0;
+ int const b = i ? (machine().rand() | 0x80) : 0;
- palette.set_pen_color(i*2+1,rgb_t(r,g,b));
- palette.set_pen_color(i*2,rgb_t(0,0,0));
+ palette.set_pen_color(i*2+1, rgb_t(r, g, b));
+ palette.set_pen_color(i*2, rgb_t(0, 0, 0));
}
diff --git a/src/mame/video/scotrsht.cpp b/src/mame/video/scotrsht.cpp
index 5a610761b25..dd4ec24781d 100644
--- a/src/mame/video/scotrsht.cpp
+++ b/src/mame/video/scotrsht.cpp
@@ -4,33 +4,30 @@
#include "includes/scotrsht.h"
-/* Similar as Iron Horse */
-PALETTE_INIT_MEMBER(scotrsht_state, scotrsht)
+// Similar as Iron Horse
+void scotrsht_state::scotrsht_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i | 0x000]);
+ int const g = pal4bit(color_prom[i | 0x100]);
+ int const b = pal4bit(color_prom[i | 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x80-0xff, sprites use colors 0-0x7f */
- for (i = 0; i < 0x200; i++)
+ // characters use colors 0x80-0xff, sprites use colors 0-0x7f
+ for (int i = 0; i < 0x200; i++)
{
- int j;
-
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- uint8_t ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
}
}
@@ -56,7 +53,7 @@ WRITE8_MEMBER(scotrsht_state::charbank_w)
m_bg_tilemap->mark_all_dirty();
}
- /* other bits unknown */
+ // other bits unknown
}
WRITE8_MEMBER(scotrsht_state::palettebank_w)
diff --git a/src/mame/video/seicross.cpp b/src/mame/video/seicross.cpp
index 6ac6ea322b8..5d8556f3a10 100644
--- a/src/mame/video/seicross.cpp
+++ b/src/mame/video/seicross.cpp
@@ -27,32 +27,30 @@
bit 0 -- 1 kohm resistor -- RED
***************************************************************************/
-PALETTE_INIT_MEMBER(seicross_state, seicross)
+void seicross_state::seicross_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/senjyo.cpp b/src/mame/video/senjyo.cpp
index 2418bf1dbb7..b138188d0d2 100644
--- a/src/mame/video/senjyo.cpp
+++ b/src/mame/video/senjyo.cpp
@@ -106,21 +106,21 @@ void senjyo_state::video_start()
m_fg_tilemap->set_scroll_cols(32);
}
-PALETTE_DECODER_MEMBER( senjyo_state, IIBBGGRR )
+rgb_t senjyo_state::IIBBGGRR(uint32_t raw)
{
- uint8_t i = (raw >> 6) & 3;
- uint8_t r = (raw << 2) & 0x0c;
- uint8_t g = (raw ) & 0x0c;
- uint8_t b = (raw >> 2) & 0x0c;
+ uint8_t const i = (raw >> 6) & 0x03;
+ uint8_t const r = (raw << 2) & 0x0c;
+ uint8_t const g = (raw ) & 0x0c;
+ uint8_t const b = (raw >> 2) & 0x0c;
return rgb_t(pal4bit(r ? (r | i) : 0), pal4bit(g ? (g | i) : 0), pal4bit(b ? (b | i) : 0));
}
-PALETTE_INIT_MEMBER( senjyo_state, radar )
+void senjyo_state::radar_palette(palette_device &palette) const
{
// two colors for the radar dots (verified on the real board)
- m_radar_palette->set_pen_color(0, rgb_t(0xff, 0x00, 0x00)); // red for enemies
- m_radar_palette->set_pen_color(1, rgb_t(0xff, 0xff, 0x00)); // yellow for player
+ palette.set_pen_color(0, rgb_t(0xff, 0x00, 0x00)); // red for enemies
+ palette.set_pen_color(1, rgb_t(0xff, 0xff, 0x00)); // yellow for player
}
diff --git a/src/mame/video/seta.cpp b/src/mame/video/seta.cpp
index 500877a5e5c..34d304aa645 100644
--- a/src/mame/video/seta.cpp
+++ b/src/mame/video/seta.cpp
@@ -493,13 +493,11 @@ VIDEO_START_MEMBER(seta_state,kyustrkr_no_layers)
The game can select to repeat every 16 colors to fill the 64 colors for the 6bpp gfx
or to use the first 64 colors of the palette regardless of the color code!
*/
-PALETTE_INIT_MEMBER(seta_state,blandia)
+void seta_state::blandia_palette(palette_device &palette) const
{
- int color, pen;
-
- for (color = 0; color < 0x20; color++)
+ for (int color = 0; color < 0x20; color++)
{
- for (pen = 0; pen < 0x40; pen++)
+ for (int pen = 0; pen < 0x40; pen++)
{
// layer 2-3
palette.set_pen_indirect(0x0200 + ((color << 6) | pen), 0x200 + ((color << 4) | (pen & 0x0f)));
@@ -513,22 +511,19 @@ PALETTE_INIT_MEMBER(seta_state,blandia)
// setup the colortable for the effect palette.
// what are used for palette from 0x800 to 0xBFF?
- for(int i = 0; i < 0x2200; i++)
- {
+ for (int i = 0; i < 0x2200; i++)
palette.set_pen_indirect(0x2200 + i, 0x600 + (i & 0x1ff));
- }
}
/* layers have 6 bits per pixel, but the color code has a 16 colors granularity,
even if the low 2 bits are ignored (so there are only 4 different palettes) */
-PALETTE_INIT_MEMBER(seta_state,gundhara)
+void seta_state::gundhara_palette(palette_device &palette) const
{
- int color, pen;
-
- for (color = 0; color < 0x20; color++)
- for (pen = 0; pen < 0x40; pen++)
+ for (int color = 0; color < 0x20; color++)
+ {
+ for (int pen = 0; pen < 0x40; pen++)
{
palette.set_pen_indirect(0x0200 + ((color << 6) | pen), 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff)); // used?
palette.set_pen_indirect(0x1200 + ((color << 6) | pen), 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff));
@@ -536,17 +531,17 @@ PALETTE_INIT_MEMBER(seta_state,gundhara)
palette.set_pen_indirect(0x0a00 + ((color << 6) | pen), 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff)); // used?
palette.set_pen_indirect(0x1a00 + ((color << 6) | pen), 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff));
}
+ }
}
/* layers have 6 bits per pixel, but the color code has a 16 colors granularity */
-PALETTE_INIT_MEMBER(seta_state,jjsquawk)
+void seta_state::jjsquawk_palette(palette_device &palette) const
{
- int color, pen;
-
- for (color = 0; color < 0x20; color++)
- for (pen = 0; pen < 0x40; pen++)
+ for (int color = 0; color < 0x20; color++)
+ {
+ for (int pen = 0; pen < 0x40; pen++)
{
palette.set_pen_indirect(0x0200 + ((color << 6) | pen), 0x400 + (((color << 4) + pen) & 0x1ff)); // used by madshark
palette.set_pen_indirect(0x1200 + ((color << 6) | pen), 0x400 + (((color << 4) + pen) & 0x1ff));
@@ -554,35 +549,35 @@ PALETTE_INIT_MEMBER(seta_state,jjsquawk)
palette.set_pen_indirect(0x0a00 + ((color << 6) | pen), 0x200 + (((color << 4) + pen) & 0x1ff)); // used by madshark
palette.set_pen_indirect(0x1a00 + ((color << 6) | pen), 0x200 + (((color << 4) + pen) & 0x1ff));
}
+ }
}
-/* layer 0 is 6 bit per pixel, but the color code has a 16 colors granularity */
-PALETTE_INIT_MEMBER(seta_state,zingzip)
+// layer 0 is 6 bit per pixel, but the color code has a 16 colors granularity
+void seta_state::zingzip_palette(palette_device &palette) const
{
- int color, pen;
-
- for (color = 0; color < 0x20; color++)
- for (pen = 0; pen < 0x40; pen++)
+ for (int color = 0; color < 0x20; color++)
+ {
+ for (int pen = 0; pen < 0x40; pen++)
{
palette.set_pen_indirect(0x400 + ((color << 6) | pen), 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff)); // used?
palette.set_pen_indirect(0xc00 + ((color << 6) | pen), 0x400 + ((((color & ~3) << 4) + pen) & 0x1ff));
}
+ }
}
// color prom
-PALETTE_INIT_MEMBER(seta_state,RRRRRGGGGGBBBBB_proms)
+void seta_state::palette_init_RRRRRGGGGGBBBBB_proms(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int x;
- for (x = 0; x < 0x200 ; x++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int x = 0; x < 0x200 ; x++)
{
- int data = (color_prom[x*2] <<8) | color_prom[x*2+1];
- palette.set_pen_color(x, pal5bit(data >> 10),pal5bit(data >> 5),pal5bit(data >> 0));
+ int const data = (color_prom[x*2] << 8) | color_prom[x*2 + 1];
+ palette.set_pen_color(x, pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
}
}
-PALETTE_INIT_MEMBER(setaroul_state,setaroul)
+void setaroul_state::setaroul_palette(palette_device &palette) const
{
m_gfxdecode->gfx(0)->set_granularity(16);
m_gfxdecode->gfx(1)->set_granularity(16);
@@ -590,18 +585,15 @@ PALETTE_INIT_MEMBER(setaroul_state,setaroul)
palette_init_RRRRRGGGGGBBBBB_proms(palette);
}
-PALETTE_INIT_MEMBER(usclssic_state,usclssic)
+void usclssic_state::usclssic_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int color, pen;
- int x;
+ uint8_t const *const color_prom = memregion("proms")->base();
- /* DECODE PROM */
- for (x = 0; x < 0x200 ; x++)
+ // decode PROM
+ for (int x = 0; x < 0x200; x++)
{
- uint16_t data = (color_prom[x*2] <<8) | color_prom[x*2+1];
-
- rgb_t color = rgb_t(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
+ uint16_t const data = (color_prom[x*2] << 8) | color_prom[x*2 + 1];
+ rgb_t const color(pal5bit(data >> 10), pal5bit(data >> 5), pal5bit(data >> 0));
if (x >= 0x100)
palette.set_indirect_color(x + 0x000, color);
@@ -609,12 +601,14 @@ PALETTE_INIT_MEMBER(usclssic_state,usclssic)
palette.set_indirect_color(x + 0x300, color);
}
- for (color = 0; color < 0x20; color++)
- for (pen = 0; pen < 0x40; pen++)
+ for (int color = 0; color < 0x20; color++)
+ {
+ for (int pen = 0; pen < 0x40; pen++)
{
palette.set_pen_indirect(0x200 + ((color << 6) | pen), 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff)); // used?
palette.set_pen_indirect(0xa00 + ((color << 6) | pen), 0x200 + ((((color & ~3) << 4) + pen) & 0x1ff));
}
+ }
}
diff --git a/src/mame/video/shangkid.cpp b/src/mame/video/shangkid.cpp
index 03356df4951..7d4975d0c82 100644
--- a/src/mame/video/shangkid.cpp
+++ b/src/mame/video/shangkid.cpp
@@ -6,7 +6,8 @@
#include "includes/shangkid.h"
-TILE_GET_INFO_MEMBER(shangkid_state::get_bg_tile_info){
+TILE_GET_INFO_MEMBER(shangkid_state::get_bg_tile_info)
+{
int attributes = m_videoram[tile_index+0x800];
int tile_number = m_videoram[tile_index]+0x100*(attributes&0x3);
int color;
@@ -190,35 +191,34 @@ uint32_t shangkid_state::screen_update_shangkid(screen_device &screen, bitmap_in
}
-PALETTE_INIT_MEMBER(shangkid_state,dynamski)
+void shangkid_state::dynamski_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
- uint16_t data = (color_prom[i | 0x20] << 8) | color_prom[i];
- rgb_t color = rgb_t(pal5bit(data >> 1), pal5bit(data >> 6), pal5bit(data >> 11));
+ uint16_t const data = (color_prom[i | 0x20] << 8) | color_prom[i];
+ rgb_t const color(pal5bit(data >> 1), pal5bit(data >> 6), pal5bit(data >> 11));
palette.set_indirect_color(i, color);
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x40;
- /* characters */
- for (i = 0; i < 0x40; i++)
+ // characters
+ for (int i = 0; i < 0x40; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites */
- for (i = 0x40; i < 0x80; i++)
+ // sprites
+ for (int i = 0; i < 0x40; i++)
{
- uint8_t ctabentry = (color_prom[(i - 0x40) + 0x100] & 0x0f) | 0x10;
- palette.set_pen_indirect(i, ctabentry);
+ uint8_t ctabentry = (color_prom[i + 0x100] & 0x0f) | 0x10;
+ palette.set_pen_indirect(i + 0x40, ctabentry);
}
}
diff --git a/src/mame/video/shaolins.cpp b/src/mame/video/shaolins.cpp
index aeeaef0c0b2..d78d5169dc3 100644
--- a/src/mame/video/shaolins.cpp
+++ b/src/mame/video/shaolins.cpp
@@ -28,61 +28,56 @@
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
-PALETTE_INIT_MEMBER(shaolins_state, shaolins)
+void shaolins_state::shaolins_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 2200, 1000, 470, 220 };
- double rweights[4], gweights[4], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2200, 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 470, 0,
4, resistances, gweights, 470, 0,
4, resistances, bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table,*/
+ // color_prom now points to the beginning of the lookup table,
color_prom += 0x300;
- /* characters use colors 0x10-0x1f of each 0x20 color bank,
- while sprites use colors 0-0x0f */
- for (i = 0; i < 0x200; i++)
+ // characters use colors 0x10-0x1f of each 0x20 color bank, while sprites use colors 0-0x0f
+ for (int i = 0; i < 0x200; i++)
{
- int j;
-
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- uint8_t ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = (j << 5) | ((~i & 0x100) >> 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
}
}
diff --git a/src/mame/video/shootout.cpp b/src/mame/video/shootout.cpp
index 34e56ac0744..a97ea52df94 100644
--- a/src/mame/video/shootout.cpp
+++ b/src/mame/video/shootout.cpp
@@ -10,33 +10,31 @@
#include "screen.h"
-PALETTE_INIT_MEMBER(shootout_state, shootout)
+void shootout_state::shootout_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/sidepckt.cpp b/src/mame/video/sidepckt.cpp
index cafe257dbe3..e4d08556c48 100644
--- a/src/mame/video/sidepckt.cpp
+++ b/src/mame/video/sidepckt.cpp
@@ -12,34 +12,34 @@
#include "includes/sidepckt.h"
-PALETTE_INIT_MEMBER(sidepckt_state, sidepckt)
+void sidepckt_state::sidepckt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (int i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 4) & 0x01;
- bit1 = (color_prom[i] >> 5) & 0x01;
- bit2 = (color_prom[i] >> 6) & 0x01;
- bit3 = (color_prom[i] >> 7) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
- bit0 = (color_prom[i + palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[i + palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[i + palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[i + palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[i], 4);
+ bit1 = BIT(color_prom[i], 5);
+ bit2 = BIT(color_prom[i], 6);
+ bit3 = BIT(color_prom[i], 7);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // green component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
+ bit0 = BIT(color_prom[i + palette.entries()], 0);
+ bit1 = BIT(color_prom[i + palette.entries()], 1);
+ bit2 = BIT(color_prom[i + palette.entries()], 2);
+ bit3 = BIT(color_prom[i + palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/skyfox.cpp b/src/mame/video/skyfox.cpp
index cf2c3ec2162..70c52e80932 100644
--- a/src/mame/video/skyfox.cpp
+++ b/src/mame/video/skyfox.cpp
@@ -56,7 +56,7 @@
***************************************************************************/
-static const res_net_decode_info skyfox_decode_info =
+static constexpr res_net_decode_info skyfox_decode_info =
{
1,
0, 255, // start/end
@@ -66,7 +66,7 @@ static const res_net_decode_info skyfox_decode_info =
{ 0xf, 0xf, 0xf, } // masks
};
-static const res_net_info skyfox_net_info =
+static constexpr res_net_info skyfox_net_info =
{
RES_NET_VCC_5V | RES_NET_VBIAS_5V | RES_NET_VIN_TTL_OUT,
{
@@ -76,19 +76,17 @@ static const res_net_info skyfox_net_info =
}
};
-PALETTE_INIT_MEMBER(skyfox_state, skyfox)
+void skyfox_state::skyfox_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, skyfox_decode_info, skyfox_net_info);
palette.set_pen_colors(0, rgb);
- /* Grey scale for the background??? is wrong */
+ // Grey scale for the background??? is wrong
for (int i = 0; i < 256; i++)
- {
palette.set_pen_color(i + 256, rgb_t(i, i, i));
- }
}
diff --git a/src/mame/video/skykid.cpp b/src/mame/video/skykid.cpp
index 1e891887e44..6c08804b0d7 100644
--- a/src/mame/video/skykid.cpp
+++ b/src/mame/video/skykid.cpp
@@ -17,32 +17,31 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(skykid_state, skykid)
+void skykid_state::skykid_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* text palette */
- for (i = 0; i < 0x100; i++)
+ // text palette
+ for (int i = 0; i < 0x100; i++)
palette.set_pen_indirect(i, i);
- /* tiles/sprites */
- for (i = 0x100; i < 0x500; i++)
+ // tiles/sprites
+ for (int i = 0x100; i < 0x500; i++)
{
- uint8_t ctabentry = color_prom[i - 0x100];
+ uint8_t const ctabentry = color_prom[i - 0x100];
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/snk.cpp b/src/mame/video/snk.cpp
index b15fe0b0c04..60b51cb4f40 100644
--- a/src/mame/video/snk.cpp
+++ b/src/mame/video/snk.cpp
@@ -28,35 +28,34 @@
/**************************************************************************************/
-PALETTE_INIT_MEMBER(snk_state,tnk3)
+void snk_state::tnk3_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- int num_colors = 0x400;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ constexpr int num_colors = 0x400;
- for( i=0; i<num_colors; i++ )
+ for (int i = 0; i < num_colors; i++)
{
- int bit0=0,bit1,bit2,bit3,r,g,b;
-
- bit0 = (color_prom[i + 2*num_colors] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- bit3 = (color_prom[i] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[i + 2*num_colors] >> 2) & 0x01;
- bit1 = (color_prom[i + num_colors] >> 2) & 0x01;
- bit2 = (color_prom[i + num_colors] >> 3) & 0x01;
- bit3 = (color_prom[i] >> 0) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- bit0 = (color_prom[i + 2*num_colors] >> 0) & 0x01;
- bit1 = (color_prom[i + 2*num_colors] >> 1) & 0x01;
- bit2 = (color_prom[i + num_colors] >> 0) & 0x01;
- bit3 = (color_prom[i + num_colors] >> 1) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 3);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ bit3 = BIT(color_prom[i], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 2);
+ bit1 = BIT(color_prom[i + num_colors], 2);
+ bit2 = BIT(color_prom[i + num_colors], 3);
+ bit3 = BIT(color_prom[i], 0);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[i + 2*num_colors], 0);
+ bit1 = BIT(color_prom[i + 2*num_colors], 1);
+ bit2 = BIT(color_prom[i + num_colors], 0);
+ bit3 = BIT(color_prom[i + num_colors], 1);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/snk6502.cpp b/src/mame/video/snk6502.cpp
index 4a4cb13058a..258fc73ed1f 100644
--- a/src/mame/video/snk6502.cpp
+++ b/src/mame/video/snk6502.cpp
@@ -25,50 +25,43 @@
Zarzon has a different PROM layout from the others.
***************************************************************************/
-PALETTE_INIT_MEMBER(snk6502_state,snk6502)
+void snk6502_state::snk6502_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
-
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
+ int bit0, bit1, bit2;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
- /* green component */
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
m_palette_val[i] = rgb_t(r, g, b);
-
- color_prom++;
}
- m_backcolor = 0; /* background color can be changed by the game */
+ m_backcolor = 0; // background color can be changed by the game
- for (i = 0; i < TOTAL_COLORS(0); i++)
+ for (int i = 0; i < TOTAL_COLORS(0); i++)
palette.set_pen_color(COLOR(0, i), m_palette_val[i]);
- for (i = 0; i < TOTAL_COLORS(1); i++)
+ for (int i = 0; i < TOTAL_COLORS(1); i++)
{
if (i % 4 == 0)
palette.set_pen_color(COLOR(1, i), m_palette_val[4 * m_backcolor + 0x20]);
@@ -204,50 +197,43 @@ uint32_t snk6502_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
/* Satan of Saturn */
-PALETTE_INIT_MEMBER(snk6502_state,satansat)
+void snk6502_state::satansat_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
-
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
+ int bit0, bit1, bit2;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
- /* green component */
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
m_palette_val[i] = rgb_t(r, g, b);
-
- color_prom++;
}
- m_backcolor = 0; /* background color can be changed by the game */
+ m_backcolor = 0; // background color can be changed by the game
- for (i = 0; i < TOTAL_COLORS(0); i++)
+ for (int i = 0; i < TOTAL_COLORS(0); i++)
palette.set_pen_color(COLOR(0, i), m_palette_val[4 * (i % 4) + (i / 4)]);
- for (i = 0; i < TOTAL_COLORS(1); i++)
+ for (int i = 0; i < TOTAL_COLORS(1); i++)
{
if (i % 4 == 0)
palette.set_pen_color(COLOR(1, i), m_palette_val[m_backcolor + 0x10]);
diff --git a/src/mame/video/snookr10.cpp b/src/mame/video/snookr10.cpp
index fb854d72d07..34ea2d82094 100644
--- a/src/mame/video/snookr10.cpp
+++ b/src/mame/video/snookr10.cpp
@@ -46,44 +46,42 @@ WRITE8_MEMBER(snookr10_state::snookr10_colorram_w)
}
-PALETTE_INIT_MEMBER(snookr10_state, snookr10)
+void snookr10_state::snookr10_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/* GGBBBRRR */
- int i;
- static const int resistances_rb[3] = { 1000, 470, 220 };
- static const int resistances_g [2] = { 470, 220 };
- double weights_r[3], weights_b[3], weights_g[2];
+ static constexpr int resistances_rb[3] = { 1000, 470, 220 };
+ static constexpr int resistances_g [2] = { 470, 220 };
+ double weights_r[3], weights_b[3], weights_g[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rb, weights_r, 100, 0,
3, resistances_rb, weights_b, 100, 0,
2, resistances_g, weights_g, 100, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
-
- /* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = combine_3_weights(weights_b, bit0, bit1, bit2);
-
- /* green component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- g = combine_2_weights(weights_g, bit0, bit1);
-
- palette.set_pen_color(i, rgb_t(r,g,b));
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = combine_3_weights(weights_b, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const g = combine_2_weights(weights_g, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -112,47 +110,45 @@ TILE_GET_INFO_MEMBER(snookr10_state::get_bg_tile_info)
**********************************************************/
-PALETTE_INIT_MEMBER(snookr10_state, apple10)
+void snookr10_state::apple10_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/* GGBBBRRR */
- int i, cn;
- static const int resistances_rb[3] = { 1000, 470, 220 };
- static const int resistances_g [2] = { 470, 220 };
- double weights_r[3], weights_b[3], weights_g[2];
+ static constexpr int resistances_rb[3] = { 1000, 470, 220 };
+ static constexpr int resistances_g [2] = { 470, 220 };
+ double weights_r[3], weights_b[3], weights_g[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rb, weights_r, 100, 0,
3, resistances_rb, weights_b, 100, 0,
2, resistances_g, weights_g, 100, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
/* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
/* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = combine_3_weights(weights_b, bit0, bit1, bit2);
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = combine_3_weights(weights_b, bit0, bit1, bit2);
/* green component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- g = combine_2_weights(weights_g, bit0, bit1);
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const g = combine_2_weights(weights_g, bit0, bit1);
/* encrypted color matrix */
- cn = bitswap<8>(i,4,5,6,7,2,3,0,1);
+ int const cn = bitswap<8>(i, 4, 5, 6, 7, 2, 3, 0, 1);
- palette.set_pen_color(cn, rgb_t(r,g,b));
+ palette.set_pen_color(cn, rgb_t(r, g, b));
}
}
@@ -181,47 +177,45 @@ TILE_GET_INFO_MEMBER(snookr10_state::apple10_get_bg_tile_info)
**********************************************************/
-PALETTE_INIT_MEMBER(snookr10_state, crystalc)
+void snookr10_state::crystalc_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
/* GGBBBRRR */
- int i, cn;
- static const int resistances_rb[3] = { 1000, 470, 220 };
- static const int resistances_g [2] = { 470, 220 };
- double weights_r[3], weights_b[3], weights_g[2];
+ static constexpr int resistances_rb[3] = { 1000, 470, 220 };
+ static constexpr int resistances_g [2] = { 470, 220 };
+ double weights_r[3], weights_b[3], weights_g[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rb, weights_r, 100, 0,
3, resistances_rb, weights_b, 100, 0,
2, resistances_g, weights_g, 100, 0);
-
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- b = combine_3_weights(weights_b, bit0, bit1, bit2);
+ // blue component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const b = combine_3_weights(weights_b, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- g = combine_2_weights(weights_g, bit0, bit1);
+ // green component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const g = combine_2_weights(weights_g, bit0, bit1);
- /* encrypted color matrix */
- cn = bitswap<8>(i,7,5,6,4,3,2,1,0);
+ // encrypted color matrix
+ int const cn = bitswap<8>(i, 7, 5, 6, 4, 3, 2, 1, 0);
- palette.set_pen_color(cn, rgb_t(r,g,b));
+ palette.set_pen_color(cn, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/sonson.cpp b/src/mame/video/sonson.cpp
index d27377b3756..f77f557e669 100644
--- a/src/mame/video/sonson.cpp
+++ b/src/mame/video/sonson.cpp
@@ -41,55 +41,53 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(sonson_state, sonson)
+void sonson_state::sonson_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
- /* red component */
+ // red component
bit0 = (color_prom[i + 0x20] >> 0) & 0x01;
bit1 = (color_prom[i + 0x20] >> 1) & 0x01;
bit2 = (color_prom[i + 0x20] >> 2) & 0x01;
bit3 = (color_prom[i + 0x20] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
+ // green component
bit0 = (color_prom[i + 0x00] >> 4) & 0x01;
bit1 = (color_prom[i + 0x00] >> 5) & 0x01;
bit2 = (color_prom[i + 0x00] >> 6) & 0x01;
bit3 = (color_prom[i + 0x00] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
+ // blue component
bit0 = (color_prom[i + 0x00] >> 0) & 0x01;
bit1 = (color_prom[i + 0x00] >> 1) & 0x01;
bit2 = (color_prom[i + 0x00] >> 2) & 0x01;
bit3 = (color_prom[i + 0x00] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x40;
- /* characters use colors 0-0x0f */
- for (i = 0; i < 0x100; i++)
+ // characters use colors 0-0x0f
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites use colors 0x10-0x1f */
- for (i = 0x100; i < 0x200; i++)
+ // sprites use colors 0x10-0x1f
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/spdodgeb.cpp b/src/mame/video/spdodgeb.cpp
index 0d6b2a6e1b2..f2da1c13fd0 100644
--- a/src/mame/video/spdodgeb.cpp
+++ b/src/mame/video/spdodgeb.cpp
@@ -1,37 +1,38 @@
// license:BSD-3-Clause
// copyright-holders:Paul Hampson, Nicola Salmoria
#include "emu.h"
-#include "cpu/m6502/m6502.h"
#include "includes/spdodgeb.h"
+#include "cpu/m6502/m6502.h"
-PALETTE_INIT_MEMBER(spdodgeb_state, spdodgeb)
+void spdodgeb_state::spdodgeb_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
for (int i = 0;i < palette.entries();i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
-
-
- /* red component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- bit2 = (color_prom[0] >> 6) & 0x01;
- bit3 = (color_prom[0] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
- bit0 = (color_prom[palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[palette.entries()] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // green component
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 5);
+ bit2 = BIT(color_prom[0], 6);
+ bit3 = BIT(color_prom[0], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ // blue component
+ bit0 = BIT(color_prom[palette.entries()], 0);
+ bit1 = BIT(color_prom[palette.entries()], 1);
+ bit2 = BIT(color_prom[palette.entries()], 2);
+ bit3 = BIT(color_prom[palette.entries()], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
palette.set_pen_color(i,rgb_t(r,g,b));
color_prom++;
diff --git a/src/mame/video/special.cpp b/src/mame/video/special.cpp
index c343d7df3ca..788479037fe 100644
--- a/src/mame/video/special.cpp
+++ b/src/mame/video/special.cpp
@@ -13,72 +13,57 @@
#include "includes/special.h"
-VIDEO_START_MEMBER(special_state,special)
-{
- m_palette->set_pen_color(0, rgb_t::black());
- m_palette->set_pen_color(1, rgb_t::white());
-}
-
uint32_t special_state::screen_update_special(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t code;
- int y, x, b;
-
- for (x = 0; x < 48; x++)
+ for (int x = 0; x < 48; x++)
{
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
- code = m_p_videoram[y + x*256];
- for (b = 7; b >= 0; b--)
- bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01;
+ uint8_t const code = m_p_videoram[y + x*256];
+ for (int b = 7; b >= 0; b--)
+ bitmap.pix16(y, x*8+(7-b)) = BIT(code, b);
}
}
return 0;
}
-VIDEO_START_MEMBER(special_state,specialp)
-{
-}
uint32_t special_state::screen_update_specialp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t code;
- int y, x, b;
-
- for (x = 0; x < 64; x++)
+ for (int x = 0; x < 64; x++)
{
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
- code = m_p_videoram[y + x*256];
- for (b = 7; b >= 0; b--)
- bitmap.pix16(y, x*8+(7-b)) = (code >> b) & 0x01;
+ uint8_t const code = m_p_videoram[y + x*256];
+ for (int b = 7; b >= 0; b--)
+ bitmap.pix16(y, x*8+(7-b)) = BIT(code, b);
}
}
return 0;
}
-static const rgb_t specimx_palette[16] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0xaa), // 1
- rgb_t(0x00, 0xaa, 0x00), // 2
- rgb_t(0x00, 0xaa, 0xaa), // 3
- rgb_t(0xaa, 0x00, 0x00), // 4
- rgb_t(0xaa, 0x00, 0xaa), // 5
- rgb_t(0xaa, 0x55, 0x00), // 6
- rgb_t(0xaa, 0xaa, 0xaa), // 7
- rgb_t(0x55, 0x55, 0x55), // 8
- rgb_t(0x55, 0x55, 0xff), // 9
- rgb_t(0x55, 0xff, 0x55), // A
- rgb_t(0x55, 0xff, 0xff), // B
- rgb_t(0xff, 0x55, 0x55), // C
- rgb_t(0xff, 0x55, 0xff), // D
- rgb_t(0xff, 0xff, 0x55), // E
- rgb_t(0xff, 0xff, 0xff) // F
+static constexpr rgb_t specimx_pens[16] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0xaa }, // 1
+ { 0x00, 0xaa, 0x00 }, // 2
+ { 0x00, 0xaa, 0xaa }, // 3
+ { 0xaa, 0x00, 0x00 }, // 4
+ { 0xaa, 0x00, 0xaa }, // 5
+ { 0xaa, 0x55, 0x00 }, // 6
+ { 0xaa, 0xaa, 0xaa }, // 7
+ { 0x55, 0x55, 0x55 }, // 8
+ { 0x55, 0x55, 0xff }, // 9
+ { 0x55, 0xff, 0x55 }, // A
+ { 0x55, 0xff, 0xff }, // B
+ { 0xff, 0x55, 0x55 }, // C
+ { 0xff, 0x55, 0xff }, // D
+ { 0xff, 0xff, 0x55 }, // E
+ { 0xff, 0xff, 0xff } // F
};
-PALETTE_INIT_MEMBER(special_state,specimx)
+void special_state::specimx_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, specimx_palette, ARRAY_LENGTH(specimx_palette));
+ palette.set_pen_colors(0, specimx_pens);
}
@@ -89,43 +74,36 @@ VIDEO_START_MEMBER(special_state,specimx)
uint32_t special_state::screen_update_specimx(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t code, color;
- int y, x, b;
-
- for (x = 0; x < 48; x++)
+ for (int x = 0; x < 48; x++)
{
- for (y = 0; y < 256; y++)
+ for (int y = 0; y < 256; y++)
{
- code = m_ram->pointer()[0x9000 + y + x*256];
- color = m_specimx_colorram[y + x*256];
- for (b = 7; b >= 0; b--)
- bitmap.pix16(y, x*8+(7-b)) = ((code >> b) & 0x01)==0 ? color & 0x0f : (color >> 4)& 0x0f ;
+ uint8_t const code = m_ram->pointer()[0x9000 + y + x*256];
+ uint8_t const color = m_specimx_colorram[y + x*256];
+ for (int b = 7; b >= 0; b--)
+ bitmap.pix16(y, x*8+(7-b)) = (BIT(code, b) ? (color >> 4) : color) & 0x0f;
}
}
return 0;
}
-static const rgb_t erik_palette[8] = {
- rgb_t(0x00, 0x00, 0x00), // 0
- rgb_t(0x00, 0x00, 0xff), // 1
- rgb_t(0xff, 0x00, 0x00), // 2
- rgb_t(0xff, 0x00, 0xff), // 3
- rgb_t(0x00, 0xff, 0x00), // 4
- rgb_t(0x00, 0xff, 0xff), // 5
- rgb_t(0xff, 0xff, 0x00), // 6
- rgb_t(0xff, 0xff, 0xff) // 7
+static constexpr rgb_t erik_pens[8] = {
+ { 0x00, 0x00, 0x00 }, // 0
+ { 0x00, 0x00, 0xff }, // 1
+ { 0xff, 0x00, 0x00 }, // 2
+ { 0xff, 0x00, 0xff }, // 3
+ { 0x00, 0xff, 0x00 }, // 4
+ { 0x00, 0xff, 0xff }, // 5
+ { 0xff, 0xff, 0x00 }, // 6
+ { 0xff, 0xff, 0xff } // 7
};
-PALETTE_INIT_MEMBER(special_state,erik)
+void special_state::erik_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, erik_palette, ARRAY_LENGTH(erik_palette));
+ palette.set_pen_colors(0, erik_pens);
}
-VIDEO_START_MEMBER(special_state,erik)
-{
-}
-
uint32_t special_state::screen_update_erik(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t code1, code2, color1, color2;
diff --git a/src/mame/video/spectrum.cpp b/src/mame/video/spectrum.cpp
index f98d5c66640..e3a0226ee74 100644
--- a/src/mame/video/spectrum.cpp
+++ b/src/mame/video/spectrum.cpp
@@ -187,28 +187,28 @@ uint32_t spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_in
}
-static const rgb_t spectrum_palette[16] = {
- rgb_t(0x00, 0x00, 0x00),
- rgb_t(0x00, 0x00, 0xbf),
- rgb_t(0xbf, 0x00, 0x00),
- rgb_t(0xbf, 0x00, 0xbf),
- rgb_t(0x00, 0xbf, 0x00),
- rgb_t(0x00, 0xbf, 0xbf),
- rgb_t(0xbf, 0xbf, 0x00),
- rgb_t(0xbf, 0xbf, 0xbf),
- rgb_t(0x00, 0x00, 0x00),
- rgb_t(0x00, 0x00, 0xff),
- rgb_t(0xff, 0x00, 0x00),
- rgb_t(0xff, 0x00, 0xff),
- rgb_t(0x00, 0xff, 0x00),
- rgb_t(0x00, 0xff, 0xff),
- rgb_t(0xff, 0xff, 0x00),
- rgb_t(0xff, 0xff, 0xff)
+static constexpr rgb_t spectrum_pens[16] = {
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0xbf },
+ { 0xbf, 0x00, 0x00 },
+ { 0xbf, 0x00, 0xbf },
+ { 0x00, 0xbf, 0x00 },
+ { 0x00, 0xbf, 0xbf },
+ { 0xbf, 0xbf, 0x00 },
+ { 0xbf, 0xbf, 0xbf },
+ { 0x00, 0x00, 0x00 },
+ { 0x00, 0x00, 0xff },
+ { 0xff, 0x00, 0x00 },
+ { 0xff, 0x00, 0xff },
+ { 0x00, 0xff, 0x00 },
+ { 0x00, 0xff, 0xff },
+ { 0xff, 0xff, 0x00 },
+ { 0xff, 0xff, 0xff }
};
-/* Initialise the palette */
-PALETTE_INIT_MEMBER(spectrum_state,spectrum)
+// Initialise the palette
+void spectrum_state::spectrum_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, spectrum_palette, ARRAY_LENGTH(spectrum_palette));
+ palette.set_pen_colors(0, spectrum_pens);
}
void spectrum_state::spectrum_UpdateScreenBitmap(bool eof)
diff --git a/src/mame/video/speedatk.cpp b/src/mame/video/speedatk.cpp
index 442d32311b0..64120bd1896 100644
--- a/src/mame/video/speedatk.cpp
+++ b/src/mame/video/speedatk.cpp
@@ -9,44 +9,42 @@
#include "includes/speedatk.h"
-PALETTE_INIT_MEMBER(speedatk_state, speedatk)
+void speedatk_state::speedatk_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- /* create a lookup table for the palette */
- for (i = 0; i < 0x10; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x10; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/sprint2.cpp b/src/mame/video/sprint2.cpp
index ac826694ae7..03286986220 100644
--- a/src/mame/video/sprint2.cpp
+++ b/src/mame/video/sprint2.cpp
@@ -10,25 +10,25 @@
#include "includes/sprint2.h"
-PALETTE_INIT_MEMBER(sprint2_state, sprint2)
+void sprint2_state::sprint2_palette(palette_device &palette) const
{
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00));
palette.set_indirect_color(1, rgb_t(0x5b, 0x5b, 0x5b));
palette.set_indirect_color(2, rgb_t(0xa4, 0xa4, 0xa4));
palette.set_indirect_color(3, rgb_t(0xff, 0xff, 0xff));
- palette.set_pen_indirect(0x0, 1); /* black playfield */
+ palette.set_pen_indirect(0x0, 1); // black playfield
palette.set_pen_indirect(0x1, 0);
- palette.set_pen_indirect(0x2, 1); /* white playfield */
+ palette.set_pen_indirect(0x2, 1); // white playfield
palette.set_pen_indirect(0x3, 3);
- palette.set_pen_indirect(0x4, 1); /* car #1 */
+ palette.set_pen_indirect(0x4, 1); // car #1
palette.set_pen_indirect(0x5, 3);
- palette.set_pen_indirect(0x6, 1); /* car #2 */
+ palette.set_pen_indirect(0x6, 1); // car #2
palette.set_pen_indirect(0x7, 0);
- palette.set_pen_indirect(0x8, 1); /* car #3 */
+ palette.set_pen_indirect(0x8, 1); // car #3
palette.set_pen_indirect(0x9, 2);
- palette.set_pen_indirect(0xa, 1); /* car #4 */
+ palette.set_pen_indirect(0xa, 1); // car #4
palette.set_pen_indirect(0xb, 2);
}
diff --git a/src/mame/video/sprint4.cpp b/src/mame/video/sprint4.cpp
index 46aeab82472..082c106a122 100644
--- a/src/mame/video/sprint4.cpp
+++ b/src/mame/video/sprint4.cpp
@@ -12,14 +12,14 @@ Atari Sprint 4 video emulation
#include "screen.h"
-PALETTE_INIT_MEMBER(sprint4_state, sprint4)
+void sprint4_state::sprint4_palette(palette_device &palette) const
{
- palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); /* black */
- palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); /* peach */
- palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); /* violet */
- palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); /* green */
- palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); /* blue */
- palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); /* white */
+ palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00)); // black
+ palette.set_indirect_color(1, rgb_t(0xfc, 0xdf, 0x80)); // peach
+ palette.set_indirect_color(2, rgb_t(0xf0, 0x00, 0xf0)); // violet
+ palette.set_indirect_color(3, rgb_t(0x00, 0xf0, 0x0f)); // green
+ palette.set_indirect_color(4, rgb_t(0x30, 0x4f, 0xff)); // blue
+ palette.set_indirect_color(5, rgb_t(0xff, 0xff, 0xff)); // white
palette.set_pen_indirect(0, 0);
palette.set_pen_indirect(2, 0);
diff --git a/src/mame/video/sprint8.cpp b/src/mame/video/sprint8.cpp
index a3ce7092c30..3f13debe6bb 100644
--- a/src/mame/video/sprint8.cpp
+++ b/src/mame/video/sprint8.cpp
@@ -10,7 +10,7 @@ Atari Sprint 8 video emulation
#include "includes/sprint8.h"
-PALETTE_INIT_MEMBER(sprint8_state, sprint8)
+void sprint8_state::sprint8_palette(palette_device &palette) const
{
for (int i = 0; i < 0x10; i++)
{
diff --git a/src/mame/video/srmp2.cpp b/src/mame/video/srmp2.cpp
index 4db1c9bb957..8200d4e53c7 100644
--- a/src/mame/video/srmp2.cpp
+++ b/src/mame/video/srmp2.cpp
@@ -10,32 +10,24 @@ Functions to emulate the video hardware of the machine.
#include "emu.h"
#include "includes/srmp2.h"
-PALETTE_INIT_MEMBER(srmp2_state,srmp2)
+void srmp2_state::srmp2_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int col;
-
- col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
- palette.set_pen_color(i ^ 0x0f,pal5bit(col >> 10),pal5bit(col >> 5),pal5bit(col >> 0));
+ int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
+ palette.set_pen_color(i ^ 0x0f, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
}
}
-PALETTE_INIT_MEMBER(srmp2_state,srmp3)
+void srmp2_state::srmp3_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < palette.entries(); i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < palette.entries(); i++)
{
- int col;
-
- col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
- palette.set_pen_color(i,pal5bit(col >> 10),pal5bit(col >> 5),pal5bit(col >> 0));
+ int const col = (color_prom[i] << 8) + color_prom[i + palette.entries()];
+ palette.set_pen_color(i,pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
}
}
diff --git a/src/mame/video/ssozumo.cpp b/src/mame/video/ssozumo.cpp
index 6cb4f1ad14b..51f37bbd789 100644
--- a/src/mame/video/ssozumo.cpp
+++ b/src/mame/video/ssozumo.cpp
@@ -14,31 +14,33 @@ Driver by Takahiro Nogi (nogi@kt.rim.or.jp) 1999/10/04
/**************************************************************************/
-PALETTE_INIT_MEMBER(ssozumo_state, ssozumo)
+void ssozumo_state::ssozumo_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int bit0, bit1, bit2, bit3, r, g, b;
- int i;
- for (i = 0 ; i < 64 ; i++)
+ for (int i = 0 ; i < 64 ; i++)
{
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[0] >> 4) & 0x01;
- bit1 = (color_prom[0] >> 5) & 0x01;
- bit2 = (color_prom[0] >> 6) & 0x01;
- bit3 = (color_prom[0] >> 7) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- bit0 = (color_prom[64] >> 0) & 0x01;
- bit1 = (color_prom[64] >> 1) & 0x01;
- bit2 = (color_prom[64] >> 2) & 0x01;
- bit3 = (color_prom[64] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[0], 4);
+ bit1 = BIT(color_prom[0], 5);
+ bit2 = BIT(color_prom[0], 6);
+ bit3 = BIT(color_prom[0], 7);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ bit0 = BIT(color_prom[64], 0);
+ bit1 = BIT(color_prom[64], 1);
+ bit2 = BIT(color_prom[64], 2);
+ bit3 = BIT(color_prom[64], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
}
diff --git a/src/mame/video/ssrj.cpp b/src/mame/video/ssrj.cpp
index 8fd787d3fd7..47a5f67b12a 100644
--- a/src/mame/video/ssrj.cpp
+++ b/src/mame/video/ssrj.cpp
@@ -66,7 +66,7 @@ TODO: This table is nowhere near as accurate. If you bother, here's how colors s
-after the first stage, houses have red/white colors.
*/
-static const uint8_t fakecols[4*4][8][3]=
+static constexpr rgb_t fakecols[4 * 4][8] =
{
{{0x00,0x00,0x00},
{42,87,140},
@@ -264,12 +264,11 @@ void ssrj_state::draw_objects(bitmap_ind16 &bitmap, const rectangle &cliprect )
}
-PALETTE_INIT_MEMBER(ssrj_state, ssrj)
+void ssrj_state::ssrj_palette(palette_device &palette) const
{
- int i, j;
- for(i=0; i<4*4; i++)
- for(j=0; j<8; j++)
- palette.set_pen_color(i*8+j, fakecols[i][j][0], fakecols[i][j][1], fakecols[i][j][2]);
+ for (int i = 0; i < 4*4; i++)
+ for (int j = 0; j < 8; j++)
+ palette.set_pen_color(i*8 + j, fakecols[i][j]);
}
uint32_t ssrj_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
diff --git a/src/mame/video/stactics.cpp b/src/mame/video/stactics.cpp
index d9a25bc472c..5f9ab186403 100644
--- a/src/mame/video/stactics.cpp
+++ b/src/mame/video/stactics.cpp
@@ -60,26 +60,25 @@ tilt the mirror up and down, and the monitor left and right.
*
*************************************/
-PALETTE_INIT_MEMBER(stactics_state,stactics)
+void stactics_state::stactics_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 0x400; i++)
+ for (int i = 0; i < 0x400; i++)
{
- int bit0 = (color_prom[i] >> 0) & 0x01;
- int bit1 = (color_prom[i] >> 1) & 0x01;
- int bit2 = (color_prom[i] >> 2) & 0x01;
- int bit3 = (color_prom[i] >> 3) & 0x01;
+ int const bit0 = BIT(color_prom[i], 0);
+ int const bit1 = BIT(color_prom[i], 1);
+ int const bit2 = BIT(color_prom[i], 2);
+ int const bit3 = BIT(color_prom[i], 3);
- /* red component */
- int r = 0xff * bit0;
+ // red component
+ int const r = 0xff * bit0;
- /* green component */
- int g = 0xff * bit1 - 0xcc * bit3;
+ // green component
+ int const g = 0xff * bit1 - 0xcc * bit3;
- /* blue component */
- int b = 0xff * bit2;
+ // blue component
+ int const b = 0xff * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -437,7 +436,5 @@ MACHINE_CONFIG_START(stactics_state::stactics_video)
MCFG_SCREEN_UPDATE_DRIVER(stactics_state, screen_update)
MCFG_SCREEN_PALETTE("palette")
- MCFG_PALETTE_ADD("palette", 0x400)
-
- MCFG_PALETTE_INIT_OWNER(stactics_state,stactics)
+ PALETTE(config, "palette", FUNC(stactics_state::stactics_palette), 0x400);
MACHINE_CONFIG_END
diff --git a/src/mame/video/starshp1.cpp b/src/mame/video/starshp1.cpp
index 0e63333814b..c00207f17fd 100644
--- a/src/mame/video/starshp1.cpp
+++ b/src/mame/video/starshp1.cpp
@@ -23,23 +23,21 @@ void starshp1_state::set_pens()
}
-PALETTE_INIT_MEMBER(starshp1_state, starshp1)
+void starshp1_state::starshp1_palette(palette_device &palette) const
{
- int i;
-
- static const uint16_t colortable_source[] =
+ static constexpr uint16_t colortable_source[] =
{
- 0, 3, /* 0x00 - 0x01 - alpha numerics */
- 0, 2, /* 0x02 - 0x03 - sprites (Z=0) */
- 0, 5, /* 0x04 - 0x05 - sprites (Z=1) */
- 0, 2, 4, 6, /* 0x06 - 0x09 - spaceship (EXPLODE=0) */
- 0, 6, 6, 7, /* 0x0a - 0x0d - spaceship (EXPLODE=1) */
- 5, 2, /* 0x0e - 0x0f - star field */
- 7, /* 0x10 - phasor */
- 5, 7 /* 0x11 - circle */
+ 0, 3, // 0x00 - 0x01 - alpha numerics
+ 0, 2, // 0x02 - 0x03 - sprites (Z=0)
+ 0, 5, // 0x04 - 0x05 - sprites (Z=1)
+ 0, 2, 4, 6, // 0x06 - 0x09 - spaceship (EXPLODE=0)
+ 0, 6, 6, 7, // 0x0a - 0x0d - spaceship (EXPLODE=1)
+ 5, 2, // 0x0e - 0x0f - star field
+ 7, // 0x10 - phasor
+ 5, 7 // 0x11 - circle
};
- for (i = 0; i < ARRAY_LENGTH(colortable_source); i++)
+ for (unsigned i = 0; i < ARRAY_LENGTH(colortable_source); i++)
palette.set_pen_indirect(i, colortable_source[i]);
}
diff --git a/src/mame/video/sub.cpp b/src/mame/video/sub.cpp
index 9f7d243b04a..f2e54e5d194 100644
--- a/src/mame/video/sub.cpp
+++ b/src/mame/video/sub.cpp
@@ -11,28 +11,22 @@ Video functions
#include "emu.h"
#include "includes/sub.h"
-PALETTE_INIT_MEMBER(sub_state, sub)
+void sub_state::sub_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- uint8_t* lookup = memregion("proms2")->base();
-
- for (i = 0;i < 0x100;i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 0x100; i++)
{
- int r,g,b;
- r = (color_prom[0x000] >> 0);
- g = (color_prom[0x100] >> 0);
- b = (color_prom[0x200] >> 0);
+ int const r = color_prom[i | 0x000];
+ int const g = color_prom[i | 0x100];
+ int const b = color_prom[i | 0x200];
- //palette.set_indirect_color(i, rgb_t(r, g, b));
palette.set_indirect_color(i, rgb_t(pal4bit(r), pal4bit(g), pal4bit(b)));
-
- color_prom++;
}
- for (i = 0;i < 0x400;i++)
+ uint8_t const *const lookup = memregion("proms2")->base();
+ for (int i = 0; i < 0x400; i++)
{
- uint8_t ctabentry = lookup[i+0x400] | (lookup[i+0x000] << 4);
+ uint8_t const ctabentry = lookup[i | 0x400] | (lookup[i | 0x000] << 4);
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/super80.cpp b/src/mame/video/super80.cpp
index b88b4f4c064..204860f1e66 100644
--- a/src/mame/video/super80.cpp
+++ b/src/mame/video/super80.cpp
@@ -14,42 +14,42 @@
/**************************** PALETTES for super80m and super80v ******************************************/
-PALETTE_INIT_MEMBER( super80_state, super80m )
+void super80_state::super80m_palette(palette_device &palette) const
{
// RGB
- m_palette->set_pen_color(0, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */
- m_palette->set_pen_color(1, rgb_t(0x00, 0x00, 0x00)); /* 1 Black */
- m_palette->set_pen_color(2, rgb_t(0x00, 0x00, 0x7f)); /* 2 Blue */
- m_palette->set_pen_color(3, rgb_t(0x00, 0x00, 0xff)); /* 3 Light Blue */
- m_palette->set_pen_color(4, rgb_t(0x00, 0x7f, 0x00)); /* 4 Green */
- m_palette->set_pen_color(5, rgb_t(0x00, 0xff, 0x00)); /* 5 Bright Green */
- m_palette->set_pen_color(6, rgb_t(0x00, 0x7f, 0x7f)); /* 6 Cyan */
- m_palette->set_pen_color(7, rgb_t(0x00, 0xff, 0xff)); /* 7 Turquoise */
- m_palette->set_pen_color(8, rgb_t(0x7f, 0x00, 0x00)); /* 8 Dark Red */
- m_palette->set_pen_color(9, rgb_t(0xff, 0x00, 0x00)); /* 9 Red */
- m_palette->set_pen_color(10, rgb_t(0x7f, 0x00, 0x7f)); /* 10 Purple */
- m_palette->set_pen_color(11, rgb_t(0xff, 0x00, 0xff)); /* 11 Magenta */
- m_palette->set_pen_color(12, rgb_t(0x7f, 0x7f, 0x00)); /* 12 Lime */
- m_palette->set_pen_color(13, rgb_t(0xff, 0xff, 0x00)); /* 13 Yellow */
- m_palette->set_pen_color(14, rgb_t(0xbf, 0xbf, 0xbf)); /* 14 Off White */
- m_palette->set_pen_color(15, rgb_t(0xff, 0xff, 0xff)); /* 15 White */
+ palette.set_pen_color( 0, rgb_t(0x00, 0x00, 0x00)); // 0 Black
+ palette.set_pen_color( 1, rgb_t(0x00, 0x00, 0x00)); // 1 Black
+ palette.set_pen_color( 2, rgb_t(0x00, 0x00, 0x7f)); // 2 Blue
+ palette.set_pen_color( 3, rgb_t(0x00, 0x00, 0xff)); // 3 Light Blue
+ palette.set_pen_color( 4, rgb_t(0x00, 0x7f, 0x00)); // 4 Green
+ palette.set_pen_color( 5, rgb_t(0x00, 0xff, 0x00)); // 5 Bright Green
+ palette.set_pen_color( 6, rgb_t(0x00, 0x7f, 0x7f)); // 6 Cyan
+ palette.set_pen_color( 7, rgb_t(0x00, 0xff, 0xff)); // 7 Turquoise
+ palette.set_pen_color( 8, rgb_t(0x7f, 0x00, 0x00)); // 8 Dark Red
+ palette.set_pen_color( 9, rgb_t(0xff, 0x00, 0x00)); // 9 Red
+ palette.set_pen_color(10, rgb_t(0x7f, 0x00, 0x7f)); // 10 Purple
+ palette.set_pen_color(11, rgb_t(0xff, 0x00, 0xff)); // 11 Magenta
+ palette.set_pen_color(12, rgb_t(0x7f, 0x7f, 0x00)); // 12 Lime
+ palette.set_pen_color(13, rgb_t(0xff, 0xff, 0x00)); // 13 Yellow
+ palette.set_pen_color(14, rgb_t(0xbf, 0xbf, 0xbf)); // 14 Off White
+ palette.set_pen_color(15, rgb_t(0xff, 0xff, 0xff)); // 15 White
// Composite
- m_palette->set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); /* 0 Black */
- m_palette->set_pen_color(17, rgb_t(0x80, 0x80, 0x80)); /* 1 Grey */
- m_palette->set_pen_color(18, rgb_t(0x00, 0x00, 0xff)); /* 2 Blue */
- m_palette->set_pen_color(19, rgb_t(0xff, 0xff, 0x80)); /* 3 Light Yellow */
- m_palette->set_pen_color(20, rgb_t(0x00, 0xff, 0x00)); /* 4 Green */
- m_palette->set_pen_color(21, rgb_t(0xff, 0x80, 0xff)); /* 5 Light Magenta */
- m_palette->set_pen_color(22, rgb_t(0x00, 0xff, 0xff)); /* 6 Cyan */
- m_palette->set_pen_color(23, rgb_t(0xff, 0x40, 0x40)); /* 7 Light Red */
- m_palette->set_pen_color(24, rgb_t(0xff, 0x00, 0x00)); /* 8 Red */
- m_palette->set_pen_color(25, rgb_t(0x00, 0x80, 0x80)); /* 9 Dark Cyan */
- m_palette->set_pen_color(26, rgb_t(0xff, 0x00, 0xff)); /* 10 Magenta */
- m_palette->set_pen_color(27, rgb_t(0x80, 0xff, 0x80)); /* 11 Light Green */
- m_palette->set_pen_color(28, rgb_t(0xff, 0xff, 0x00)); /* 12 Yellow */
- m_palette->set_pen_color(29, rgb_t(0x00, 0x00, 0x80)); /* 13 Dark Blue */
- m_palette->set_pen_color(30, rgb_t(0xff, 0xff, 0xff)); /* 14 White */
- m_palette->set_pen_color(31, rgb_t(0x00, 0x00, 0x00)); /* 15 Black */
+ palette.set_pen_color(16, rgb_t(0x00, 0x00, 0x00)); // 0 Black
+ palette.set_pen_color(17, rgb_t(0x80, 0x80, 0x80)); // 1 Grey
+ palette.set_pen_color(18, rgb_t(0x00, 0x00, 0xff)); // 2 Blue
+ palette.set_pen_color(19, rgb_t(0xff, 0xff, 0x80)); // 3 Light Yellow
+ palette.set_pen_color(20, rgb_t(0x00, 0xff, 0x00)); // 4 Green
+ palette.set_pen_color(21, rgb_t(0xff, 0x80, 0xff)); // 5 Light Magenta
+ palette.set_pen_color(22, rgb_t(0x00, 0xff, 0xff)); // 6 Cyan
+ palette.set_pen_color(23, rgb_t(0xff, 0x40, 0x40)); // 7 Light Red
+ palette.set_pen_color(24, rgb_t(0xff, 0x00, 0x00)); // 8 Red
+ palette.set_pen_color(25, rgb_t(0x00, 0x80, 0x80)); // 9 Dark Cyan
+ palette.set_pen_color(26, rgb_t(0xff, 0x00, 0xff)); // 10 Magenta
+ palette.set_pen_color(27, rgb_t(0x80, 0xff, 0x80)); // 11 Light Green
+ palette.set_pen_color(28, rgb_t(0xff, 0xff, 0x00)); // 12 Yellow
+ palette.set_pen_color(29, rgb_t(0x00, 0x00, 0x80)); // 13 Dark Blue
+ palette.set_pen_color(30, rgb_t(0xff, 0xff, 0xff)); // 14 White
+ palette.set_pen_color(31, rgb_t(0x00, 0x00, 0x00)); // 15 Black
}
diff --git a/src/mame/video/superqix.cpp b/src/mame/video/superqix.cpp
index 6c9f620c4de..4f8b8fc7f54 100644
--- a/src/mame/video/superqix.cpp
+++ b/src/mame/video/superqix.cpp
@@ -67,12 +67,12 @@ void superqix_state::video_start()
save_item(NAME(*m_fg_bitmap[1]));
}
-PALETTE_DECODER_MEMBER( superqix_state_base, BBGGRRII )
+rgb_t superqix_state_base::BBGGRRII(uint32_t raw)
{
- uint8_t i = raw & 3;
- uint8_t r = (raw >> 0) & 0x0c;
- uint8_t g = (raw >> 2) & 0x0c;
- uint8_t b = (raw >> 4) & 0x0c;
+ uint8_t const i = raw & 3;
+ uint8_t const r = (raw >> 0) & 0x0c;
+ uint8_t const g = (raw >> 2) & 0x0c;
+ uint8_t const b = (raw >> 4) & 0x0c;
return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i));
}
diff --git a/src/mame/video/suprloco.cpp b/src/mame/video/suprloco.cpp
index 19401afaf4f..15608323be7 100644
--- a/src/mame/video/suprloco.cpp
+++ b/src/mame/video/suprloco.cpp
@@ -30,42 +30,35 @@
I'm not sure about the resistor values, I'm using the Galaxian ones.
***************************************************************************/
-PALETTE_INIT_MEMBER(suprloco_state, suprloco)
+void suprloco_state::suprloco_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0;i < 512;i++)
+ for (int i = 0; i < 512; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
- /* hack: generate a second bank of sprite palette with red changed to purple */
+ // hack: generate a second bank of sprite palette with red changed to purple
if (i >= 256)
- {
- if ((i & 0x0f) == 0x09)
- palette.set_pen_color(i+256,rgb_t(r,g,0xff));
- else
- palette.set_pen_color(i+256,rgb_t(r,g,b));
- }
+ palette.set_pen_color(i + 256, rgb_t(r, g, ((i & 0x0f) == 0x09) ? 0xff : b));
}
}
diff --git a/src/mame/video/suprridr.cpp b/src/mame/video/suprridr.cpp
index ff5e614c024..1b695465257 100644
--- a/src/mame/video/suprridr.cpp
+++ b/src/mame/video/suprridr.cpp
@@ -58,32 +58,31 @@ void suprridr_state::video_start()
*
*************************************/
-PALETTE_INIT_MEMBER(suprridr_state, suprridr)
+void suprridr_state::suprridr_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0; i < 96; i++)
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 96; i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (*color_prom >> 6) & 0x01;
- bit1 = (*color_prom >> 7) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
-
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/tagteam.cpp b/src/mame/video/tagteam.cpp
index 159ef302285..2fb421ad380 100644
--- a/src/mame/video/tagteam.cpp
+++ b/src/mame/video/tagteam.cpp
@@ -34,11 +34,11 @@ static const res_net_decode_info tagteam_decode_info =
{ 0x07, 0x07, 0x03 } /* masks */
};
-PALETTE_INIT_MEMBER(tagteam_state, tagteam)
+void tagteam_state::tagteam_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- std::vector<rgb_t> rgb;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ std::vector<rgb_t> rgb;
compute_res_net_all(rgb, color_prom, tagteam_decode_info, tagteam_net_info);
palette.set_pen_colors(0x00, rgb);
}
diff --git a/src/mame/video/taito_l.cpp b/src/mame/video/taito_l.cpp
index f1d2a02ed5c..237ce077cf4 100644
--- a/src/mame/video/taito_l.cpp
+++ b/src/mame/video/taito_l.cpp
@@ -49,7 +49,6 @@ TILE_GET_INFO_MEMBER(taitol_state::get_tx_tile_info)
void taitol_state::video_start()
{
m_buff_spriteram = make_unique_clear<u8[]>(SPRITERAM_SIZE);
- int i;
m_bg_tilemap[0] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(taitol_state::get_tile_info<0x8000>),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
m_bg_tilemap[1] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(taitol_state::get_tile_info<0x9000>),this), TILEMAP_SCAN_ROWS, 8, 8, 64, 32);
@@ -58,9 +57,6 @@ void taitol_state::video_start()
m_bg_tilemap[0]->set_transparent_pen(0);
m_tx_tilemap->set_transparent_pen(0);
- for (i = 0; i < 256; i++)
- m_palette->set_pen_color(i, rgb_t(0, 0, 0));
-
m_tx_tilemap->set_scrolldx(-8, -8);
m_bg_tilemap[0]->set_scrolldx(28, -11);
m_bg_tilemap[1]->set_scrolldx(38, -21);
diff --git a/src/mame/video/tank8.cpp b/src/mame/video/tank8.cpp
index a1c515cfba2..0507640e84a 100644
--- a/src/mame/video/tank8.cpp
+++ b/src/mame/video/tank8.cpp
@@ -10,14 +10,12 @@ Atari Tank 8 video emulation
#include "includes/tank8.h"
-PALETTE_INIT_MEMBER(tank8_state, tank8)
+void tank8_state::tank8_palette(palette_device &palette) const
{
- int i;
-
palette.set_indirect_color(8, rgb_t(0x00, 0x00, 0x00));
palette.set_indirect_color(9, rgb_t(0xff, 0xff, 0xff));
- for (i = 0; i < 8; i++)
+ for (int i = 0; i < 8; i++)
{
palette.set_pen_indirect(2 * i + 0, 8);
palette.set_pen_indirect(2 * i + 1, i);
diff --git a/src/mame/video/tankbatt.cpp b/src/mame/video/tankbatt.cpp
index baa0813a6a1..847bba56002 100644
--- a/src/mame/video/tankbatt.cpp
+++ b/src/mame/video/tankbatt.cpp
@@ -17,41 +17,34 @@
Convert the color PROMs into a more useable format.
***************************************************************************/
-PALETTE_INIT_MEMBER(tankbatt_state, tankbatt)
+void tankbatt_state::tankbatt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- #define RES_1 0xc0 /* this is a guess */
- #define RES_2 0x3f /* this is a guess */
+ constexpr int RES_1 = 0xc0; // this is a guess
+ constexpr int RES_2 = 0x3f; // this is a guess
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int bit0, bit1, bit2, bit3;
- int r, g, b;
+ int const bit0 = BIT(color_prom[i], 0); // intensity
+ int const bit1 = BIT(color_prom[i], 1); // red
+ int const bit2 = BIT(color_prom[i], 2); // green
+ int const bit3 = BIT(color_prom[i], 3); // blue
- bit0 = (color_prom[i] >> 0) & 0x01; /* intensity */
- bit1 = (color_prom[i] >> 1) & 0x01; /* red */
- bit2 = (color_prom[i] >> 2) & 0x01; /* green */
- bit3 = (color_prom[i] >> 3) & 0x01; /* blue */
+ // red component
+ int const r = bit1 * (RES_1 + (RES_2 * bit0));
- /* red component */
- r = RES_1 * bit1;
- if (bit1) r += RES_2 * bit0;
+ // green component
+ int const g = bit2 * (RES_1 + (RES_2 * bit0));
- /* green component */
- g = RES_1 * bit2;
- if (bit2) g += RES_2 * bit0;
-
- /* blue component */
- b = RES_1 * bit3;
- if (bit3) b += RES_2 * bit0;
+ // blue component
+ int const b = bit3 * (RES_1 + (RES_2 * bit0));
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0; i < 0x200; i += 2)
+ for (int i = 0; i < 0x200; i += 2)
{
palette.set_pen_indirect(i + 0, 0);
palette.set_pen_indirect(i + 1, i >> 1);
diff --git a/src/mame/video/tceptor.cpp b/src/mame/video/tceptor.cpp
index 1b4f67d31d6..7b14db0b7b7 100644
--- a/src/mame/video/tceptor.cpp
+++ b/src/mame/video/tceptor.cpp
@@ -8,6 +8,8 @@
#include "emu.h"
#include "includes/tceptor.h"
+#include <algorithm>
+
#define TX_TILE_OFFSET_CENTER (32 * 2)
#define TX_TILE_OFFSET_RIGHT (32 * 0 + 2)
@@ -19,67 +21,67 @@
/*******************************************************************/
-PALETTE_INIT_MEMBER(tceptor_state, tceptor)
+void tceptor_state::tceptor_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x400; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x400; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x400]);
- int b = pal4bit(color_prom[i + 0x800]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x400]);
+ int const b = pal4bit(color_prom[i + 0x800]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0xc00;
-
/*
- color lookup table:
- 0- +1024 ( 4 * 256) colors: text (use 0- 256 colors)
- 1024- +1024 (16 * 64) colors: sprite (use 768- 256 colors)
- 2048- +512 ( 8 * 64) colors: bg (use 0- 512 colors)
- 3840- +256 ( 4 * 64) colors: road (use 512- 256 colors)
- */
-
- /* tiles lookup table (1024 colors) */
- for (i = 0; i < 0x0400; i++)
+ color lookup table:
+ 0- +1024 ( 4 * 256) colors: text (use 0- 256 colors)
+ 1024- +1024 (16 * 64) colors: sprite (use 768- 256 colors)
+ 2048- +512 ( 8 * 64) colors: bg (use 0- 512 colors)
+ 3840- +256 ( 4 * 64) colors: road (use 512- 256 colors)
+ */
+
+ // tiles lookup table (1024 colors)
+ for (int i = 0; i < 0x0400; i++)
{
- int ctabentry = color_prom[i];
+ int const ctabentry = color_prom[i];
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites lookup table (1024 colors) */
- for (i = 0x0400; i < 0x0800; i++)
+ // sprites lookup table (1024 colors)
+ for (int i = 0x0400; i < 0x0800; i++)
{
- int ctabentry = color_prom[i] | 0x300;
+ int const ctabentry = color_prom[i] | 0x300;
palette.set_pen_indirect(i, ctabentry);
}
- /* background: no lookup PROM, use directly (512 colors) */
- for (i = 0x0a00; i < 0x0c00; i++)
+ // background: no lookup PROM, use directly (512 colors)
+ for (int i = 0x0a00; i < 0x0c00; i++)
{
- int ctabentry = i & 0x1ff;
+ int const ctabentry = i & 0x1ff;
palette.set_pen_indirect(i, ctabentry);
}
- /* road lookup table (256 colors) */
- for (i = 0x0f00; i < 0x1000; i++)
+ // road lookup table (256 colors)
+ for (int i = 0x0f00; i < 0x1000; i++)
{
- int ctabentry = color_prom[i - 0x700] | 0x200;
+ int const ctabentry = color_prom[i - 0x700] | 0x200;
palette.set_pen_indirect(i, ctabentry);
}
- /* setup sprite mask color map */
- /* tceptor2: only 0x23 */
- memset(m_is_mask_spr, 0, sizeof m_is_mask_spr);
- for (i = 0; i < 0x400; i++)
+ // setup sprite mask color map
+ // tceptor2: only 0x23
+ std::fill(std::begin(m_is_mask_spr), std::end(m_is_mask_spr), 0);
+ for (int i = 0; i < 0x400; i++)
+ {
if (palette.pen_indirect(i | 0x400) == SPR_MASK_COLOR)
m_is_mask_spr[i >> 4] = 1;
+ }
}
diff --git a/src/mame/video/terracre.cpp b/src/mame/video/terracre.cpp
index d2ee3a13cdb..3da7cad5313 100644
--- a/src/mame/video/terracre.cpp
+++ b/src/mame/video/terracre.cpp
@@ -89,72 +89,60 @@ void terracre_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
}
}
-PALETTE_INIT_MEMBER(terracre_state, terracre)
+void terracre_state::terracre_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
- int r = pal4bit(color_prom[i + 0x000]);
- int g = pal4bit(color_prom[i + 0x100]);
- int b = pal4bit(color_prom[i + 0x200]);
+ int const r = pal4bit(color_prom[i + 0x000]);
+ int const g = pal4bit(color_prom[i + 0x100]);
+ int const b = pal4bit(color_prom[i + 0x200]);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0-0x0f */
- for (i = 0; i < 0x10; i++)
+ // characters use colors 0-0x0f
+ for (int i = 0; i < 0x10; i++)
palette.set_pen_indirect(i, i);
- /* background tiles use colors 0xc0-0xff in four banks */
- /* the bottom two bits of the color code select the palette bank for */
- /* pens 0-7; the top two bits for pens 8-0x0f. */
- for (i = 0; i < 0x100; i++)
+ // background tiles use colors 0xc0-0xff in four banks
+ // the bottom two bits of the color code select the palette bank for pens 0-7;
+ // the top two bits for pens 8-0x0f.
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry;
-
- if (i & 0x08)
- ctabentry = 0xc0 | (i & 0x0f) | ((i & 0xc0) >> 2);
- else
- ctabentry = 0xc0 | (i & 0x0f) | ((i & 0x30) >> 0);
+ uint8_t const ctabentry = 0xc0 | (i & 0x0f) | ((i >> ((i & 0x08) ? 2 : 0)) & 0x30);
palette.set_pen_indirect(0x10 + i, ctabentry);
}
- /* sprites use colors 128-191 in four banks */
- /* The lookup table tells which colors to pick from the selected bank */
- /* the bank is selected by another PROM and depends on the top 8 bits of */
- /* the sprite code. The PROM selects the bank *separately* for pens 0-7 and */
- /* 8-15 (like for tiles). */
- for (i = 0; i < 0x1000; i++)
+ // sprites use colors 128-191 in four banks
+ // The lookup table tells which colors to pick from the selected bank
+ // the bank is selected by another PROM and depends on the top 8 bits of the sprite code.
+ // The PROM selects the bank *separately* for pens 0-7 and 8-15 (like for tiles).
+ for (int i = 0; i < 0x1000; i++)
{
- uint8_t ctabentry;
+ uint8_t const ctabentry = 0x80 | ((i << ((i & 0x80) ? 2 : 4)) & 0x30) | (color_prom[i >> 4] & 0x0f);
int i_swapped = ((i & 0x0f) << 8) | ((i & 0xff0) >> 4);
- if (i & 0x80)
- ctabentry = 0x80 | ((i & 0x0c) << 2) | (color_prom[i >> 4] & 0x0f);
- else
- ctabentry = 0x80 | ((i & 0x03) << 4) | (color_prom[i >> 4] & 0x0f);
-
palette.set_pen_indirect(0x110 + i_swapped, ctabentry);
}
}
WRITE16_MEMBER(terracre_state::amazon_background_w)
{
- COMBINE_DATA( &m_bg_videoram[offset] );
- m_background->mark_tile_dirty(offset );
+ COMBINE_DATA(&m_bg_videoram[offset]);
+ m_background->mark_tile_dirty(offset);
}
WRITE16_MEMBER(terracre_state::amazon_foreground_w)
{
- COMBINE_DATA( &m_fg_videoram[offset] );
- m_foreground->mark_tile_dirty(offset );
+ COMBINE_DATA(&m_fg_videoram[offset]);
+ m_foreground->mark_tile_dirty(offset);
}
WRITE16_MEMBER(terracre_state::amazon_flipscreen_w)
diff --git a/src/mame/video/thedeep.cpp b/src/mame/video/thedeep.cpp
index b84f505147d..6338b6fdaeb 100644
--- a/src/mame/video/thedeep.cpp
+++ b/src/mame/video/thedeep.cpp
@@ -84,12 +84,11 @@ WRITE8_MEMBER(thedeep_state::vram_1_w)
***************************************************************************/
-PALETTE_INIT_MEMBER(thedeep_state, thedeep)
+void thedeep_state::thedeep_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < 512;i++)
- palette.set_pen_color(i,pal4bit(color_prom[0x400 + i] >> 0),pal4bit(color_prom[0x400 + i] >> 4),pal4bit(color_prom[0x200 + i] >> 0));
+ uint8_t const *const color_prom = memregion("proms")->base();
+ for (int i = 0; i < 512; i++)
+ palette.set_pen_color(i, pal4bit(color_prom[0x400 + i] >> 0), pal4bit(color_prom[0x400 + i] >> 4), pal4bit(color_prom[0x200 + i] >> 0));
}
/***************************************************************************
diff --git a/src/mame/video/thepit.cpp b/src/mame/video/thepit.cpp
index 51086bc601e..58d401ca2c4 100644
--- a/src/mame/video/thepit.cpp
+++ b/src/mame/video/thepit.cpp
@@ -31,36 +31,35 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(thepit_state, thepit)
+void thepit_state::thepit_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r, g, b));
}
- /* allocate primary colors for the background and foreground
- this is wrong, but I don't know where to pick the colors from */
- for (i = 0; i < 8; i++)
+ // allocate primary colors for the background and foreground
+ // this is wrong, but I don't know where to pick the colors from
+ for (int i = 0; i < 8; i++)
palette.set_pen_color(i + 32, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
@@ -72,23 +71,22 @@ PALETTE_INIT_MEMBER(thepit_state, thepit)
***************************************************************************/
-PALETTE_INIT_MEMBER(thepit_state,suprmous)
+void thepit_state::suprmous_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0; i < 32; i++)
+ for (int i = 0; i < 32; i++)
{
- uint8_t b = bitswap<8>(color_prom[i + 0x00], 0, 1, 2, 3, 4, 5, 6, 7);
- uint8_t g = bitswap<8>(color_prom[i + 0x20], 0, 1, 2, 3, 4, 5, 6, 7);
- uint8_t r = (b>>5&7)<<2 | (g>>6&3);
+ uint8_t const b = bitswap<8>(color_prom[i + 0x00], 0, 1, 2, 3, 4, 5, 6, 7);
+ uint8_t const g = bitswap<8>(color_prom[i + 0x20], 0, 1, 2, 3, 4, 5, 6, 7);
+ uint8_t const r = (b>>5&7)<<2 | (g>>6&3);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal4bit(b));
}
- /* allocate primary colors for the background and foreground
- this is wrong, but I don't know where to pick the colors from */
- for (i = 0; i < 8; i++)
+ // allocate primary colors for the background and foreground
+ // this is wrong, but I don't know where to pick the colors from
+ for (int i = 0; i < 8; i++)
palette.set_pen_color(i + 32, pal1bit(i >> 2), pal1bit(i >> 1), pal1bit(i >> 0));
}
diff --git a/src/mame/video/thomson.cpp b/src/mame/video/thomson.cpp
index c732ecb2125..ff72cbfe2d6 100644
--- a/src/mame/video/thomson.cpp
+++ b/src/mame/video/thomson.cpp
@@ -1184,8 +1184,8 @@ VIDEO_START_MEMBER( thomson_state, thom )
/* sets the fixed palette (for MO5,TO7,TO7/70) and gamma correction */
void thomson_state::thom_configure_palette(double gamma, const uint16_t* pal, palette_device& palette)
{
- memcpy( m_thom_last_pal, pal, 32 );
- memcpy( m_thom_pal, pal, 32 );
+ memcpy(m_thom_last_pal, pal, 32);
+ memcpy(m_thom_pal, pal, 32);
for ( int i = 0; i < 4097; i++ )
{
@@ -1198,31 +1198,31 @@ void thomson_state::thom_configure_palette(double gamma, const uint16_t* pal, pa
}
-PALETTE_INIT_MEMBER(thomson_state, thom)
+void thomson_state::thom_palette(palette_device &palette)
{
LOG (( "thom: palette init called\n" ));
- /* TO8 and later use an EF9369 color palette chip
- The spec shows a built-in gamma correction for gamma=2.8
- i.e., output is out = in ^ (1/2.8)
+ /* TO8 and later use an EF9369 color palette chip
+ The spec shows a built-in gamma correction for gamma=2.8
+ i.e., output is out = in ^ (1/2.8)
- For the TO7, the gamma correction is irrelevant.
+ For the TO7, the gamma correction is irrelevant.
- For the TO7/70, we use the same palette and gamma has the TO8,
- which gives good results (but is not verified).
- */
- thom_configure_palette(1.0 / 2.8, thom_pal_init, palette);
+ For the TO7/70, we use the same palette and gamma has the TO8,
+ which gives good results (but is not verified).
+ */
+ thom_configure_palette(1.0 / 2.8, thom_pal_init, palette);
}
-PALETTE_INIT_MEMBER(thomson_state, mo5)
+void thomson_state::mo5_palette(palette_device &palette)
{
LOG (( "thom: MO5 palette init called\n" ));
- /* The MO5 has a different fixed palette than the TO7/70.
- We use a smaller gamma correction which gives intutively better
- results (but is not verified).
- */
- thom_configure_palette(1.0, mo5_pal_init, palette);
+ /* The MO5 has a different fixed palette than the TO7/70.
+ We use a smaller gamma correction which gives intutively better
+ results (but is not verified).
+ */
+ thom_configure_palette(1.0, mo5_pal_init, palette);
}
diff --git a/src/mame/video/ti85.cpp b/src/mame/video/ti85.cpp
index b0b304a788a..65a9697d431 100644
--- a/src/mame/video/ti85.cpp
+++ b/src/mame/video/ti85.cpp
@@ -27,7 +27,7 @@
-static const unsigned char ti85_colors[32*7][3] =
+static constexpr rgb_t ti85_colors[32*7] =
{
{ 0xae, 0xcd, 0xb0 }, { 0xaa, 0xc9, 0xae }, { 0xa6, 0xc5, 0xad }, { 0xa3, 0xc1, 0xab }, { 0x9f, 0xbd, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x98, 0xb5, 0xa7 }, //0x00
{ 0xae, 0xcd, 0xb0 }, { 0xa9, 0xc8, 0xae }, { 0xa4, 0xc3, 0xac }, { 0xa0, 0xbe, 0xaa }, { 0x9b, 0xb9, 0xa8 }, { 0x96, 0xb4, 0xa6 }, { 0x92, 0xaf, 0xa4 }, //0x01
@@ -63,7 +63,7 @@ static const unsigned char ti85_colors[32*7][3] =
{ 0x57, 0x74, 0x8c }, { 0x56, 0x73, 0x8b }, { 0x55, 0x72, 0x8b }, { 0x55, 0x71, 0x8b }, { 0x54, 0x70, 0x8a }, { 0x53, 0x6f, 0x8a }, { 0x53, 0x6f, 0x8a } //0x1f
};
-static const unsigned short ti85_palette[32][7] =
+static const unsigned short ti85_pens[32][7] =
{
{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 },
{ 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d },
@@ -99,19 +99,14 @@ static const unsigned short ti85_palette[32][7] =
{ 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf }
};
-PALETTE_INIT_MEMBER(ti85_state, ti85)
+void ti85_state::ti85_palette(palette_device &palette)
{
- uint8_t i, j, r, g, b;
+ for (int i = 0; i < 224; i++)
+ palette.set_indirect_color(i, ti85_colors[i]);
- for ( i = 0; i < 224; i++ )
- {
- r = ti85_colors[i][0]; g = ti85_colors[i][1]; b = ti85_colors[i][2];
- palette.set_indirect_color(i, rgb_t(r, g, b));
- }
-
- for (i=0; i < 32; i++)
- for (j=0; j < 7; j++)
- palette.set_pen_indirect(i*7+j, ti85_palette[i][j]);
+ for (int i = 0; i < 32; i++)
+ for (int j = 0; j < 7; j++)
+ palette.set_pen_indirect(i*7+j, ti85_pens[i][j]);
if (!strncmp(machine().system().name, "ti81", 4))
{
@@ -136,7 +131,7 @@ PALETTE_INIT_MEMBER(ti85_state, ti85)
}
else
{
- /* don't allocate memory for the others drivers */
+ // don't allocate memory for the others drivers
return;
}
@@ -159,7 +154,7 @@ uint32_t ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bit
for (y=0; y<m_ti_screen_y_size; y++)
for (x=0; x<m_ti_screen_x_size; x++)
for (b=0; b<8; b++)
- bitmap.pix16(y, x*8+b) = ti85_palette[m_LCD_contrast&0x1f][6];
+ bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][6];
return 0;
}
@@ -182,12 +177,12 @@ uint32_t ti85_state::screen_update_ti85(screen_device &screen, bitmap_ind16 &bit
+ ((*(m_frames.get()+4*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01)
+ ((*(m_frames.get()+5*m_ti_video_memory_size+y*m_ti_screen_x_size+x)>>(7-b)) & 0x01);
- bitmap.pix16(y, x*8+b) = ti85_palette[m_LCD_contrast&0x1f][brightnes];
+ bitmap.pix16(y, x*8+b) = ti85_pens[m_LCD_contrast&0x1f][brightnes];
}
return 0;
}
-PALETTE_INIT_MEMBER(ti85_state,ti82)
+void ti85_state::ti82_palette(palette_device &palette) const
{
palette.set_pen_color(0, rgb_t(160, 190, 170));
palette.set_pen_color(1, rgb_t(83, 111, 138));
diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp
index 45650cb15fc..c6230e2f418 100644
--- a/src/mame/video/tia.cpp
+++ b/src/mame/video/tia.cpp
@@ -47,198 +47,197 @@ static void extend_palette(palette_device &palette) {
}
}
-PALETTE_INIT_MEMBER(tia_ntsc_video_device, tia_ntsc)
+void tia_ntsc_video_device::tia_ntsc_palette(palette_device &palette) const
{
- int i, j;
-/********************************************************************
-Atari 2600 NTSC Palette Notes:
-
-Palette on a modern flat panel display (LCD, LED, Plasma, etc.)
-appears different from a traditional CRT. The most outstanding
-difference is Hue 1x, the hue begin point. Hue 1x looks very
-'green' (~-60 to -45 degrees - depending on how poor or well it
-handles the signal conversion and its calibration) on a modern
-flat panel display, as opposed to 'gold' (~-33 degrees) on a CRT.
-
-The official technical documents: "Television Interface Adaptor
-[TIA] (Model 1A)", "Atari VCS POP Field Service Manual", and
-"Stella Programmer's Guide" stipulate Hue 1x to be gold.
-
-The system's pot adjustment manually manipulates the degree of
-phase shift, while the system 'warming-up' will automatically
-push whatever degrees has been manually set, higher. According
-to the Atari VCS POP Field Service Manual and system diagnostic
-and test (color) cart, instructions are provide to set the pot
-adjustment having Hue 1x and Hue 15x (F$) match or within one
-shade of each other, both a 'goldenrod'.
-
-At power on, the system's phase shift appears as low as ~23
-degrees and after a considerable consistent runtime, can be as
-high as ~28 degrees.
-
-In general, the low end of ~23 degrees lasts for several seconds,
-whereas higher values such as ~25-27 degrees are the most
-dominant during system run time. 180 degrees colorburst takes
-place at ~25.7 degrees (A near exact match of Hue 1x and 15x -
-To the naked eye they appear to be the same).
-
-However, if the system is adjusted within the first several
-minutes of running, the warm up, consistent system run time,
-causes Hue 15x (F$) to become stronger/darker gold (More brown
-then ultimately red-brown); as well as leans Hue 14x (E$) more
-brown than green. Once achieving a phase shift of 27.7 degrees,
-Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x
-respectively.
-
-Therefore, an ideal phase shift while accounting for properly
-calibrating a system's color palette within the first several
-minutes of it running via the pot adjustment, the reality of
-shifting while warming up, as well as maintaining differences
-between Hues 1x, 2x and 14x, 15x, would likely fall between 25.7
-and 27.7 degrees. Phase shifts 26.2 and 26.7 places Hue 15x/F$
-between Hue 1x and Hue 2x, having 26.2 degrees leaning closer to
-Hue 1x and 26.7 degrees leaning closer to Hue 2x.
-
-The above notion would also harmonize with what has been
-documented within "Stella Programmer's Guide" for the colors of
-1x, 2x, 14x, 15x on the 2600 and 7800. 1x = Gold, 2x = Orange,
-14x (E$) = Orange-Green. 15x (F$) = Light Orange. Color
-descriptions are best measured in the middle of the brightness
-scale. It should be mentioned that Green-Yellow is referenced
-at Hue 13x (D$), nowhere near Hue 1x. A Green-Yellow Hue 1x is
-how the palette is manipulated and modified (in part) under a
-modern flat panel display.
-
-Additionally, the blue to red (And consequently blue to green)
-ratio proportions may appear different on a modern flat panel
-display than a CRT in some instances for the Atari 2600 system.
-Furthermore, you may have some variation of proportions even
-within the same display type.
-
-One side effect of this on the console's palette is that some
-values of red may appear too pinkish - Too much blue to red.
-This is not the same as a traditional tint-hue control adjustment;
-rather, can be demonstrated by changing the blue ratio values
-via MESS HLSL settings.
-
-Lastly, the Atari 5200 & 7800 NTSC color palettes hold the same
-hue structure order and have similar appearance differences that
-are dependent upon display type.
-********************************************************************/
-/*********************************
-Phase Shift 24.7
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.239, -0.052 },
- { 0.244, 0.030 },
- { 0.201, 0.108 },
- { 0.125, 0.166 },
- { 0.026, 0.194 },
- { -0.080, 0.185 },
- { -0.169, 0.145 },
- { -0.230, 0.077 },
- { -0.247, -0.006 },
- { -0.220, -0.087 },
- { -0.152, -0.153 },
- { -0.057, -0.189 },
- { 0.049, -0.193 },
- { 0.144, -0.161 }
-
-Phase Shift 25.2
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.239, -0.052 },
- { 0.244, 0.033 },
- { 0.200, 0.113 },
- { 0.119, 0.169 },
- { 0.013, 0.195 },
- { -0.094, 0.183 },
- { -0.182, 0.136 },
- { -0.237, 0.062 },
- { -0.245, -0.020 },
- { -0.210, -0.103 },
- { -0.131, -0.164 },
- { -0.027, -0.193 },
- { 0.079, -0.187 },
- { 0.169, -0.145 }
-
-Phase Shift 25.7
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.243, -0.049 },
- { 0.242, 0.038 },
- { 0.196, 0.116 },
- { 0.109, 0.172 },
- { 0.005, 0.196 },
- { -0.104, 0.178 },
- { -0.192, 0.127 },
- { -0.241, 0.051 },
- { -0.244, -0.037 },
- { -0.197, -0.115 },
- { -0.112, -0.173 },
- { -0.004, -0.197 },
- { 0.102, -0.179 },
- { 0.190, -0.128 }
-
-Phase Shift 26.7
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.242, -0.046 },
- { 0.240, 0.044 },
- { 0.187, 0.125 },
- { 0.092, 0.180 },
- { -0.020, 0.195 },
- { -0.128, 0.170 },
- { -0.210, 0.107 },
- { -0.247, 0.022 },
- { -0.231, -0.067 },
- { -0.166, -0.142 },
- { -0.064, -0.188 },
- { 0.049, -0.193 },
- { 0.154, -0.155 },
- { 0.227, -0.086 }
-
-Phase Shift 27.2
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.243, -0.044 },
- { 0.239, 0.047 },
- { 0.183, 0.129 },
- { 0.087, 0.181 },
- { -0.029, 0.195 },
- { -0.138, 0.164 },
- { -0.217, 0.098 },
- { -0.246, 0.009 },
- { -0.223, -0.081 },
- { -0.149, -0.153 },
- { -0.041, -0.192 },
- { 0.073, -0.188 },
- { 0.173, -0.142 },
- { 0.235, -0.067 }
-
-Phase Shift 27.7
- { 0.000, 0.000 },
- { 0.192, -0.127 },
- { 0.243, -0.044 },
- { 0.238, 0.051 },
- { 0.178, 0.134 },
- { 0.078, 0.184 },
- { -0.041, 0.194 },
- { -0.151, 0.158 },
- { -0.224, 0.087 },
- { -0.248, -0.005 },
- { -0.214, -0.096 },
- { -0.131, -0.164 },
- { -0.019, -0.195 },
- { 0.099, -0.182 },
- { 0.194, -0.126 },
- { 0.244, -0.042 }
-*********************************/
-
- static const double color[16][2] =
-/*********************************
-Phase Shift 26.2
-**********************************/
+ /********************************************************************
+ Atari 2600 NTSC Palette Notes:
+
+ Palette on a modern flat panel display (LCD, LED, Plasma, etc.)
+ appears different from a traditional CRT. The most outstanding
+ difference is Hue 1x, the hue begin point. Hue 1x looks very
+ 'green' (~-60 to -45 degrees - depending on how poor or well it
+ handles the signal conversion and its calibration) on a modern
+ flat panel display, as opposed to 'gold' (~-33 degrees) on a CRT.
+
+ The official technical documents: "Television Interface Adaptor
+ [TIA] (Model 1A)", "Atari VCS POP Field Service Manual", and
+ "Stella Programmer's Guide" stipulate Hue 1x to be gold.
+
+ The system's pot adjustment manually manipulates the degree of
+ phase shift, while the system 'warming-up' will automatically
+ push whatever degrees has been manually set, higher. According
+ to the Atari VCS POP Field Service Manual and system diagnostic
+ and test (color) cart, instructions are provide to set the pot
+ adjustment having Hue 1x and Hue 15x (F$) match or within one
+ shade of each other, both a 'goldenrod'.
+
+ At power on, the system's phase shift appears as low as ~23
+ degrees and after a considerable consistent runtime, can be as
+ high as ~28 degrees.
+
+ In general, the low end of ~23 degrees lasts for several seconds,
+ whereas higher values such as ~25-27 degrees are the most
+ dominant during system run time. 180 degrees colorburst takes
+ place at ~25.7 degrees (A near exact match of Hue 1x and 15x -
+ To the naked eye they appear to be the same).
+
+ However, if the system is adjusted within the first several
+ minutes of running, the warm up, consistent system run time,
+ causes Hue 15x (F$) to become stronger/darker gold (More brown
+ then ultimately red-brown); as well as leans Hue 14x (E$) more
+ brown than green. Once achieving a phase shift of 27.7 degrees,
+ Hue 14x (E$) and Hue 15x (F$) near-exact match Hue 1x and 2x
+ respectively.
+
+ Therefore, an ideal phase shift while accounting for properly
+ calibrating a system's color palette within the first several
+ minutes of it running via the pot adjustment, the reality of
+ shifting while warming up, as well as maintaining differences
+ between Hues 1x, 2x and 14x, 15x, would likely fall between 25.7
+ and 27.7 degrees. Phase shifts 26.2 and 26.7 places Hue 15x/F$
+ between Hue 1x and Hue 2x, having 26.2 degrees leaning closer to
+ Hue 1x and 26.7 degrees leaning closer to Hue 2x.
+
+ The above notion would also harmonize with what has been
+ documented within "Stella Programmer's Guide" for the colors of
+ 1x, 2x, 14x, 15x on the 2600 and 7800. 1x = Gold, 2x = Orange,
+ 14x (E$) = Orange-Green. 15x (F$) = Light Orange. Color
+ descriptions are best measured in the middle of the brightness
+ scale. It should be mentioned that Green-Yellow is referenced
+ at Hue 13x (D$), nowhere near Hue 1x. A Green-Yellow Hue 1x is
+ how the palette is manipulated and modified (in part) under a
+ modern flat panel display.
+
+ Additionally, the blue to red (And consequently blue to green)
+ ratio proportions may appear different on a modern flat panel
+ display than a CRT in some instances for the Atari 2600 system.
+ Furthermore, you may have some variation of proportions even
+ within the same display type.
+
+ One side effect of this on the console's palette is that some
+ values of red may appear too pinkish - Too much blue to red.
+ This is not the same as a traditional tint-hue control adjustment;
+ rather, can be demonstrated by changing the blue ratio values
+ via MESS HLSL settings.
+
+ Lastly, the Atari 5200 & 7800 NTSC color palettes hold the same
+ hue structure order and have similar appearance differences that
+ are dependent upon display type.
+ ********************************************************************/
+ /*********************************
+ Phase Shift 24.7
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.239, -0.052 },
+ { 0.244, 0.030 },
+ { 0.201, 0.108 },
+ { 0.125, 0.166 },
+ { 0.026, 0.194 },
+ { -0.080, 0.185 },
+ { -0.169, 0.145 },
+ { -0.230, 0.077 },
+ { -0.247, -0.006 },
+ { -0.220, -0.087 },
+ { -0.152, -0.153 },
+ { -0.057, -0.189 },
+ { 0.049, -0.193 },
+ { 0.144, -0.161 }
+
+ Phase Shift 25.2
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.239, -0.052 },
+ { 0.244, 0.033 },
+ { 0.200, 0.113 },
+ { 0.119, 0.169 },
+ { 0.013, 0.195 },
+ { -0.094, 0.183 },
+ { -0.182, 0.136 },
+ { -0.237, 0.062 },
+ { -0.245, -0.020 },
+ { -0.210, -0.103 },
+ { -0.131, -0.164 },
+ { -0.027, -0.193 },
+ { 0.079, -0.187 },
+ { 0.169, -0.145 }
+
+ Phase Shift 25.7
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.243, -0.049 },
+ { 0.242, 0.038 },
+ { 0.196, 0.116 },
+ { 0.109, 0.172 },
+ { 0.005, 0.196 },
+ { -0.104, 0.178 },
+ { -0.192, 0.127 },
+ { -0.241, 0.051 },
+ { -0.244, -0.037 },
+ { -0.197, -0.115 },
+ { -0.112, -0.173 },
+ { -0.004, -0.197 },
+ { 0.102, -0.179 },
+ { 0.190, -0.128 }
+
+ Phase Shift 26.7
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.242, -0.046 },
+ { 0.240, 0.044 },
+ { 0.187, 0.125 },
+ { 0.092, 0.180 },
+ { -0.020, 0.195 },
+ { -0.128, 0.170 },
+ { -0.210, 0.107 },
+ { -0.247, 0.022 },
+ { -0.231, -0.067 },
+ { -0.166, -0.142 },
+ { -0.064, -0.188 },
+ { 0.049, -0.193 },
+ { 0.154, -0.155 },
+ { 0.227, -0.086 }
+
+ Phase Shift 27.2
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.243, -0.044 },
+ { 0.239, 0.047 },
+ { 0.183, 0.129 },
+ { 0.087, 0.181 },
+ { -0.029, 0.195 },
+ { -0.138, 0.164 },
+ { -0.217, 0.098 },
+ { -0.246, 0.009 },
+ { -0.223, -0.081 },
+ { -0.149, -0.153 },
+ { -0.041, -0.192 },
+ { 0.073, -0.188 },
+ { 0.173, -0.142 },
+ { 0.235, -0.067 }
+
+ Phase Shift 27.7
+ { 0.000, 0.000 },
+ { 0.192, -0.127 },
+ { 0.243, -0.044 },
+ { 0.238, 0.051 },
+ { 0.178, 0.134 },
+ { 0.078, 0.184 },
+ { -0.041, 0.194 },
+ { -0.151, 0.158 },
+ { -0.224, 0.087 },
+ { -0.248, -0.005 },
+ { -0.214, -0.096 },
+ { -0.131, -0.164 },
+ { -0.019, -0.195 },
+ { 0.099, -0.182 },
+ { 0.194, -0.126 },
+ { 0.244, -0.042 }
+ *********************************/
+
+ /*********************************
+ Phase Shift 26.2
+ **********************************/
+ static constexpr double color[16][2] =
{
{ 0.000, 0.000 },
{ 0.192, -0.127 },
@@ -258,14 +257,14 @@ Phase Shift 26.2
{ 0.210, -0.107 }
};
- for (i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
- double I = color[i][0];
- double Q = color[i][1];
+ double const I = color[i][0];
+ double const Q = color[i][1];
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- double Y = j / 7.0;
+ double const Y = j / 7.0;
double R = Y + 0.956 * I + 0.621 * Q;
double G = Y - 0.272 * I - 0.647 * Q;
@@ -283,21 +282,20 @@ Phase Shift 26.2
if (G > 1) G = 1;
if (B > 1) B = 1;
- palette.set_pen_color(8 * i + j,
- (uint8_t) (255 * R + 0.5),
- (uint8_t) (255 * G + 0.5),
- (uint8_t) (255 * B + 0.5));
+ palette.set_pen_color(
+ 8 * i + j,
+ uint8_t(255 * R + 0.5),
+ uint8_t(255 * G + 0.5),
+ uint8_t(255 * B + 0.5));
}
}
- extend_palette( palette );
+ extend_palette(palette);
}
-PALETTE_INIT_MEMBER(tia_pal_video_device, tia_pal)
+void tia_pal_video_device::tia_pal_palette(palette_device &palette) const
{
- int i, j;
-
- static const double color[16][2] =
+ static constexpr double color[16][2] =
{
{ 0.000, 0.000 },
{ 0.000, 0.000 },
@@ -317,14 +315,14 @@ PALETTE_INIT_MEMBER(tia_pal_video_device, tia_pal)
{ 0.000, 0.000 }
};
- for (i = 0; i < 16; i++)
+ for (int i = 0; i < 16; i++)
{
- double U = color[i][0];
- double V = color[i][1];
+ double const U = color[i][0];
+ double const V = color[i][1];
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- double Y = j / 7.0;
+ double const Y = j / 7.0;
double R = Y + 1.403 * V;
double G = Y - 0.344 * U - 0.714 * V;
@@ -342,13 +340,14 @@ PALETTE_INIT_MEMBER(tia_pal_video_device, tia_pal)
if (G > 1) G = 1;
if (B > 1) B = 1;
- palette.set_pen_color(8 * i + j,
- (uint8_t) (255 * R + 0.5),
- (uint8_t) (255 * G + 0.5),
- (uint8_t) (255 * B + 0.5));
+ palette.set_pen_color(
+ 8 * i + j,
+ uint8_t(255 * R + 0.5),
+ uint8_t(255 * G + 0.5),
+ uint8_t(255 * B + 0.5));
}
}
- extend_palette( palette );
+ extend_palette(palette);
}
tia_video_device::tia_video_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
@@ -378,10 +377,10 @@ tia_pal_video_device::tia_pal_video_device(const machine_config &mconfig, const
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(tia_pal_video_device::device_add_mconfig)
- MCFG_PALETTE_ADD("palette", TIA_PALETTE_LENGTH)
- MCFG_PALETTE_INIT_OWNER(tia_pal_video_device, tia_pal)
-MACHINE_CONFIG_END
+void tia_pal_video_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, "palette", FUNC(tia_pal_video_device::tia_pal_palette), TIA_PALETTE_LENGTH);
+}
// device type definition
DEFINE_DEVICE_TYPE(TIA_NTSC_VIDEO, tia_ntsc_video_device, "tia_ntsc_video", "TIA Video (NTSC)")
@@ -399,10 +398,10 @@ tia_ntsc_video_device::tia_ntsc_video_device(const machine_config &mconfig, cons
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(tia_ntsc_video_device::device_add_mconfig)
- MCFG_PALETTE_ADD("palette", TIA_PALETTE_LENGTH)
- MCFG_PALETTE_INIT_OWNER(tia_ntsc_video_device, tia_ntsc)
-MACHINE_CONFIG_END
+void tia_ntsc_video_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, "palette", FUNC(tia_ntsc_video_device::tia_ntsc_palette), TIA_PALETTE_LENGTH);
+}
//-------------------------------------------------
// device_start - device-specific startup
diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h
index f166408cf52..6ae40f9a8bd 100644
--- a/src/mame/video/tia.h
+++ b/src/mame/video/tia.h
@@ -218,7 +218,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- DECLARE_PALETTE_INIT(tia_pal);
+ void tia_pal_palette(palette_device &palette) const;
};
class tia_ntsc_video_device : public tia_video_device
@@ -236,7 +236,7 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
private:
- DECLARE_PALETTE_INIT(tia_ntsc);
+ void tia_ntsc_palette(palette_device &palette) const;
};
diff --git a/src/mame/video/tiamc1.cpp b/src/mame/video/tiamc1.cpp
index fd44fdbeff8..29530f325c6 100644
--- a/src/mame/video/tiamc1.cpp
+++ b/src/mame/video/tiamc1.cpp
@@ -109,36 +109,35 @@ void tiamc1_state::update_bg_palette()
m_palette->set_pen_color(i + 16, m_palette_ptr[m_paletteram[i | bplmask]]);
}
-PALETTE_INIT_MEMBER(tiamc1_state, tiamc1)
+void tiamc1_state::tiamc1_palette(palette_device &palette)
{
// Voltage computed by Proteus
- //static const float g_v[8]={1.05f,0.87f,0.81f,0.62f,0.44f,0.25f,0.19f,0.00f};
- //static const float r_v[8]={1.37f,1.13f,1.00f,0.75f,0.63f,0.38f,0.25f,0.00f};
- //static const float b_v[4]={1.16f,0.75f,0.42f,0.00f};
+ //static constexpr float g_v[8] = {1.05F, 0.87F, 0.81f, 0.62F, 0.44F, 0.25F, 0.19F, 0.00F };
+ //static constexpr float r_v[8] = {1.37F, 1.13F, 1.00f, 0.75F, 0.63F, 0.38F, 0.25F, 0.00F };
+ //static constexpr float b_v[4] = {1.16F, 0.75F, 0.42f, 0.00F };
// Voltage adjusted by Shiru
- static const float g_v[8] = { 1.2071f,0.9971f,0.9259f,0.7159f,0.4912f,0.2812f,0.2100f,0.0000f};
- static const float r_v[8] = { 1.5937f,1.3125f,1.1562f,0.8750f,0.7187f,0.4375f,0.2812f,0.0000f};
- static const float b_v[4] = { 1.3523f,0.8750f,0.4773f,0.0000f};
-
- int col;
- int r, g, b, ir, ig, ib;
- float tcol;
+ static constexpr float g_v[8] = { 1.2071F, 0.9971F, 0.9259F, 0.7159F, 0.4912F, 0.2812F, 0.2100F, 0.0000F };
+ static constexpr float r_v[8] = { 1.5937F, 1.3125F, 1.1562F, 0.8750F, 0.7187F, 0.4375F, 0.2812F, 0.0000F };
+ static constexpr float b_v[4] = { 1.3523F, 0.8750F, 0.4773F, 0.0000F };
m_palette_ptr = std::make_unique<rgb_t[]>(256);
- for (col = 0; col < 256; col++) {
- ir = (col >> 3) & 7;
- ig = col & 7;
- ib = (col >> 6) & 3;
+ for (int col = 0; col < 256; col++)
+ {
+ float tcol;
+
+ int const ir = (col >> 3) & 7;
+ int const ig = col & 7;
+ int const ib = (col >> 6) & 3;
tcol = 255.0f * r_v[ir] / r_v[0];
- r = 255 - (((int)tcol) & 255);
+ int const r = 255 - (int(tcol) & 255);
tcol = 255.0f * g_v[ig] / g_v[0];
- g = 255 - (((int)tcol) & 255);
+ int const g = 255 - (int(tcol) & 255);
tcol = 255.0f * b_v[ib] / b_v[0];
- b = 255 - (((int)tcol) & 255);
+ int const b = 255 - (int(tcol) & 255);
- m_palette_ptr[col] = rgb_t(r,g,b);
+ m_palette_ptr[col] = rgb_t(r, g, b);
}
}
@@ -156,8 +155,8 @@ void tiamc1_state::video_start()
{
m_videoram = make_unique_clear<uint8_t[]>(0x3050);
- m_charram = m_videoram.get() + 0x0800; /* Ram is banked */
- m_tileram = m_videoram.get() + 0x0000;
+ m_charram = m_videoram.get() + 0x0800; /* Ram is banked */
+ m_tileram = m_videoram.get() + 0x0000;
m_spriteram_y = m_videoram.get() + 0x3000;
m_spriteram_x = m_videoram.get() + 0x3010;
@@ -232,10 +231,10 @@ void tiamc1_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
if (!(m_spriteram_a[offs] & 0x01))
m_gfxdecode->gfx(1)->transpen(bitmap,cliprect,
- spritecode,
- 0,
- flipx, flipy,
- sx, sy, 15);
+ spritecode,
+ 0,
+ flipx, flipy,
+ sx, sy, 15);
}
}
@@ -260,7 +259,6 @@ uint32_t tiamc1_state::screen_update_tiamc1(screen_device &screen, bitmap_ind16
else
m_bg_tilemap1->draw(screen, bitmap, cliprect, 0, 0);
-
draw_sprites(bitmap, cliprect);
return 0;
diff --git a/src/mame/video/timelimt.cpp b/src/mame/video/timelimt.cpp
index 40ec0718dab..1d3f1020e55 100644
--- a/src/mame/video/timelimt.cpp
+++ b/src/mame/video/timelimt.cpp
@@ -23,41 +23,41 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(timelimt_state, timelimt)
+void timelimt_state::timelimt_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double weights_r[3], weights_g[3], weights_b[2];
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
+
+ uint8_t const *const color_prom = memregion("proms")->base();
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 0, 0,
3, resistances_rg, weights_g, 0, 0,
2, resistances_b, weights_b, 0, 0);
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = combine_3_weights(weights_r, bit0, bit1, bit2);
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = combine_3_weights(weights_g, bit0, bit1, bit2);
- /* blue component */
- bit0 = (*color_prom >> 6) & 0x01;
- bit1 = (*color_prom >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
-
- palette.set_pen_color(i,rgb_t(r,g,b));
- color_prom++;
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(weights_r, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(weights_g, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
diff --git a/src/mame/video/timeplt.cpp b/src/mame/video/timeplt.cpp
index f2c80dd4b62..5c4e3f1da64 100644
--- a/src/mame/video/timeplt.cpp
+++ b/src/mame/video/timeplt.cpp
@@ -39,48 +39,47 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(timeplt_state, timeplt)
+void timeplt_state::timeplt_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- rgb_t palette_val[32];
- int i;
- for (i = 0; i < 32; i++)
+ rgb_t palette_val[32];
+ for (int i = 0; i < 32; i++)
{
- int bit0, bit1, bit2, bit3, bit4, r, g, b;
-
- bit0 = (color_prom[i + 1 * 32] >> 1) & 0x01;
- bit1 = (color_prom[i + 1 * 32] >> 2) & 0x01;
- bit2 = (color_prom[i + 1 * 32] >> 3) & 0x01;
- bit3 = (color_prom[i + 1 * 32] >> 4) & 0x01;
- bit4 = (color_prom[i + 1 * 32] >> 5) & 0x01;
- r = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
- bit0 = (color_prom[i + 1 * 32] >> 6) & 0x01;
- bit1 = (color_prom[i + 1 * 32] >> 7) & 0x01;
- bit2 = (color_prom[i + 0 * 32] >> 0) & 0x01;
- bit3 = (color_prom[i + 0 * 32] >> 1) & 0x01;
- bit4 = (color_prom[i + 0 * 32] >> 2) & 0x01;
- g = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
- bit0 = (color_prom[i + 0 * 32] >> 3) & 0x01;
- bit1 = (color_prom[i + 0 * 32] >> 4) & 0x01;
- bit2 = (color_prom[i + 0 * 32] >> 5) & 0x01;
- bit3 = (color_prom[i + 0 * 32] >> 6) & 0x01;
- bit4 = (color_prom[i + 0 * 32] >> 7) & 0x01;
- b = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
+ int bit0, bit1, bit2, bit3, bit4;
+
+ bit0 = BIT(color_prom[i + 1 * 32], 1);
+ bit1 = BIT(color_prom[i + 1 * 32], 2);
+ bit2 = BIT(color_prom[i + 1 * 32], 3);
+ bit3 = BIT(color_prom[i + 1 * 32], 4);
+ bit4 = BIT(color_prom[i + 1 * 32], 5);
+ int const r = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
+ bit0 = BIT(color_prom[i + 1 * 32], 6);
+ bit1 = BIT(color_prom[i + 1 * 32], 7);
+ bit2 = BIT(color_prom[i + 0 * 32], 0);
+ bit3 = BIT(color_prom[i + 0 * 32], 1);
+ bit4 = BIT(color_prom[i + 0 * 32], 2);
+ int const g = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
+ bit0 = BIT(color_prom[i + 0 * 32], 3);
+ bit1 = BIT(color_prom[i + 0 * 32], 4);
+ bit2 = BIT(color_prom[i + 0 * 32], 5);
+ bit3 = BIT(color_prom[i + 0 * 32], 6);
+ bit4 = BIT(color_prom[i + 0 * 32], 7);
+ int const b = 0x19 * bit0 + 0x24 * bit1 + 0x35 * bit2 + 0x40 * bit3 + 0x4d * bit4;
palette_val[i] = rgb_t(r, g, b);
}
color_prom += 2*32;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
- /* sprites */
- for (i = 0; i < 64 * 4; i++)
+ // sprites
+ for (int i = 0; i < 64 * 4; i++)
palette.set_pen_color(32 * 4 + i, palette_val[*color_prom++ & 0x0f]);
- /* characters */
- for (i = 0; i < 32 * 4; i++)
+ // characters
+ for (int i = 0; i < 32 * 4; i++)
palette.set_pen_color(i, palette_val[(*color_prom++ & 0x0f) + 0x10]);
}
diff --git a/src/mame/video/tnzs.cpp b/src/mame/video/tnzs.cpp
index 159f953e58d..7bc7688c8f1 100644
--- a/src/mame/video/tnzs.cpp
+++ b/src/mame/video/tnzs.cpp
@@ -31,13 +31,13 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(tnzs_base_state, prompalette)
+void tnzs_base_state::prompalette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
for (int i = 0; i < palette.entries(); i++)
{
- int col = (color_prom[i] << 8) + color_prom[i + 512];
+ int const col = (color_prom[i] << 8) + color_prom[i + 512];
palette.set_pen_color(i, pal5bit(col >> 10), pal5bit(col >> 5), pal5bit(col >> 0));
}
}
diff --git a/src/mame/video/tp84.cpp b/src/mame/video/tp84.cpp
index d6534f36e43..14a64748c89 100644
--- a/src/mame/video/tp84.cpp
+++ b/src/mame/video/tp84.cpp
@@ -43,60 +43,56 @@
220 ohm
100 ohm
*/
-PALETTE_INIT_MEMBER(tp84_state, tp84)
+void tp84_state::tp84_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 1000, 470, 220, 100 };
- double weights[4];
- int i;
+ static constexpr int resistances[4] = { 1000, 470, 220, 100 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double weights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, weights, 470, 0,
0, nullptr, nullptr, 0, 0,
0, nullptr, nullptr, 0, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x100; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i | 0x000], 0);
+ bit1 = BIT(color_prom[i | 0x000], 1);
+ bit2 = BIT(color_prom[i | 0x000], 2);
+ bit3 = BIT(color_prom[i | 0x000], 3);
+ int const r = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i | 0x100], 0);
+ bit1 = BIT(color_prom[i | 0x100], 1);
+ bit2 = BIT(color_prom[i | 0x100], 2);
+ bit3 = BIT(color_prom[i | 0x100], 3);
+ int const g = combine_4_weights(weights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i | 0x200], 0);
+ bit1 = BIT(color_prom[i | 0x200], 1);
+ bit2 = BIT(color_prom[i | 0x200], 2);
+ bit3 = BIT(color_prom[i | 0x200], 3);
+ int const b = combine_4_weights(weights, bit0, bit1, bit2, bit3);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x300;
- /* characters use colors 0x80-0xff, sprites use colors 0-0x7f */
- for (i = 0; i < 0x200; i++)
+ // characters use colors 0x80-0xff, sprites use colors 0-0x7f
+ for (int i = 0; i < 0x200; i++)
{
- int j;
-
- for (j = 0; j < 8; j++)
+ for (int j = 0; j < 8; j++)
{
- uint8_t ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f);
+ uint8_t const ctabentry = ((~i & 0x100) >> 1) | (j << 4) | (color_prom[i] & 0x0f);
palette.set_pen_indirect(((i & 0x100) << 3) | (j << 8) | (i & 0xff), ctabentry);
}
}
diff --git a/src/mame/video/trackfld.cpp b/src/mame/video/trackfld.cpp
index e4531d3a140..0e89d6f1869 100644
--- a/src/mame/video/trackfld.cpp
+++ b/src/mame/video/trackfld.cpp
@@ -31,60 +31,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(trackfld_state,trackfld)
+void trackfld_state::trackfld_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 1000, 0,
3, &resistances_rg[0], gweights, 1000, 0,
2, &resistances_b[0], bweights, 1000, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* sprites */
- for (i = 0; i < 0x100; i++)
+ // sprites
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i] & 0x0f;
+ uint8_t const ctabentry = color_prom[i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* characters */
- for (i = 0x100; i < 0x200; i++)
+ // characters
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/travrusa.cpp b/src/mame/video/travrusa.cpp
index 29319501c49..42749cf2def 100644
--- a/src/mame/video/travrusa.cpp
+++ b/src/mame/video/travrusa.cpp
@@ -40,148 +40,142 @@ J Clegg
***************************************************************************/
-PALETTE_INIT_MEMBER(travrusa_state, travrusa)
+void travrusa_state::travrusa_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x80; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x80; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0x80; i < 0x90; i++)
+ for (int i = 0x80; i < 0x90; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 6) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[(i - 0x80) + 0x200] >> 3) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 4) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[(i - 0x80) + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 6);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[(i - 0x80) + 0x200], 3);
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 4);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[(i - 0x80) + 0x200], 0);
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 1);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x220;
- /* characters */
- for (i = 0; i < 0x80; i++)
+ // characters
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i, i);
- /* sprites */
- for (i = 0x80; i < 0x100; i++)
+ // sprites
+ for (int i = 0x80; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80;
+ uint8_t const ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80;
palette.set_pen_indirect(i, ctabentry);
}
}
-PALETTE_INIT_MEMBER(travrusa_state,shtrider)
+void travrusa_state::shtrider_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- /* create a lookup table for the palette */
- for (i = 0; i < 0x80; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x80; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 3) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 1) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i + 0x000], 2);
+ bit2 = BIT(color_prom[i + 0x000], 3);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i + 0x100], 3);
+ bit1 = BIT(color_prom[i + 0x000], 0);
+ bit2 = BIT(color_prom[i + 0x000], 1);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x100], 0);
+ bit1 = BIT(color_prom[i + 0x100], 1);
+ bit2 = BIT(color_prom[i + 0x100], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- for (i = 0x80; i < 0x90; i++)
+ for (int i = 0x80; i < 0x90; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
+ // red component
bit0 = 0;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 6) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 7) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* green component */
- bit0 = (color_prom[(i - 0x80) + 0x200] >> 3) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 4) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
-
- /* blue component */
- bit0 = (color_prom[(i - 0x80) + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[(i - 0x80) + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[(i - 0x80) + 0x200] >> 2) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 6);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 7);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[(i - 0x80) + 0x200], 3);
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 4);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[(i - 0x80) + 0x200], 0);
+ bit1 = BIT(color_prom[(i - 0x80) + 0x200], 1);
+ bit2 = BIT(color_prom[(i - 0x80) + 0x200], 2);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x220;
- /* characters */
- for (i = 0; i < 0x80; i++)
+ // characters
+ for (int i = 0; i < 0x80; i++)
palette.set_pen_indirect(i, i);
- /* sprites */
- for (i = 0x80; i < 0x100; i++)
+ // sprites
+ for (int i = 0x80; i < 0x100; i++)
{
- uint8_t ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80;
+ uint8_t const ctabentry = (color_prom[i - 0x80] & 0x0f) | 0x80;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/trs80.cpp b/src/mame/video/trs80.cpp
index 36dfab8e3b5..9ad2452dd26 100644
--- a/src/mame/video/trs80.cpp
+++ b/src/mame/video/trs80.cpp
@@ -362,19 +362,19 @@ uint32_t trs80_state::screen_update_radionic(screen_device &screen, bitmap_ind16
***************************************************************************/
/* Levels are unknown - guessing */
-static const rgb_t lnw80_palette[] =
+static constexpr rgb_t lnw80_pens[] =
{
- rgb_t(220, 220, 220), // white
- rgb_t(0, 175, 0), // green
- rgb_t(200, 200, 0), // yellow
- rgb_t(255, 0, 0), // red
- rgb_t(255, 0, 255), // magenta
- rgb_t(0, 0, 175), // blue
- rgb_t(0, 255, 255), // cyan
- rgb_t(0, 0, 0), // black
+ { 220, 220, 220 }, // white
+ { 0, 175, 0 }, // green
+ { 200, 200, 0 }, // yellow
+ { 255, 0, 0 }, // red
+ { 255, 0, 255 }, // magenta
+ { 0, 0, 175 }, // blue
+ { 0, 255, 255 }, // cyan
+ { 0, 0, 0 } // black
};
-PALETTE_INIT_MEMBER(trs80_state,lnw80)
+void trs80_state::lnw80_palette(palette_device &palette) const
{
- palette.set_pen_colors(0, lnw80_palette, ARRAY_LENGTH(lnw80_palette));
+ palette.set_pen_colors(0, lnw80_pens);
}
diff --git a/src/mame/video/truco.cpp b/src/mame/video/truco.cpp
index bc1f936356b..986a4d29b04 100644
--- a/src/mame/video/truco.cpp
+++ b/src/mame/video/truco.cpp
@@ -11,19 +11,18 @@
#include "emu.h"
#include "includes/truco.h"
-PALETTE_INIT_MEMBER(truco_state, truco)
+void truco_state::truco_palette(palette_device &palette) const
{
- int i;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int r = ( i & 0x8 ) ? 0xff : 0x00;
- int g = ( i & 0x4 ) ? 0xff : 0x00;
- int b = ( i & 0x2 ) ? 0xff : 0x00;
+ int r = (i & 0x8) ? 0xff : 0x00;
+ int g = (i & 0x4) ? 0xff : 0x00;
+ int b = (i & 0x2) ? 0xff : 0x00;
- int dim = ( i & 0x1 );
+ int const dim = (i & 0x1);
- if ( dim ) {
+ if (dim)
+ {
r >>= 1;
g >>= 1;
b >>= 1;
@@ -35,25 +34,18 @@ PALETTE_INIT_MEMBER(truco_state, truco)
uint32_t truco_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- uint8_t *videoram = m_videoram;
- uint8_t *vid = videoram;
- int x, y;
+ uint8_t const *videoram = m_videoram;
- for( y = 0; y < 192; y++ )
+ for (int y = 0; y < 192; y++)
{
- for( x = 0; x < 256; x++ )
+ for (int x = 0; x < 256; x++)
{
- int pixel;
-
- if ( x & 1 )
- pixel = vid[x>>1] & 0x0f;
- else
- pixel = ( vid[x>>1] >> 4 ) & 0x0f;
+ int const pixel = (videoram[x >> 1] >> ((x & 1) ? 0 : 4)) & 0x0f;
bitmap.pix16(y, x) = pixel;
}
- vid += 0x80;
+ videoram += 0x80;
}
return 0;
}
diff --git a/src/mame/video/trucocl.cpp b/src/mame/video/trucocl.cpp
index 2c8f83faaf6..e47fbf4397c 100644
--- a/src/mame/video/trucocl.cpp
+++ b/src/mame/video/trucocl.cpp
@@ -38,13 +38,12 @@ Daughterboard: Custom made, plugged in the 2 roms and Z80 mainboard sockets.
#include "includes/trucocl.h"
-PALETTE_INIT_MEMBER(trucocl_state, trucocl)
+void trucocl_state::trucocl_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (i = 0;i < 32;i++)
- palette.set_pen_color(i,pal4bit(color_prom[i] >> 0),pal4bit(color_prom[i+32] >> 0),pal4bit(color_prom[i+32] >> 4));
+ for (int i = 0; i < 32; i++)
+ palette.set_pen_color(i, pal4bit(color_prom[i] >> 0), pal4bit(color_prom[i + 32] >> 0), pal4bit(color_prom[i + 32] >> 4));
}
WRITE8_MEMBER(trucocl_state::trucocl_videoram_w)
diff --git a/src/mame/video/tryout.cpp b/src/mame/video/tryout.cpp
index c23e219ae07..cdf7d443ff3 100644
--- a/src/mame/video/tryout.cpp
+++ b/src/mame/video/tryout.cpp
@@ -11,31 +11,31 @@
#include "includes/tryout.h"
-PALETTE_INIT_MEMBER(tryout_state, tryout)
+void tryout_state::tryout_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
+ uint8_t const *const color_prom = memregion("proms")->base();
- for (int i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // blue component
bit0 = 0;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- palette.set_pen_color(i,rgb_t(r,g,b));
+ palette.set_pen_color(i, rgb_t(r, g, b));
}
}
@@ -44,7 +44,7 @@ TILE_GET_INFO_MEMBER(tryout_state::get_fg_tile_info)
int code = m_videoram[tile_index];
int attr = m_videoram[tile_index + 0x400];
code |= ((attr & 0x03) << 8);
- int color = ((attr & 0x4)>>2)+6;
+ int color = ((attr & 0x4) >> 2) + 6;
SET_TILE_INFO_MEMBER(0, code, color, 0);
}
diff --git a/src/mame/video/tubep.cpp b/src/mame/video/tubep.cpp
index 9e4d72fd705..dbc89df3845 100644
--- a/src/mame/video/tubep.cpp
+++ b/src/mame/video/tubep.cpp
@@ -133,98 +133,87 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(tubep_state,tubep)
+void tubep_state::tubep_palette(palette_device &palette)
{
const uint8_t *color_prom = memregion("proms")->base();
- int i,r,g,b;
- /* background/sprites palette variables */
-
- static const int resistors_0[6] = { 33000, 15000, 8200, 4700, 2200, 1000 };
- static const int resistors_1[6] = { 15000, 8200, 4700, 2200, 1000, 470 };
- static const int resistors_2[6] = { 8200, 4700, 2200, 1000, 470, 220 };
-
- int active_resistors_r[3*6];
- int active_resistors_g[3*6];
- int active_resistors_b[2*6];
-
- double weights_r[3*6];
- double weights_g[3*6];
- double weights_b[2*6];
-
- //double output_scaler;
-
- /* text palette variables */
-
- static const int resistors_txt_rg[3] = { 1000, 470, 220 };
- static const int resistors_txt_b [2] = { 470, 220 };
- double weights_txt_rg[3];
- double weights_txt_b[2];
-
- memset(weights_r, 0, sizeof(weights_r));
- memset(weights_g, 0, sizeof(weights_g));
- memset(weights_b, 0, sizeof(weights_b));
-
- compute_resistor_weights(0, 255, -1.0,
- 3, resistors_txt_rg, weights_txt_rg, 470, 0,
- 2, resistors_txt_b, weights_txt_b, 470, 0,
- 0, nullptr, nullptr, 0, 0 );
-
- /* create text palette */
-
- for (i = 0; i < 32; i++)
{
- int bit0,bit1,bit2;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = combine_3_weights(weights_txt_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = combine_3_weights(weights_txt_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (*color_prom >> 6) & 0x01;
- bit1 = (*color_prom >> 7) & 0x01;
- b = combine_2_weights(weights_txt_b, bit0, bit1);
-
- palette.set_pen_color(i, rgb_t(r,g,b));
-
- color_prom++;
+ // text palette variables
+ static constexpr int resistors_txt_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistors_txt_b [2] = { 470, 220 };
+
+ double weights_txt_rg[3];
+ double weights_txt_b[2];
+ compute_resistor_weights(0, 255, -1.0,
+ 3, resistors_txt_rg, weights_txt_rg, 470, 0,
+ 2, resistors_txt_b, weights_txt_b, 470, 0,
+ 0, nullptr, nullptr, 0, 0 );
+
+ // create text palette
+ for (int i = 0; i < 32; i++)
+ {
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = combine_3_weights(weights_txt_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = combine_3_weights(weights_txt_rg, bit0, bit1, bit2);
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_2_weights(weights_txt_b, bit0, bit1);
+
+ palette.set_pen_color(i, rgb_t(r, g, b));
+
+ color_prom++;
+ }
}
- /* sprites use the second PROM to control 8 x LS368. We copy content of this PROM over here */
- for (i = 0; i < 32; i++)
- {
- m_prom2[i] = *color_prom;
- color_prom++;
- }
+ // sprites use the second PROM to control 8 x LS368. We copy content of this PROM over here
+ for (int i = 0; i < 32; i++)
+ m_prom2[i] = *color_prom++;
+ // background/sprites palette variables
+ static constexpr int resistors_0[6] = { 33000, 15000, 8200, 4700, 2200, 1000 };
+ static constexpr int resistors_1[6] = { 15000, 8200, 4700, 2200, 1000, 470 };
+ static constexpr int resistors_2[6] = { 8200, 4700, 2200, 1000, 470, 220 };
- /* create background/sprites palette */
+ // create background/sprites palette
/* find the output scaler
in order to do this we need to calculate the output with everything enabled.
*/
- /* red component */
- for (i=0; i<6; i++) active_resistors_r[ 0+i] = resistors_0[i];
- for (i=0; i<6; i++) active_resistors_r[ 6+i] = resistors_1[i];
- for (i=0; i<6; i++) active_resistors_r[12+i] = resistors_2[i];
- /* green component */
- for (i=0; i<6; i++) active_resistors_g[ 0+i] = resistors_0[i];
- for (i=0; i<6; i++) active_resistors_g[ 6+i] = resistors_1[i];
- for (i=0; i<6; i++) active_resistors_g[12+i] = resistors_2[i];
- /* blue component */
- for (i=0; i<6; i++) active_resistors_b[ 0+i] = resistors_1[i];
- for (i=0; i<6; i++) active_resistors_b[ 6+i] = resistors_2[i];
-
- /* calculate and store the scaler */
- /*output_scaler = */compute_resistor_weights(0, 255, -1.0,
+ int active_resistors_r[3 * 6];
+ int active_resistors_g[3 * 6];
+ int active_resistors_b[2 * 6];
+ for (int i = 0; i < 6; i++)
+ {
+ // red component
+ active_resistors_r[ 0+i] = resistors_0[i];
+ active_resistors_r[ 6+i] = resistors_1[i];
+ active_resistors_r[12+i] = resistors_2[i];
+ // green component
+ active_resistors_g[ 0+i] = resistors_0[i];
+ active_resistors_g[ 6+i] = resistors_1[i];
+ active_resistors_g[12+i] = resistors_2[i];
+ // blue component
+ active_resistors_b[ 0+i] = resistors_1[i];
+ active_resistors_b[ 6+i] = resistors_2[i];
+ }
+
+ // calculate and store the scaler
+ double weights_r[3 * 6];
+ double weights_g[3 * 6];
+ double weights_b[2 * 6];
+ /*double const output_scaler = */compute_resistor_weights(0, 255, -1.0,
3*6, active_resistors_r, weights_r, 470, 0,
3*6, active_resistors_g, weights_g, 470, 0,
2*6, active_resistors_b, weights_b, 470, 0);
@@ -236,26 +225,21 @@ PALETTE_INIT_MEMBER(tubep_state,tubep)
*/
/* now calculate all possible outputs from the circuit */
- for (i=0; i<256; i++)
+ for (int i = 0; i < 256; i++)
{
- int sh;
-
- for (sh=0; sh<0x40; sh++)
+ for (int sh = 0; sh < 0x40; sh++)
{
int j = i; /* active low */
int shade = sh^0x3f; /* negated outputs */
- int bits_r[3*6];
- int bits_g[3*6];
- int bits_b[2*6];
- double out;
- int c;
-
//int active_r = 3*6;
//int active_g = 3*6;
//int active_b = 2*6;
- for (c=0; c<6; c++)
+ int bits_r[3 * 6];
+ int bits_g[3 * 6];
+ int bits_b[2 * 6];
+ for (int c = 0; c < 6; c++)
{
bits_r[0 + c] = (shade>>c) & 1;
bits_r[6 + c] = (shade>>c) & 1;
@@ -272,67 +256,69 @@ PALETTE_INIT_MEMBER(tubep_state,tubep)
//j &= 0x7; /* only red; debug */
/* red component */
- if ((j >> 0) & 0x01) /* if LS368 @E9 is disabled */
+ if (BIT(j, 0)) /* if LS368 @E9 is disabled */
{
- for (c=0; c<6; c++) bits_r[0 +c] = 0;
+ for (int c=0; c<6; c++) bits_r[0 +c] = 0;
//active_r-=6;
}
- if ((j >> 1) & 0x01) /* if LS368 @E10 is disabled */
+ if (BIT(j, 1)) /* if LS368 @E10 is disabled */
{
- for (c=0; c<6; c++) bits_r[6 +c] = 0;
+ for (int c=0; c<6; c++) bits_r[6 +c] = 0;
//active_r-=6;
}
- if ((j >> 2) & 0x01) /* if LS368 @E11 is disabled */
+ if (BIT(j, 2)) /* if LS368 @E11 is disabled */
{
- for (c=0; c<6; c++) bits_r[12 +c] = 0;
+ for (int c=0; c<6; c++) bits_r[12 +c] = 0;
//active_r-=6;
}
/* green component */
- if ((j >> 3) & 0x01) /* if LS368 @E12 is disabled */
+ if (BIT(j, 3)) /* if LS368 @E12 is disabled */
{
- for (c=0; c<6; c++) bits_g[0 +c] = 0;
+ for (int c=0; c<6; c++) bits_g[0 +c] = 0;
//active_g-=6;
}
- if ((j >> 4) & 0x01) /* if LS368 @E13 is disabled */
+ if (BIT(j, 4)) /* if LS368 @E13 is disabled */
{
- for (c=0; c<6; c++) bits_g[6 +c] = 0;
+ for (int c=0; c<6; c++) bits_g[6 +c] = 0;
//active_g-=6;
}
- if ((j >> 5) & 0x01) /* if LS368 @E14 is disabled */
+ if (BIT(j, 5)) /* if LS368 @E14 is disabled */
{
- for (c=0; c<6; c++) bits_g[12+c] = 0;
+ for (int c=0; c<6; c++) bits_g[12+c] = 0;
//active_g-=6;
}
/* blue component */
- if ((j >> 6) & 0x01) /* if LS368 @E15 is disabled */
+ if (BIT(j, 6)) /* if LS368 @E15 is disabled */
{
- for (c=0; c<6; c++) bits_b[0 +c] = 0;
+ for (int c=0; c<6; c++) bits_b[0 +c] = 0;
//active_b-=6;
}
- if ((j >> 7) & 0x01) /* if LS368 @E16 is disabled */
+ if (BIT(j, 7)) /* if LS368 @E16 is disabled */
{
- for (c=0; c<6; c++) bits_b[6 +c] = 0;
+ for (int c=0; c<6; c++) bits_b[6 +c] = 0;
//active_b-=6;
}
+ double out;
+
out = 0.0;
- for (c=0; c<3*6; c++) out += weights_r[c] * bits_r[c];
- r = (int)(out + 0.5);
+ for (int c = 0; c < 3*6; c++) out += weights_r[c] * bits_r[c];
+ int const r = int(out + 0.5);
out = 0.0;
- for (c=0; c<3*6; c++) out += weights_g[c] * bits_g[c];
- g = (int)(out + 0.5);
+ for (int c = 0; c < 3*6; c++) out += weights_g[c] * bits_g[c];
+ int const g = int(out + 0.5);
out = 0.0;
- for (c=0; c<2*6; c++) out += weights_b[c] * bits_b[c];
- b = (int)(out + 0.5);
+ for (int c = 0; c < 2*6; c++) out += weights_b[c] * bits_b[c];
+ int const b = int(out + 0.5);
- /*logerror("Calculate [%x:%x] (active resistors:r=%i g=%i b=%i) = ", i, shade, active_r, active_g, active_b);*/
- /*logerror("r:%3i g:%3i b:%3i\n",r,g,b );*/
+ //logerror("Calculate [%x:%x] (active resistors:r=%i g=%i b=%i) = ", i, shade, active_r, active_g, active_b);
+ //logerror("r:%3i g:%3i b:%3i\n",r,g,b);
- palette.set_pen_color(32+i*0x40+sh, rgb_t(r,g,b));
+ palette.set_pen_color(32+ i*0x40 + sh, rgb_t(r, g, b));
}
}
}
@@ -684,39 +670,38 @@ uint32_t tubep_state::screen_update_tubep(screen_device &screen, bitmap_ind16 &b
***************************************************************************/
-PALETTE_INIT_MEMBER(tubep_state,rjammer)
+void tubep_state::rjammer_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
+
+ static constexpr int resistors_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistors_b [2] = { 470, 220 };
- static const int resistors_rg[3] = { 1000, 470, 220 };
- static const int resistors_b [2] = { 470, 220 };
double weights_rg[3];
double weights_b[2];
-
- compute_resistor_weights(0, 255, -1.0,
+ compute_resistor_weights(0, 255, -1.0,
3, resistors_rg, weights_rg, 470, 0,
2, resistors_b, weights_b, 470, 0,
- 0, nullptr, nullptr, 0, 0 );
+ 0, nullptr, nullptr, 0, 0);
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (*color_prom >> 6) & 0x01;
- bit1 = (*color_prom >> 7) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // blue component
+ bit0 = BIT(*color_prom, 6);
+ bit1 = BIT(*color_prom, 7);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_pen_color(i, rgb_t(r,g,b));
diff --git a/src/mame/video/tunhunt.cpp b/src/mame/video/tunhunt.cpp
index 3f9100cad93..b88da89c78a 100644
--- a/src/mame/video/tunhunt.cpp
+++ b/src/mame/video/tunhunt.cpp
@@ -84,7 +84,7 @@ void tunhunt_state::video_start()
save_item(NAME(m_control));
}
-PALETTE_INIT_MEMBER(tunhunt_state, tunhunt)
+void tunhunt_state::tunhunt_palette(palette_device &palette) const
{
/* Tunnel Hunt uses a combination of color proms and palette RAM to specify a 16 color
* palette. Here, we manage only the mappings for alphanumeric characters and SHELL
@@ -102,20 +102,20 @@ PALETTE_INIT_MEMBER(tunhunt_state, tunhunt)
*/
/* alpha hilite#0 */
- palette.set_pen_indirect(0x10, 0x0); /* background color#0 (transparent) */
- palette.set_pen_indirect(0x11, 0x4); /* foreground color */
+ palette.set_pen_indirect(0x10, 0x0); // background color#0 (transparent)
+ palette.set_pen_indirect(0x11, 0x4); // foreground color
/* alpha hilite#1 */
- palette.set_pen_indirect(0x12, 0x5); /* background color#1 */
- palette.set_pen_indirect(0x13, 0x4); /* foreground color */
+ palette.set_pen_indirect(0x12, 0x5); // background color#1
+ palette.set_pen_indirect(0x13, 0x4); // foreground color
/* alpha hilite#2 */
- palette.set_pen_indirect(0x14, 0x6); /* background color#2 */
- palette.set_pen_indirect(0x15, 0x4); /* foreground color */
+ palette.set_pen_indirect(0x14, 0x6); // background color#2
+ palette.set_pen_indirect(0x15, 0x4); // foreground color
/* alpha hilite#3 */
- palette.set_pen_indirect(0x16, 0xf); /* background color#3 */
- palette.set_pen_indirect(0x17, 0x4); /* foreground color */
+ palette.set_pen_indirect(0x16, 0xf); // background color#3
+ palette.set_pen_indirect(0x17, 0x4); // foreground color
/* shell graphics; these are either 1bpp (2 banks) or 2bpp. It isn't clear which.
* In any event, the following pens are associated with the shell graphics:
diff --git a/src/mame/video/turbo.cpp b/src/mame/video/turbo.cpp
index a2234d6d40a..7d61bbfc61a 100644
--- a/src/mame/video/turbo.cpp
+++ b/src/mame/video/turbo.cpp
@@ -10,7 +10,7 @@
#include "includes/turbo.h"
#include "video/resnet.h"
-static const uint32_t sprite_expand[16] =
+static constexpr uint32_t sprite_expand[16] =
{
0x00000000, 0x00000001, 0x00000100, 0x00000101,
0x00010000, 0x00010001, 0x00010100, 0x00010101,
@@ -27,119 +27,84 @@ static const uint32_t sprite_expand[16] =
*
*************************************/
-PALETTE_INIT_MEMBER(turbo_state,turbo)
+void turbo_state::turbo_palette(palette_device &palette) const
{
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances[3] = { 1000, 470, 220 };
/* compute the color output resistor weights */
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 470, 0,
3, &resistances[0], gweights, 470, 0,
2, &resistances[1], bweights, 470, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < 256; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
-
- /* red component */
- bit0 = (i >> 0) & 1;
- bit1 = (i >> 1) & 1;
- bit2 = (i >> 2) & 1;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ int const r = combine_3_weights(rweights, BIT(i, 0), BIT(i, 1), BIT(i, 2));
- /* green component */
- bit0 = (i >> 3) & 1;
- bit1 = (i >> 4) & 1;
- bit2 = (i >> 5) & 1;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ int const g = combine_3_weights(gweights, BIT(i, 3), BIT(i, 4), BIT(i, 5));
- /* blue component */
- bit0 = (i >> 6) & 1;
- bit1 = (i >> 7) & 1;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ int const b = combine_2_weights(bweights, BIT(i, 6), BIT(i, 7));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(turbo_state,subroc3d)
+void turbo_state::subroc3d_palette(palette_device &palette) const
{
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 470, 0,
3, &resistances[0], gweights, 470, 0,
2, &resistances[1], bweights, 470, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < 256; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 256; i++)
{
- int bit0, bit1, bit2, r, g, b;
+ // red component
+ int const r = combine_3_weights(rweights, BIT(i, 0), BIT(i, 1), BIT(i, 2));
- /* red component */
- bit0 = (i >> 0) & 1;
- bit1 = (i >> 1) & 1;
- bit2 = (i >> 2) & 1;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // green component
+ int const g = combine_3_weights(gweights, BIT(i, 3), BIT(i, 4), BIT(i, 5));
- /* green component */
- bit0 = (i >> 3) & 1;
- bit1 = (i >> 4) & 1;
- bit2 = (i >> 5) & 1;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
-
- /* blue component */
- bit0 = (i >> 6) & 1;
- bit1 = (i >> 7) & 1;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ int const b = combine_2_weights(bweights, BIT(i, 6), BIT(i, 7));
palette.set_pen_color(i, rgb_t(r, g, b));
}
}
-PALETTE_INIT_MEMBER(turbo_state,buckrog)
+void turbo_state::buckrog_palette(palette_device &palette) const
{
- static const int resistances[4] = { 2200, 1000, 500, 250 };
- double rweights[3], gweights[3], bweights[4];
- int i;
+ static constexpr int resistances[4] = { 2200, 1000, 500, 250 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[4];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[1], rweights, 1000, 0,
3, &resistances[1], gweights, 1000, 0,
4, &resistances[0], bweights, 1000, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < 1024; i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < 1024; i++)
{
- int bit0, bit1, bit2, bit3, r, g, b;
-
- /* red component */
- bit0 = (i >> 0) & 1;
- bit1 = (i >> 1) & 1;
- bit2 = (i >> 2) & 1;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
-
- /* green component */
- bit0 = (i >> 3) & 1;
- bit1 = (i >> 4) & 1;
- bit2 = (i >> 5) & 1;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
-
- /* blue component - note the shuffled bits */
- bit0 = (i >> 8) & 1;
- bit1 = (i >> 9) & 1;
- bit2 = (i >> 6) & 1;
- bit3 = (i >> 7) & 1;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+ // red component
+ int const r = combine_3_weights(rweights, BIT(i, 0), BIT(i, 1), BIT(i, 2));
+
+ // green component
+ int const g = combine_3_weights(gweights, BIT(i, 3), BIT(i, 4), BIT(i, 5));
+
+ // blue component - note the shuffled bits
+ int const b = combine_4_weights(bweights, BIT(i, 8), BIT(i, 9), BIT(i, 6), BIT(i, 7));
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp
index dabfc0a9ae3..537fca8c173 100644
--- a/src/mame/video/tx1.cpp
+++ b/src/mame/video/tx1.cpp
@@ -113,11 +113,8 @@ enum
***************************************************************************/
-PALETTE_INIT_MEMBER(tx1_state,tx1)
+void tx1_state::tx1_palette(palette_device &palette) const
{
- const uint8_t *const color_prom = &m_proms[0];
- int i;
-
static const res_net_info tx1_net_info =
{
RES_NET_VCC_5V | RES_NET_VIN_TTL_OUT,
@@ -128,13 +125,12 @@ PALETTE_INIT_MEMBER(tx1_state,tx1)
}
};
- for (i = 0; i < 256; ++i)
+ uint8_t const *const color_prom = &m_proms[0];
+ for (int i = 0; i < 256; ++i)
{
- int r, g, b;
-
- r = compute_res_net(color_prom[i + 0x300] & 0xf, 0, tx1_net_info);
- g = compute_res_net(color_prom[i + 0x400] & 0xf, 1, tx1_net_info);
- b = compute_res_net(color_prom[i + 0x500] & 0xf, 2, tx1_net_info);
+ int const r = compute_res_net(color_prom[i + 0x300] & 0xf, 0, tx1_net_info);
+ int const g = compute_res_net(color_prom[i + 0x400] & 0xf, 1, tx1_net_info);
+ int const b = compute_res_net(color_prom[i + 0x500] & 0xf, 2, tx1_net_info);
palette.set_pen_color(i, rgb_t(r, g, b));
}
@@ -1252,36 +1248,34 @@ uint32_t tx1_state::screen_update_tx1_right(screen_device &screen, bitmap_ind16
***************************************************************************/
-PALETTE_INIT_MEMBER(tx1_state,buggyboy)
+void tx1_state::buggyboy_palette(palette_device &palette) const
{
- const uint8_t *const color_prom = &m_proms[0];
- int i;
+ uint8_t const *const color_prom = &m_proms[0];
- for (i = 0; i < 0x100; i++)
+ for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3, bit4;
- int r, g, b;
bit0 = BIT(color_prom[i + 0x000], 0);
bit1 = BIT(color_prom[i + 0x000], 1);
bit2 = BIT(color_prom[i + 0x000], 2);
bit3 = BIT(color_prom[i + 0x000], 3);
bit4 = BIT(color_prom[i + 0x300], 2);
- r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+ int const r = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x100], 0);
bit1 = BIT(color_prom[i + 0x100], 1);
bit2 = BIT(color_prom[i + 0x100], 2);
bit3 = BIT(color_prom[i + 0x100], 3);
bit4 = BIT(color_prom[i + 0x300], 1);
- g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+ int const g = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
bit0 = BIT(color_prom[i + 0x200], 0);
bit1 = BIT(color_prom[i + 0x200], 1);
bit2 = BIT(color_prom[i + 0x200], 2);
bit3 = BIT(color_prom[i + 0x200], 3);
bit4 = BIT(color_prom[i + 0x300], 0);
- b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
+ int const b = 0x06 * bit4 + 0x0d * bit0 + 0x1e * bit1 + 0x41 * bit2 + 0x8a * bit3;
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/ultratnk.cpp b/src/mame/video/ultratnk.cpp
index 7219f0edee5..3f679791793 100644
--- a/src/mame/video/ultratnk.cpp
+++ b/src/mame/video/ultratnk.cpp
@@ -11,7 +11,7 @@ Atari Ultra Tank video emulation
#include "audio/sprint4.h"
-PALETTE_INIT_MEMBER(ultratnk_state, ultratnk)
+void ultratnk_state::ultratnk_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
diff --git a/src/mame/video/unico.cpp b/src/mame/video/unico.cpp
index 8a8df95c098..5525dbe56c6 100644
--- a/src/mame/video/unico.cpp
+++ b/src/mame/video/unico.cpp
@@ -53,13 +53,13 @@ Note: if MAME_DEBUG is defined, pressing Z with:
***************************************************************************/
-PALETTE_DECODER_MEMBER(unico_state, unico_R6G6B6X)
+rgb_t unico_state::unico_R6G6B6X(uint32_t raw)
{
- int const red = (raw >> 24) & 0xFC;
- int const green = (raw >> 16) & 0xFC;
- int const blue = (raw >> 8) & 0xFC;
+ int const red = (raw >> 24) & 0xfc;
+ int const green = (raw >> 16) & 0xfc;
+ int const blue = (raw >> 8) & 0xfc;
- return rgb_t(red, green, blue);
+ return rgb_t(red | (red >> 6), green | (green >> 6), blue | (blue >> 6));
}
/***************************************************************************
diff --git a/src/mame/video/usgames.cpp b/src/mame/video/usgames.cpp
index 38a9015d88a..e03b681750c 100644
--- a/src/mame/video/usgames.cpp
+++ b/src/mame/video/usgames.cpp
@@ -4,30 +4,22 @@
#include "includes/usgames.h"
-PALETTE_INIT_MEMBER(usgames_state, usgames)
+void usgames_state::usgames_palette(palette_device &palette) const
{
- int j;
-
- for (j = 0; j < 0x200; j++)
+ for (int j = 0; j < 0x200; j++)
{
- int data;
- int r, g, b, i;
-
- if (j & 0x01)
- data = (j >> 5) & 0x0f;
- else
- data = (j >> 1) & 0x0f;
+ int const data = (j >> ((j & 0x01) ? 5 : 1)) & 0x0f;
- r = (data & 1) >> 0;
- g = (data & 2) >> 1;
- b = (data & 4) >> 2;
- i = (data & 8) >> 3;
+ int r = BIT(data, 0);
+ int g = BIT(data, 1);
+ int b = BIT(data, 2);
+ int const i = BIT(data, 3);
r = 0xff * r;
g = 0x7f * g * (i + 1);
b = 0x7f * b * (i + 1);
- palette.set_pen_color(j,rgb_t(r, g, b));
+ palette.set_pen_color(j, rgb_t(r, g, b));
}
}
@@ -35,10 +27,10 @@ PALETTE_INIT_MEMBER(usgames_state, usgames)
TILE_GET_INFO_MEMBER(usgames_state::get_tile_info)
{
- int tileno = m_videoram[tile_index*2];
- int colour = m_videoram[tile_index*2+1];
+ int const tileno = m_videoram[tile_index*2];
+ int const colour = m_videoram[tile_index*2+1];
- SET_TILE_INFO_MEMBER(0,tileno,colour,0);
+ SET_TILE_INFO_MEMBER(0, tileno, colour, 0);
}
void usgames_state::video_start()
diff --git a/src/mame/video/v1050.cpp b/src/mame/video/v1050.cpp
index 71c4f623816..fe13a93ea24 100644
--- a/src/mame/video/v1050.cpp
+++ b/src/mame/video/v1050.cpp
@@ -124,5 +124,5 @@ MACHINE_CONFIG_START(v1050_state::v1050_video)
MCFG_SCREEN_SIZE(640, 400)
MCFG_SCREEN_VISIBLE_AREA(0,640-1, 0, 400-1)
- MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
+ PALETTE(config, m_palette, palette_device::MONOCHROME_HIGHLIGHT);
MACHINE_CONFIG_END
diff --git a/src/mame/video/vector06.cpp b/src/mame/video/vector06.cpp
index df3e9fc47ae..f9f15eaa04e 100644
--- a/src/mame/video/vector06.cpp
+++ b/src/mame/video/vector06.cpp
@@ -54,9 +54,3 @@ uint32_t vector06_state::screen_update_vector06(screen_device &screen, bitmap_in
}
return 0;
}
-
-PALETTE_INIT_MEMBER(vector06_state, vector06)
-{
- for (uint8_t i=0; i<16; i++)
- m_palette->set_pen_color(i, rgb_t::black());
-}
diff --git a/src/mame/video/vtvideo.cpp b/src/mame/video/vtvideo.cpp
index ab232583384..3fed7fd93f7 100644
--- a/src/mame/video/vtvideo.cpp
+++ b/src/mame/video/vtvideo.cpp
@@ -917,9 +917,10 @@ TIMER_CALLBACK_MEMBER(vt100_video_device::lba3_change)
// device_add_mconfig - add device configuration
//-------------------------------------------------
-MACHINE_CONFIG_START(vt100_video_device::device_add_mconfig)
- MCFG_PALETTE_ADD_MONOCHROME("palette")
-MACHINE_CONFIG_END
+void vt100_video_device::device_add_mconfig(machine_config &config)
+{
+ PALETTE(config, m_palette, palette_device::MONOCHROME);
+}
MACHINE_CONFIG_START(rainbow_video_device::device_add_mconfig)
MCFG_PALETTE_ADD("palette", 4)
diff --git a/src/mame/video/vulgus.cpp b/src/mame/video/vulgus.cpp
index a1213cfb3b1..40c028eb1a5 100644
--- a/src/mame/video/vulgus.cpp
+++ b/src/mame/video/vulgus.cpp
@@ -18,49 +18,47 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(vulgus_state, vulgus)
+void vulgus_state::vulgus_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- for (i = 0;i < 256;i++)
+ for (int i = 0; i < 256; i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
+ int bit0,bit1,bit2,bit3;
bit0 = (color_prom[0] >> 0) & 0x01;
bit1 = (color_prom[0] >> 1) & 0x01;
bit2 = (color_prom[0] >> 2) & 0x01;
bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[256] >> 0) & 0x01;
bit1 = (color_prom[256] >> 1) & 0x01;
bit2 = (color_prom[256] >> 2) & 0x01;
bit3 = (color_prom[256] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
bit0 = (color_prom[2*256] >> 0) & 0x01;
bit1 = (color_prom[2*256] >> 1) & 0x01;
bit2 = (color_prom[2*256] >> 2) & 0x01;
bit3 = (color_prom[2*256] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
color_prom += 2*256;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
-
- /* characters use colors 32-47 (?) */
- for (i = 0;i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity();i++)
+ // characters use colors 32-47 (?)
+ for (int i = 0; i < m_gfxdecode->gfx(0)->colors() * m_gfxdecode->gfx(0)->granularity(); i++)
palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i, 32 + *color_prom++);
- /* sprites use colors 16-31 */
- for (i = 0;i < m_gfxdecode->gfx(2)->colors() * m_gfxdecode->gfx(2)->granularity();i++)
+ // sprites use colors 16-31
+ for (int i = 0; i < m_gfxdecode->gfx(2)->colors() * m_gfxdecode->gfx(2)->granularity(); i++)
palette.set_pen_indirect(m_gfxdecode->gfx(2)->colorbase() + i, 16 + *color_prom++);
- /* background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks */
- for (i = 0;i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity() / 4;i++)
+ // background tiles use colors 0-15, 64-79, 128-143, 192-207 in four banks
+ for (int i = 0; i < m_gfxdecode->gfx(1)->colors() * m_gfxdecode->gfx(1)->granularity() / 4; i++)
{
palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 0*32*8 + i, *color_prom);
palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + 1*32*8 + i, *color_prom + 64);
diff --git a/src/mame/video/warpwarp.cpp b/src/mame/video/warpwarp.cpp
index 9d9d3c2d4c2..a6bc99ce8ac 100644
--- a/src/mame/video/warpwarp.cpp
+++ b/src/mame/video/warpwarp.cpp
@@ -13,31 +13,31 @@
#include "includes/warpwarp.h"
-static const rgb_t geebee_palette[] =
+static constexpr rgb_t geebee_pens[] =
{
rgb_t(0x00,0x00,0x00), /* black */
rgb_t(0xff,0xff,0xff), /* white */
rgb_t(0x7f,0x7f,0x7f) /* grey */
};
-PALETTE_INIT_MEMBER(warpwarp_state,geebee)
+void warpwarp_state::geebee_palette(palette_device &palette) const
{
- palette.set_pen_color(0, geebee_palette[0]);
- palette.set_pen_color(1, geebee_palette[1]);
- palette.set_pen_color(2, geebee_palette[1]);
- palette.set_pen_color(3, geebee_palette[0]);
- palette.set_pen_color(4, geebee_palette[0]);
- palette.set_pen_color(5, geebee_palette[2]);
- palette.set_pen_color(6, geebee_palette[2]);
- palette.set_pen_color(7, geebee_palette[0]);
+ palette.set_pen_color(0, geebee_pens[0]);
+ palette.set_pen_color(1, geebee_pens[1]);
+ palette.set_pen_color(2, geebee_pens[1]);
+ palette.set_pen_color(3, geebee_pens[0]);
+ palette.set_pen_color(4, geebee_pens[0]);
+ palette.set_pen_color(5, geebee_pens[2]);
+ palette.set_pen_color(6, geebee_pens[2]);
+ palette.set_pen_color(7, geebee_pens[0]);
}
-PALETTE_INIT_MEMBER(warpwarp_state,navarone)
+void warpwarp_state::navarone_palette(palette_device &palette) const
{
- palette.set_pen_color(0, geebee_palette[0]);
- palette.set_pen_color(1, geebee_palette[1]);
- palette.set_pen_color(2, geebee_palette[1]);
- palette.set_pen_color(3, geebee_palette[0]);
+ palette.set_pen_color(0, geebee_pens[0]);
+ palette.set_pen_color(1, geebee_pens[1]);
+ palette.set_pen_color(2, geebee_pens[1]);
+ palette.set_pen_color(3, geebee_pens[0]);
}
MACHINE_RESET_MEMBER(warpwarp_state,kaitei)
@@ -46,7 +46,7 @@ MACHINE_RESET_MEMBER(warpwarp_state,kaitei)
// This is due of the monitor type used, cfr. http://news.livedoor.com/article/detail/5604337/
// We change color palette at reset time, according to the configuration switch.
- if(m_in_config->read() & 1) // color
+ if (m_in_config->read() & 1) // color
{
m_palette->set_pen_color(0, rgb_t(0x00,0x00,0x00));
m_palette->set_pen_color(1, rgb_t(0x00,0xff,0xff));
@@ -60,15 +60,15 @@ MACHINE_RESET_MEMBER(warpwarp_state,kaitei)
}
else // b & w
{
- m_palette->set_pen_color(0, geebee_palette[0]);
- m_palette->set_pen_color(1, geebee_palette[1]);
- m_palette->set_pen_color(2, geebee_palette[1]);
- m_palette->set_pen_color(3, geebee_palette[0]);
- m_palette->set_pen_color(4, geebee_palette[0]);
- m_palette->set_pen_color(5, geebee_palette[1]);
- m_palette->set_pen_color(6, geebee_palette[1]);
- m_palette->set_pen_color(7, geebee_palette[0]);
- m_palette->set_pen_color(8, geebee_palette[1]); // ball pen
+ m_palette->set_pen_color(0, geebee_pens[0]);
+ m_palette->set_pen_color(1, geebee_pens[1]);
+ m_palette->set_pen_color(2, geebee_pens[1]);
+ m_palette->set_pen_color(3, geebee_pens[0]);
+ m_palette->set_pen_color(4, geebee_pens[0]);
+ m_palette->set_pen_color(5, geebee_pens[1]);
+ m_palette->set_pen_color(6, geebee_pens[1]);
+ m_palette->set_pen_color(7, geebee_pens[0]);
+ m_palette->set_pen_color(8, geebee_pens[1]); // ball pen
}
}
@@ -92,14 +92,13 @@ MACHINE_RESET_MEMBER(warpwarp_state,kaitei)
***************************************************************************/
-PALETTE_INIT_MEMBER(warpwarp_state,warpwarp)
+void warpwarp_state::warpwarp_palette(palette_device &palette) const
{
- static const int resistances_tiles_rg[] = { 1600, 820, 390 };
- static const int resistances_tiles_b[] = { 820, 390 };
- static const int resistance_ball[] = { 220 };
+ static constexpr int resistances_tiles_rg[] = { 1600, 820, 390 };
+ static constexpr int resistances_tiles_b[] = { 820, 390 };
+ static constexpr int resistance_ball[] = { 220 };
double weights_tiles_rg[3], weights_tiles_b[2], weight_ball[1];
-
compute_resistor_weights(0, 0xff, -1.0,
3, resistances_tiles_rg, weights_tiles_rg, 150, 0,
2, resistances_tiles_b, weights_tiles_b, 150, 0,
@@ -108,27 +107,26 @@ PALETTE_INIT_MEMBER(warpwarp_state,warpwarp)
for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2;
- int r,g,b;
-
- /* red component */
- bit0 = (i >> 0) & 0x01;
- bit1 = (i >> 1) & 0x01;
- bit2 = (i >> 2) & 0x01;
- r = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
-
- /* green component */
- bit0 = (i >> 3) & 0x01;
- bit1 = (i >> 4) & 0x01;
- bit2 = (i >> 5) & 0x01;
- g = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
-
- /* blue component */
- bit0 = (i >> 6) & 0x01;
- bit1 = (i >> 7) & 0x01;
- b = combine_2_weights(weights_tiles_b, bit0, bit1);
-
- palette.set_pen_color((i * 2) + 0, rgb_t::black());
- palette.set_pen_color((i * 2) + 1, rgb_t(r, g, b));
+
+ // red component
+ bit0 = BIT(i, 0);
+ bit1 = BIT(i, 1);
+ bit2 = BIT(i, 2);
+ int const r = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
+
+ // green component
+ bit0 = BIT(i, 3);
+ bit1 = BIT(i, 4);
+ bit2 = BIT(i, 5);
+ int const g = combine_3_weights(weights_tiles_rg, bit0, bit1, bit2);
+
+ // blue component
+ bit0 = BIT(i, 6);
+ bit1 = BIT(i, 7);
+ int const b = combine_2_weights(weights_tiles_b, bit0, bit1);
+
+ palette.set_pen_color((i << 1) | 0, rgb_t::black());
+ palette.set_pen_color((i << 1) | 1, rgb_t(r, g, b));
}
palette.set_pen_color(0x200, rgb_t(weight_ball[0], weight_ball[0], weight_ball[0]));
diff --git a/src/mame/video/williams.cpp b/src/mame/video/williams.cpp
index 95e32f95671..77f16f5d58a 100644
--- a/src/mame/video/williams.cpp
+++ b/src/mame/video/williams.cpp
@@ -313,27 +313,26 @@ uint32_t williams2_state::screen_update_williams2(screen_device &screen, bitmap_
*
*************************************/
-PALETTE_INIT_MEMBER(williams_state,williams)
+void williams_state::williams_palette(palette_device &palette) const
{
- static const int resistances_rg[3] = { 1200, 560, 330 };
- static const int resistances_b[2] = { 560, 330 };
- double weights_r[3], weights_g[3], weights_b[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1200, 560, 330 };
+ static constexpr int resistances_b[2] = { 560, 330 };
- /* compute palette information */
- /* note that there really are pullup/pulldown resistors, but this situation is complicated */
- /* by the use of transistors, so we ignore that and just use the relative resistor weights */
+ // compute palette information
+ // note that there really are pullup/pulldown resistors, but this situation is complicated
+ // by the use of transistors, so we ignore that and just use the relative resistor weights
+ double weights_r[3], weights_g[3], weights_b[2];
compute_resistor_weights(0, 255, -1.0,
3, resistances_rg, weights_r, 0, 0,
3, resistances_rg, weights_g, 0, 0,
2, resistances_b, weights_b, 0, 0);
- /* build a palette lookup */
- for (i = 0; i < 256; i++)
+ // build a palette lookup
+ for (int i = 0; i < 256; i++)
{
- int r = combine_3_weights(weights_r, BIT(i,0), BIT(i,1), BIT(i,2));
- int g = combine_3_weights(weights_g, BIT(i,3), BIT(i,4), BIT(i,5));
- int b = combine_2_weights(weights_b, BIT(i,6), BIT(i,7));
+ int const r = combine_3_weights(weights_r, BIT(i, 0), BIT(i, 1), BIT(i, 2));
+ int const g = combine_3_weights(weights_g, BIT(i, 3), BIT(i, 4), BIT(i, 5));
+ int const b = combine_2_weights(weights_b, BIT(i, 6), BIT(i, 7));
palette.set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/wiping.cpp b/src/mame/video/wiping.cpp
index 89a69353254..8539998fbe4 100644
--- a/src/mame/video/wiping.cpp
+++ b/src/mame/video/wiping.cpp
@@ -19,60 +19,58 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(wiping_state, wiping)
+void wiping_state::wiping_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances_rg[3] = { 1000, 470, 220 };
- static const int resistances_b [2] = { 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ static constexpr int resistances_rg[3] = { 1000, 470, 220 };
+ static constexpr int resistances_b [2] = { 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances_rg[0], rweights, 470, 0,
3, &resistances_rg[0], gweights, 470, 0,
2, &resistances_b[0], bweights, 470, 0);
- /* create a lookup table for the palette */
- for (i = 0; i < 0x20; i++)
+ // create a lookup table for the palette
+ for (int i = 0; i < 0x20; i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
color_prom += 0x20;
- /* chars use colors 0-15 */
- for (i = 0; i < 0x100; i++)
+ // chars use colors 0-15
+ for (int i = 0; i < 0x100; i++)
{
- uint8_t ctabentry = color_prom[i ^ 0x03] & 0x0f;
+ uint8_t const ctabentry = color_prom[i ^ 0x03] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
- /* sprites use colors 16-31 */
- for (i = 0x100; i < 0x200; i++)
+ // sprites use colors 16-31
+ for (int i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (color_prom[i ^ 0x03] & 0x0f) | 0x10;
+ uint8_t const ctabentry = (color_prom[i ^ 0x03] & 0x0f) | 0x10;
palette.set_pen_indirect(i, ctabentry);
}
}
diff --git a/src/mame/video/wiz.cpp b/src/mame/video/wiz.cpp
index 87e89dcae54..e1b23685ca7 100644
--- a/src/mame/video/wiz.cpp
+++ b/src/mame/video/wiz.cpp
@@ -9,9 +9,10 @@
***************************************************************************/
#include "emu.h"
-#include "video/resnet.h"
#include "includes/wiz.h"
+#include "video/resnet.h"
+
/***************************************************************************
@@ -27,44 +28,43 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(wiz_state, wiz)
+void wiz_state::wiz_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[4] = { 1000, 470, 220, 100 };
- double rweights[4], gweights[4], bweights[4];
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[4] = { 1000, 470, 220, 100 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[4], gweights[4], bweights[4];
compute_resistor_weights(0, 255, -1.0,
4, resistances, rweights, 470, 0,
4, resistances, gweights, 470, 0,
4, resistances, bweights, 470, 0);
- /* initialize the palette with these colors */
+ // initialize the palette with these colors
for (int i = 0; i < 0x100; i++)
{
int bit0, bit1, bit2, bit3;
- int r, g, b;
-
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x000] >> 3) & 0x01;
- r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
-
- /* green component */
- bit0 = (color_prom[i + 0x100] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x100] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x100] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x100] >> 3) & 0x01;
- g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
-
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- bit3 = (color_prom[i + 0x200] >> 3) & 0x01;
- b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
+
+ // red component
+ bit0 = BIT(color_prom[i + 0x000], 0);
+ bit1 = BIT(color_prom[i + 0x000], 1);
+ bit2 = BIT(color_prom[i + 0x000], 2);
+ bit3 = BIT(color_prom[i + 0x000], 3);
+ int const r = combine_4_weights(rweights, bit0, bit1, bit2, bit3);
+
+ // green component
+ bit0 = BIT(color_prom[i + 0x100], 0);
+ bit1 = BIT(color_prom[i + 0x100], 1);
+ bit2 = BIT(color_prom[i + 0x100], 2);
+ bit3 = BIT(color_prom[i + 0x100], 3);
+ int const g = combine_4_weights(gweights, bit0, bit1, bit2, bit3);
+
+ // blue component
+ bit0 = BIT(color_prom[i + 0x200], 0);
+ bit1 = BIT(color_prom[i + 0x200], 1);
+ bit2 = BIT(color_prom[i + 0x200], 2);
+ bit3 = BIT(color_prom[i + 0x200], 3);
+ int const b = combine_4_weights(bweights, bit0, bit1, bit2, bit3);
m_palette->set_pen_color(i, rgb_t(r, g, b));
}
diff --git a/src/mame/video/wolfpack.cpp b/src/mame/video/wolfpack.cpp
index b00c6d983f6..e384d7ee2a0 100644
--- a/src/mame/video/wolfpack.cpp
+++ b/src/mame/video/wolfpack.cpp
@@ -10,23 +10,22 @@ Atari Wolf Pack (prototype) video emulation
#include "includes/wolfpack.h"
-PALETTE_INIT_MEMBER(wolfpack_state, wolfpack)
+void wolfpack_state::wolfpack_palette(palette_device &palette) const
{
- int i;
-
palette.set_indirect_color(0, rgb_t(0x00, 0x00, 0x00));
palette.set_indirect_color(1, rgb_t(0xc1, 0xc1, 0xc1));
palette.set_indirect_color(2, rgb_t(0x81, 0x81, 0x81));
palette.set_indirect_color(3, rgb_t(0x48, 0x48, 0x48));
- for (i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++)
{
- rgb_t color = palette.indirect_color(i);
-
- palette.set_indirect_color(4 + i,
- rgb_t(color.r() < 0xb8 ? color.r() + 0x48 : 0xff,
- color.g() < 0xb8 ? color.g() + 0x48 : 0xff,
- color.b() < 0xb8 ? color.b() + 0x48 : 0xff));
+ rgb_t const color = palette.indirect_color(i);
+ palette.set_indirect_color(
+ 4 + i,
+ rgb_t(
+ (color.r() < 0xb8) ? (color.r() + 0x48) : 0xff,
+ (color.g() < 0xb8) ? (color.g() + 0x48) : 0xff,
+ (color.b() < 0xb8) ? (color.b() + 0x48) : 0xff));
}
palette.set_pen_indirect(0x00, 0);
diff --git a/src/mame/video/x68k.cpp b/src/mame/video/x68k.cpp
index b8b83746c15..2ab88a2fbf6 100644
--- a/src/mame/video/x68k.cpp
+++ b/src/mame/video/x68k.cpp
@@ -40,12 +40,12 @@
#include "logmacro.h"
-PALETTE_DECODER_MEMBER(x68k_state, GGGGGRRRRRBBBBBI)
+rgb_t x68k_state::GGGGGRRRRRBBBBBI(uint32_t raw)
{
- uint8_t i = raw & 1;
- uint8_t r = pal6bit(((raw >> 5) & 0x3e) | i);
- uint8_t g = pal6bit(((raw >> 10) & 0x3e) | i);
- uint8_t b = pal6bit(((raw >> 0) & 0x3e) | i);
+ uint8_t const i = raw & 1;
+ uint8_t const r = pal6bit(((raw >> 5) & 0x3e) | i);
+ uint8_t const g = pal6bit(((raw >> 10) & 0x3e) | i);
+ uint8_t const b = pal6bit(((raw >> 0) & 0x3e) | i);
return rgb_t(r, g, b);
}
@@ -418,7 +418,7 @@ void x68k_state::draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect)
{
colour = m_gfxbitmap.pix16(scanline, pixel);
if(colour || (m_video.gfx_pri == 2))
- bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI_decoder(colour);
+ bitmap.pix32(scanline, pixel) = GGGGGRRRRRBBBBBI(colour);
}
else if(gfxblend)
{
diff --git a/src/mame/video/xevious.cpp b/src/mame/video/xevious.cpp
index 9d336b437f2..ba83d17d6b4 100644
--- a/src/mame/video/xevious.cpp
+++ b/src/mame/video/xevious.cpp
@@ -27,73 +27,75 @@
bit 0 -- 2.2kohm resistor -- RED/GREEN/BLUE
***************************************************************************/
-PALETTE_INIT_MEMBER(xevious_state,xevious)
+void xevious_state::xevious_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
- #define TOTAL_COLORS(gfxn) (m_gfxdecode->gfx(gfxn)->colors() *m_gfxdecode->gfx(gfxn)->granularity())
+ auto const TOTAL_COLORS = [this] (int gfxn) { return m_gfxdecode->gfx(gfxn)->colors() * m_gfxdecode->gfx(gfxn)->granularity(); };
- for (i = 0;i < 128;i++)
+ for (int i = 0; i < 128; i++)
{
- int bit0,bit1,bit2,bit3,r,g,b;
-
- /* red component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* green component */
- bit0 = (color_prom[256] >> 0) & 0x01;
- bit1 = (color_prom[256] >> 1) & 0x01;
- bit2 = (color_prom[256] >> 2) & 0x01;
- bit3 = (color_prom[256] >> 3) & 0x01;
- g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
- /* blue component */
- bit0 = (color_prom[2*256] >> 0) & 0x01;
- bit1 = (color_prom[2*256] >> 1) & 0x01;
- bit2 = (color_prom[2*256] >> 2) & 0x01;
- bit3 = (color_prom[2*256] >> 3) & 0x01;
- b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
-
- palette.set_indirect_color(i,rgb_t(r,g,b));
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // green component
+ bit0 = BIT(color_prom[256], 0);
+ bit1 = BIT(color_prom[256], 1);
+ bit2 = BIT(color_prom[256], 2);
+ bit3 = BIT(color_prom[256], 3);
+ int const g = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+ // blue component
+ bit0 = BIT(color_prom[2*256], 0);
+ bit1 = BIT(color_prom[2*256], 1);
+ bit2 = BIT(color_prom[2*256], 2);
+ bit3 = BIT(color_prom[2*256], 3);
+ int const b = 0x0e * bit0 + 0x1f * bit1 + 0x43 * bit2 + 0x8f * bit3;
+
+ palette.set_indirect_color(i, rgb_t(r, g, b));
color_prom++;
}
- /* color 0x80 is used by sprites to mark transparency */
- palette.set_indirect_color(0x80,rgb_t(0,0,0));
+ // color 0x80 is used by sprites to mark transparency
+ palette.set_indirect_color(0x80, rgb_t(0, 0, 0));
- color_prom += 128; /* the bottom part of the PROM is unused */
+ color_prom += 128; // the bottom part of the PROM is unused
color_prom += 2*256;
- /* color_prom now points to the beginning of the lookup table */
+ // color_prom now points to the beginning of the lookup table
- /* background tiles */
- for (i = 0;i < TOTAL_COLORS(1);i++)
+ // background tiles
+ for (int i = 0; i < TOTAL_COLORS(1); i++)
{
- palette.set_pen_indirect(m_gfxdecode->gfx(1)->colorbase() + i,
+ palette.set_pen_indirect(
+ m_gfxdecode->gfx(1)->colorbase() + i,
(color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(1)] & 0x0f) << 4));
color_prom++;
}
color_prom += TOTAL_COLORS(1);
- /* sprites */
- for (i = 0;i < TOTAL_COLORS(2);i++)
+ // sprites
+ for (int i = 0; i < TOTAL_COLORS(2); i++)
{
- int c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4);
+ int const c = (color_prom[0] & 0x0f) | ((color_prom[TOTAL_COLORS(2)] & 0x0f) << 4);
- palette.set_pen_indirect(m_gfxdecode->gfx(2)->colorbase() + i,
+ palette.set_pen_indirect(
+ m_gfxdecode->gfx(2)->colorbase() + i,
(c & 0x80) ? (c & 0x7f) : 0x80);
color_prom++;
}
color_prom += TOTAL_COLORS(2);
- /* foreground characters */
- for (i = 0;i < TOTAL_COLORS(0);i++)
+ // foreground characters
+ for (int i = 0; i < TOTAL_COLORS(0); i++)
{
- palette.set_pen_indirect(m_gfxdecode->gfx(0)->colorbase() + i,
- (i % 2 != 0) ? (i / 2) : 0x80);
+ palette.set_pen_indirect(
+ m_gfxdecode->gfx(0)->colorbase() + i,
+ BIT(i, 0) ? (i >> 1) : 0x80);
}
}
diff --git a/src/mame/video/xorworld.cpp b/src/mame/video/xorworld.cpp
index ac62a10b67f..46ed0f62593 100644
--- a/src/mame/video/xorworld.cpp
+++ b/src/mame/video/xorworld.cpp
@@ -18,34 +18,33 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(xorworld_state, xorworld)
+void xorworld_state::xorworld_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0;i < palette.entries();i++){
- int bit0,bit1,bit2,bit3;
- int r,g,b;
-
- /* red component */
- bit0 = (color_prom[0] >> 0) & 0x01;
- bit1 = (color_prom[0] >> 1) & 0x01;
- bit2 = (color_prom[0] >> 2) & 0x01;
- bit3 = (color_prom[0] >> 3) & 0x01;
- r = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3;
- /* green component */
- bit0 = (color_prom[palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[palette.entries()] >> 3) & 0x01;
- g = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3;
- /* blue component */
- bit0 = (color_prom[2*palette.entries()] >> 0) & 0x01;
- bit1 = (color_prom[2*palette.entries()] >> 1) & 0x01;
- bit2 = (color_prom[2*palette.entries()] >> 2) & 0x01;
- bit3 = (color_prom[2*palette.entries()] >> 3) & 0x01;
- b = 0x0e*bit0 + 0x1e * bit1 + 0x44*bit2 + 0x8f*bit3;
- palette.set_pen_color(i,rgb_t(r,g,b));
+
+ for (int i = 0; i < palette.entries(); i++)
+ {
+ int bit0, bit1, bit2, bit3;
+
+ // red component
+ bit0 = BIT(color_prom[0], 0);
+ bit1 = BIT(color_prom[0], 1);
+ bit2 = BIT(color_prom[0], 2);
+ bit3 = BIT(color_prom[0], 3);
+ int const r = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3;
+ // green component
+ bit0 = BIT(color_prom[palette.entries()], 0);
+ bit1 = BIT(color_prom[palette.entries()], 1);
+ bit2 = BIT(color_prom[palette.entries()], 2);
+ bit3 = BIT(color_prom[palette.entries()], 3);
+ int const g = 0x0e*bit0 + 0x1e*bit1 + 0x44*bit2 + 0x8f*bit3;
+ // blue component
+ bit0 = BIT(color_prom[2 * palette.entries()], 0);
+ bit1 = BIT(color_prom[2 * palette.entries()], 1);
+ bit2 = BIT(color_prom[2 * palette.entries()], 2);
+ bit3 = BIT(color_prom[2 * palette.entries()], 3);
+ int const b = 0x0e*bit0 + 0x1e * bit1 + 0x44*bit2 + 0x8f*bit3;
+ palette.set_pen_color(i, rgb_t(r, g, b));
color_prom++;
}
diff --git a/src/mame/video/xxmissio.cpp b/src/mame/video/xxmissio.cpp
index 1f457ac38f7..4c4c551620d 100644
--- a/src/mame/video/xxmissio.cpp
+++ b/src/mame/video/xxmissio.cpp
@@ -77,37 +77,34 @@ void xxmissio_state::video_start()
save_item(NAME(m_flipscreen));
}
-PALETTE_DECODER_MEMBER( xxmissio_state, BBGGRRII )
+rgb_t xxmissio_state::BBGGRRII(uint32_t raw)
{
- uint8_t i = raw & 3;
- uint8_t r = (raw >> 0) & 0x0c;
- uint8_t g = (raw >> 2) & 0x0c;
- uint8_t b = (raw >> 4) & 0x0c;
+ uint8_t const i = raw & 3;
+ uint8_t const r = ((raw >> 0) & 0x0c) | i;
+ uint8_t const g = ((raw >> 2) & 0x0c) | i;
+ uint8_t const b = ((raw >> 4) & 0x0c) | i;
- return rgb_t(pal4bit(r | i), pal4bit(g | i), pal4bit(b | i));
+ return rgb_t(r | (r << 4), g | (g << 4), b | (b << 4));
}
void xxmissio_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx)
{
- int offs;
- int chr,col;
- int x,y,px,py,fx,fy;
-
- for (offs=0; offs<0x800; offs +=0x20)
+ for (int offs = 0; offs < 0x800; offs += 0x20)
{
- chr = m_spriteram[offs];
- col = m_spriteram[offs+3];
+ int chr = m_spriteram[offs];
+ int col = m_spriteram[offs+3];
- fx = ((col & 0x10) >> 4) ^ m_flipscreen;
- fy = ((col & 0x20) >> 5) ^ m_flipscreen;
+ int const fx = BIT(col, 4) ^ m_flipscreen;
+ int const fy = BIT(col, 5) ^ m_flipscreen;
- x = m_spriteram[offs+1]*2;
- y = m_spriteram[offs+2];
+ int const x = m_spriteram[offs+1]*2;
+ int const y = m_spriteram[offs+2];
- chr = chr + ((col & 0x40) << 2);
- col = col & 0x07;
+ chr += (col & 0x40) << 2;
+ col &= 0x07;
- if (m_flipscreen==0)
+ int px, py;
+ if (!m_flipscreen)
{
px = x-8;
py = y;
@@ -126,7 +123,7 @@ void xxmissio_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec
fx,fy,
px,py,0);
- if (px>0x1e0)
+ if (px > 0x1e0)
gfx->transpen(bitmap,cliprect,
chr,
col,
diff --git a/src/mame/video/xyonix.cpp b/src/mame/video/xyonix.cpp
index eef9e32982d..d5e9d38fdd5 100644
--- a/src/mame/video/xyonix.cpp
+++ b/src/mame/video/xyonix.cpp
@@ -3,30 +3,30 @@
#include "emu.h"
#include "includes/xyonix.h"
-PALETTE_INIT_MEMBER(xyonix_state, xyonix)
+void xyonix_state::xyonix_palette(palette_device &palette) const
{
const uint8_t *color_prom = memregion("proms")->base();
- int i;
-
- for (i = 0;i < palette.entries();i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0,bit1,bit2,r,g,b;
-
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (color_prom[i] >> 5) & 0x01;
- bit1 = (color_prom[i] >> 6) & 0x01;
- bit2 = (color_prom[i] >> 7) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- b = 0x4f * bit0 + 0xa8 * bit1;
+ int bit0, bit1, bit2;
+
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // green component
+ bit0 = BIT(color_prom[i], 5);
+ bit1 = BIT(color_prom[i], 6);
+ bit2 = BIT(color_prom[i], 7);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+
+ // blue component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ int const b = 0x4f * bit0 + 0xa8 * bit1;
palette.set_pen_color(i,rgb_t(r,g,b));
}
diff --git a/src/mame/video/yiear.cpp b/src/mame/video/yiear.cpp
index 7ef673635bd..3e8c3526f0f 100644
--- a/src/mame/video/yiear.cpp
+++ b/src/mame/video/yiear.cpp
@@ -31,32 +31,31 @@
***************************************************************************/
-PALETTE_INIT_MEMBER(yiear_state, yiear)
+void yiear_state::yiear_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i;
+ uint8_t const *color_prom = memregion("proms")->base();
- for (i = 0; i < palette.entries(); i++)
+ for (int i = 0; i < palette.entries(); i++)
{
- int bit0, bit1, bit2, r, g, b;
+ int bit0, bit1, bit2;
- /* red component */
- bit0 = (*color_prom >> 0) & 0x01;
- bit1 = (*color_prom >> 1) & 0x01;
- bit2 = (*color_prom >> 2) & 0x01;
- r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // red component
+ bit0 = BIT(*color_prom, 0);
+ bit1 = BIT(*color_prom, 1);
+ bit2 = BIT(*color_prom, 2);
+ int const r = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* green component */
- bit0 = (*color_prom >> 3) & 0x01;
- bit1 = (*color_prom >> 4) & 0x01;
- bit2 = (*color_prom >> 5) & 0x01;
- g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ // green component
+ bit0 = BIT(*color_prom, 3);
+ bit1 = BIT(*color_prom, 4);
+ bit2 = BIT(*color_prom, 5);
+ int const g = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
- /* blue component */
+ // blue component
bit0 = 0;
- bit1 = (*color_prom >> 6) & 0x01;
- bit2 = (*color_prom >> 7) & 0x01;
- b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
+ bit1 = BIT(*color_prom, 6);
+ bit2 = BIT(*color_prom, 7);
+ int const b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette.set_pen_color(i, rgb_t(r,g,b));
color_prom++;
diff --git a/src/mame/video/z88.cpp b/src/mame/video/z88.cpp
index ff78f2d0bcd..ce89fb011bb 100644
--- a/src/mame/video/z88.cpp
+++ b/src/mame/video/z88.cpp
@@ -40,7 +40,7 @@ inline uint8_t* z88_state::convert_address(uint32_t offset)
***************************************************************************/
// Initialise the palette
-PALETTE_INIT_MEMBER(z88_state, z88)
+void z88_state::z88_palette(palette_device &palette) const
{
m_palette->set_pen_color(0, rgb_t(138, 146, 148));
m_palette->set_pen_color(1, rgb_t(92, 83, 88));
diff --git a/src/mame/video/zaccaria.cpp b/src/mame/video/zaccaria.cpp
index 5ab388cab0b..9616b66ec24 100644
--- a/src/mame/video/zaccaria.cpp
+++ b/src/mame/video/zaccaria.cpp
@@ -35,21 +35,19 @@ Here's the hookup from the proms (82s131) to the r-g-b-outputs
***************************************************************************/
-PALETTE_INIT_MEMBER(zaccaria_state, zaccaria)
+void zaccaria_state::zaccaria_palette(palette_device &palette) const
{
- const uint8_t *color_prom = memregion("proms")->base();
- int i, j, k;
- static const int resistances_rg[] = { 1200, 1000, 820 };
- static const int resistances_b[] = { 1000, 820 };
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances_rg[] = { 1200, 1000, 820 };
+ static constexpr int resistances_b[] = { 1000, 820 };
double weights_rg[3], weights_b[2];
-
compute_resistor_weights(0, 0xff, -1.0,
- 3, resistances_rg, weights_rg, 390, 0,
- 2, resistances_b, weights_b, 470, 0,
- 0, nullptr, nullptr, 0, 0);
+ 3, resistances_rg, weights_rg, 390, 0,
+ 2, resistances_b, weights_b, 470, 0,
+ 0, nullptr, nullptr, 0, 0);
- for (i = 0; i < 0x200; i++)
+ for (int i = 0; i < 0x200; i++)
{
/*
TODO: I'm not sure, but I think that pen 0 must always be black, otherwise
@@ -59,29 +57,28 @@ PALETTE_INIT_MEMBER(zaccaria_state, zaccaria)
attributesram, but they are always 0 in these games so they would turn out
black anyway.
*/
- if (((i % 64) / 8) == 0)
+ if (!(i & 0x038))
palette.set_indirect_color(i, rgb_t::black());
else
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i + 0x000] >> 3) & 0x01;
- bit1 = (color_prom[i + 0x000] >> 2) & 0x01;
- bit2 = (color_prom[i + 0x000] >> 1) & 0x01;
- r = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i + 0x000], 3);
+ bit1 = BIT(color_prom[i + 0x000], 2);
+ bit2 = BIT(color_prom[i + 0x000], 1);
+ int const r = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i + 0x000] >> 0) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 3) & 0x01;
- bit2 = (color_prom[i + 0x200] >> 2) & 0x01;
- g = combine_3_weights(weights_rg, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i + 0x000], 0);
+ bit1 = BIT(color_prom[i + 0x200], 3);
+ bit2 = BIT(color_prom[i + 0x200], 2);
+ int const g = combine_3_weights(weights_rg, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i + 0x200] >> 1) & 0x01;
- bit1 = (color_prom[i + 0x200] >> 0) & 0x01;
- b = combine_2_weights(weights_b, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i + 0x200], 1);
+ bit1 = BIT(color_prom[i + 0x200], 0);
+ int const b = combine_2_weights(weights_b, bit0, bit1);
palette.set_indirect_color(i, rgb_t(r, g, b));
}
@@ -91,17 +88,17 @@ PALETTE_INIT_MEMBER(zaccaria_state, zaccaria)
/* of 64. In each block, colors are not in the usual sequential order */
/* but in interleaved order, like Phoenix. Additionally, colors for */
/* background and sprites are interleaved. */
- for (i = 0;i < 8;i++)
- for (j = 0;j < 4;j++)
- for (k = 0;k < 8;k++)
- /* swap j and k to make the colors sequential */
- palette.set_pen_indirect(0 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2*j);
-
- for (i = 0;i < 8;i++)
- for (j = 0;j < 4;j++)
- for (k = 0;k < 8;k++)
- /* swap j and k to make the colors sequential */
- palette.set_pen_indirect(256 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2*j+1);
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 4; j++)
+ for (int k = 0; k < 8; k++)
+ // swap j and k to make the colors sequential
+ palette.set_pen_indirect(0 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2 * j);
+
+ for (int i = 0; i < 8; i++)
+ for (int j = 0; j < 4; j++)
+ for (int k = 0; k < 8; k++)
+ // swap j and k to make the colors sequential
+ palette.set_pen_indirect(256 + 32 * i + 8 * j + k, 64 * i + 8 * k + 2 * j + 1);
}
diff --git a/src/mame/video/zaxxon.cpp b/src/mame/video/zaxxon.cpp
index 04323f11742..76b11ba6a98 100644
--- a/src/mame/video/zaxxon.cpp
+++ b/src/mame/video/zaxxon.cpp
@@ -17,46 +17,44 @@
*
*************************************/
-PALETTE_INIT_MEMBER(zaxxon_state, zaxxon)
+void zaxxon_state::zaxxon_palette(palette_device &palette)
{
- const uint8_t *color_prom = memregion("proms")->base();
- static const int resistances[3] = { 1000, 470, 220 };
- double rweights[3], gweights[3], bweights[2];
- int i;
+ uint8_t const *const color_prom = memregion("proms")->base();
+ static constexpr int resistances[3] = { 1000, 470, 220 };
- /* compute the color output resistor weights */
+ // compute the color output resistor weights
+ double rweights[3], gweights[3], bweights[2];
compute_resistor_weights(0, 255, -1.0,
3, &resistances[0], rweights, 470, 0,
3, &resistances[0], gweights, 470, 0,
2, &resistances[1], bweights, 470, 0);
- /* initialize the palette with these colors */
- for (i = 0; i < palette.entries(); i++)
+ // initialize the palette with these colors
+ for (int i = 0; i < palette.entries(); i++)
{
int bit0, bit1, bit2;
- int r, g, b;
- /* red component */
- bit0 = (color_prom[i] >> 0) & 0x01;
- bit1 = (color_prom[i] >> 1) & 0x01;
- bit2 = (color_prom[i] >> 2) & 0x01;
- r = combine_3_weights(rweights, bit0, bit1, bit2);
+ // red component
+ bit0 = BIT(color_prom[i], 0);
+ bit1 = BIT(color_prom[i], 1);
+ bit2 = BIT(color_prom[i], 2);
+ int const r = combine_3_weights(rweights, bit0, bit1, bit2);
- /* green component */
- bit0 = (color_prom[i] >> 3) & 0x01;
- bit1 = (color_prom[i] >> 4) & 0x01;
- bit2 = (color_prom[i] >> 5) & 0x01;
- g = combine_3_weights(gweights, bit0, bit1, bit2);
+ // green component
+ bit0 = BIT(color_prom[i], 3);
+ bit1 = BIT(color_prom[i], 4);
+ bit2 = BIT(color_prom[i], 5);
+ int const g = combine_3_weights(gweights, bit0, bit1, bit2);
- /* blue component */
- bit0 = (color_prom[i] >> 6) & 0x01;
- bit1 = (color_prom[i] >> 7) & 0x01;
- b = combine_2_weights(bweights, bit0, bit1);
+ // blue component
+ bit0 = BIT(color_prom[i], 6);
+ bit1 = BIT(color_prom[i], 7);
+ int const b = combine_2_weights(bweights, bit0, bit1);
palette.set_pen_color(i, rgb_t(r, g, b));
}
- /* color_prom now points to the beginning of the character color codes */
+ // color_prom now points to the beginning of the character color codes
m_color_codes = &color_prom[256];
}