summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar Vas Crabb <vas@vastheman.com>2017-12-13 17:32:17 +1100
committerGravatarGravatar Vas Crabb <vas@vastheman.com>2017-12-13 19:26:12 +1100
commit9bf81912d3e6c7a59b83ebbbdab72189d1c3cc75 (patch)
treec95b463f45b0a67d67c37bce2d2e859b7354740b
parentbb524ec858e142a497767fd3f1605f43bea7cca9 (diff)
downloadmame-9bf81912d3e6c7a59b83ebbbdab72189d1c3cc75.zip
mame-9bf81912d3e6c7a59b83ebbbdab72189d1c3cc75.tar.bz2
get rid of legacy BITSWAP* (nw)
-rw-r--r--src/devices/bus/c64/silverrock.cpp4
-rw-r--r--src/devices/bus/c64/stardos.cpp2
-rw-r--r--src/devices/bus/c64/vizastar.cpp4
-rw-r--r--src/devices/bus/c64/vw64.cpp4
-rw-r--r--src/devices/bus/c64/warp_speed.cpp4
-rw-r--r--src/devices/bus/cbmiec/c1541.cpp2
-rw-r--r--src/devices/bus/chanf/rom.cpp2
-rw-r--r--src/devices/bus/gameboy/mbc.cpp16
-rw-r--r--src/devices/bus/msx_cart/dooly.cpp2
-rw-r--r--src/devices/bus/neogeo/boot_kof10th.cpp2
-rw-r--r--src/devices/bus/neogeo/prot_cmc.cpp6
-rw-r--r--src/devices/bus/neogeo/prot_cthd.cpp4
-rw-r--r--src/devices/bus/neogeo/prot_kof2k3bl.cpp4
-rw-r--r--src/devices/bus/neogeo/prot_misc.cpp28
-rw-r--r--src/devices/bus/neogeo/prot_pcm2.cpp2
-rw-r--r--src/devices/bus/neogeo/prot_pvc.cpp30
-rw-r--r--src/devices/bus/neogeo/prot_sma.cpp30
-rw-r--r--src/devices/bus/neogeo/sbp.cpp2
-rw-r--r--src/devices/bus/nes/jy.cpp2
-rw-r--r--src/devices/bus/nes/mmc3_clones.cpp2
-rw-r--r--src/devices/bus/nes/waixing.cpp4
-rw-r--r--src/devices/bus/nubus/nubus_spec8.cpp2
-rw-r--r--src/devices/bus/nubus/pds30_procolor816.cpp2
-rw-r--r--src/devices/bus/s100/wunderbus.cpp2
-rw-r--r--src/devices/bus/saturn/sat_slot.cpp2
-rw-r--r--src/devices/bus/sega8/rom.cpp2
-rw-r--r--src/devices/bus/snes/rom.cpp6
-rw-r--r--src/devices/bus/snes_ctrl/pachinko.cpp2
-rw-r--r--src/devices/bus/vcs/dpc.cpp4
-rw-r--r--src/devices/cpu/hmcs40/hmcs40.cpp2
-rw-r--r--src/devices/cpu/hmcs40/hmcs40d.cpp2
-rw-r--r--src/devices/cpu/hmcs40/hmcs40op.cpp4
-rw-r--r--src/devices/cpu/tms1000/tms0970.cpp2
-rw-r--r--src/devices/cpu/tms1000/tms0980.cpp4
-rw-r--r--src/devices/cpu/tms1000/tms1k_base.cpp2
-rw-r--r--src/devices/cpu/tms1000/tp0320.cpp2
-rw-r--r--src/devices/cpu/upd7725/upd7725.cpp4
-rw-r--r--src/devices/machine/eepromser.cpp12
-rw-r--r--src/devices/machine/ldpr8210.cpp2
-rw-r--r--src/devices/machine/roc10937.cpp2
-rw-r--r--src/devices/machine/sdlc.cpp2
-rw-r--r--src/devices/machine/stvcd.cpp2
-rw-r--r--src/devices/machine/tms6100.cpp2
-rw-r--r--src/devices/machine/z80sio.cpp2
-rw-r--r--src/devices/sound/astrocde.cpp2
-rw-r--r--src/devices/sound/tms5110.cpp2
-rw-r--r--src/devices/video/ef9340_1.cpp2
-rw-r--r--src/emu/emucore.h11
-rw-r--r--src/mame/audio/seibu.cpp14
-rw-r--r--src/mame/drivers/24cdjuke.cpp2
-rw-r--r--src/mame/drivers/39in1.cpp4
-rw-r--r--src/mame/drivers/4enraya.cpp2
-rw-r--r--src/mame/drivers/8080bw.cpp4
-rw-r--r--src/mame/drivers/acesp.cpp14
-rw-r--r--src/mame/drivers/aerofgt.cpp2
-rw-r--r--src/mame/drivers/airraid.cpp4
-rw-r--r--src/mame/drivers/alesis.cpp2
-rw-r--r--src/mame/drivers/altos5.cpp4
-rw-r--r--src/mame/drivers/amaticmg.cpp2
-rw-r--r--src/mame/drivers/ampoker2.cpp2
-rw-r--r--src/mame/drivers/apc.cpp4
-rw-r--r--src/mame/drivers/apple2e.cpp2
-rw-r--r--src/mame/drivers/aquarium.cpp4
-rw-r--r--src/mame/drivers/arkanoid.cpp4
-rw-r--r--src/mame/drivers/arsystems.cpp2
-rw-r--r--src/mame/drivers/astrof.cpp2
-rw-r--r--src/mame/drivers/atarisy2.cpp2
-rw-r--r--src/mame/drivers/atvtrack.cpp6
-rw-r--r--src/mame/drivers/backfire.cpp2
-rw-r--r--src/mame/drivers/berzerk.cpp2
-rw-r--r--src/mame/drivers/beta.cpp2
-rw-r--r--src/mame/drivers/bfm_sc4.cpp2
-rw-r--r--src/mame/drivers/bigbord2.cpp2
-rw-r--r--src/mame/drivers/bking.cpp2
-rw-r--r--src/mame/drivers/blktiger.cpp2
-rw-r--r--src/mame/drivers/bloodbro.cpp2
-rw-r--r--src/mame/drivers/bob85.cpp2
-rw-r--r--src/mame/drivers/boogwing.cpp4
-rw-r--r--src/mame/drivers/bublbobl.cpp4
-rw-r--r--src/mame/drivers/by35.cpp2
-rw-r--r--src/mame/drivers/cabal.cpp4
-rw-r--r--src/mame/drivers/camplynx.cpp4
-rw-r--r--src/mame/drivers/cave.cpp6
-rw-r--r--src/mame/drivers/cd2650.cpp2
-rw-r--r--src/mame/drivers/centiped.cpp2
-rw-r--r--src/mame/drivers/chessmst.cpp2
-rw-r--r--src/mame/drivers/chesstrv.cpp2
-rw-r--r--src/mame/drivers/chsuper.cpp6
-rw-r--r--src/mame/drivers/cninja.cpp16
-rw-r--r--src/mame/drivers/cntsteer.cpp2
-rw-r--r--src/mame/drivers/coinmstr.cpp4
-rw-r--r--src/mame/drivers/coolpool.cpp4
-rw-r--r--src/mame/drivers/cops.cpp6
-rw-r--r--src/mame/drivers/cvs.cpp4
-rw-r--r--src/mame/drivers/cybertnk.cpp2
-rw-r--r--src/mame/drivers/dambustr.cpp8
-rw-r--r--src/mame/drivers/darkmist.cpp22
-rw-r--r--src/mame/drivers/datum.cpp4
-rw-r--r--src/mame/drivers/dblewing.cpp4
-rw-r--r--src/mame/drivers/ddragon.cpp12
-rw-r--r--src/mame/drivers/de_2.cpp14
-rw-r--r--src/mame/drivers/de_3.cpp10
-rw-r--r--src/mame/drivers/deco156.cpp2
-rw-r--r--src/mame/drivers/deco32.cpp6
-rw-r--r--src/mame/drivers/deco_mlc.cpp6
-rw-r--r--src/mame/drivers/decocass.cpp2
-rw-r--r--src/mame/drivers/didact.cpp2
-rw-r--r--src/mame/drivers/dietgo.cpp4
-rw-r--r--src/mame/drivers/digel804.cpp2
-rw-r--r--src/mame/drivers/divebomb.cpp2
-rw-r--r--src/mame/drivers/dkong.cpp6
-rw-r--r--src/mame/drivers/dreambal.cpp4
-rw-r--r--src/mame/drivers/dynax.cpp16
-rw-r--r--src/mame/drivers/eacc.cpp2
-rw-r--r--src/mame/drivers/ecoinf3.cpp2
-rw-r--r--src/mame/drivers/ecoinfr.cpp4
-rw-r--r--src/mame/drivers/elwro800.cpp2
-rw-r--r--src/mame/drivers/enigma2.cpp4
-rw-r--r--src/mame/drivers/epos.cpp8
-rw-r--r--src/mame/drivers/et3400.cpp2
-rw-r--r--src/mame/drivers/ettrivia.cpp2
-rw-r--r--src/mame/drivers/eva.cpp2
-rw-r--r--src/mame/drivers/excali64.cpp2
-rw-r--r--src/mame/drivers/expro02.cpp4
-rw-r--r--src/mame/drivers/fgoal.cpp4
-rw-r--r--src/mame/drivers/fidel6502.cpp10
-rw-r--r--src/mame/drivers/fidel68k.cpp8
-rw-r--r--src/mame/drivers/fidelz80.cpp8
-rw-r--r--src/mame/drivers/forte2.cpp4
-rw-r--r--src/mame/drivers/fp1100.cpp2
-rw-r--r--src/mame/drivers/fp200.cpp2
-rw-r--r--src/mame/drivers/funkyjet.cpp4
-rw-r--r--src/mame/drivers/funworld.cpp30
-rw-r--r--src/mame/drivers/gaiden.cpp8
-rw-r--r--src/mame/drivers/galaga.cpp4
-rw-r--r--src/mame/drivers/galaxian.cpp20
-rw-r--r--src/mame/drivers/gladiatr.cpp4
-rw-r--r--src/mame/drivers/goldnpkr.cpp2
-rw-r--r--src/mame/drivers/goldstar.cpp162
-rw-r--r--src/mame/drivers/gts3.cpp2
-rw-r--r--src/mame/drivers/gts3a.cpp2
-rw-r--r--src/mame/drivers/gts80.cpp2
-rw-r--r--src/mame/drivers/gts80a.cpp2
-rw-r--r--src/mame/drivers/gts80b.cpp2
-rw-r--r--src/mame/drivers/h8.cpp2
-rw-r--r--src/mame/drivers/halleys.cpp4
-rw-r--r--src/mame/drivers/hankin.cpp2
-rw-r--r--src/mame/drivers/hh_amis2k.cpp2
-rw-r--r--src/mame/drivers/hh_cop400.cpp2
-rw-r--r--src/mame/drivers/hh_hmcs40.cpp102
-rw-r--r--src/mame/drivers/hh_melps4.cpp8
-rw-r--r--src/mame/drivers/hh_pic16.cpp2
-rw-r--r--src/mame/drivers/hh_tms1k.cpp22
-rw-r--r--src/mame/drivers/hh_ucom4.cpp50
-rw-r--r--src/mame/drivers/hnayayoi.cpp2
-rw-r--r--src/mame/drivers/hprot1.cpp2
-rw-r--r--src/mame/drivers/hshavoc.cpp10
-rw-r--r--src/mame/drivers/igs011.cpp12
-rw-r--r--src/mame/drivers/igs017.cpp42
-rw-r--r--src/mame/drivers/igs_m027.cpp2
-rw-r--r--src/mame/drivers/igspoker.cpp2
-rw-r--r--src/mame/drivers/inder.cpp2
-rw-r--r--src/mame/drivers/jack.cpp8
-rw-r--r--src/mame/drivers/jclub2.cpp2
-rw-r--r--src/mame/drivers/jongkyo.cpp2
-rw-r--r--src/mame/drivers/jp.cpp2
-rw-r--r--src/mame/drivers/k28.cpp2
-rw-r--r--src/mame/drivers/kaneko16.cpp8
-rw-r--r--src/mame/drivers/kas89.cpp4
-rw-r--r--src/mame/drivers/kingdrby.cpp2
-rw-r--r--src/mame/drivers/kurukuru.cpp2
-rw-r--r--src/mame/drivers/lasso.cpp2
-rw-r--r--src/mame/drivers/lbeach.cpp2
-rw-r--r--src/mame/drivers/lc80.cpp2
-rw-r--r--src/mame/drivers/legionna.cpp2
-rw-r--r--src/mame/drivers/lemmings.cpp4
-rw-r--r--src/mame/drivers/looping.cpp2
-rw-r--r--src/mame/drivers/ltcasino.cpp2
-rw-r--r--src/mame/drivers/ltd.cpp2
-rw-r--r--src/mame/drivers/m90.cpp8
-rw-r--r--src/mame/drivers/madalien.cpp4
-rw-r--r--src/mame/drivers/mcr3.cpp2
-rw-r--r--src/mame/drivers/meadows.cpp2
-rw-r--r--src/mame/drivers/megadrvb.cpp12
-rw-r--r--src/mame/drivers/megasys1.cpp8
-rw-r--r--src/mame/drivers/mephisto_montec.cpp4
-rw-r--r--src/mame/drivers/merit.cpp6
-rw-r--r--src/mame/drivers/metlfrzr.cpp4
-rw-r--r--src/mame/drivers/metro.cpp6
-rw-r--r--src/mame/drivers/minicom.cpp2
-rw-r--r--src/mame/drivers/mirax.cpp6
-rw-r--r--src/mame/drivers/missb2.cpp4
-rw-r--r--src/mame/drivers/missile.cpp4
-rw-r--r--src/mame/drivers/mk1.cpp8
-rw-r--r--src/mame/drivers/mkit09.cpp2
-rw-r--r--src/mame/drivers/monzagp.cpp6
-rw-r--r--src/mame/drivers/mpf1.cpp2
-rw-r--r--src/mame/drivers/multfish.cpp14
-rw-r--r--src/mame/drivers/multi16.cpp2
-rw-r--r--src/mame/drivers/multigam.cpp8
-rw-r--r--src/mame/drivers/mustache.cpp10
-rw-r--r--src/mame/drivers/mw8080bw.cpp2
-rw-r--r--src/mame/drivers/namcona1.cpp2
-rw-r--r--src/mame/drivers/namcos10.cpp2
-rw-r--r--src/mame/drivers/nbmj8688.cpp6
-rw-r--r--src/mame/drivers/nbmj8891.cpp16
-rw-r--r--src/mame/drivers/nbmj8900.cpp4
-rw-r--r--src/mame/drivers/neopcb.cpp14
-rw-r--r--src/mame/drivers/newbrain.cpp2
-rw-r--r--src/mame/drivers/niyanpai.cpp4
-rw-r--r--src/mame/drivers/nmk16.cpp2
-rw-r--r--src/mame/drivers/notetaker.cpp20
-rw-r--r--src/mame/drivers/novag6502.cpp2
-rw-r--r--src/mame/drivers/nsm.cpp2
-rw-r--r--src/mame/drivers/nss.cpp2
-rw-r--r--src/mame/drivers/nycaptor.cpp4
-rw-r--r--src/mame/drivers/ojankohs.cpp4
-rw-r--r--src/mame/drivers/omegrace.cpp2
-rw-r--r--src/mame/drivers/pacman.cpp24
-rw-r--r--src/mame/drivers/panicr.cpp12
-rw-r--r--src/mame/drivers/pbaction.cpp2
-rw-r--r--src/mame/drivers/pc88va.cpp4
-rw-r--r--src/mame/drivers/pc9801.cpp12
-rw-r--r--src/mame/drivers/pegasus.cpp4
-rw-r--r--src/mame/drivers/pengadvb.cpp4
-rw-r--r--src/mame/drivers/pet.cpp12
-rw-r--r--src/mame/drivers/pgm2.cpp8
-rw-r--r--src/mame/drivers/piggypas.cpp2
-rw-r--r--src/mame/drivers/pingpong.cpp6
-rw-r--r--src/mame/drivers/pirates.cpp32
-rw-r--r--src/mame/drivers/playch10.cpp4
-rw-r--r--src/mame/drivers/pntnpuzl.cpp4
-rw-r--r--src/mame/drivers/poly880.cpp2
-rw-r--r--src/mame/drivers/popeye.cpp4
-rw-r--r--src/mame/drivers/popobear.cpp2
-rw-r--r--src/mame/drivers/puckpkmn.cpp2
-rw-r--r--src/mame/drivers/pve500.cpp2
-rw-r--r--src/mame/drivers/qix.cpp10
-rw-r--r--src/mame/drivers/r2dx_v33.cpp2
-rw-r--r--src/mame/drivers/raiden.cpp4
-rw-r--r--src/mame/drivers/rainbow.cpp8
-rw-r--r--src/mame/drivers/risc2500.cpp4
-rw-r--r--src/mame/drivers/rohga.cpp8
-rw-r--r--src/mame/drivers/royalmah.cpp6
-rw-r--r--src/mame/drivers/s11.cpp8
-rw-r--r--src/mame/drivers/s11b.cpp16
-rw-r--r--src/mame/drivers/sc1.cpp2
-rw-r--r--src/mame/drivers/sc2.cpp2
-rw-r--r--src/mame/drivers/scregg.cpp2
-rw-r--r--src/mame/drivers/sdk85.cpp2
-rw-r--r--src/mame/drivers/segag80r.cpp4
-rw-r--r--src/mame/drivers/segaorun.cpp10
-rw-r--r--src/mame/drivers/segas16b.cpp44
-rw-r--r--src/mame/drivers/segaufo.cpp2
-rw-r--r--src/mame/drivers/seicross.cpp2
-rw-r--r--src/mame/drivers/selz80.cpp2
-rw-r--r--src/mame/drivers/sfbonus.cpp16
-rw-r--r--src/mame/drivers/sfkick.cpp2
-rw-r--r--src/mame/drivers/simpl156.cpp2
-rw-r--r--src/mame/drivers/skimaxx.cpp2
-rw-r--r--src/mame/drivers/skyarmy.cpp4
-rw-r--r--src/mame/drivers/snesb.cpp52
-rw-r--r--src/mame/drivers/snookr10.cpp6
-rw-r--r--src/mame/drivers/snowbros.cpp10
-rw-r--r--src/mame/drivers/sothello.cpp2
-rw-r--r--src/mame/drivers/speedbal.cpp4
-rw-r--r--src/mame/drivers/sshangha.cpp8
-rw-r--r--src/mame/drivers/statriv2.cpp2
-rw-r--r--src/mame/drivers/stv.cpp12
-rw-r--r--src/mame/drivers/suna8.cpp34
-rw-r--r--src/mame/drivers/superqix.cpp8
-rw-r--r--src/mame/drivers/supertnk.cpp2
-rw-r--r--src/mame/drivers/supracan.cpp2
-rw-r--r--src/mame/drivers/system16.cpp2
-rw-r--r--src/mame/drivers/taito_l.cpp2
-rw-r--r--src/mame/drivers/tcl.cpp2
-rw-r--r--src/mame/drivers/tec1.cpp2
-rw-r--r--src/mame/drivers/techno.cpp4
-rw-r--r--src/mame/drivers/ticalc1x.cpp12
-rw-r--r--src/mame/drivers/tispeak.cpp8
-rw-r--r--src/mame/drivers/tispellb.cpp4
-rw-r--r--src/mame/drivers/tmnt.cpp6
-rw-r--r--src/mame/drivers/toaplan2.cpp8
-rw-r--r--src/mame/drivers/toki.cpp6
-rw-r--r--src/mame/drivers/trackfld.cpp6
-rw-r--r--src/mame/drivers/travrusa.cpp6
-rw-r--r--src/mame/drivers/tsispch.cpp8
-rw-r--r--src/mame/drivers/twins.cpp6
-rw-r--r--src/mame/drivers/vaportra.cpp2
-rw-r--r--src/mame/drivers/vboy.cpp2
-rw-r--r--src/mame/drivers/vcs80.cpp2
-rw-r--r--src/mame/drivers/vega.cpp6
-rw-r--r--src/mame/drivers/vt240.cpp8
-rw-r--r--src/mame/drivers/wallc.cpp6
-rw-r--r--src/mame/drivers/wecleman.cpp4
-rw-r--r--src/mame/drivers/wico.cpp2
-rw-r--r--src/mame/drivers/williams.cpp2
-rw-r--r--src/mame/drivers/wink.cpp10
-rw-r--r--src/mame/drivers/wiz.cpp2
-rw-r--r--src/mame/drivers/wpc_an.cpp4
-rw-r--r--src/mame/drivers/z100.cpp4
-rw-r--r--src/mame/drivers/zapcomputer.cpp2
-rw-r--r--src/mame/etc/fd1094dp.cpp34
-rw-r--r--src/mame/machine/315-5881_crypt.cpp6
-rw-r--r--src/mame/machine/awboard.cpp4
-rw-r--r--src/mame/machine/bfm_bd1.cpp2
-rw-r--r--src/mame/machine/bfm_bda.cpp2
-rw-r--r--src/mame/machine/cps2crypt.cpp4
-rw-r--r--src/mame/machine/deco102.cpp2
-rw-r--r--src/mame/machine/deco146.cpp4
-rw-r--r--src/mame/machine/deco156.cpp8
-rw-r--r--src/mame/machine/deco222.cpp8
-rw-r--r--src/mame/machine/decocpu6.cpp4
-rw-r--r--src/mame/machine/decocpu7.cpp4
-rw-r--r--src/mame/machine/decocrpt.cpp2
-rw-r--r--src/mame/machine/epos.cpp2
-rw-r--r--src/mame/machine/fd1089.cpp28
-rw-r--r--src/mame/machine/fd1094.cpp32
-rw-r--r--src/mame/machine/gaelcrpt.cpp10
-rw-r--r--src/mame/machine/gb.cpp4
-rw-r--r--src/mame/machine/igs025.cpp4
-rw-r--r--src/mame/machine/igs036crypt.cpp2
-rw-r--r--src/mame/machine/jalcrpt.cpp20
-rw-r--r--src/mame/machine/jumpshot.cpp2
-rw-r--r--src/mame/machine/kaneko_calc3.cpp16
-rw-r--r--src/mame/machine/m24_z8000.cpp8
-rw-r--r--src/mame/machine/mbee.cpp8
-rw-r--r--src/mame/machine/mc8123.cpp78
-rw-r--r--src/mame/machine/megacd.cpp8
-rw-r--r--src/mame/machine/mexico86.cpp4
-rw-r--r--src/mame/machine/mpu4.cpp14
-rw-r--r--src/mame/machine/pacplus.cpp2
-rw-r--r--src/mame/machine/pgmprot_igs027a_type1.cpp12
-rw-r--r--src/mame/machine/pgmprot_igs027a_type3.cpp2
-rw-r--r--src/mame/machine/pgmprot_orlegend.cpp2
-rw-r--r--src/mame/machine/r2crypt.cpp4
-rw-r--r--src/mame/machine/scramble.cpp30
-rw-r--r--src/mame/machine/segacrp2_device.cpp4
-rw-r--r--src/mame/machine/segas32.cpp2
-rw-r--r--src/mame/machine/seibuspi.cpp4
-rw-r--r--src/mame/machine/subsino.cpp64
-rw-r--r--src/mame/machine/trs80m2kb.cpp2
-rw-r--r--src/mame/machine/xevious.cpp2
-rw-r--r--src/mame/video/agat7.cpp4
-rw-r--r--src/mame/video/alesis.cpp10
-rw-r--r--src/mame/video/apple2.cpp4
-rw-r--r--src/mame/video/aussiebyte.cpp2
-rw-r--r--src/mame/video/champbas.cpp2
-rw-r--r--src/mame/video/cvs.cpp2
-rw-r--r--src/mame/video/decocass.cpp2
-rw-r--r--src/mame/video/dynax.cpp26
-rw-r--r--src/mame/video/gsword.cpp2
-rw-r--r--src/mame/video/hanaawas.cpp2
-rw-r--r--src/mame/video/igs017_igs031.cpp4
-rw-r--r--src/mame/video/irobot.cpp2
-rw-r--r--src/mame/video/kan_pand.cpp4
-rw-r--r--src/mame/video/kingobox.cpp2
-rw-r--r--src/mame/video/ladybug.cpp4
-rw-r--r--src/mame/video/mbee.cpp2
-rw-r--r--src/mame/video/mz700.cpp2
-rw-r--r--src/mame/video/naughtyb.cpp2
-rw-r--r--src/mame/video/nmk16.cpp4
-rw-r--r--src/mame/video/pc9801.cpp4
-rw-r--r--src/mame/video/pingpong.cpp2
-rw-r--r--src/mame/video/redclash.cpp4
-rw-r--r--src/mame/video/retofinv.cpp4
-rw-r--r--src/mame/video/segaic16.cpp2
-rw-r--r--src/mame/video/seibu_crtc.cpp4
-rw-r--r--src/mame/video/seibuspi.cpp2
-rw-r--r--src/mame/video/snookr10.cpp8
-rw-r--r--src/mame/video/splash.cpp39
-rw-r--r--src/mame/video/thepit.cpp4
-rw-r--r--src/mame/video/tia.cpp8
-rw-r--r--src/mame/video/tx1.cpp2
-rw-r--r--src/mame/video/xevious.cpp2
375 files changed, 1295 insertions, 1305 deletions
diff --git a/src/devices/bus/c64/silverrock.cpp b/src/devices/bus/c64/silverrock.cpp
index 2260b82..a34f21d 100644
--- a/src/devices/bus/c64/silverrock.cpp
+++ b/src/devices/bus/c64/silverrock.cpp
@@ -37,10 +37,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
- BITSWAP16(_offset,15,14,13,12,1,0,2,3,11,10,9,8,7,6,5,4)
+ bitswap<16>(_offset,15,14,13,12,1,0,2,3,11,10,9,8,7,6,5,4)
#define UNSCRAMBLE_DATA(_data) \
- BITSWAP8(_data,7,6,5,4,0,1,2,3)
+ bitswap<8>(_data,7,6,5,4,0,1,2,3)
diff --git a/src/devices/bus/c64/stardos.cpp b/src/devices/bus/c64/stardos.cpp
index ce3d19f..c8e47d3 100644
--- a/src/devices/bus/c64/stardos.cpp
+++ b/src/devices/bus/c64/stardos.cpp
@@ -142,7 +142,7 @@ uint8_t c64_stardos_cartridge_device::c64_cd_r(address_space &space, offs_t offs
{
if (!roml || !romh)
{
- // TODO BITSWAP8(7,6,5,4,3,1,2,0) ?
+ // TODO bitswap<8>(7,6,5,4,3,1,2,0) ?
data = m_roml[offset & 0x3fff];
}
else if (!io1)
diff --git a/src/devices/bus/c64/vizastar.cpp b/src/devices/bus/c64/vizastar.cpp
index 03043e7..444ff65 100644
--- a/src/devices/bus/c64/vizastar.cpp
+++ b/src/devices/bus/c64/vizastar.cpp
@@ -36,10 +36,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
- BITSWAP16(_offset,15,14,13,12,5,0,7,10,11,9,8,6,4,3,2,1)
+ bitswap<16>(_offset,15,14,13,12,5,0,7,10,11,9,8,6,4,3,2,1)
#define UNSCRAMBLE_DATA(_data) \
- BITSWAP8(_data,7,6,0,5,1,4,2,3)
+ bitswap<8>(_data,7,6,0,5,1,4,2,3)
diff --git a/src/devices/bus/c64/vw64.cpp b/src/devices/bus/c64/vw64.cpp
index f6ed996..ea0d3c3 100644
--- a/src/devices/bus/c64/vw64.cpp
+++ b/src/devices/bus/c64/vw64.cpp
@@ -40,10 +40,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
- BITSWAP16(_offset,15,14,13,12,6,2,8,10,11,9,7,5,4,3,1,0)
+ bitswap<16>(_offset,15,14,13,12,6,2,8,10,11,9,7,5,4,3,1,0)
#define UNSCRAMBLE_DATA(_data) \
- BITSWAP8(_data,7,6,0,5,1,4,2,3)
+ bitswap<8>(_data,7,6,0,5,1,4,2,3)
// 74LS122 tW=0.45*R*C = 1.1844s
diff --git a/src/devices/bus/c64/warp_speed.cpp b/src/devices/bus/c64/warp_speed.cpp
index e9098da..3c266e3 100644
--- a/src/devices/bus/c64/warp_speed.cpp
+++ b/src/devices/bus/c64/warp_speed.cpp
@@ -38,10 +38,10 @@
//**************************************************************************
#define UNSCRAMBLE_ADDRESS(_offset) \
- BITSWAP16(_offset,15,14,12,13,5,2,7,9,11,10,8,6,4,3,1,0)
+ bitswap<16>(_offset,15,14,12,13,5,2,7,9,11,10,8,6,4,3,1,0)
#define UNSCRAMBLE_DATA(_data) \
- BITSWAP8(_data,7,6,5,0,1,4,2,3)
+ bitswap<8>(_data,7,6,5,0,1,4,2,3)
diff --git a/src/devices/bus/cbmiec/c1541.cpp b/src/devices/bus/cbmiec/c1541.cpp
index 4d0f974..427cebe 100644
--- a/src/devices/bus/cbmiec/c1541.cpp
+++ b/src/devices/bus/cbmiec/c1541.cpp
@@ -1071,7 +1071,7 @@ void fsd2_device::device_start()
for (offs_t offset = 0; offset < 0x4000; offset++)
{
- uint8_t data = BITSWAP8(rom[offset], 7, 6, 5, 3, 4, 2, 1, 0);
+ uint8_t data = bitswap<8>(rom[offset], 7, 6, 5, 3, 4, 2, 1, 0);
rom[offset] = data;
}
diff --git a/src/devices/bus/chanf/rom.cpp b/src/devices/bus/chanf/rom.cpp
index 3dc509a..a3a213b 100644
--- a/src/devices/bus/chanf/rom.cpp
+++ b/src/devices/bus/chanf/rom.cpp
@@ -192,7 +192,7 @@ void chanf_rom_device::common_write_2102(uint32_t offset, uint8_t data)
m_latch[1] = data;
// all bits but 2,3 come from this write, but they are shuffled
// notice that data is 8bits, so when swapping bit8 & bit9 are always 0!
- m_addr_latch = (m_addr_latch & 0x0c) | (BITSWAP16((uint16_t) data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
+ m_addr_latch = (m_addr_latch & 0x0c) | (bitswap<16>((uint16_t) data, 15, 14, 13, 12, 11, 10, 7, 6, 5, 3, 2, 1, 9, 8, 4, 0));
}
}
diff --git a/src/devices/bus/gameboy/mbc.cpp b/src/devices/bus/gameboy/mbc.cpp
index de71f48..4a48d89 100644
--- a/src/devices/bus/gameboy/mbc.cpp
+++ b/src/devices/bus/gameboy/mbc.cpp
@@ -1057,26 +1057,26 @@ WRITE8_MEMBER(gb_rom_sintax_device::write_bank)
switch (m_sintax_mode & 0x0f)
{
case 0x0d:
- data = BITSWAP8(data, 1,0,7,6,5,4,3,2);
+ data = bitswap<8>(data, 1,0,7,6,5,4,3,2);
break;
case 0x09:
- //data = BITSWAP8(data, 3,2,5,4,0,1,6,7); // Monkey..no
- data = BITSWAP8(data, 4,5,2,3,0,1,6,7);
+ //data = bitswap<8>(data, 3,2,5,4,0,1,6,7); // Monkey..no
+ data = bitswap<8>(data, 4,5,2,3,0,1,6,7);
break;
case 0x00: // 0x10=lion 0x00 hmmmmm // 1 and 0 unconfirmed
- data = BITSWAP8(data, 7,0,5,6,3,4,1,2);
+ data = bitswap<8>(data, 7,0,5,6,3,4,1,2);
break;
case 0x01:
- data = BITSWAP8(data, 0,1,6,7,4,5,2,3);
+ data = bitswap<8>(data, 0,1,6,7,4,5,2,3);
break;
case 0x05:
- data = BITSWAP8(data, 7,6,1,0,3,2,5,4); // Not 100% on this one
+ data = bitswap<8>(data, 7,6,1,0,3,2,5,4); // Not 100% on this one
break;
case 0x07:
- data = BITSWAP8(data, 2,0,3,1,5,4,7,6); // 5 and 7 unconfirmed
+ data = bitswap<8>(data, 2,0,3,1,5,4,7,6); // 5 and 7 unconfirmed
break;
case 0x0b:
- data = BITSWAP8(data, 2,3,0,1,6,7,4,5); // 5 and 6 unconfirmed
+ data = bitswap<8>(data, 2,3,0,1,6,7,4,5); // 5 and 6 unconfirmed
break;
}
m_latch_bank2 = (m_latch_bank2 & 0x100) | data;
diff --git a/src/devices/bus/msx_cart/dooly.cpp b/src/devices/bus/msx_cart/dooly.cpp
index 389e0c3..d1d3ad9 100644
--- a/src/devices/bus/msx_cart/dooly.cpp
+++ b/src/devices/bus/msx_cart/dooly.cpp
@@ -45,7 +45,7 @@ READ8_MEMBER(msx_cart_dooly_device::read_cart)
switch (m_prot)
{
case 0x04:
- data = BITSWAP8(data, 7, 6, 5, 4, 3, 1, 0, 2);
+ data = bitswap<8>(data, 7, 6, 5, 4, 3, 1, 0, 2);
break;
}
return data;
diff --git a/src/devices/bus/neogeo/boot_kof10th.cpp b/src/devices/bus/neogeo/boot_kof10th.cpp
index 6f31cf6..167692f 100644
--- a/src/devices/bus/neogeo/boot_kof10th.cpp
+++ b/src/devices/bus/neogeo/boot_kof10th.cpp
@@ -102,7 +102,7 @@ WRITE16_MEMBER(neogeo_kof10th_cart_device::protection_w)
if (!m_cart_ram[0xffe])
COMBINE_DATA(&m_cart_ram2[(0x00000/2) + (offset & 0xffff)]); // Write to RAM bank A
else
- m_fixed[offset] = BITSWAP8(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly
+ m_fixed[offset] = bitswap<8>(data, 7,6,0,4,3,2,1,5); // Write S data on-the-fly
}
else if (offset >= 0xfe000/2)
{
diff --git a/src/devices/bus/neogeo/prot_cmc.cpp b/src/devices/bus/neogeo/prot_cmc.cpp
index 336bb54..7759182 100644
--- a/src/devices/bus/neogeo/prot_cmc.cpp
+++ b/src/devices/bus/neogeo/prot_cmc.cpp
@@ -689,15 +689,15 @@ int cmc_prot_device::m1_address_scramble(int address, uint16_t key)
int block = (address >> 16) & 7;
int aux = address & 0xffff;
- aux ^= BITSWAP16(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
- aux = BITSWAP16(aux,
+ aux ^= bitswap<16>(key,12,0,2,4,8,15,7,13,10,1,3,6,11,9,14,5);
+ aux = bitswap<16>(aux,
p1[block][15], p1[block][14], p1[block][13], p1[block][12],
p1[block][11], p1[block][10], p1[block][9], p1[block][8],
p1[block][7], p1[block][6], p1[block][5], p1[block][4],
p1[block][3], p1[block][2], p1[block][1], p1[block][0]);
aux ^= m1_address_0_7_xor[(aux >> 8) & 0xff];
aux ^= m1_address_8_15_xor[aux & 0xff] << 8;
- aux = BITSWAP16(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0);
+ aux = bitswap<16>(aux, 7,15,14,6,5,13,12,4,11,3,10,2,9,1,8,0);
return (block << 16) | aux;
}
diff --git a/src/devices/bus/neogeo/prot_cthd.cpp b/src/devices/bus/neogeo/prot_cthd.cpp
index dd641e6..d2c427d 100644
--- a/src/devices/bus/neogeo/prot_cthd.cpp
+++ b/src/devices/bus/neogeo/prot_cthd.cpp
@@ -189,7 +189,7 @@ void cthd_prot_device::ct2k3sp_sx_decrypt( uint8_t* fixedrom, uint32_t fixedrom_
for (int i = 0; i < rom_size; i++)
{
- int ofst = BITSWAP24((i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
+ int ofst = bitswap<24>((i & 0x1ffff), 23, 22, 21, 20, 19, 18, 17, 3,
0, 1, 4, 2, 13, 14, 16, 15,
5, 6, 11, 10, 9, 8, 7, 12 );
ofst += (i >> 17) << 17;
@@ -275,7 +275,7 @@ void cthd_prot_device::patch_ct2k3sa(uint8_t* cpurom, uint32_t cpurom_size)
/* Matrimelee / Shin Gouketsuji Ichizoku Toukon (bootleg) */
-#define MATRIMBLZ80(i) (i ^ (BITSWAP8(i & 0x3,4,3,1,2,0,7,6,5) << 8))
+#define MATRIMBLZ80(i) (i ^ (bitswap<8>(i & 0x3,4,3,1,2,0,7,6,5) << 8))
void cthd_prot_device::matrimbl_decrypt(uint8_t* sprrom, uint32_t sprrom_size, uint8_t* audiorom, uint32_t audiorom_size)
{
diff --git a/src/devices/bus/neogeo/prot_kof2k3bl.cpp b/src/devices/bus/neogeo/prot_kof2k3bl.cpp
index 5afe9a0..456f164 100644
--- a/src/devices/bus/neogeo/prot_kof2k3bl.cpp
+++ b/src/devices/bus/neogeo/prot_kof2k3bl.cpp
@@ -102,7 +102,7 @@ void kof2k3bl_prot_device::pl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
{
memcpy(&tmp[0], &rom16[i], 0x100000);
for (int j = 0; j < 0x100000/2; j++)
- rom16[i+j] = tmp[BITSWAP24(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
+ rom16[i+j] = tmp[bitswap<24>(j,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)];
}
/* patched by Altera protection chip on PCB */
@@ -124,7 +124,7 @@ void kof2k3bl_prot_device::upl_px_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
uint8_t *buf = cpurom + 0xd0610;
for (int i = 0; i < 0x2000 / 2; i++)
{
- int ofst = (i & 0xff00) + BITSWAP8((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5);
+ int ofst = (i & 0xff00) + bitswap<8>((i & 0x00ff), 7, 6, 0, 4, 3, 2, 1, 5);
memcpy(&rom[i * 2], &buf[ofst * 2], 2);
}
diff --git a/src/devices/bus/neogeo/prot_misc.cpp b/src/devices/bus/neogeo/prot_misc.cpp
index 54b9c5b..47150bb 100644
--- a/src/devices/bus/neogeo/prot_misc.cpp
+++ b/src/devices/bus/neogeo/prot_misc.cpp
@@ -77,7 +77,7 @@ void neoboot_prot_device::sx_decrypt(uint8_t* fixed, uint32_t fixed_size, int va
else if (value == 2)
{
for (int i = 0; i < sx_size; i++)
- rom[i] = BITSWAP8(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
+ rom[i] = bitswap<8>(rom[i], 7, 6, 0, 4, 3, 2, 1, 5);
}
}
@@ -139,7 +139,7 @@ void neoboot_prot_device::kf2k5uni_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
{
for (int j = 0; j < 0x80; j += 2)
{
- int ofst = BITSWAP8(j, 0, 3, 4, 5, 6, 1, 2, 7);
+ int ofst = bitswap<8>(j, 0, 3, 4, 5, 6, 1, 2, 7);
memcpy(&dst[j], src + i + ofst, 2);
}
memcpy(src + i, &dst[0], 0x80);
@@ -154,7 +154,7 @@ void neoboot_prot_device::kf2k5uni_sx_decrypt(uint8_t* fixedrom, uint32_t fixedr
uint8_t *srom = fixedrom;
for (int i = 0; i < 0x20000; i++)
- srom[i] = BITSWAP8(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
+ srom[i] = bitswap<8>(srom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
void neoboot_prot_device::kf2k5uni_mx_decrypt(uint8_t* audiorom, uint32_t audiorom_size)
@@ -162,7 +162,7 @@ void neoboot_prot_device::kf2k5uni_mx_decrypt(uint8_t* audiorom, uint32_t audior
uint8_t *mrom = audiorom;
for (int i = 0; i < 0x30000; i++)
- mrom[i] = BITSWAP8(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
+ mrom[i] = bitswap<8>(mrom[i], 4, 5, 6, 7, 0, 1, 2, 3);
}
@@ -187,7 +187,7 @@ void neoboot_prot_device::lans2004_vx_decrypt(uint8_t* ymsndrom, uint32_t ymsndr
{
uint8_t *rom = ymsndrom;
for (int i = 0; i < 0xA00000; i++)
- rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
void neoboot_prot_device::lans2004_decrypt_68k(uint8_t* cpurom, uint32_t cpurom_size)
@@ -239,7 +239,7 @@ void neoboot_prot_device::samsho5b_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
for (int i = 0; i < px_size / 2; i++)
{
- int ofst = BITSWAP8((i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2);
+ int ofst = bitswap<8>((i & 0x000ff), 7, 6, 5, 4, 3, 0, 1, 2);
ofst += (i & 0xfffff00);
ofst ^= 0x060005;
@@ -259,7 +259,7 @@ void neoboot_prot_device::samsho5b_vx_decrypt(uint8_t* ymsndrom, uint32_t ymsndr
uint8_t *rom = ymsndrom;
for (int i = 0; i < vx_size; i++)
- rom[i] = BITSWAP8(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 5, 4, 3, 2, 6, 7);
}
@@ -381,7 +381,7 @@ void neoboot_prot_device::svcboot_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si
for (int i = 0; i < size / 2; i++)
{
- int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4);
+ int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4);
ofst += (i & 0xffff00);
memcpy(&src[i * 2], &dst[ofst * 2], 0x02);
}
@@ -410,7 +410,7 @@ void neoboot_prot_device::svcboot_cx_decrypt(uint8_t* sprrom, uint32_t sprrom_si
int bit1 = bitswap4_tbl[idx][1];
int bit2 = bitswap4_tbl[idx][2];
int bit3 = bitswap4_tbl[idx][3];
- int ofst = BITSWAP8((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0);
+ int ofst = bitswap<8>((i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0);
ofst += (i & 0xfffff00);
memcpy(&src[i * 0x80], &dst[ofst * 0x80], 0x80);
}
@@ -429,7 +429,7 @@ void neoboot_prot_device::svcplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_si
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
- int ofst = BITSWAP24((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
+ int ofst = bitswap<24>((i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x10, 0x11, 0x12);
ofst ^= 0x0f0007;
@@ -478,7 +478,7 @@ void neoboot_prot_device::svcsplus_px_decrypt(uint8_t* cpurom, uint32_t cpurom_s
memcpy(&dst[0], src, size);
for (int i = 0; i < size / 2; i++)
{
- int ofst = BITSWAP16((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
+ int ofst = bitswap<16>((i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
0x04, 0x03, 0x01, 0x07, 0x06, 0x02, 0x05, 0x0e);
ofst += (i & 0x078000);
@@ -524,7 +524,7 @@ void neoboot_prot_device::kof2002b_gfx_decrypt(uint8_t *src, int size)
for (int j = 0; j < 0x200; j++)
{
int n = (j & 0x38) >> 3;
- int ofst = BITSWAP16(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
+ int ofst = bitswap<16>(j, 15, 14, 13, 12, 11, 10, 9, t[n][0], t[n][1], t[n][2], 5, 4, 3, t[n][3], t[n][4], t[n][5]);
memcpy(src + i + ofst * 128, &dst[j * 128], 128);
}
}
@@ -544,7 +544,7 @@ void neoboot_prot_device::kf2k2mp_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
{
for (int j = 0; j < 0x80 / 2; j++)
{
- int ofst = BITSWAP8( j, 6, 7, 2, 3, 4, 5, 0, 1 );
+ int ofst = bitswap<8>( j, 6, 7, 2, 3, 4, 5, 0, 1 );
memcpy(dst + j * 2, src + i + ofst * 2, 2);
}
memcpy(src + i, dst, 0x80);
@@ -580,7 +580,7 @@ void neoboot_prot_device::kof10th_decrypt(uint8_t* cpurom, uint32_t cpurom_size)
for (int i = 0; i < 0x900000; i++)
{
- int j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
+ int j = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,2,9,8,7,1,5,4,3,10,6,0);
src[j] = dst[i];
}
diff --git a/src/devices/bus/neogeo/prot_pcm2.cpp b/src/devices/bus/neogeo/prot_pcm2.cpp
index 80fa21e..82f3175 100644
--- a/src/devices/bus/neogeo/prot_pcm2.cpp
+++ b/src/devices/bus/neogeo/prot_pcm2.cpp
@@ -82,7 +82,7 @@ void pcm2_prot_device::swap(uint8_t* ymrom, uint32_t ymsize, int value)
for (int i = 0; i < 0x1000000; i++)
{
- j = BITSWAP24(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
+ j = bitswap<24>(i,23,22,21,20,19,18,17,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,16);
j ^= addrs[value][1];
d = ((i + addrs[value][0]) & 0xffffff);
src[j] = buf[d] ^ xordata[value][j & 0x7];
diff --git a/src/devices/bus/neogeo/prot_pvc.cpp b/src/devices/bus/neogeo/prot_pvc.cpp
index 99c7014..8e29059 100644
--- a/src/devices/bus/neogeo/prot_pvc.cpp
+++ b/src/devices/bus/neogeo/prot_pvc.cpp
@@ -112,7 +112,7 @@ void pvc_prot_device::mslug5_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x0800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
- rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
+ rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
@@ -120,12 +120,12 @@ void pvc_prot_device::mslug5_decrypt_68k(uint8_t* rom, uint32_t size)
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
- int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
+ int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
- int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (BITSWAP8(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12);
+ int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00700) + (bitswap<8>(((i & 0x0ff000) >> 12), 5, 4, 7, 6, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
@@ -151,7 +151,7 @@ void pvc_prot_device::svc_px_decrypt(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x0800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
- rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
+ rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
@@ -159,13 +159,13 @@ void pvc_prot_device::svc_px_decrypt(uint8_t* rom, uint32_t size)
memcpy(&buf[0], rom, rom_size);
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
- int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1);
+ int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1);
memcpy(&rom[i * 0x10000], &buf[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x800000; i += 0x100)
{
- int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
+ int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00a00) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&rom[i], &buf[ofst], 0x100);
}
memcpy(&buf[0], rom, rom_size );
@@ -189,20 +189,20 @@ void pvc_prot_device::kf2k3pcb_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
- rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0);
+ rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 4, 5, 6, 7, 8, 9, 10, 11, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
- int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
+ int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
- int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
+ int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00300) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
@@ -230,20 +230,20 @@ void pvc_prot_device::kof2003_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
- rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0);
+ rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 5, 4, 7, 6, 9, 8, 11, 10, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
- int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
+ int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 0, 1, 2, 3);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
- int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (BITSWAP8(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
+ int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00800) + (bitswap<8>(((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
@@ -271,19 +271,19 @@ void pvc_prot_device::kof2003h_decrypt_68k(uint8_t* rom, uint32_t size)
for (int i = 0x100000; i < 0x800000; i += 4)
{
uint16_t rom16 = rom[BYTE_XOR_LE(i+1)] | rom[BYTE_XOR_LE(i+2)] << 8;
- rom16 = BITSWAP16(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
+ rom16 = bitswap<16>(rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0);
rom[BYTE_XOR_LE(i+1)] = rom16 & 0xff;
rom[BYTE_XOR_LE(i+2)] = rom16 >> 8;
}
for (int i = 0; i < 0x0100000 / 0x10000; i++)
{
- int ofst = (i & 0xf0) + BITSWAP8((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
+ int ofst = (i & 0xf0) + bitswap<8>((i & 0x0f), 7, 6, 5, 4, 1, 0, 3, 2);
memcpy(&buf[i * 0x10000], &rom[ofst * 0x10000], 0x10000);
}
for (int i = 0x100000; i < 0x900000; i += 0x100)
{
- int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (BITSWAP8(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12);
+ int ofst = (i & 0xf000ff) + ((i & 0x000f00) ^ 0x00400) + (bitswap<8>(((i & 0x0ff000) >> 12), 6, 7, 4, 5, 0, 1, 2, 3) << 12);
memcpy(&buf[i], &rom[ofst], 0x100);
}
memcpy(&rom[0x000000], &buf[0x000000], 0x100000);
diff --git a/src/devices/bus/neogeo/prot_sma.cpp b/src/devices/bus/neogeo/prot_sma.cpp
index 1b6e232..bfd15ab 100644
--- a/src/devices/bus/neogeo/prot_sma.cpp
+++ b/src/devices/bus/neogeo/prot_sma.cpp
@@ -398,7 +398,7 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
- rom[i] = BITSWAP16(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
+ rom[i] = bitswap<16>(rom[i],13,7,3,0,9,4,5,6,1,12,8,14,10,11,2,15);
// swap address lines for the banked part
for (int i = 0; i < 0x600000/2; i += 0x800/2)
@@ -406,13 +406,13 @@ void sma_prot_device::kof99_decrypt_68k(uint8_t* base)
uint16_t buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
- rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
+ rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,6,2,4,9,8,3,1,7,0,5)];
}
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
- rom[i] = rom[0x700000/2 + BITSWAP24(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
+ rom[i] = rom[0x700000/2 + bitswap<24>(i,23,22,21,20,19,18,11,6,14,17,16,5,8,10,12,0,4,3,2,7,9,15,13,1)];
}
@@ -423,12 +423,12 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
- rom[i] = BITSWAP16(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
+ rom[i] = bitswap<16>(rom[i],13,12,14,10,8,2,3,1,5,9,11,4,15,0,6,7);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
- rom[i] = rom[0x710000/2 + BITSWAP24(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
+ rom[i] = rom[0x710000/2 + bitswap<24>(i,23,22,21,20,19,18,4,5,16,14,7,9,6,13,17,15,3,1,2,12,11,8,10,0)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@@ -437,7 +437,7 @@ void sma_prot_device::garou_decrypt_68k(uint8_t* base)
uint16_t buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
- rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
+ rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,9,4,8,3,13,6,2,7,0,12,1,11,10,5)];
}
}
@@ -449,12 +449,12 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
- rom[i] = BITSWAP16(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
+ rom[i] = bitswap<16>(rom[i],14,5,1,11,7,4,10,15,3,12,8,13,0,2,9,6);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
- rom[i] = rom[0x7f8000/2 + BITSWAP24(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
+ rom[i] = rom[0x7f8000/2 + bitswap<24>(i,23,22,21,20,19,18,5,16,11,2,6,7,17,3,12,8,14,4,0,9,1,10,15,13)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@@ -463,7 +463,7 @@ void sma_prot_device::garouh_decrypt_68k(uint8_t* base)
uint16_t buffer[0x8000/2];
memcpy(buffer, &rom[i], 0x8000);
for (int j = 0; j < 0x8000/2; j++)
- rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
+ rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,12,8,1,7,11,3,13,10,6,9,5,4,0,2)];
}
}
@@ -475,12 +475,12 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
- rom[i] = BITSWAP16(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
+ rom[i] = bitswap<16>(rom[i],4,11,14,3,1,13,0,7,2,8,12,15,10,9,5,6);
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
- rom[i] = rom[0x5d0000/2 + BITSWAP24(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
+ rom[i] = rom[0x5d0000/2 + bitswap<24>(i,23,22,21,20,19,18,15,2,1,13,3,0,9,6,16,4,11,5,7,12,17,14,10,8)];
// swap address lines for the banked part
rom = (uint16_t *)(base + 0x100000);
@@ -489,7 +489,7 @@ void sma_prot_device::mslug3_decrypt_68k(uint8_t* base)
uint16_t buffer[0x10000/2];
memcpy(buffer, &rom[i], 0x10000);
for (int j = 0; j < 0x10000/2; j++)
- rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
+ rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,2,11,0,14,6,4,13,8,9,3,10,7,5,12,1)];
}
}
@@ -501,7 +501,7 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base)
// swap data lines on the whole ROMs
for (int i = 0; i < 0x800000/2; i++)
- rom[i] = BITSWAP16(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
+ rom[i] = bitswap<16>(rom[i],12,8,11,3,15,14,7,0,10,13,6,5,9,2,1,4);
// swap address lines for the banked part
for (int i = 0; i < 0x63a000/2; i += 0x800/2)
@@ -509,11 +509,11 @@ void sma_prot_device::kof2000_decrypt_68k(uint8_t* base)
uint16_t buffer[0x800/2];
memcpy(buffer, &rom[i], 0x800);
for (int j = 0; j < 0x800/2; j++)
- rom[i+j] = buffer[BITSWAP24(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
+ rom[i+j] = buffer[bitswap<24>(j,23,22,21,20,19,18,17,16,15,14,13,12,11,10,4,1,3,8,6,2,7,0,9,5)];
}
// swap address lines & relocate fixed part
rom = (uint16_t *)base;
for (int i = 0; i < 0x0c0000/2; i++)
- rom[i] = rom[0x73a000/2 + BITSWAP24(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
+ rom[i] = rom[0x73a000/2 + bitswap<24>(i,23,22,21,20,19,18,8,4,15,13,3,14,16,2,6,17,7,12,10,0,5,11,1,9)];
}
diff --git a/src/devices/bus/neogeo/sbp.cpp b/src/devices/bus/neogeo/sbp.cpp
index f5c25a2..6b6920c 100644
--- a/src/devices/bus/neogeo/sbp.cpp
+++ b/src/devices/bus/neogeo/sbp.cpp
@@ -36,7 +36,7 @@ READ16_MEMBER( neogeo_sbp_cart_device::protection_r )
{
uint16_t* rom = (get_rom_size()) ? get_rom_base() : get_region_rom_base();
uint16_t origdata = rom[offset + (0x200/2)];
- uint16_t data = BITSWAP16(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
+ uint16_t data = bitswap<16>(origdata, 11,10,9,8,15,14,13,12,3,2,1,0,7,6,5,4);
int realoffset = 0x200 + (offset * 2);
logerror("sbp_lowerrom_r offset %08x data %04x\n", realoffset, data);
diff --git a/src/devices/bus/nes/jy.cpp b/src/devices/bus/nes/jy.cpp
index 38a3084..191892e 100644
--- a/src/devices/bus/nes/jy.cpp
+++ b/src/devices/bus/nes/jy.cpp
@@ -296,7 +296,7 @@ READ8_MEMBER(nes_jy_typea_device::read_m)
inline uint8_t nes_jy_typea_device::unscramble(uint8_t bank)
{
- return BITSWAP8(bank & 0x7f,7,0,1,2,3,4,5,6);
+ return bitswap<8>(bank & 0x7f,7,0,1,2,3,4,5,6);
}
void nes_jy_typea_device::update_prg()
diff --git a/src/devices/bus/nes/mmc3_clones.cpp b/src/devices/bus/nes/mmc3_clones.cpp
index 5d776c5..5c578c0 100644
--- a/src/devices/bus/nes/mmc3_clones.cpp
+++ b/src/devices/bus/nes/mmc3_clones.cpp
@@ -2565,7 +2565,7 @@ void nes_a9746_device::pcb_reset()
void nes_a9746_device::update_banks(uint8_t value)
{
- uint8_t bank = BITSWAP8(value & 0x3c,7,6,0,1,2,3,4,5);
+ uint8_t bank = bitswap<8>(value & 0x3c,7,6,0,1,2,3,4,5);
switch (m_reg[0])
{
diff --git a/src/devices/bus/nes/waixing.cpp b/src/devices/bus/nes/waixing.cpp
index f4d9c33..7e95102 100644
--- a/src/devices/bus/nes/waixing.cpp
+++ b/src/devices/bus/nes/waixing.cpp
@@ -929,7 +929,7 @@ READ8_MEMBER(nes_waixing_sh2_device::chr_r)
void nes_waixing_sec_device::prg_cb(int start, int bank)
{
if (m_reg)
- bank = BITSWAP8(bank & 0x1f,7,6,5,2,1,3,4,0);
+ bank = bitswap<8>(bank & 0x1f,7,6,5,2,1,3,4,0);
prg8_x(start, bank);
}
@@ -937,7 +937,7 @@ void nes_waixing_sec_device::prg_cb(int start, int bank)
void nes_waixing_sec_device::chr_cb(int start, int bank, int source)
{
if (m_reg)
- bank = BITSWAP8(bank, 5,4,2,6,7,3,1,0);
+ bank = bitswap<8>(bank, 5,4,2,6,7,3,1,0);
chr1_x(start, bank, source);
}
diff --git a/src/devices/bus/nubus/nubus_spec8.cpp b/src/devices/bus/nubus/nubus_spec8.cpp
index a828966..1cc9056 100644
--- a/src/devices/bus/nubus/nubus_spec8.cpp
+++ b/src/devices/bus/nubus/nubus_spec8.cpp
@@ -257,7 +257,7 @@ WRITE32_MEMBER( nubus_spec8s3_device::spec8s3_w )
if (m_count == 3)
{
- int actual_color = BITSWAP8(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
+ int actual_color = bitswap<8>(m_clutoffs, 0, 1, 2, 3, 4, 5, 6, 7);
// printf("RAMDAC: color %d = %02x %02x %02x (PC=%x)\n", actual_color, m_colors[0], m_colors[1], m_colors[2], space.device().safe_pc() );
m_palette[actual_color] = rgb_t(m_colors[0], m_colors[1], m_colors[2]);
diff --git a/src/devices/bus/nubus/pds30_procolor816.cpp b/src/devices/bus/nubus/pds30_procolor816.cpp
index 366eb8e..869e919 100644
--- a/src/devices/bus/nubus/pds30_procolor816.cpp
+++ b/src/devices/bus/nubus/pds30_procolor816.cpp
@@ -272,7 +272,7 @@ WRITE32_MEMBER( nubus_procolor816_device::procolor816_w )
if (mem_mask == 0x00ff0000)
{
// printf("%08x to DAC control (PC=%x)\n", data, space.device().safe_pc());
- m_clutoffs = BITSWAP8((data>>16)&0xff, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_clutoffs = bitswap<8>((data>>16)&0xff, 0, 1, 2, 3, 4, 5, 6, 7);
}
else if (mem_mask == 0x000000ff)
{
diff --git a/src/devices/bus/s100/wunderbus.cpp b/src/devices/bus/s100/wunderbus.cpp
index e0eec1b..1bd7df7 100644
--- a/src/devices/bus/s100/wunderbus.cpp
+++ b/src/devices/bus/s100/wunderbus.cpp
@@ -345,7 +345,7 @@ uint8_t s100_wunderbus_device::s100_sinp_r(address_space &space, offs_t offset)
*/
- data = BITSWAP8(m_10a->read(),0,1,2,3,4,5,6,7) & 0xfc;
+ data = bitswap<8>(m_10a->read(),0,1,2,3,4,5,6,7) & 0xfc;
break;
case 2: // R.T. Clock IN/RESET CLK. Int.
diff --git a/src/devices/bus/saturn/sat_slot.cpp b/src/devices/bus/saturn/sat_slot.cpp
index 13f69c8..defdd4d 100644
--- a/src/devices/bus/saturn/sat_slot.cpp
+++ b/src/devices/bus/saturn/sat_slot.cpp
@@ -156,7 +156,7 @@ image_init_result sat_cart_slot_device::call_load()
// fix endianness....
for (int i = 0; i < len/4; i ++)
- ROM[i] = BITSWAP32(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
+ ROM[i] = bitswap<32>(ROM[i],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,23,22,21,20,19,18,17,16,31,30,29,28,27,26,25,24);
// {
// uint8_t tempa = ROM[i+0];
// uint8_t tempb = ROM[i+1];
diff --git a/src/devices/bus/sega8/rom.cpp b/src/devices/bus/sega8/rom.cpp
index 9006cc1..e3fa290 100644
--- a/src/devices/bus/sega8/rom.cpp
+++ b/src/devices/bus/sega8/rom.cpp
@@ -871,7 +871,7 @@ READ8_MEMBER(sega8_janggun_device::read_cart)
if (m_rom_bank_base[bank] < 0x80)
return m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)];
else
- return BITSWAP8(m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)], 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(m_rom[(m_rom_bank_base[bank] & 0x3f) * 0x2000 + (offset & 0x1fff)], 0, 1, 2, 3, 4, 5, 6, 7);
}
diff --git a/src/devices/bus/snes/rom.cpp b/src/devices/bus/snes/rom.cpp
index 628ab1a..bae27f2 100644
--- a/src/devices/bus/snes/rom.cpp
+++ b/src/devices/bus/snes/rom.cpp
@@ -291,7 +291,7 @@ WRITE8_MEMBER( sns_rom_obc1_device::chip_write )
// Address range for read/write depends on the game (check snes.xml)
READ8_MEMBER( sns_rom_pokemon_device::chip_read )
{
- return BITSWAP8(m_latch,0,6,7,1,2,3,4,5);
+ return bitswap<8>(m_latch,0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_pokemon_device::chip_write )
@@ -488,7 +488,7 @@ WRITE8_MEMBER( sns_rom_20col_device::chip_write )
READ8_MEMBER( sns_rom_banana_device::chip_read )
{
- return BITSWAP8(m_latch[0xf],0,6,7,1,2,3,4,5);
+ return bitswap<8>(m_latch[0xf],0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_banana_device::chip_write )
@@ -499,7 +499,7 @@ WRITE8_MEMBER( sns_rom_banana_device::chip_write )
READ8_MEMBER( sns_rom_bugs_device::chip_read )
{
- return BITSWAP8(m_latch[offset & 0xff],0,6,7,1,2,3,4,5);
+ return bitswap<8>(m_latch[offset & 0xff],0,6,7,1,2,3,4,5);
}
WRITE8_MEMBER( sns_rom_bugs_device::chip_write )
diff --git a/src/devices/bus/snes_ctrl/pachinko.cpp b/src/devices/bus/snes_ctrl/pachinko.cpp
index 44d8106..010385e 100644
--- a/src/devices/bus/snes_ctrl/pachinko.cpp
+++ b/src/devices/bus/snes_ctrl/pachinko.cpp
@@ -83,7 +83,7 @@ void snes_pachinko_device::device_reset()
void snes_pachinko_device::port_poll()
{
- uint8_t dial = BITSWAP8(m_dial->read() ^ 0xff,7,6,5,4,3,2,1,0);
+ uint8_t dial = bitswap<8>(m_dial->read() ^ 0xff,7,6,5,4,3,2,1,0);
m_latch = m_button->read() | (dial << 25) | 0xee7000; // add ID
}
diff --git a/src/devices/bus/vcs/dpc.cpp b/src/devices/bus/vcs/dpc.cpp
index f15e426..bcddc3e 100644
--- a/src/devices/bus/vcs/dpc.cpp
+++ b/src/devices/bus/vcs/dpc.cpp
@@ -160,10 +160,10 @@ READ8_MEMBER(dpc_device::read)
data = m_df[data_fetcher].flag ? display_data : 0x00;
break;
case 0x18: // display data AND'd w/flag, nibbles swapped
- data = m_df[data_fetcher].flag ? BITSWAP8(display_data,3,2,1,0,7,6,5,4) : 0x00;
+ data = m_df[data_fetcher].flag ? bitswap<8>(display_data,3,2,1,0,7,6,5,4) : 0x00;
break;
case 0x20: // display data AND'd w/flag, byte reversed
- data = m_df[data_fetcher].flag ? BITSWAP8(display_data,0,1,2,3,4,5,6,7) : 0x00;
+ data = m_df[data_fetcher].flag ? bitswap<8>(display_data,0,1,2,3,4,5,6,7) : 0x00;
break;
case 0x28: // display data AND'd w/flag, rotated right
data = m_df[data_fetcher].flag ? (display_data >> 1) : 0x00;
diff --git a/src/devices/cpu/hmcs40/hmcs40.cpp b/src/devices/cpu/hmcs40/hmcs40.cpp
index a80c067..fa874022 100644
--- a/src/devices/cpu/hmcs40/hmcs40.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40.cpp
@@ -620,7 +620,7 @@ void hmcs40_cpu_device::execute_run()
debugger_instruction_hook(this, m_pc);
m_icount--;
m_op = m_program->read_word(m_pc) & 0x3ff;
- m_i = BITSWAP8(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
+ m_i = bitswap<8>(m_op,7,6,5,4,0,1,2,3) & 0xf; // reversed bit-order for 4-bit immediate param (except for XAMR)
increment_pc();
// handle opcode
diff --git a/src/devices/cpu/hmcs40/hmcs40d.cpp b/src/devices/cpu/hmcs40/hmcs40d.cpp
index 48ae33c..96e4b63 100644
--- a/src/devices/cpu/hmcs40/hmcs40d.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40d.cpp
@@ -181,7 +181,7 @@ offs_t hmcs40_disassembler::disassemble(std::ostream &stream, offs_t pc, const d
// reverse bits
if (bits < 0)
{
- param = BITSWAP8(param,0,1,2,3,4,5,6,7);
+ param = bitswap<8>(param,0,1,2,3,4,5,6,7);
param >>= (8 + bits);
bits = -bits;
}
diff --git a/src/devices/cpu/hmcs40/hmcs40op.cpp b/src/devices/cpu/hmcs40/hmcs40op.cpp
index 2078d5e..1886768 100644
--- a/src/devices/cpu/hmcs40/hmcs40op.cpp
+++ b/src/devices/cpu/hmcs40/hmcs40op.cpp
@@ -669,13 +669,13 @@ void hmcs40_cpu_device::op_p()
if (o & 0x100)
{
// B3 B2 B1 B0 A0 A1 A2 A3
- m_a = BITSWAP8(o,7,6,5,4,0,1,2,3) & 0xf;
+ m_a = bitswap<8>(o,7,6,5,4,0,1,2,3) & 0xf;
m_b = o >> 4 & 0xf;
}
if (o & 0x200)
{
// R20 R21 R22 R23 R30 R31 R32 R33
- o = BITSWAP8(o,0,1,2,3,4,5,6,7);
+ o = bitswap<8>(o,0,1,2,3,4,5,6,7);
write_r(2, o & 0xf);
write_r(3, o >> 4 & 0xf);
}
diff --git a/src/devices/cpu/tms1000/tms0970.cpp b/src/devices/cpu/tms1000/tms0970.cpp
index 503f95d..2ba98ae 100644
--- a/src/devices/cpu/tms1000/tms0970.cpp
+++ b/src/devices/cpu/tms1000/tms0970.cpp
@@ -110,7 +110,7 @@ void tms0970_cpu_device::device_reset()
if (imask & 0x40 && (imask & 0x20) == 0)
msel = (op & 0xf) | (op >> 1 & 0x10);
- msel = BITSWAP8(msel,7,6,5,0,1,2,3,4); // lines are reversed
+ msel = bitswap<8>(msel,7,6,5,0,1,2,3,4); // lines are reversed
u32 mmask = m_mpla->read(msel);
mmask ^= 0x09fe; // invert active-negative
diff --git a/src/devices/cpu/tms1000/tms0980.cpp b/src/devices/cpu/tms1000/tms0980.cpp
index 622d8ca..4ca31ad 100644
--- a/src/devices/cpu/tms1000/tms0980.cpp
+++ b/src/devices/cpu/tms1000/tms0980.cpp
@@ -110,7 +110,7 @@ u32 tms0980_cpu_device::decode_fixed(u16 op)
u32 tms0980_cpu_device::decode_micro(u8 sel)
{
u32 decode = 0;
- sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
+ sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed
u32 mask = m_mpla->read(sel);
mask ^= 0x43fc3; // invert active-negative
@@ -175,7 +175,7 @@ void tms0980_cpu_device::read_opcode()
{
debugger_instruction_hook(this, m_rom_address);
m_opcode = m_program->read_word(m_rom_address) & 0x1ff;
- m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
+ m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
m_micro = read_micro();
diff --git a/src/devices/cpu/tms1000/tms1k_base.cpp b/src/devices/cpu/tms1000/tms1k_base.cpp
index bfbf6ea..eaac999 100644
--- a/src/devices/cpu/tms1000/tms1k_base.cpp
+++ b/src/devices/cpu/tms1000/tms1k_base.cpp
@@ -294,7 +294,7 @@ void tms1k_base_device::read_opcode()
{
debugger_instruction_hook(this, m_rom_address);
m_opcode = m_program->read_byte(m_rom_address);
- m_c4 = BITSWAP8(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
+ m_c4 = bitswap<8>(m_opcode,7,6,5,4,0,1,2,3) & 0xf; // opcode operand is bitswapped for most opcodes
m_fixed = m_fixed_decode[m_opcode];
m_micro = m_micro_decode[m_opcode];
diff --git a/src/devices/cpu/tms1000/tp0320.cpp b/src/devices/cpu/tms1000/tp0320.cpp
index 64ebdb3..8f10c9f 100644
--- a/src/devices/cpu/tms1000/tp0320.cpp
+++ b/src/devices/cpu/tms1000/tp0320.cpp
@@ -67,7 +67,7 @@ u32 tp0320_cpu_device::decode_micro(u8 sel)
{
u32 decode = 0;
- sel = BITSWAP8(sel,7,6,0,1,2,3,4,5); // lines are reversed
+ sel = bitswap<8>(sel,7,6,0,1,2,3,4,5); // lines are reversed
u32 mask = m_mpla->read(sel);
mask ^= 0x0bff0; // invert active-negative
diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp
index 716fa45..c805c5b 100644
--- a/src/devices/cpu/upd7725/upd7725.cpp
+++ b/src/devices/cpu/upd7725/upd7725.cpp
@@ -398,7 +398,7 @@ void necdsp_device::exec_op(uint32_t opcode) {
case 9: regs.idb = regs.dr; break;
case 10: regs.idb = regs.sr; break;
case 11: regs.idb = regs.si; break; //MSB = first bit in from serial, 'natural' SI register order
- case 12: regs.idb = BITSWAP16(regs.si, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB = first bit in from serial, 'reversed' SI register order
+ case 12: regs.idb = bitswap<16>(regs.si, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB = first bit in from serial, 'reversed' SI register order
case 13: regs.idb = regs.k; break;
case 14: regs.idb = regs.l; break;
case 15: regs.idb = dataRAM[regs.dp]; break;
@@ -586,7 +586,7 @@ void necdsp_device::exec_ld(uint32_t opcode) {
m_out_p0_cb(regs.sr.p0);
m_out_p1_cb(regs.sr.p1);
break;
- case 8: regs.so = BITSWAP16(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
+ case 8: regs.so = bitswap<16>(id, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); break; //LSB first output, output tapped at bit 15 shifting left
case 9: regs.so = id; break; //MSB first output, output tapped at bit 15 shifting left
case 10: regs.k = id; break;
case 11: regs.k = id; regs.l = m_data->read_word(regs.rp); break;
diff --git a/src/devices/machine/eepromser.cpp b/src/devices/machine/eepromser.cpp
index 5e6e08a..d97ea31 100644
--- a/src/devices/machine/eepromser.cpp
+++ b/src/devices/machine/eepromser.cpp
@@ -1007,9 +1007,9 @@ void eeprom_serial_x24c44_device::handle_event(eeprom_event event)
if (bit_index % m_data_bits == 0 && (bit_index == 0 || m_streaming_enabled)){
m_shift_register=m_ram_data[m_address];
- //m_shift_register=BITSWAP16(m_shift_register,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
- //m_shift_register=BITSWAP16(m_shift_register,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
- m_shift_register= BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ //m_shift_register=bitswap<16>(m_shift_register,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
+ //m_shift_register=bitswap<16>(m_shift_register,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
+ m_shift_register= bitswap<16>(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
m_shift_register=m_shift_register<<16;
@@ -1046,9 +1046,9 @@ void eeprom_serial_x24c44_device::handle_event(eeprom_event event)
m_shift_register = (m_shift_register << 1) | m_di_state;
if (++m_bits_accum == m_data_bits)
{
- //m_shift_register=BITSWAP16(m_shift_register, 0, 1, 2, 3, 4, 5,6,7, 8, 9,10,11,12,13,14,15);
- //m_shift_register=BITSWAP16(m_shift_register, 7, 6, 5, 4, 3, 2,1,0,15,14,13,12,11,10, 9, 8);
- m_shift_register=BITSWAP16(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ //m_shift_register=bitswap<16>(m_shift_register, 0, 1, 2, 3, 4, 5,6,7, 8, 9,10,11,12,13,14,15);
+ //m_shift_register=bitswap<16>(m_shift_register, 7, 6, 5, 4, 3, 2,1,0,15,14,13,12,11,10, 9, 8);
+ m_shift_register=bitswap<16>(m_shift_register,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
m_ram_data[m_address]=m_shift_register;
LOG1("write to RAM addr=%02X data=%04X\n",m_address,m_shift_register);
diff --git a/src/devices/machine/ldpr8210.cpp b/src/devices/machine/ldpr8210.cpp
index 8e1b879..39bb12f 100644
--- a/src/devices/machine/ldpr8210.cpp
+++ b/src/devices/machine/ldpr8210.cpp
@@ -236,7 +236,7 @@ void pioneer_pr8210_device::control_w(uint8_t data)
{
// data is stored to the PIA in bit-reverse order
uint8_t newcommand = (m_accumulator >> 2) & 0x1f;
- m_pia.porta = BITSWAP8(newcommand, 0,1,2,3,4,5,6,7);
+ m_pia.porta = bitswap<8>(newcommand, 0,1,2,3,4,5,6,7);
// the MCU logic requires a 0 to execute many commands; however, nobody
// consistently sends a 0, whereas they do tend to send duplicate commands...
diff --git a/src/devices/machine/roc10937.cpp b/src/devices/machine/roc10937.cpp
index 05d3321..966d28c 100644
--- a/src/devices/machine/roc10937.cpp
+++ b/src/devices/machine/roc10937.cpp
@@ -180,7 +180,7 @@ void rocvfd_device::device_reset()
///////////////////////////////////////////////////////////////////////////
uint32_t rocvfd_device::set_display(uint32_t segin)
{
- return BITSWAP32(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
+ return bitswap<32>(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
}
diff --git a/src/devices/machine/sdlc.cpp b/src/devices/machine/sdlc.cpp
index e3cc8cc..870f8ab 100644
--- a/src/devices/machine/sdlc.cpp
+++ b/src/devices/machine/sdlc.cpp
@@ -282,7 +282,7 @@ void sdlc_logger_device::log_frame(bool partial) const
fcs |= std::uint16_t(m_buffer[frame_bytes - 1]) << (8 - residual_bits);
if (residual_bits)
fcs |= (std::uint16_t(m_buffer[frame_bytes]) & ((1U << residual_bits) - 1U)) << (16 - residual_bits);
- fcs = ~BITSWAP16(fcs, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
+ fcs = ~bitswap<16>(fcs, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
util::stream_format(msg, " FCS=%04X", fcs);
if (!is_frame_check_good())
util::stream_format(msg, " (expected %04X)", m_expected_fcs);
diff --git a/src/devices/machine/stvcd.cpp b/src/devices/machine/stvcd.cpp
index 87b3b9e..e3b0cef 100644
--- a/src/devices/machine/stvcd.cpp
+++ b/src/devices/machine/stvcd.cpp
@@ -100,7 +100,7 @@ int saturn_state::get_track_index(uint32_t fad)
int saturn_state::sega_cdrom_get_adr_control(cdrom_file *file, int track)
{
- return BITSWAP8(cdrom_get_adr_control(file, cur_track),3,2,1,0,7,6,5,4);
+ return bitswap<8>(cdrom_get_adr_control(file, cur_track),3,2,1,0,7,6,5,4);
}
void saturn_state::cr_standard_return(uint16_t cur_status)
diff --git a/src/devices/machine/tms6100.cpp b/src/devices/machine/tms6100.cpp
index d2fb40c..0728a51 100644
--- a/src/devices/machine/tms6100.cpp
+++ b/src/devices/machine/tms6100.cpp
@@ -182,7 +182,7 @@ void tms6100_device::handle_command(u8 cmd)
// M58819S reads serial data reversed
if (m_reverse_bits)
- m_sa = BITSWAP8(m_sa,0,1,2,3,4,5,6,7);
+ m_sa = bitswap<8>(m_sa,0,1,2,3,4,5,6,7);
}
else
{
diff --git a/src/devices/machine/z80sio.cpp b/src/devices/machine/z80sio.cpp
index ddf9511..efe83ac 100644
--- a/src/devices/machine/z80sio.cpp
+++ b/src/devices/machine/z80sio.cpp
@@ -1128,7 +1128,7 @@ void z80sio_channel::sync_tx_sr_empty()
LOGTX("%s() Channel %c Transmit FCS '%04x' m_wr5:%02x\n", FUNCNAME, 'A' + m_index, m_tx_crc, m_wr5);
// just for fun, SDLC sends the FCS inverted in reverse bit order
- uint16_t const fcs(BITSWAP16(m_tx_crc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
+ uint16_t const fcs(bitswap<16>(m_tx_crc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15));
tx_setup(((m_wr4 & WR4_SYNC_MODE_MASK) == WR4_SYNC_MODE_SDLC) ? ~fcs : fcs, 16, 0, false, true);
// set the underrun flag so it will send sync next time
diff --git a/src/devices/sound/astrocde.cpp b/src/devices/sound/astrocde.cpp
index 1e8349b..36b0f76 100644
--- a/src/devices/sound/astrocde.cpp
+++ b/src/devices/sound/astrocde.cpp
@@ -87,7 +87,7 @@ void astrocade_device::device_start()
/* generate a bitswap table for the noise */
for (i = 0; i < 256; i++)
- m_bitswap[i] = BITSWAP8(i, 0,1,2,3,4,5,6,7);
+ m_bitswap[i] = bitswap<8>(i, 0,1,2,3,4,5,6,7);
/* allocate a stream for output */
m_stream = stream_alloc(0, 1, clock());
diff --git a/src/devices/sound/tms5110.cpp b/src/devices/sound/tms5110.cpp
index 5f7ee0b..b7bef7f 100644
--- a/src/devices/sound/tms5110.cpp
+++ b/src/devices/sound/tms5110.cpp
@@ -1345,7 +1345,7 @@ void tmsprom_device::device_timer(emu_timer &timer, device_timer_id id, int para
if (ctrl & (1 << m_reset_bit))
m_address = 0;
- m_ctl_cb((offs_t)0, BITSWAP8(ctrl,0,0,0,0,m_ctl8_bit,
+ m_ctl_cb((offs_t)0, bitswap<8>(ctrl,0,0,0,0,m_ctl8_bit,
m_ctl4_bit,m_ctl2_bit,m_ctl1_bit));
m_pdc_cb((ctrl >> m_pdc_bit) & 0x01);
diff --git a/src/devices/video/ef9340_1.cpp b/src/devices/video/ef9340_1.cpp
index 484cc67..54c6f65 100644
--- a/src/devices/video/ef9340_1.cpp
+++ b/src/devices/video/ef9340_1.cpp
@@ -213,7 +213,7 @@ void ef9340_1_device::ef9341_write( uint8_t command, uint8_t b, uint8_t data )
if ( b >= 0xa0 )
{
- m_ef934x_ext_char_ram[ ( ( a & 0x80 ) << 3 ) | external_chargen_address( b, slice ) ] = BITSWAP8(m_ef9341.TA,0,1,2,3,4,5,6,7);
+ m_ef934x_ext_char_ram[ ( ( a & 0x80 ) << 3 ) | external_chargen_address( b, slice ) ] = bitswap<8>(m_ef9341.TA,0,1,2,3,4,5,6,7);
}
// Increment slice number
diff --git a/src/emu/emucore.h b/src/emu/emucore.h
index 1782ac8..b6d1e7b 100644
--- a/src/emu/emucore.h
+++ b/src/emu/emucore.h
@@ -255,6 +255,7 @@ template <typename T, typename U, typename... V> constexpr T bitswap(T val, U b,
return (BIT(val, b) << sizeof...(c)) | bitswap(val, c...);
}
+// explicit version that checks number of bit position arguments
template <unsigned B, typename T, typename... U> T bitswap(T val, U... b)
{
static_assert(sizeof...(b) == B, "wrong number of bits");
@@ -262,16 +263,6 @@ template <unsigned B, typename T, typename... U> T bitswap(T val, U... b)
return bitswap(val, b...);
}
-// explicit versions that check number of bit position arguments
-template <typename T, typename... U> constexpr T BITSWAP8(T val, U... b) { return bitswap<8U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP16(T val, U... b) { return bitswap<16U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP24(T val, U... b) { return bitswap<24U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP32(T val, U... b) { return bitswap<32U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP40(T val, U... b) { return bitswap<40U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP48(T val, U... b) { return bitswap<48U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP56(T val, U... b) { return bitswap<56U>(val, b...); }
-template <typename T, typename... U> constexpr T BITSWAP64(T val, U... b) { return bitswap<64U>(val, b...); }
-
//**************************************************************************
diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp
index a7336ef..8a13fd9 100644
--- a/src/mame/audio/seibu.cpp
+++ b/src/mame/audio/seibu.cpp
@@ -337,8 +337,8 @@ READ8_MEMBER(sei80bu_device::data_r)
if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02;
if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01;
- if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1);
- if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0);
+ if (BIT(a,13) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,3,2,0,1);
+ if (BIT(a, 8) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,2,3,1,0);
return src;
}
@@ -357,10 +357,10 @@ READ8_MEMBER(sei80bu_device::opcode_r)
if ( BIT(a,13) & ~BIT(a,6) & BIT(a,4)) src ^= 0x02;
if (~BIT(a,11) & BIT(a,9) & BIT(a,2)) src ^= 0x01;
- if (BIT(a,13) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,3,2,0,1);
- if (BIT(a, 8) & BIT(a,4)) src = BITSWAP8(src,7,6,5,4,2,3,1,0);
- if (BIT(a,12) & BIT(a,9)) src = BITSWAP8(src,7,6,4,5,3,2,1,0);
- if (BIT(a,11) & ~BIT(a,6)) src = BITSWAP8(src,6,7,5,4,3,2,1,0);
+ if (BIT(a,13) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,3,2,0,1);
+ if (BIT(a, 8) & BIT(a,4)) src = bitswap<8>(src,7,6,5,4,2,3,1,0);
+ if (BIT(a,12) & BIT(a,9)) src = bitswap<8>(src,7,6,4,5,3,2,1,0);
+ if (BIT(a,11) & ~BIT(a,6)) src = bitswap<8>(src,6,7,5,4,3,2,1,0);
return src;
}
@@ -410,7 +410,7 @@ void seibu_adpcm_device::decrypt()
{
for (int i = 0; i < m_base.length(); i++)
{
- m_base[i] = BITSWAP8(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
+ m_base[i] = bitswap<8>(m_base[i], 7, 5, 3, 1, 6, 4, 2, 0);
}
}
diff --git a/src/mame/drivers/24cdjuke.cpp b/src/mame/drivers/24cdjuke.cpp
index 4d1cd57..2d06f44 100644
--- a/src/mame/drivers/24cdjuke.cpp
+++ b/src/mame/drivers/24cdjuke.cpp
@@ -116,7 +116,7 @@ WRITE8_MEMBER(midcoin24cdjuke_state::digit_w)
{
uint16_t char_data = m_charset[((data & 0x60) << 1) | (data & 0x1f)];
- char_data = BITSWAP16(char_data, 13,11,9,15,14,10,12,8,7,6,5,4,3,2,1,0);
+ char_data = bitswap<16>(char_data, 13,11,9,15,14,10,12,8,7,6,5,4,3,2,1,0);
output().set_digit_value(offset, char_data ^ 0xffff);
}
diff --git a/src/mame/drivers/39in1.cpp b/src/mame/drivers/39in1.cpp
index 45e24a0..532b59d 100644
--- a/src/mame/drivers/39in1.cpp
+++ b/src/mame/drivers/39in1.cpp
@@ -1550,7 +1550,7 @@ void _39in1_state::machine_start()
for (i = 0; i < 0x80000; i += 2)
{
- ROM[i] = BITSWAP8(ROM[i],7,2,5,6,0,3,1,4) ^ BITSWAP8((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90;
+ ROM[i] = bitswap<8>(ROM[i],7,2,5,6,0,3,1,4) ^ bitswap<8>((i>>3)&0xf, 3,2,4,1,4,4,0,4) ^ 0x90;
}
pxa255_start();
@@ -1565,7 +1565,7 @@ MACHINE_START_MEMBER(_39in1_state,60in1)
{
if ((i%2)==0)
{
- ROM[i] = BITSWAP8(ROM[i],5,1,4,2,0,7,6,3)^BITSWAP8(i, 6,0,4,13,0,5,3,11);
+ ROM[i] = bitswap<8>(ROM[i],5,1,4,2,0,7,6,3)^bitswap<8>(i, 6,0,4,13,0,5,3,11);
}
}
diff --git a/src/mame/drivers/4enraya.cpp b/src/mame/drivers/4enraya.cpp
index b165007..8d6d41a 100644
--- a/src/mame/drivers/4enraya.cpp
+++ b/src/mame/drivers/4enraya.cpp
@@ -636,7 +636,7 @@ DRIVER_INIT_MEMBER(_4enraya_state, unkpacg)
// descramble rom
uint8_t *rom = memregion("maincpu")->base();
for (int i = 0x8000; i < 0xa000; i++)
- rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1);
+ rom[i] = bitswap<8>(rom[i], 7,6,5,4,3,2,0,1);
}
diff --git a/src/mame/drivers/8080bw.cpp b/src/mame/drivers/8080bw.cpp
index 8e22550..294be4b 100644
--- a/src/mame/drivers/8080bw.cpp
+++ b/src/mame/drivers/8080bw.cpp
@@ -3284,7 +3284,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,attackfc)
// swap a8/a9
for (int i = 0; i < len; i++)
- buffer[BITSWAP16(i, 15,14,13,12,11,10,8,9, 7,6,5,4,3,2,1,0)] = rom[i];
+ buffer[bitswap<16>(i, 15,14,13,12,11,10,8,9, 7,6,5,4,3,2,1,0)] = rom[i];
memcpy(rom, &buffer[0], len);
}
@@ -3419,7 +3419,7 @@ DRIVER_INIT_MEMBER(_8080bw_state,invmulti)
// decrypt rom
for (int i = 0; i < len; i++)
- dest[i] = BITSWAP8(src[(i & 0x100ff) | (BITSWAP8(i >> 8 & 0xff, 7,3,4,5,0,6,1,2) << 8)],0,6,5,7,4,3,1,2);
+ dest[i] = bitswap<8>(src[(i & 0x100ff) | (bitswap<8>(i >> 8 & 0xff, 7,3,4,5,0,6,1,2) << 8)],0,6,5,7,4,3,1,2);
membank("bank1")->configure_entries(0, 8, memregion("maincpu")->base(), 0x4000);
membank("bank1")->set_entry(0);
diff --git a/src/mame/drivers/acesp.cpp b/src/mame/drivers/acesp.cpp
index c74324a..b69928b 100644
--- a/src/mame/drivers/acesp.cpp
+++ b/src/mame/drivers/acesp.cpp
@@ -3856,13 +3856,13 @@ static void descramble_crystal( uint8_t* region, int start, int end, uint8_t ext
switch (i & 0x58)
{
case 0x00: // same as 0x08
- case 0x08: x = BITSWAP8( x^0xca , 3,2,1,0,7,4,6,5 ); break;
- case 0x10: x = BITSWAP8( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
- case 0x18: x = BITSWAP8( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
- case 0x40: x = BITSWAP8( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
- case 0x48: x = BITSWAP8( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
- case 0x50: x = BITSWAP8( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
- case 0x58: x = BITSWAP8( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
+ case 0x08: x = bitswap<8>( x^0xca , 3,2,1,0,7,4,6,5 ); break;
+ case 0x10: x = bitswap<8>( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
+ case 0x18: x = bitswap<8>( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
+ case 0x40: x = bitswap<8>( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
+ case 0x48: x = bitswap<8>( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
+ case 0x50: x = bitswap<8>( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
+ case 0x58: x = bitswap<8>( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
}
region[i] = x ^ extra_xor;
}
diff --git a/src/mame/drivers/aerofgt.cpp b/src/mame/drivers/aerofgt.cpp
index d6f4e54..47cd3a5 100644
--- a/src/mame/drivers/aerofgt.cpp
+++ b/src/mame/drivers/aerofgt.cpp
@@ -3027,7 +3027,7 @@ DRIVER_INIT_MEMBER(aerofgt_state, kickball)
uint8_t *src = memregion( "gfx2" )->base();
for (int i = 0;i < 0x80000;i++)
{
- src[i] = BITSWAP8(src[i], 7, 5, 6, 4, 3, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 5, 6, 4, 3, 2, 1, 0);
}
}
diff --git a/src/mame/drivers/airraid.cpp b/src/mame/drivers/airraid.cpp
index 018e149..8a85510 100644
--- a/src/mame/drivers/airraid.cpp
+++ b/src/mame/drivers/airraid.cpp
@@ -601,14 +601,14 @@ DRIVER_INIT_MEMBER(airraid_state,cshootere)
m_decrypted_opcodes[A] ^= 0x02;
if (BIT(A,9) || !BIT(A,5) || BIT(A,3))
- m_decrypted_opcodes[A] = BITSWAP8(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
+ m_decrypted_opcodes[A] = bitswap<8>(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
/* decode the data */
if (BIT(A,5))
rom[A] ^= 0x40;
if (BIT(A,9) || !BIT(A,5))
- rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
+ rom[A] = bitswap<8>(rom[A],7,6,1,4,3,2,5,0);
}
DRIVER_INIT_CALL(cshooter);
diff --git a/src/mame/drivers/alesis.cpp b/src/mame/drivers/alesis.cpp
index 4a18d1f..c7e9fc9 100644
--- a/src/mame/drivers/alesis.cpp
+++ b/src/mame/drivers/alesis.cpp
@@ -472,7 +472,7 @@ DRIVER_INIT_MEMBER(alesis_state,hr16)
uint8_t *orig = memregion("user1")->base();
for (i = 0; i < 0x8000; i++)
{
- ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
+ ROM[bitswap<16>(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i];
}
}
diff --git a/src/mame/drivers/altos5.cpp b/src/mame/drivers/altos5.cpp
index df6ccb1..08fcdf9 100644
--- a/src/mame/drivers/altos5.cpp
+++ b/src/mame/drivers/altos5.cpp
@@ -126,9 +126,9 @@ void altos5_state::setup_banks(uint8_t source)
// WPRT | template | dma bank / cpu bank
if (source == 1) // use DMA banks only if BUSACK is asserted
- offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 7, 6) << 4) & 0x1f0) ^ 0x100;
+ offs = ((bitswap<8>(m_port09, 0, 0, 0, 5, 1, 2, 7, 6) << 4) & 0x1f0) ^ 0x100;
else
- offs = ((BITSWAP8(m_port09, 0, 0, 0, 5, 1, 2, 4, 3) << 4) & 0x1f0) ^ 0x100;
+ offs = ((bitswap<8>(m_port09, 0, 0, 0, 5, 1, 2, 4, 3) << 4) & 0x1f0) ^ 0x100;
temp = offs;
if ((source == 2) || (temp != m_curr_bank))
diff --git a/src/mame/drivers/amaticmg.cpp b/src/mame/drivers/amaticmg.cpp
index d2cf7a9..bbf0e69 100644
--- a/src/mame/drivers/amaticmg.cpp
+++ b/src/mame/drivers/amaticmg.cpp
@@ -1055,7 +1055,7 @@ void amaticmg_state::encf(uint8_t ciphertext, int address, uint8_t &plaintext, i
int aux = address & 0xfff;
aux = aux ^ (aux>>6);
aux = ((aux<<6) | (aux>>6)) & 0xfff;
- uint8_t aux2 = BITSWAP8(aux, 9,10,4,1,6,0,7,3);
+ uint8_t aux2 = bitswap<8>(aux, 9,10,4,1,6,0,7,3);
aux2 ^= aux2>>4;
aux2 = (aux2<<4) | (aux2>>4);
ciphertext ^= ciphertext<<4;
diff --git a/src/mame/drivers/ampoker2.cpp b/src/mame/drivers/ampoker2.cpp
index e5da31e..f698d41 100644
--- a/src/mame/drivers/ampoker2.cpp
+++ b/src/mame/drivers/ampoker2.cpp
@@ -1392,7 +1392,7 @@ DRIVER_INIT_MEMBER(ampoker2_state, rabbitpk)
for (i = start; i < size; i++)
{
- rom[i] = BITSWAP8(rom[i], 1, 2, 5, 4, 3, 0, 7, 6) ^ dec_base[(i >> 2) & 0x1f];
+ rom[i] = bitswap<8>(rom[i], 1, 2, 5, 4, 3, 0, 7, 6) ^ dec_base[(i >> 2) & 0x1f];
}
}
diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp
index 98952ae..a57bea3 100644
--- a/src/mame/drivers/apc.cpp
+++ b/src/mame/drivers/apc.cpp
@@ -394,12 +394,12 @@ CH3_EXA == 0X3E ; CH-3 extended address (W)
READ8_MEMBER(apc_state::apc_dma_r)
{
- return m_dmac->read(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), 0xff);
+ return m_dmac->read(space, bitswap<8>(offset,7,6,5,4,2,1,0,3), 0xff);
}
WRITE8_MEMBER(apc_state::apc_dma_w)
{
- m_dmac->write(space, BITSWAP8(offset,7,6,5,4,2,1,0,3), data, 0xff);
+ m_dmac->write(space, bitswap<8>(offset,7,6,5,4,2,1,0,3), data, 0xff);
}
WRITE8_MEMBER(apc_state::apc_irq_ack_w)
diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp
index dcfde97..cd97f6e 100644
--- a/src/mame/drivers/apple2e.cpp
+++ b/src/mame/drivers/apple2e.cpp
@@ -743,7 +743,7 @@ void apple2e_state::machine_start()
// let's do that in the modern MAME way
for (int i=0; i<0x040000; i++)
{
- m_cec_remap[i] = BITSWAP8(m_cec_ptr[i], 0, 1, 2, 3, 4, 5, 6, 7);
+ m_cec_remap[i] = bitswap<8>(m_cec_ptr[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
// remap cec gfx1 rom
diff --git a/src/mame/drivers/aquarium.cpp b/src/mame/drivers/aquarium.cpp
index c4278c1..91d8032 100644
--- a/src/mame/drivers/aquarium.cpp
+++ b/src/mame/drivers/aquarium.cpp
@@ -68,7 +68,7 @@ WRITE8_MEMBER(aquarium_state::aquarium_watchdog_w)
WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
{
// uses bits ---x --xx
- data = BITSWAP8(data, 7, 6, 5, 2, 3, 1, 4, 0);
+ data = bitswap<8>(data, 7, 6, 5, 2, 3, 1, 4, 0);
//printf("aquarium bank %04x %04x\n", data, mem_mask);
// aquarium bank 0003 00ff - correct (title) 011
@@ -82,7 +82,7 @@ WRITE8_MEMBER(aquarium_state::aquarium_z80_bank_w)
uint8_t aquarium_state::aquarium_snd_bitswap( uint8_t scrambled_data )
{
- return BITSWAP8(scrambled_data, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(scrambled_data, 0, 1, 2, 3, 4, 5, 6, 7);
}
READ8_MEMBER(aquarium_state::aquarium_oki_r)
diff --git a/src/mame/drivers/arkanoid.cpp b/src/mame/drivers/arkanoid.cpp
index c4c7ae8..eb6ed5a 100644
--- a/src/mame/drivers/arkanoid.cpp
+++ b/src/mame/drivers/arkanoid.cpp
@@ -2116,12 +2116,12 @@ DRIVER_INIT_MEMBER(arkanoid_state,block2)
int srctile;
// combine these into a single swap..
- srctile = BITSWAP16(tile,15,14,13,12,
+ srctile = bitswap<16>(tile,15,14,13,12,
11,10,9,8,
7,5,6,3,
1,2,4,0);
- srctile = BITSWAP16(srctile,15,14,13,12,
+ srctile = bitswap<16>(srctile,15,14,13,12,
11,9,10,5,
7,6,8,4,
3,2,1,0);
diff --git a/src/mame/drivers/arsystems.cpp b/src/mame/drivers/arsystems.cpp
index 986b4aa..9bc03bd 100644
--- a/src/mame/drivers/arsystems.cpp
+++ b/src/mame/drivers/arsystems.cpp
@@ -896,7 +896,7 @@ void arcadia_amiga_state::generic_decode(const char *tag, int bit7, int bit6, in
/* only the low byte of ROMs are encrypted in these games */
for (i = 0; i < 0x20000/2; i++)
- rom[i] = BITSWAP16(rom[i], 15,14,13,12,11,10,9,8, bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0);
+ rom[i] = bitswap<16>(rom[i], 15,14,13,12,11,10,9,8, bit7,bit6,bit5,bit4,bit3,bit2,bit1,bit0);
#if 0
{
diff --git a/src/mame/drivers/astrof.cpp b/src/mame/drivers/astrof.cpp
index 5573fca..18d6789 100644
--- a/src/mame/drivers/astrof.cpp
+++ b/src/mame/drivers/astrof.cpp
@@ -453,7 +453,7 @@ READ8_MEMBER(astrof_state::afire_coin_prot_r)
READ8_MEMBER(astrof_state::tomahawk_protection_r)
{
/* flip the byte */
- return BITSWAP8(*m_tomahawk_protection, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(*m_tomahawk_protection, 0, 1, 2, 3, 4, 5, 6, 7);
}
diff --git a/src/mame/drivers/atarisy2.cpp b/src/mame/drivers/atarisy2.cpp
index 4739ae4..c33db51 100644
--- a/src/mame/drivers/atarisy2.cpp
+++ b/src/mame/drivers/atarisy2.cpp
@@ -296,7 +296,7 @@ WRITE16_MEMBER(atarisy2_state::bankselect_w)
};*/
int banknumber = ((data >> 10) & 0x3f) ^ 0x03;
- banknumber = BITSWAP16(banknumber, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 0, 3, 2);
+ banknumber = bitswap<16>(banknumber, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 1, 0, 3, 2);
if (offset)
m_rombank2->set_entry(banknumber);
diff --git a/src/mame/drivers/atvtrack.cpp b/src/mame/drivers/atvtrack.cpp
index 7a971b6..4592a98 100644
--- a/src/mame/drivers/atvtrack.cpp
+++ b/src/mame/drivers/atvtrack.cpp
@@ -438,7 +438,7 @@ void get_altera10ke_eab(u8* dst, u8 *pof, int eab)
for (u32 bit = 0; bit < 4096; bit++)
{
- u32 tbit = BITSWAP16(bit, 15, 14, 13, 12,
+ u32 tbit = bitswap<16>(bit, 15, 14, 13, 12,
9, 8, 7, 6, 5, 4, 3,
11, 10,
2, 1, 0);
@@ -471,8 +471,8 @@ void atvtrack_state::machine_reset()
{
u16 lword = tdata[i * 2 + 512] | (tdata[i * 2 + 513] << 8);
u16 hword = tdata[i * 2] | (tdata[i * 2 + 1] << 8);
- lword = BITSWAP16(lword, 7, 9, 0, 10, 3, 11, 4, 12, 2, 15, 1, 13, 6, 8, 5, 14);
- hword = BITSWAP16(hword, 5, 10, 7, 9, 6, 13, 3, 15, 2, 11, 1, 8, 0, 12, 4, 14);
+ lword = bitswap<16>(lword, 7, 9, 0, 10, 3, 11, 4, 12, 2, 15, 1, 13, 6, 8, 5, 14);
+ hword = bitswap<16>(hword, 5, 10, 7, 9, 6, 13, 3, 15, 2, 11, 1, 8, 0, 12, 4, 14);
dst[i * 4 + 0] = lword & 0xff;
dst[i * 4 + 1] = lword >> 8;
dst[i * 4 + 2] = hword & 0xff;
diff --git a/src/mame/drivers/backfire.cpp b/src/mame/drivers/backfire.cpp
index 4999e33..6a56f80 100644
--- a/src/mame/drivers/backfire.cpp
+++ b/src/mame/drivers/backfire.cpp
@@ -687,7 +687,7 @@ void backfire_state::descramble_sound()
{
uint32_t addr;
- addr = BITSWAP24 (x,23,22,21,0, 20,
+ addr = bitswap<24> (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
diff --git a/src/mame/drivers/berzerk.cpp b/src/mame/drivers/berzerk.cpp
index c87689a..d0d19c6 100644
--- a/src/mame/drivers/berzerk.cpp
+++ b/src/mame/drivers/berzerk.cpp
@@ -392,7 +392,7 @@ WRITE8_MEMBER(berzerk_state::magicram_w)
uint8_t shift_flop_output = (((uint16_t)m_last_shift_data << 8) | data) >> (m_magicram_control & 0x07);
if (m_magicram_control & 0x08)
- shift_flop_output = BITSWAP8(shift_flop_output, 0, 1, 2, 3, 4, 5, 6, 7);
+ shift_flop_output = bitswap<8>(shift_flop_output, 0, 1, 2, 3, 4, 5, 6, 7);
/* collision detection - AND gate output goes to the K pin of the flip-flop,
while J is LO, therefore, it only resets, never sets */
diff --git a/src/mame/drivers/beta.cpp b/src/mame/drivers/beta.cpp
index 61c417a..4d39750 100644
--- a/src/mame/drivers/beta.cpp
+++ b/src/mame/drivers/beta.cpp
@@ -217,7 +217,7 @@ WRITE8_MEMBER( beta_state::riot_pa_w )
// logerror("PA %02x\n", data);
/* display */
- m_segment = BITSWAP8(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
+ m_segment = bitswap<8>(data, 7, 3, 4, 1, 0, 2, 5, 6) & 0x7f;
m_led_refresh_timer->adjust(attotime::from_usec(70));
/* EPROM data */
diff --git a/src/mame/drivers/bfm_sc4.cpp b/src/mame/drivers/bfm_sc4.cpp
index 89e174d..8147019 100644
--- a/src/mame/drivers/bfm_sc4.cpp
+++ b/src/mame/drivers/bfm_sc4.cpp
@@ -493,7 +493,7 @@ WRITE8_MEMBER(bfm_sc45_state::mux_output2_w)
}
else
{
- uint8_t bf7segdata = BITSWAP8(data,0,7,6,5,4,3,2,1);
+ uint8_t bf7segdata = bitswap<8>(data,0,7,6,5,4,3,2,1);
output().set_digit_value(offset, bf7segdata);
}
}
diff --git a/src/mame/drivers/bigbord2.cpp b/src/mame/drivers/bigbord2.cpp
index 6a474cb..8486bdf 100644
--- a/src/mame/drivers/bigbord2.cpp
+++ b/src/mame/drivers/bigbord2.cpp
@@ -482,7 +482,7 @@ u8 bigbord2_state::crt8002(u8 ac_ra, u8 ac_chr, u8 ac_attr, uint16_t ac_cnt, boo
}
break;
case 1: // external mode
- gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7);
+ gfx = bitswap<8>(ac_chr, 0,1,2,3,4,5,6,7);
break;
case 2: // thin gfx
break;
diff --git a/src/mame/drivers/bking.cpp b/src/mame/drivers/bking.cpp
index 3b0bc07..b29f06c 100644
--- a/src/mame/drivers/bking.cpp
+++ b/src/mame/drivers/bking.cpp
@@ -42,7 +42,7 @@ WRITE8_MEMBER(bking_state::bking_sndnmi_enable_w)
WRITE8_MEMBER(bking_state::bking_soundlatch_w)
{
- m_soundlatch->write(space, offset, BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
+ m_soundlatch->write(space, offset, bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7));
}
WRITE8_MEMBER(bking_state::bking3_addr_l_w)
diff --git a/src/mame/drivers/blktiger.cpp b/src/mame/drivers/blktiger.cpp
index 5911e0a..5e35862 100644
--- a/src/mame/drivers/blktiger.cpp
+++ b/src/mame/drivers/blktiger.cpp
@@ -608,7 +608,7 @@ DRIVER_INIT_MEMBER(blktiger_state,blktigerb3)
{
int addr;
- addr = BITSWAP16(i, 15,14,13,12,11,10,9,8, 3,4,5,6, 7,2,1,0);
+ addr = bitswap<16>(i, 15,14,13,12,11,10,9,8, 3,4,5,6, 7,2,1,0);
buffer[i] = src[addr];
}
diff --git a/src/mame/drivers/bloodbro.cpp b/src/mame/drivers/bloodbro.cpp
index b9660c7..867c4ac 100644
--- a/src/mame/drivers/bloodbro.cpp
+++ b/src/mame/drivers/bloodbro.cpp
@@ -860,7 +860,7 @@ DRIVER_INIT_MEMBER(bloodbro_state,weststry)
{
/* sprite roms ws25 and ws26 have 2 bits swapped
there is also an address swap but that is currently handled in the video implementation */
- sprites[i] = BITSWAP8(sprites[i],7,6,4,5,3,2,1,0);
+ sprites[i] = bitswap<8>(sprites[i],7,6,4,5,3,2,1,0);
}
m_weststry_opl_irq = false;
diff --git a/src/mame/drivers/bob85.cpp b/src/mame/drivers/bob85.cpp
index b2e3fb2..c3447df 100644
--- a/src/mame/drivers/bob85.cpp
+++ b/src/mame/drivers/bob85.cpp
@@ -137,7 +137,7 @@ READ8_MEMBER(bob85_state::bob85_keyboard_r)
WRITE8_MEMBER(bob85_state::bob85_7seg_w)
{
- output().set_digit_value(offset, BITSWAP8( data,3,2,1,0,7,6,5,4 ));
+ output().set_digit_value(offset, bitswap<8>( data,3,2,1,0,7,6,5,4 ));
}
static ADDRESS_MAP_START( bob85_mem, AS_PROGRAM, 8, bob85_state )
diff --git a/src/mame/drivers/boogwing.cpp b/src/mame/drivers/boogwing.cpp
index f176751..de64ad3 100644
--- a/src/mame/drivers/boogwing.cpp
+++ b/src/mame/drivers/boogwing.cpp
@@ -97,7 +97,7 @@
READ16_MEMBER( boogwing_state::boogwing_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -106,7 +106,7 @@ READ16_MEMBER( boogwing_state::boogwing_protection_region_0_104_r )
WRITE16_MEMBER( boogwing_state::boogwing_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/bublbobl.cpp b/src/mame/drivers/bublbobl.cpp
index 516e058..cf0fa1f 100644
--- a/src/mame/drivers/bublbobl.cpp
+++ b/src/mame/drivers/bublbobl.cpp
@@ -2007,10 +2007,10 @@ DRIVER_INIT_MEMBER(bublbobl_state,dland)
int i;
uint8_t* src = memregion("gfx1")->base();
for (i = 0; i < 0x40000; i++)
- src[i] = BITSWAP8(src[i],7,6,5,4,0,1,2,3);
+ src[i] = bitswap<8>(src[i],7,6,5,4,0,1,2,3);
for (i = 0x40000; i < 0x80000; i++)
- src[i] = BITSWAP8(src[i],7,4,5,6,3,0,1,2);
+ src[i] = bitswap<8>(src[i],7,4,5,6,3,0,1,2);
DRIVER_INIT_CALL(common);
}
diff --git a/src/mame/drivers/by35.cpp b/src/mame/drivers/by35.cpp
index 974b279..61c582e 100644
--- a/src/mame/drivers/by35.cpp
+++ b/src/mame/drivers/by35.cpp
@@ -885,7 +885,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( by35_state::timer_as2888 )
{
m_snd_sel = m_snd_prom[offs];
// logerror("SndSel read %02x from PROM addr %02x\n",m_snd_sel, offs );
- m_snd_sel = BITSWAP8(m_snd_sel,0,1,2,3,4,5,6,7);
+ m_snd_sel = bitswap<8>(m_snd_sel,0,1,2,3,4,5,6,7);
m_snd_tone_gen = m_snd_sel;
// logerror("SndSel=%02x, Tone=%02x, Div=%02x\n",m_snd_sel, m_snd_tone_gen, m_snd_div);
diff --git a/src/mame/drivers/cabal.cpp b/src/mame/drivers/cabal.cpp
index c16319c..a51f037 100644
--- a/src/mame/drivers/cabal.cpp
+++ b/src/mame/drivers/cabal.cpp
@@ -156,12 +156,12 @@ ADDRESS_MAP_END
READ8_MEMBER(cabal_state::cabalbl_snd2_r)
{
- return BITSWAP8(m_sound_command2, 7,2,4,5,3,6,1,0);
+ return bitswap<8>(m_sound_command2, 7,2,4,5,3,6,1,0);
}
READ8_MEMBER(cabal_state::cabalbl_snd1_r)
{
- return BITSWAP8(m_sound_command1, 7,2,4,5,3,6,1,0);
+ return bitswap<8>(m_sound_command1, 7,2,4,5,3,6,1,0);
}
WRITE8_MEMBER(cabal_state::cabalbl_coin_w)
diff --git a/src/mame/drivers/camplynx.cpp b/src/mame/drivers/camplynx.cpp
index 0424213..f0c76d7 100644
--- a/src/mame/drivers/camplynx.cpp
+++ b/src/mame/drivers/camplynx.cpp
@@ -319,9 +319,9 @@ d0 = read from bank 4 */
m_bankdata = data;
data ^= 0x8c; // make all lines active high
// do writes
- m_wbyte = BITSWAP8(data, 0, 0, 0, 0, 4, 5, 6, 7) & 0x0f; // rearrange to 1,2,3,4
+ m_wbyte = bitswap<8>(data, 0, 0, 0, 0, 4, 5, 6, 7) & 0x0f; // rearrange to 1,2,3,4
// do reads
- uint8_t rbyte = BITSWAP8(data, 0, 0, 0, 0, 0, 1, 2, 3) & 0x0f; // rearrange to 0,1,2,4
+ uint8_t rbyte = bitswap<8>(data, 0, 0, 0, 0, 0, 1, 2, 3) & 0x0f; // rearrange to 0,1,2,4
if (BIT(rbyte, 1))
rbyte &= 0x07; // remove 4 if 1 selected (AND gate in IC82)
//printf("%s:%X:%X:%X\n", machine().describe_context(), data, rbyte, m_wbyte);
diff --git a/src/mame/drivers/cave.cpp b/src/mame/drivers/cave.cpp
index 7734583..babec0a 100644
--- a/src/mame/drivers/cave.cpp
+++ b/src/mame/drivers/cave.cpp
@@ -5200,7 +5200,7 @@ DRIVER_INIT_MEMBER(cave_state,mazinger)
{
int i;
for (i = 0; i < len; i++)
- buffer[i ^ 0xdf88] = src[BITSWAP24(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)];
+ buffer[i ^ 0xdf88] = src[bitswap<24>(i,23,22,21,20,19,9,7,3,15,4,17,14,18,2,16,5,11,8,6,13,1,10,12,0)];
memcpy(src, &buffer[0], len);
}
@@ -5262,7 +5262,7 @@ DRIVER_INIT_MEMBER(cave_state,pwrinst2j)
{
for(i = 0; i < len/2; i++)
{
- j = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0);
+ j = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7, 2,4,6,1,5,3, 0);
if(((j & 6) == 0) || ((j & 6) == 6))
j ^= 6;
buffer[j ^ 7] = (src[i] >> 4) | (src[i] << 4);
@@ -5315,7 +5315,7 @@ DRIVER_INIT_MEMBER(cave_state,sailormn)
{
int i;
for (i = 0; i < len; i++)
- buffer[i ^ 0x950c4] = src[BITSWAP24(i,23,22,21,20,15,10,12,6,11,1,13,3,16,17,2,5,14,7,18,8,4,19,9,0)];
+ buffer[i ^ 0x950c4] = src[bitswap<24>(i,23,22,21,20,15,10,12,6,11,1,13,3,16,17,2,5,14,7,18,8,4,19,9,0)];
memcpy(src, &buffer[0], len);
}
diff --git a/src/mame/drivers/cd2650.cpp b/src/mame/drivers/cd2650.cpp
index 95ffe91..86aaffb 100644
--- a/src/mame/drivers/cd2650.cpp
+++ b/src/mame/drivers/cd2650.cpp
@@ -167,7 +167,7 @@ uint32_t cd2650_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap
chr = m_p_videoram[mem] & 0x3f;
- gfx = m_p_chargen[(BITSWAP8(chr,7,6,2,1,0,3,4,5)<<3) | ra];
+ gfx = m_p_chargen[(bitswap<8>(chr,7,6,2,1,0,3,4,5)<<3) | ra];
}
/* Display a scanline of a character */
diff --git a/src/mame/drivers/centiped.cpp b/src/mame/drivers/centiped.cpp
index e02caf4..65cde93 100644
--- a/src/mame/drivers/centiped.cpp
+++ b/src/mame/drivers/centiped.cpp
@@ -2233,7 +2233,7 @@ DRIVER_INIT_MEMBER(centiped_state,multiped)
// descramble rom and put in maincpu region
for (int i = 0; i < 0x10000; i++)
- dest[0x10000 + (i ^ (~i << 4 & 0x1000) ^ (~i >> 3 & 0x400))] = BITSWAP8(src[BITSWAP16(i,15,14,13,1,8,11,4,7,10,5,6,9,12,0,3,2)],0,2,1,3,4,5,6,7);
+ dest[0x10000 + (i ^ (~i << 4 & 0x1000) ^ (~i >> 3 & 0x400))] = bitswap<8>(src[bitswap<16>(i,15,14,13,1,8,11,4,7,10,5,6,9,12,0,3,2)],0,2,1,3,4,5,6,7);
// (this can be removed when prg bankswitch is implemented)
memmove(dest+0x0000, dest+0x10000, 0x8000);
diff --git a/src/mame/drivers/chessmst.cpp b/src/mame/drivers/chessmst.cpp
index 84e21b1..6dddf2c 100644
--- a/src/mame/drivers/chessmst.cpp
+++ b/src/mame/drivers/chessmst.cpp
@@ -253,7 +253,7 @@ void chessmst_state::update_display()
for(int i=0; i<4; i++)
{
if (BIT(m_digit_matrix, i))
- output().set_indexed_value("digit", i, BITSWAP16(m_digit, 3,5,12,10,14,1,2,13,8,6,11,15,7,9,4,0) | (m_digit_dot << 16));
+ output().set_indexed_value("digit", i, bitswap<16>(m_digit, 3,5,12,10,14,1,2,13,8,6,11,15,7,9,4,0) | (m_digit_dot << 16));
}
}
diff --git a/src/mame/drivers/chesstrv.cpp b/src/mame/drivers/chesstrv.cpp
index 0e0434a..29bfdca 100644
--- a/src/mame/drivers/chesstrv.cpp
+++ b/src/mame/drivers/chesstrv.cpp
@@ -64,7 +64,7 @@ WRITE8_MEMBER( chesstrv_state::ram_w )
WRITE8_MEMBER( chesstrv_state::display_w )
{
- uint8_t seg_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ uint8_t seg_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
if(!(m_matrix & 0x01))
output().set_digit_value( 3, seg_data );
diff --git a/src/mame/drivers/chsuper.cpp b/src/mame/drivers/chsuper.cpp
index 801d490..6934ba0 100644
--- a/src/mame/drivers/chsuper.cpp
+++ b/src/mame/drivers/chsuper.cpp
@@ -528,9 +528,9 @@ DRIVER_INIT_MEMBER(chsuper_state,chmpnum)
j = i ^ (m_tilexor << 5);
- j = BITSWAP24(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
- j = BITSWAP24(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
- j = BITSWAP24(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
+ j = bitswap<24>(j,23,22,21,20,19,18,17,13, 15,14,16,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
+ j = bitswap<24>(j,23,22,21,20,19,18,17,14, 15,16,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
+ j = bitswap<24>(j,23,22,21,20,19,18,17,15, 16,14,13,12, 11,10,9,8, 7,6,5,4, 3,2,1,0);
buffer[j] = rom[i];
}
diff --git a/src/mame/drivers/cninja.cpp b/src/mame/drivers/cninja.cpp
index 6461434..2a5b960 100644
--- a/src/mame/drivers/cninja.cpp
+++ b/src/mame/drivers/cninja.cpp
@@ -85,7 +85,7 @@ WRITE16_MEMBER(cninja_state::cninja_pf34_control_w)
READ16_MEMBER( cninja_state::cninja_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -94,7 +94,7 @@ READ16_MEMBER( cninja_state::cninja_protection_region_0_104_r )
WRITE16_MEMBER( cninja_state::cninja_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -167,7 +167,7 @@ ADDRESS_MAP_END
READ16_MEMBER( cninja_state::sshangha_protection_region_8_146_r )
{
int real_address = 0x1a0000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -176,7 +176,7 @@ READ16_MEMBER( cninja_state::sshangha_protection_region_8_146_r )
WRITE16_MEMBER( cninja_state::sshangha_protection_region_8_146_w )
{
int real_address = 0x1a0000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -186,7 +186,7 @@ READ16_MEMBER( cninja_state::sshangha_protection_region_6_146_r )
// uint16_t realdat = deco16_60_prot_r(space,offset&0x3ff,mem_mask);
int real_address = 0x198000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
@@ -203,7 +203,7 @@ WRITE16_MEMBER( cninja_state::sshangha_protection_region_6_146_w )
int real_address = 0x198000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -273,7 +273,7 @@ ADDRESS_MAP_END
READ16_MEMBER( cninja_state::mutantf_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -282,7 +282,7 @@ READ16_MEMBER( cninja_state::mutantf_protection_region_0_146_r )
WRITE16_MEMBER( cninja_state::mutantf_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/cntsteer.cpp b/src/mame/drivers/cntsteer.cpp
index 20e63ae..79a3172 100644
--- a/src/mame/drivers/cntsteer.cpp
+++ b/src/mame/drivers/cntsteer.cpp
@@ -488,7 +488,7 @@ WRITE8_MEMBER(cntsteer_state::cntsteer_background_w)
/* checks area 0x2000-0x2fff with this address config. */
READ8_MEMBER(cntsteer_state::cntsteer_background_mirror_r)
{
- return m_videoram2[BITSWAP16(offset,15,14,13,12,5,4,3,2,1,0,11,10,9,8,7,6)];
+ return m_videoram2[bitswap<16>(offset,15,14,13,12,5,4,3,2,1,0,11,10,9,8,7,6)];
}
/*************************************
diff --git a/src/mame/drivers/coinmstr.cpp b/src/mame/drivers/coinmstr.cpp
index b95ad8d..8f1d297 100644
--- a/src/mame/drivers/coinmstr.cpp
+++ b/src/mame/drivers/coinmstr.cpp
@@ -1540,8 +1540,8 @@ DRIVER_INIT_MEMBER(coinmstr_state,coinmstr)
for(i = 0; i < length; i++)
{
- int adr = BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4);
- rom[i] = BITSWAP8(buf[adr],3,2,4,1,5,0,6,7);
+ int adr = bitswap<24>(i, 23,22,21,20,19,18,17,16,15, 14,8,7,2,5,12,10,9,11,13,3,6,0,1,4);
+ rom[i] = bitswap<8>(buf[adr],3,2,4,1,5,0,6,7);
}
}
diff --git a/src/mame/drivers/coolpool.cpp b/src/mame/drivers/coolpool.cpp
index 80cab47..ab09d05 100644
--- a/src/mame/drivers/coolpool.cpp
+++ b/src/mame/drivers/coolpool.cpp
@@ -1145,13 +1145,13 @@ DRIVER_INIT_MEMBER(coolpool_state,9ballsht)
hi = rom[a] >> 8;
lo = rom[a] & 0xff;
- nhi = BITSWAP8(hi,5,2,0,7,6,4,3,1) ^ 0x29;
+ nhi = bitswap<8>(hi,5,2,0,7,6,4,3,1) ^ 0x29;
if (hi & 0x01) nhi ^= 0x03;
if (hi & 0x10) nhi ^= 0xc1;
if (hi & 0x20) nhi ^= 0x40;
if (hi & 0x40) nhi ^= 0x12;
- nlo = BITSWAP8(lo,5,3,4,6,7,1,2,0) ^ 0x80;
+ nlo = bitswap<8>(lo,5,3,4,6,7,1,2,0) ^ 0x80;
if ((lo & 0x02) && (lo & 0x04)) nlo ^= 0x01;
if (lo & 0x04) nlo ^= 0x0c;
if (lo & 0x08) nlo ^= 0x10;
diff --git a/src/mame/drivers/cops.cpp b/src/mame/drivers/cops.cpp
index e1238dc..7a2af7b 100644
--- a/src/mame/drivers/cops.cpp
+++ b/src/mame/drivers/cops.cpp
@@ -200,7 +200,7 @@ uint32_t cops_state::screen_update( screen_device &screen, bitmap_ind16 &bitmap,
WRITE8_MEMBER(cops_state::cdrom_data_w)
{
const char *regs[4] = { "CMD", "PARAM", "WRITE", "CTRL" };
- m_cdrom_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ m_cdrom_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
uint8_t reg = ((m_cdrom_ctrl & 4) >> 1) | ((m_cdrom_ctrl & 8) >> 3);
if (LOG_CDROM) logerror("%s:cdrom_data_w(reg = %s, data = %02x)\n", machine().describe_context(), regs[reg & 0x03], m_cdrom_data);
}
@@ -647,7 +647,7 @@ WRITE8_MEMBER(cops_state::io1_w)
{
sprintf(output_name, "digit%d", i);
display_data = m_lcd_data_l | (m_lcd_data_h << 8);
- display_data = BITSWAP16(display_data, 4, 5, 12, 1, 0, 11, 10, 6, 7, 2, 9, 3, 15, 8, 14, 13);
+ display_data = bitswap<16>(display_data, 4, 5, 12, 1, 0, 11, 10, 6, 7, 2, 9, 3, 15, 8, 14, 13);
output().set_value(output_name, display_data);
}
}
@@ -757,7 +757,7 @@ WRITE_LINE_MEMBER(cops_state::via1_irq)
WRITE8_MEMBER(cops_state::via1_b_w)
{
- m_sn_data = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ m_sn_data = bitswap<8>(data,0,1,2,3,4,5,6,7);
if (m_sn_cb1)
{
m_sn->write(space,0,m_sn_data);
diff --git a/src/mame/drivers/cvs.cpp b/src/mame/drivers/cvs.cpp
index 8581b6b..2c65f6b 100644
--- a/src/mame/drivers/cvs.cpp
+++ b/src/mame/drivers/cvs.cpp
@@ -1572,7 +1572,7 @@ DRIVER_INIT_MEMBER(cvs_state,hunchbaka)
/* data lines D2 and D5 swapped */
for (offs = 0; offs < 0x7400; offs++)
- ROM[offs] = BITSWAP8(ROM[offs],7,6,2,4,3,5,1,0);
+ ROM[offs] = bitswap<8>(ROM[offs],7,6,2,4,3,5,1,0);
}
@@ -1638,7 +1638,7 @@ DRIVER_INIT_MEMBER(cvs_state,raiders)
/* data lines D1 and D6 swapped */
for (offs = 0; offs < 0x7400; offs++)
- ROM[offs] = BITSWAP8(ROM[offs],7,1,5,4,3,2,6,0);
+ ROM[offs] = bitswap<8>(ROM[offs],7,1,5,4,3,2,6,0);
/* patch out protection */
ROM[0x010a] = 0xc0;
diff --git a/src/mame/drivers/cybertnk.cpp b/src/mame/drivers/cybertnk.cpp
index 27893cc..666695f 100644
--- a/src/mame/drivers/cybertnk.cpp
+++ b/src/mame/drivers/cybertnk.cpp
@@ -982,7 +982,7 @@ DRIVER_INIT_MEMBER(cybertnk_state,cybertnk)
// reorder the data to simplify sprite drawing
// we draw 8 pixels at a time, each each nibble contains a pixel, however the original order of 32-bits (8 pixels)
// is along the lines of 04 15 26 37 which is awkward to use
- spr[x] = BITSWAP32(spr[x], 27,26,25,24, 19,18,17,16, 11,10,9,8, 3,2,1,0, 31,30,29,28, 23,22,21,20, 15,14,13,12, 7,6,5,4 );
+ spr[x] = bitswap<32>(spr[x], 27,26,25,24, 19,18,17,16, 11,10,9,8, 3,2,1,0, 31,30,29,28, 23,22,21,20, 15,14,13,12, 7,6,5,4 );
}
}
diff --git a/src/mame/drivers/dambustr.cpp b/src/mame/drivers/dambustr.cpp
index 9035159..ca7c004 100644
--- a/src/mame/drivers/dambustr.cpp
+++ b/src/mame/drivers/dambustr.cpp
@@ -220,7 +220,7 @@ DRIVER_INIT_MEMBER(dambustr_state,dambustr)
// Bit swap addresses
for(i=0; i<4096*4; i++) {
- rom[i] = usr[BITSWAP16(i,15,14,13,12, 4,10,9,8,7,6,5,3,11,2,1,0)];
+ rom[i] = usr[bitswap<16>(i,15,14,13,12, 4,10,9,8,7,6,5,3,11,2,1,0)];
};
// Swap program ROMs
@@ -233,9 +233,9 @@ DRIVER_INIT_MEMBER(dambustr_state,dambustr)
// Bit swap in $1000-$1fff and $4000-$5fff
for(i=0; i<0x1000; i++) {
- rom[0x1000+i] = BITSWAP8(rom[0x1000+i],7,6,5,1,3,2,4,0);
- rom[0x4000+i] = BITSWAP8(rom[0x4000+i],7,6,5,1,3,2,4,0);
- rom[0x5000+i] = BITSWAP8(rom[0x5000+i],7,6,5,1,3,2,4,0);
+ rom[0x1000+i] = bitswap<8>(rom[0x1000+i],7,6,5,1,3,2,4,0);
+ rom[0x4000+i] = bitswap<8>(rom[0x4000+i],7,6,5,1,3,2,4,0);
+ rom[0x5000+i] = bitswap<8>(rom[0x5000+i],7,6,5,1,3,2,4,0);
};
// Swap graphics ROMs
diff --git a/src/mame/drivers/darkmist.cpp b/src/mame/drivers/darkmist.cpp
index de42028..3329aae 100644
--- a/src/mame/drivers/darkmist.cpp
+++ b/src/mame/drivers/darkmist.cpp
@@ -336,7 +336,7 @@ void darkmist_state::decrypt_fgbgtiles(uint8_t* rom, int size)
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
- w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
+ w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@@ -345,7 +345,7 @@ void darkmist_state::decrypt_fgbgtiles(uint8_t* rom, int size)
/* address lines */
for (int i = 0;i < size;i++)
{
- rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13, 5,4,3,2, 12,11,10,9,8, 1,0, 7,6)];
+ rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13, 5,4,3,2, 12,11,10,9,8, 1,0, 7,6)];
}
}
@@ -368,7 +368,7 @@ void darkmist_state::decrypt_gfx()
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
- w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
+ w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@@ -377,7 +377,7 @@ void darkmist_state::decrypt_gfx()
/* address lines */
for (i = 0;i < size;i++)
{
- rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12, 3,2,1, 11,10,9,8, 0, 7,6,5,4)];
+ rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12, 3,2,1, 11,10,9,8, 0, 7,6,5,4)];
}
decrypt_fgbgtiles(memregion("bg_gfx")->base(), memregion("bg_gfx")->bytes());
@@ -394,7 +394,7 @@ void darkmist_state::decrypt_gfx()
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
- w1 = BITSWAP16(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
+ w1 = bitswap<16>(w1, 9,14,7,2, 6,8,3,15, 10,13,5,12, 0,11,4,1);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@@ -403,7 +403,7 @@ void darkmist_state::decrypt_gfx()
/* address lines */
for (i = 0;i < size;i++)
{
- rom[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
+ rom[i] = buf[bitswap<24>(i, 23,22,21,20,19,18,17,16,15,14, 12,11,10,9,8, 5,4,3, 13, 7,6, 1,0, 2)];
}
}
@@ -412,7 +412,7 @@ void darkmist_state::decrypt_snd()
uint8_t *ROM = memregion("t5182_z80")->base();
for (int i = 0x0000; i < 0x8000; i++)
- ROM[i] = BITSWAP8(ROM[i], 7, 1, 2, 3, 4, 5, 6, 0);
+ ROM[i] = bitswap<8>(ROM[i], 7, 1, 2, 3, 4, 5, 6, 0);
}
DRIVER_INIT_MEMBER(darkmist_state,darkmist)
@@ -441,8 +441,8 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
if((i & 0x220) != 0x200)
{
- p = BITSWAP8(p, 7,6,5,2,3,4,1,0);
- d = BITSWAP8(d, 7,6,5,2,3,4,1,0);
+ p = bitswap<8>(p, 7,6,5,2,3,4,1,0);
+ d = bitswap<8>(d, 7,6,5,2,3,4,1,0);
}
ROM[i] = d;
@@ -458,7 +458,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
for(i=0;i<len;i++)
{
- ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,7,6,5,4,3,15,14,13,12,9,8,2,1,11,10, 0)];
+ ROM[i]=buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,7,6,5,4,3,15,14,13,12,9,8,2,1,11,10, 0)];
}
@@ -467,7 +467,7 @@ DRIVER_INIT_MEMBER(darkmist_state,darkmist)
memcpy( &buffer[0], ROM, len );
for(i=0;i<len;i++)
{
- ROM[i]=buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,15 ,6,5,4,3,12,11,10,9,14,13,2,1,8,7 ,0 )];
+ ROM[i]=buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,15 ,6,5,4,3,12,11,10,9,14,13,2,1,8,7 ,0 )];
}
}
diff --git a/src/mame/drivers/datum.cpp b/src/mame/drivers/datum.cpp
index 4525617..cdeafa1 100644
--- a/src/mame/drivers/datum.cpp
+++ b/src/mame/drivers/datum.cpp
@@ -161,7 +161,7 @@ WRITE8_MEMBER( datum_state::pa_w )
data ^= 0xff;
if (m_keydata > 3)
{
- output().set_digit_value(m_keydata, BITSWAP8(data & 0x7f, 7, 0, 5, 6, 4, 2, 1, 3));
+ output().set_digit_value(m_keydata, bitswap<8>(data & 0x7f, 7, 0, 5, 6, 4, 2, 1, 3));
m_keydata = 0;
}
@@ -171,7 +171,7 @@ WRITE8_MEMBER( datum_state::pa_w )
// select keyboard row, select a digit
WRITE8_MEMBER( datum_state::pb_w )
{
- m_keydata = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 15;
+ m_keydata = bitswap<8>(data, 7, 6, 5, 4, 0, 1, 2, 3) & 15;
return;
}
diff --git a/src/mame/drivers/dblewing.cpp b/src/mame/drivers/dblewing.cpp
index bf8a806..8ca06f2 100644
--- a/src/mame/drivers/dblewing.cpp
+++ b/src/mame/drivers/dblewing.cpp
@@ -148,7 +148,7 @@ uint32_t dblewing_state::screen_update_dblewing(screen_device &screen, bitmap_in
READ16_MEMBER( dblewing_state::wf_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -157,7 +157,7 @@ READ16_MEMBER( dblewing_state::wf_protection_region_0_104_r )
WRITE16_MEMBER( dblewing_state::wf_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/ddragon.cpp b/src/mame/drivers/ddragon.cpp
index 6af28a9..9aad910 100644
--- a/src/mame/drivers/ddragon.cpp
+++ b/src/mame/drivers/ddragon.cpp
@@ -231,7 +231,7 @@ WRITE8_MEMBER(darktowr_state::darktowr_mcu_bank_w)
if (offset == 0x1400 || offset == 0)
{
- uint8_t const value(BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
+ uint8_t const value(bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7));
m_mcu->pb_w(space, 0, value);
logerror("MCU PORT 1 -> %04x (from %04x)\n", value, data);
}
@@ -2116,27 +2116,27 @@ DRIVER_INIT_MEMBER(toffy_state, toffy)
rom = memregion("maincpu")->base();
length = memregion("maincpu")->bytes();
for (i = 0; i < length; i++)
- rom[i] = BITSWAP8(rom[i], 6,7,5,4,3,2,1,0);
+ rom[i] = bitswap<8>(rom[i], 6,7,5,4,3,2,1,0);
/* and the fg gfx ... */
rom = memregion("gfx1")->base();
length = memregion("gfx1")->bytes();
for (i = 0; i < length; i++)
- rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0);
+ rom[i] = bitswap<8>(rom[i], 7,6,5,3,4,2,1,0);
/* and the sprites gfx */
rom = memregion("gfx2")->base();
length = memregion("gfx2")->bytes();
for (i = 0; i < length; i++)
- rom[i] = BITSWAP8(rom[i], 7,6,5,4,3,2,0,1);
+ rom[i] = bitswap<8>(rom[i], 7,6,5,4,3,2,0,1);
/* and the bg gfx */
rom = memregion("gfx3")->base();
length = memregion("gfx3")->bytes();
for (i = 0; i < length / 2; i++)
{
- rom[i + 0*length/2] = BITSWAP8(rom[i + 0*length/2], 7,6,1,4,3,2,5,0);
- rom[i + 1*length/2] = BITSWAP8(rom[i + 1*length/2], 7,6,2,4,3,5,1,0);
+ rom[i + 0*length/2] = bitswap<8>(rom[i + 0*length/2], 7,6,1,4,3,2,5,0);
+ rom[i + 1*length/2] = bitswap<8>(rom[i + 1*length/2], 7,6,2,4,3,5,1,0);
}
/* should the sound rom be bitswapped too? */
diff --git a/src/mame/drivers/de_2.cpp b/src/mame/drivers/de_2.cpp
index c3e0dc5..1a458e8 100644
--- a/src/mame/drivers/de_2.cpp
+++ b/src/mame/drivers/de_2.cpp
@@ -288,7 +288,7 @@ WRITE8_MEMBER( de_2_state::dig1_w )
m_segment2 |= 0x30000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
@@ -299,7 +299,7 @@ WRITE8_MEMBER( de_2_state::type2alpha3_dig1_w )
m_segment2 |= 0x20000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
@@ -310,7 +310,7 @@ WRITE8_MEMBER( de_2_state::alpha3_dig1_w )
m_segment2 |= 0x20000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
@@ -332,7 +332,7 @@ WRITE8_MEMBER( de_2_state::pia2c_pa_w )
m_segment1 |= 0x10000;
if ((m_segment1 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment1 |= 0x40000;
}
}
@@ -343,7 +343,7 @@ WRITE8_MEMBER( de_2_state::pia2c_pb_w )
m_segment1 |= 0x20000;
if ((m_segment1 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment1 |= 0x40000;
}
}
@@ -383,7 +383,7 @@ WRITE8_MEMBER( de_2_state::type2alpha3_pia34_pa_w )
m_segment2 |= 0x10000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
@@ -394,7 +394,7 @@ WRITE8_MEMBER( de_2_state::alpha3_pia34_pa_w )
m_segment2 |= 0x10000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
diff --git a/src/mame/drivers/de_3.cpp b/src/mame/drivers/de_3.cpp
index 4086fab..1101e44 100644
--- a/src/mame/drivers/de_3.cpp
+++ b/src/mame/drivers/de_3.cpp
@@ -211,9 +211,9 @@ WRITE8_MEMBER( de_3_state::dig1_w )
// if ((m_segment2 & 0x70000) == 0x30000)
// {
// if(m_is_alpha3) // Alphanumeric type 2 uses 7 segment LEDs on the bottom row, type 3 uses 14 segment LEDs
-// output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
// else
-// output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
+// output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 11, 15, 12, 10, 8, 14, 13, 9, 7, 6, 5, 4, 3, 2, 1, 0));
// m_segment2 |= 0x40000;
// }
}
@@ -246,7 +246,7 @@ WRITE8_MEMBER( de_3_state::pia2c_pa_w )
// m_segment1 |= 0x10000;
// if ((m_segment1 & 0x70000) == 0x30000)
// {
-// output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
// m_segment1 |= 0x40000;
// }
}
@@ -278,7 +278,7 @@ WRITE8_MEMBER( de_3_state::pia2c_pb_w )
// m_segment1 |= 0x20000;
// if ((m_segment1 & 0x70000) == 0x30000)
// {
-// output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
// m_segment1 |= 0x40000;
// }
}
@@ -312,7 +312,7 @@ WRITE8_MEMBER( de_3_state::pia34_pa_w )
// m_segment2 |= 0x10000;
// if ((m_segment2 & 0x70000) == 0x30000)
// {
-// output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+// output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
// m_segment2 |= 0x40000;
// }
}
diff --git a/src/mame/drivers/deco156.cpp b/src/mame/drivers/deco156.cpp
index 3cb1cdd..7464130 100644
--- a/src/mame/drivers/deco156.cpp
+++ b/src/mame/drivers/deco156.cpp
@@ -647,7 +647,7 @@ void deco156_state::descramble_sound( const char *tag )
{
uint32_t addr;
- addr = BITSWAP24 (x,23,22,21,0, 20,
+ addr = bitswap<24> (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
diff --git a/src/mame/drivers/deco32.cpp b/src/mame/drivers/deco32.cpp
index c0f59bd..a561781 100644
--- a/src/mame/drivers/deco32.cpp
+++ b/src/mame/drivers/deco32.cpp
@@ -670,7 +670,7 @@ ADDRESS_MAP_END
READ16_MEMBER( deco32_state::ioprot_r )
{
offs_t real_address = 0 + (offset *2);
- offs_t deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ offs_t deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
return m_ioprot->read_data( deco146_addr, mem_mask, cs );
@@ -679,7 +679,7 @@ READ16_MEMBER( deco32_state::ioprot_r )
WRITE16_MEMBER( deco32_state::ioprot_w )
{
offs_t real_address = 0 + (offset *2);
- offs_t deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ offs_t deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_ioprot->write_data( space, deco146_addr, data, mem_mask, cs );
@@ -760,7 +760,7 @@ WRITE_LINE_MEMBER( nslasher_state::tattass_sound_irq_w )
{
uint8_t data = m_ioprot->soundlatch_r(machine().dummy_space(), 0);
// Swap bits 0 and 3 to correct for design error from BSMT schematic
- data = BITSWAP8(data, 7, 6, 5, 4, 0, 2, 1, 3);
+ data = bitswap<8>(data, 7, 6, 5, 4, 0, 2, 1, 3);
m_decobsmt->bsmt_comms_w(machine().dummy_space(), 0, data);
}
}
diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp
index f828fa9..3a6051e 100644
--- a/src/mame/drivers/deco_mlc.cpp
+++ b/src/mame/drivers/deco_mlc.cpp
@@ -273,7 +273,7 @@ WRITE32_MEMBER( deco_mlc_state::mlc_spriteram_w )
READ16_MEMBER( deco_mlc_state::sh96_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -282,7 +282,7 @@ READ16_MEMBER( deco_mlc_state::sh96_protection_region_0_146_r )
WRITE16_MEMBER( deco_mlc_state::sh96_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -887,7 +887,7 @@ void deco_mlc_state::descramble_sound( )
{
uint32_t addr;
- addr = BITSWAP24 (x,23,22,21,0, 20,
+ addr = bitswap<24> (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
diff --git a/src/mame/drivers/decocass.cpp b/src/mame/drivers/decocass.cpp
index dbe3192..dbed82b 100644
--- a/src/mame/drivers/decocass.cpp
+++ b/src/mame/drivers/decocass.cpp
@@ -945,7 +945,7 @@ PALETTE_INIT_MEMBER(decocass_state, decocass)
for (i = 0; i < 32; i++)
{
palette.set_pen_indirect(i, i);
- palette.set_pen_indirect(32+i, BITSWAP8(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));
}
}
diff --git a/src/mame/drivers/didact.cpp b/src/mame/drivers/didact.cpp
index 7258d24..917350d 100644
--- a/src/mame/drivers/didact.cpp
+++ b/src/mame/drivers/didact.cpp
@@ -268,7 +268,7 @@ WRITE8_MEMBER( md6802_state::pia2_kbB_w )
// LOG("--->%s(%02x)\n", FUNCNAME, data);
/* Store the segment pattern but do not lit up the digit here, done by pulling the correct cathode low on Port A */
- m_segments = BITSWAP8(data, 0, 4, 5, 3, 2, 1, 7, 6);
+ m_segments = bitswap<8>(data, 0, 4, 5, 3, 2, 1, 7, 6);
}
WRITE_LINE_MEMBER( md6802_state::pia2_ca2_w )
diff --git a/src/mame/drivers/dietgo.cpp b/src/mame/drivers/dietgo.cpp
index 8321a56..fb71b27 100644
--- a/src/mame/drivers/dietgo.cpp
+++ b/src/mame/drivers/dietgo.cpp
@@ -37,7 +37,7 @@ PAL16R6A 11H
READ16_MEMBER( dietgo_state::dietgo_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -46,7 +46,7 @@ READ16_MEMBER( dietgo_state::dietgo_protection_region_0_104_r )
WRITE16_MEMBER( dietgo_state::dietgo_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/digel804.cpp b/src/mame/drivers/digel804.cpp
index 9537883..cd52cf4 100644
--- a/src/mame/drivers/digel804.cpp
+++ b/src/mame/drivers/digel804.cpp
@@ -315,7 +315,7 @@ READ8_MEMBER( digel804_state::ip46 ) // keypad read
logerror("Digel804: returning %02X for port 46 keypad read\n", kbd);
#endif
- return BITSWAP8(kbd,7,6,5,4,1,0,3,2); // verified from schematics
+ return bitswap<8>(kbd,7,6,5,4,1,0,3,2); // verified from schematics
}
WRITE8_MEMBER( digel804_state::op46 )
diff --git a/src/mame/drivers/divebomb.cpp b/src/mame/drivers/divebomb.cpp
index bb1bcfd..0668f08 100644
--- a/src/mame/drivers/divebomb.cpp
+++ b/src/mame/drivers/divebomb.cpp
@@ -251,7 +251,7 @@ ADDRESS_MAP_END
WRITE8_MEMBER(divebomb_state::rozcpu_bank_w)
{
- uint32_t bank = BITSWAP8(data, 4, 5, 6, 7, 3, 2, 1, 0) >> 4;
+ uint32_t bank = bitswap<8>(data, 4, 5, 6, 7, 3, 2, 1, 0) >> 4;
m_bank1->set_entry(bank);
if (data & 0x0f)
diff --git a/src/mame/drivers/dkong.cpp b/src/mame/drivers/dkong.cpp
index 0634835..53e95b3 100644
--- a/src/mame/drivers/dkong.cpp
+++ b/src/mame/drivers/dkong.cpp
@@ -1655,8 +1655,8 @@ void dkong_state::braze_decrypt_rom(uint8_t *dest)
{
oldbyte = ROM[mem];
- newmem = ((BITSWAP8((mem >> 8),7,2,3,1,0,6,4,5))<<8) | (mem & 0xff);
- newbyte = BITSWAP8(oldbyte, 1,4,5,7,6,0,3,2);
+ newmem = ((bitswap<8>((mem >> 8),7,2,3,1,0,6,4,5))<<8) | (mem & 0xff);
+ newbyte = bitswap<8>(oldbyte, 1,4,5,7,6,0,3,2);
dest[newmem] = newbyte;
}
@@ -3248,7 +3248,7 @@ void dkong_state::drakton_decrypt_rom(uint8_t mod, int offs, int *bs)
PAL10H8 driven by the counter. */
newbyte = (oldbyte & mod) | (~oldbyte & ~mod);
- newbyte = BITSWAP8(newbyte, bs[0], bs[1], bs[2], bs[3], bs[4], bs[5], bs[6], bs[7]);
+ newbyte = bitswap<8>(newbyte, bs[0], bs[1], bs[2], bs[3], bs[4], bs[5], bs[6], bs[7]);
ROM[mem + offs] = newbyte;
}
diff --git a/src/mame/drivers/dreambal.cpp b/src/mame/drivers/dreambal.cpp
index 3e0e571..ef4899e 100644
--- a/src/mame/drivers/dreambal.cpp
+++ b/src/mame/drivers/dreambal.cpp
@@ -96,7 +96,7 @@ uint32_t dreambal_state::screen_update_dreambal(screen_device &screen, bitmap_in
READ16_MEMBER( dreambal_state::dreambal_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -105,7 +105,7 @@ READ16_MEMBER( dreambal_state::dreambal_protection_region_0_104_r )
WRITE16_MEMBER( dreambal_state::dreambal_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/dynax.cpp b/src/mame/drivers/dynax.cpp
index dc4ec3a..6d06ce3 100644
--- a/src/mame/drivers/dynax.cpp
+++ b/src/mame/drivers/dynax.cpp
@@ -317,9 +317,9 @@ void dynax_state::hnoridur_palette_update(offs_t offset)
{
int x = (m_palette_ram[256 * m_palbank + offset] << 8) + m_palette_ram[256 * m_palbank + offset + 16 * 256];
/* The bits are in reverse order! */
- int r = BITSWAP8((x >> 0) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int g = BITSWAP8((x >> 5) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int b = BITSWAP8((x >> 10) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
+ 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);
m_palette->set_pen_color(256 * m_palbank + offset, pal5bit(r), pal5bit(g), pal5bit(b));
}
@@ -5345,7 +5345,7 @@ DRIVER_INIT_MEMBER(dynax_state,blktouch)
for (i = 0; i < 0x90000; i++)
{
- src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
}
@@ -5353,7 +5353,7 @@ DRIVER_INIT_MEMBER(dynax_state,blktouch)
for (i = 0; i < 0xc0000; i++)
{
- src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
}
}
@@ -5387,7 +5387,7 @@ DRIVER_INIT_MEMBER(dynax_state,maya)
std::vector<uint8_t> rom(0xc0000);
memcpy(&rom[0], gfx, 0xc0000);
for (i = 0; i < 0xc0000; i++)
- gfx[i] = rom[BITSWAP24(i, 23, 22, 21, 20, 19, 18, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)];
+ gfx[i] = rom[bitswap<24>(i, 23, 22, 21, 20, 19, 18, 14, 15, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)];
}
}
@@ -5404,7 +5404,7 @@ DRIVER_INIT_MEMBER(dynax_state,mayac)
std::vector<uint8_t> rom(0xc0000);
memcpy(&rom[0], gfx, 0xc0000);
for (i = 0; i < 0xc0000; i++)
- gfx[i] = rom[BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 14, 16, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)];
+ gfx[i] = rom[bitswap<24>(i, 23, 22, 21, 20, 19, 18, 17, 14, 16, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0)];
}
}
@@ -6324,7 +6324,7 @@ DRIVER_INIT_MEMBER(dynax_state,mjelct3)
memcpy(&rom1[0], rom, size);
for (i = 0; i < size; i++)
- rom[i] = BITSWAP8(rom1[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8, 1,6,5,4,3,2,7, 0)], 7,6, 1,4,3,2,5,0);
+ rom[i] = bitswap<8>(rom1[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8, 1,6,5,4,3,2,7, 0)], 7,6, 1,4,3,2,5,0);
}
DRIVER_INIT_MEMBER(dynax_state,mjelct3a)
diff --git a/src/mame/drivers/eacc.cpp b/src/mame/drivers/eacc.cpp
index ee95ce8..416d4fe 100644
--- a/src/mame/drivers/eacc.cpp
+++ b/src/mame/drivers/eacc.cpp
@@ -218,7 +218,7 @@ WRITE8_MEMBER( eacc_state::eacc_segment_w )
{
for (i = 3; i < 7; i++)
if (BIT(m_digit, i))
- output().set_digit_value(i, BITSWAP8(data, 7, 0, 1, 4, 5, 6, 2, 3));
+ output().set_digit_value(i, bitswap<8>(data, 7, 0, 1, 4, 5, 6, 2, 3));
}
}
}
diff --git a/src/mame/drivers/ecoinf3.cpp b/src/mame/drivers/ecoinf3.cpp
index 65de231..2a990dc 100644
--- a/src/mame/drivers/ecoinf3.cpp
+++ b/src/mame/drivers/ecoinf3.cpp
@@ -351,7 +351,7 @@ static const uint16_t ecoin_charset[]=
static uint32_t set_display(uint32_t segin)
{
- return BITSWAP32(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
+ return bitswap<32>(segin, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,11,9,15,13,12,8,10,14,7,6,5,4,3,2,1,0);
}
void ecoinf3_state::update_display()
diff --git a/src/mame/drivers/ecoinfr.cpp b/src/mame/drivers/ecoinfr.cpp
index c92704d..c72a126 100644
--- a/src/mame/drivers/ecoinfr.cpp
+++ b/src/mame/drivers/ecoinfr.cpp
@@ -323,7 +323,7 @@ WRITE8_MEMBER(ecoinfr_state::ec_port0d_out_cred_data_w)
{
if (m_credsel!=0xff)
{
- uint8_t bf7segdata = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ uint8_t bf7segdata = bitswap<8>(data,7,0,1,2,3,4,5,6);
output().set_digit_value(m_credsel+8, bf7segdata);
}
}
@@ -336,7 +336,7 @@ WRITE8_MEMBER(ecoinfr_state::ec_port0f_out_bank_segdata_w)
{
if (m_banksel!=0xff)
{
- uint8_t bf7segdata = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ uint8_t bf7segdata = bitswap<8>(data,7,0,1,2,3,4,5,6);
output().set_digit_value(m_banksel, bf7segdata);
}
}
diff --git a/src/mame/drivers/elwro800.cpp b/src/mame/drivers/elwro800.cpp
index db006dc..43e2cc8 100644
--- a/src/mame/drivers/elwro800.cpp
+++ b/src/mame/drivers/elwro800.cpp
@@ -129,7 +129,7 @@ void elwro800_state::elwro800jr_mmu_w(uint8_t data)
uint8_t cs;
uint8_t ls175;
- ls175 = BITSWAP8(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f;
+ ls175 = bitswap<8>(data, 7, 6, 5, 4, 4, 5, 7, 6) & 0x0f;
cs = prom[((0x0000 >> 10) | (ls175 << 6)) & 0x1ff];
if (!BIT(cs,0))
diff --git a/src/mame/drivers/enigma2.cpp b/src/mame/drivers/enigma2.cpp
index 7d979fe..910adba 100644
--- a/src/mame/drivers/enigma2.cpp
+++ b/src/mame/drivers/enigma2.cpp
@@ -401,7 +401,7 @@ WRITE8_MEMBER(enigma2_state::sound_data_w)
READ8_MEMBER(enigma2_state::sound_latch_r)
{
- return BITSWAP8(m_sound_latch,0,1,2,3,4,5,6,7);
+ return bitswap<8>(m_sound_latch,0,1,2,3,4,5,6,7);
}
@@ -700,7 +700,7 @@ DRIVER_INIT_MEMBER(enigma2_state,enigma2)
for(i = 0; i < 0x2000; i++)
{
- rom[i] = BITSWAP8(rom[i],4,5,6,0,7,1,3,2);
+ rom[i] = bitswap<8>(rom[i],4,5,6,0,7,1,3,2);
}
}
diff --git a/src/mame/drivers/epos.cpp b/src/mame/drivers/epos.cpp
index 7b8a0c2..8f95c06 100644
--- a/src/mame/drivers/epos.cpp
+++ b/src/mame/drivers/epos.cpp
@@ -740,19 +740,19 @@ DRIVER_INIT_MEMBER(epos_state,dealer)
/* Key 0 */
for (A = 0; A < 0x8000; A++)
- rom[A] = BITSWAP8(rom[A] ^ 0xbd, 2,6,4,0,5,7,1,3 );
+ rom[A] = bitswap<8>(rom[A] ^ 0xbd, 2,6,4,0,5,7,1,3 );
/* Key 1 */
for (A = 0; A < 0x8000; A++)
- rom[A + 0x10000] = BITSWAP8(rom[A], 7,5,4,6,3,2,1,0 );
+ rom[A + 0x10000] = bitswap<8>(rom[A], 7,5,4,6,3,2,1,0 );
/* Key 2 */
for (A = 0; A < 0x8000; A++)
- rom[A + 0x20000] = BITSWAP8(rom[A] ^ 1, 7,6,5,4,3,0,2,1 );
+ rom[A + 0x20000] = bitswap<8>(rom[A] ^ 1, 7,6,5,4,3,0,2,1 );
/* Key 3 */
for (A = 0; A < 0x8000; A++)
- rom[A + 0x30000] = BITSWAP8(rom[A] ^ 1, 7,5,4,6,3,0,2,1 );
+ rom[A + 0x30000] = bitswap<8>(rom[A] ^ 1, 7,5,4,6,3,0,2,1 );
/*
there is not enough data to determine key 3.
diff --git a/src/mame/drivers/et3400.cpp b/src/mame/drivers/et3400.cpp
index e3d140c..5d3553f 100644
--- a/src/mame/drivers/et3400.cpp
+++ b/src/mame/drivers/et3400.cpp
@@ -92,7 +92,7 @@ template<int digit>
WRITE8_MEMBER(et3400_state::led_w)
{
/* This computer sets each segment, one at a time. */
- uint8_t segdata = BITSWAP8(~data, 7, 0, 1, 2, 3, 4, 5, 6);
+ uint8_t segdata = bitswap<8>(~data, 7, 0, 1, 2, 3, 4, 5, 6);
output().set_digit_value(digit, segdata);
}
diff --git a/src/mame/drivers/ettrivia.cpp b/src/mame/drivers/ettrivia.cpp
index 494242b..cc80a38 100644
--- a/src/mame/drivers/ettrivia.cpp
+++ b/src/mame/drivers/ettrivia.cpp
@@ -262,7 +262,7 @@ PALETTE_INIT_MEMBER(ettrivia_state, ettrivia)
bit1 = (color_prom[i+0x100] >> 1) & 0x01;
b = combine_2_weights(weights, bit0, bit1);
- palette.set_pen_color(BITSWAP8(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/drivers/eva.cpp b/src/mame/drivers/eva.cpp
index fe290dd..c7681d9 100644
--- a/src/mame/drivers/eva.cpp
+++ b/src/mame/drivers/eva.cpp
@@ -123,7 +123,7 @@ WRITE16_MEMBER(eva_state::eva11_write_o)
READ8_MEMBER(eva_state::eva11_read_k)
{
// K84: TMS5100 CTL81(O30)
- u8 ctl = BITSWAP8(m_tms5100->ctl_r(space, 0),7,6,5,4,3,0,1,2) & 0xc;
+ u8 ctl = bitswap<8>(m_tms5100->ctl_r(space, 0),7,6,5,4,3,0,1,2) & 0xc;
// TODO: sensors
diff --git a/src/mame/drivers/excali64.cpp b/src/mame/drivers/excali64.cpp
index a9bc490..c538655 100644
--- a/src/mame/drivers/excali64.cpp
+++ b/src/mame/drivers/excali64.cpp
@@ -524,7 +524,7 @@ MC6845_UPDATE_ROW( excali64_state::update_row )
if (h > 5)
h = 0; // keep us in bounds
// hires definition - pixels are opposite order to characters
- gfx = BITSWAP8(m_p_hiresram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7);
+ gfx = bitswap<8>(m_p_hiresram[(h << 12) | (chr<<4) | ra], 0, 1, 2, 3, 4, 5, 6, 7);
}
else
gfx = m_p_chargen[(chr<<4) | ra]; // normal character
diff --git a/src/mame/drivers/expro02.cpp b/src/mame/drivers/expro02.cpp
index 0ff353a..5b909c2 100644
--- a/src/mame/drivers/expro02.cpp
+++ b/src/mame/drivers/expro02.cpp
@@ -1797,7 +1797,7 @@ DRIVER_INIT_MEMBER(expro02_state,expro02)
offset = x;
// swap bits around to simplify further processing
- offset = BITSWAP24(offset, 23, 22, 21, 20, 19, 18, 15, 9, 10, 8, 7, 12, 13, 16, 17, 6, 5, 4, 3, 14, 11, 2, 1, 0);
+ offset = bitswap<24>(offset, 23, 22, 21, 20, 19, 18, 15, 9, 10, 8, 7, 12, 13, 16, 17, 6, 5, 4, 3, 14, 11, 2, 1, 0);
// invert 8 bits
offset ^= 0x0528f;
@@ -1809,7 +1809,7 @@ DRIVER_INIT_MEMBER(expro02_state,expro02)
offset = (offset & ~0x1fe00) | ((offset - 0x09600) & 0x1fe00);
// reverse the initial bitswap
- offset = BITSWAP24(offset, 23, 22, 21, 20, 19, 18, 9, 10, 17, 4, 11, 12, 3, 15, 16, 14, 13, 8, 7, 6, 5, 2, 1, 0);
+ offset = bitswap<24>(offset, 23, 22, 21, 20, 19, 18, 9, 10, 17, 4, 11, 12, 3, 15, 16, 14, 13, 8, 7, 6, 5, 2, 1, 0);
// swap nibbles to use the same gfxdecode
dst[x] = (src[offset] << 4 & 0xF0F0F0F0) | (src[offset] >> 4 & 0x0F0F0F0F);
diff --git a/src/mame/drivers/fgoal.cpp b/src/mame/drivers/fgoal.cpp
index 6545b82..70a654e 100644
--- a/src/mame/drivers/fgoal.cpp
+++ b/src/mame/drivers/fgoal.cpp
@@ -171,14 +171,14 @@ READ8_MEMBER(fgoal_state::shifter_r)
{
uint8_t v = m_mb14241->shift_result_r(space, 0);
- return BITSWAP8(v, 7, 6, 5, 4, 3, 2, 1, 0);
+ return bitswap<8>(v, 7, 6, 5, 4, 3, 2, 1, 0);
}
READ8_MEMBER(fgoal_state::shifter_reverse_r)
{
uint8_t v = m_mb14241->shift_result_r(space, 0);
- return BITSWAP8(v, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(v, 0, 1, 2, 3, 4, 5, 6, 7);
}
diff --git a/src/mame/drivers/fidel6502.cpp b/src/mame/drivers/fidel6502.cpp
index 45d7e0a..47cb361 100644
--- a/src/mame/drivers/fidel6502.cpp
+++ b/src/mame/drivers/fidel6502.cpp
@@ -581,7 +581,7 @@ WRITE8_MEMBER(fidel6502_state::csc_pia0_pa_w)
m_speech->data_w(space, 0, data & 0x3f);
// d0-d7: data for the 4 7seg leds, bits are ABFGHCDE (H is extra led)
- m_7seg_data = BITSWAP8(data,0,1,5,6,7,2,3,4);
+ m_7seg_data = bitswap<8>(data,0,1,5,6,7,2,3,4);
csc_prepare_display();
}
@@ -687,7 +687,7 @@ WRITE8_MEMBER(fidel6502_state::eas_segment_w)
{
// a0-a2,d7: digit segment
m_7seg_data = (data & 0x80) >> offset;
- m_7seg_data = BITSWAP8(m_7seg_data,7,6,4,5,0,2,1,3);
+ m_7seg_data = bitswap<8>(m_7seg_data,7,6,4,5,0,2,1,3);
eas_prepare_display();
}
@@ -912,11 +912,11 @@ WRITE8_MEMBER(fidel6502_state::fexcel_ttl_w)
m_dac->write(BIT(sel, 9));
// 74259 Q4-Q7,Q2,Q1: digit/led select (active low)
- u8 led_sel = ~BITSWAP8(m_led_select,0,3,1,2,7,6,5,4) & 0x3f;
+ u8 led_sel = ~bitswap<8>(m_led_select,0,3,1,2,7,6,5,4) & 0x3f;
// a0-a2,d1: digit segment data (model 6093)
m_7seg_data = (m_7seg_data & ~mask) | ((data & 2) ? mask : 0);
- u8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4);
+ u8 seg_data = bitswap<8>(m_7seg_data,0,1,3,2,7,5,6,4);
// update display: 4 7seg leds, 2*8 chessboard leds
for (int i = 0; i < 6; i++)
@@ -1009,7 +1009,7 @@ WRITE8_MEMBER(fidel6502_state::fdesdis_control_w)
WRITE8_MEMBER(fidel6502_state::fdesdis_lcd_w)
{
// a0-a2,d0-d3: 4*74259 to lcd digit segments
- u32 mask = BITSWAP8(1 << offset,3,7,6,0,1,2,4,5);
+ u32 mask = bitswap<8>(1 << offset,3,7,6,0,1,2,4,5);
for (int i = 0; i < 4; i++)
{
m_7seg_data = (m_7seg_data & ~mask) | ((data >> i & 1) ? 0 : mask);
diff --git a/src/mame/drivers/fidel68k.cpp b/src/mame/drivers/fidel68k.cpp
index 32a8937..f801772 100644
--- a/src/mame/drivers/fidel68k.cpp
+++ b/src/mame/drivers/fidel68k.cpp
@@ -289,7 +289,7 @@ READ8_MEMBER(fidel68k_state::fdes68k_input_r)
WRITE8_MEMBER(fidel68k_state::fdes68k_lcd_w)
{
// a1-a3,d0-d3: 4*74259 to lcd digit segments
- u32 mask = BITSWAP8(1 << offset,3,7,6,0,1,2,4,5);
+ u32 mask = bitswap<8>(1 << offset,3,7,6,0,1,2,4,5);
for (int i = 0; i < 4; i++)
{
m_7seg_data = (m_7seg_data & ~mask) | ((data >> i & 1) ? mask : 0);
@@ -304,13 +304,13 @@ DRIVER_INIT_MEMBER(fidel68k_state, fdes2265)
// descramble data lines
for (int i = 0; i < len; i++)
- rom[i] = BITSWAP16(rom[i], 15,14,8,13,9,12,10,11, 3,4,5,7,6,0,1,2);
+ rom[i] = bitswap<16>(rom[i], 15,14,8,13,9,12,10,11, 3,4,5,7,6,0,1,2);
// descramble address lines
std::vector<u16> buf(len);
memcpy(&buf[0], rom, len*2);
for (int i = 0; i < len; i++)
- rom[i] = buf[BITSWAP24(i, 23,22,21,20,19,18,17,16, 15,14,13,12,11,8,10,9, 7,6,5,4,3,2,1,0)];
+ rom[i] = buf[bitswap<24>(i, 23,22,21,20,19,18,17,16, 15,14,13,12,11,8,10,9, 7,6,5,4,3,2,1,0)];
}
@@ -325,7 +325,7 @@ void fidel68k_state::eag_prepare_display()
{
// Excel 68000: 4*7seg leds, 8*8 chessboard leds
// EAG: 8*7seg leds(2 panels), (8+1)*8 chessboard leds
- u8 seg_data = BITSWAP8(m_7seg_data,0,1,3,2,7,5,6,4);
+ u8 seg_data = bitswap<8>(m_7seg_data,0,1,3,2,7,5,6,4);
set_display_segmask(0x1ff, 0x7f);
display_matrix(16, 9, m_led_data << 8 | seg_data, m_inp_mux);
}
diff --git a/src/mame/drivers/fidelz80.cpp b/src/mame/drivers/fidelz80.cpp
index 2ce5b29..9c788b9 100644
--- a/src/mame/drivers/fidelz80.cpp
+++ b/src/mame/drivers/fidelz80.cpp
@@ -798,7 +798,7 @@ MACHINE_START_MEMBER(fidelz80_state,vcc)
WRITE8_MEMBER(fidelz80_state::vcc_ppi_porta_w)
{
// d0-d6: digit segment data, bits are xABCDEFG
- m_7seg_data = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ m_7seg_data = bitswap<8>(data,7,0,1,2,3,4,5,6);
vcc_prepare_display();
// d0-d5: TSI C0-C5
@@ -860,7 +860,7 @@ WRITE8_MEMBER(fidelz80_state::cc10_ppi_porta_w)
}
// d0-d6: digit segment data (same as VCC)
- m_7seg_data = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ m_7seg_data = bitswap<8>(data,7,0,1,2,3,4,5,6);
vcc_prepare_display();
}
@@ -943,7 +943,7 @@ WRITE8_MEMBER(fidelz80_state::vsc_ppi_porta_w)
m_speech->data_w(space, 0, data & 0x3f);
// d0-d7: data for the 4 7seg leds, bits are HGCBAFED (H is extra led)
- m_7seg_data = BITSWAP8(data,7,6,2,1,0,5,4,3);
+ m_7seg_data = bitswap<8>(data,7,6,2,1,0,5,4,3);
vsc_prepare_display();
}
@@ -1010,7 +1010,7 @@ WRITE8_MEMBER(fidelz80_state::vsc_pio_portb_w)
void fidelz80_state::vbrc_prepare_display()
{
// 14seg led segments, d15 is extra led, d14 is unused (tone on prototype?)
- u16 outdata = BITSWAP16(m_7seg_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8);
+ u16 outdata = bitswap<16>(m_7seg_data,12,13,1,6,5,2,0,7,15,11,10,14,4,3,9,8);
set_display_segmask(0xff, 0x3fff);
display_matrix(16, 8, outdata, m_led_select);
}
diff --git a/src/mame/drivers/forte2.cpp b/src/mame/drivers/forte2.cpp
index c4292dc..bbf5218 100644
--- a/src/mame/drivers/forte2.cpp
+++ b/src/mame/drivers/forte2.cpp
@@ -147,7 +147,7 @@ DRIVER_INIT_MEMBER(forte2_state,pesadelo)
// data swap
for (int i = 0; i < memsize; i++)
{
- mem[i] = BITSWAP8(mem[i],3,5,6,7,0,4,2,1);
+ mem[i] = bitswap<8>(mem[i],3,5,6,7,0,4,2,1);
}
// address line swap
@@ -155,7 +155,7 @@ DRIVER_INIT_MEMBER(forte2_state,pesadelo)
memcpy(&buf[0], mem, memsize);
for (int i = 0; i < memsize; i++)
{
- mem[BITSWAP16(i,11,9,8,13,14,15,12,7,6,5,4,3,2,1,0,10)] = buf[i];
+ mem[bitswap<16>(i,11,9,8,13,14,15,12,7,6,5,4,3,2,1,0,10)] = buf[i];
}
}
diff --git a/src/mame/drivers/fp1100.cpp b/src/mame/drivers/fp1100.cpp
index 90512ce..e841528 100644
--- a/src/mame/drivers/fp1100.cpp
+++ b/src/mame/drivers/fp1100.cpp
@@ -246,7 +246,7 @@ d7 - 1=display area; 0=cursor
*/
WRITE8_MEMBER( fp1100_state::colour_control_w )
{
- data = BITSWAP8(data, 7, 4, 6, 5, 3, 0, 2, 1); // change BRG to RGB
+ data = bitswap<8>(data, 7, 4, 6, 5, 3, 0, 2, 1); // change BRG to RGB
m_col_border = data & 7;
diff --git a/src/mame/drivers/fp200.cpp b/src/mame/drivers/fp200.cpp
index 20c8583..798d6b3 100644
--- a/src/mame/drivers/fp200.cpp
+++ b/src/mame/drivers/fp200.cpp
@@ -554,7 +554,7 @@ void fp200_state::machine_start()
for(int i=0;i<0x800;i++)
{
- m_chargen[i] = raw_gfx[BITSWAP16(i,15,14,13,12,11,6,5,4,3,10,9,8,7,2,1,0)];
+ m_chargen[i] = raw_gfx[bitswap<16>(i,15,14,13,12,11,6,5,4,3,10,9,8,7,2,1,0)];
}
}
diff --git a/src/mame/drivers/funkyjet.cpp b/src/mame/drivers/funkyjet.cpp
index c453650..ef3a853 100644
--- a/src/mame/drivers/funkyjet.cpp
+++ b/src/mame/drivers/funkyjet.cpp
@@ -110,7 +110,7 @@ READ16_MEMBER( funkyjet_state::funkyjet_protection_region_0_146_r )
// uint16_t realdat = deco16_146_funkyjet_prot_r(space,offset&0x3ff,mem_mask);
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, /* note, same bitswap as fghthist */ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, /* note, same bitswap as fghthist */ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
@@ -125,7 +125,7 @@ WRITE16_MEMBER( funkyjet_state::funkyjet_protection_region_0_146_w )
// deco16_146_funkyjet_prot_w(space,offset&0x3ff,data,mem_mask);
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, /* note, same bitswap as fghthist */ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, /* note, same bitswap as fghthist */ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/funworld.cpp b/src/mame/drivers/funworld.cpp
index 93874b8..23418f8 100644
--- a/src/mame/drivers/funworld.cpp
+++ b/src/mame/drivers/funworld.cpp
@@ -6463,7 +6463,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
for (i = start; i < size; i++)
{
- rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 0, 1, 2);
+ rom[i] = bitswap<8>(rom[i], 7, 6, 5, 4, 3, 0, 1, 2);
}
{
@@ -6475,7 +6475,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
for (i = start; i < size; i++)
{
- a = ((i & 0xff00) | BITSWAP8(i & 0xff, 2, 0, 1, 3, 4, 5, 6, 7));
+ a = ((i & 0xff00) | bitswap<8>(i & 0xff, 2, 0, 1, 3, 4, 5, 6, 7));
rom[a] = buffer[i];
}
}
@@ -6493,7 +6493,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
for (i = startg; i < sizeg; i++)
{
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 6, 7, 5, 8, 4, 10, 3, 9, 0, 1, 2);
+ a = bitswap<16>(i, 15, 14, 13, 12, 11, 6, 7, 5, 8, 4, 10, 3, 9, 0, 1, 2);
gfxrom[a] = buffer[i];
}
}
@@ -6507,7 +6507,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
for (i = startp; i < sizep; i++)
{
- prom[i] = BITSWAP8(prom[i], 2, 3, 5, 4, 6, 7, 1, 0);
+ prom[i] = bitswap<8>(prom[i], 2, 3, 5, 4, 6, 7, 1, 0);
}
{
@@ -6519,7 +6519,7 @@ DRIVER_INIT_MEMBER(funworld_state, saloon)
for (i = startp; i < sizep; i++)
{
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 4, 8, 7, 6, 5, 2, 0, 1, 3);
+ a = bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 4, 8, 7, 6, 5, 2, 0, 1, 3);
prom[a] = buffer[i];
}
}
@@ -6545,7 +6545,7 @@ DRIVER_INIT_MEMBER(funworld_state, multiwin)
ROM[x] = ROM[x] ^ 0x91;
uint8_t code;
- ROM[x] = BITSWAP8(ROM[x],5,6,7,2,3,0,1,4);
+ ROM[x] = bitswap<8>(ROM[x],5,6,7,2,3,0,1,4);
code = ROM[x];
@@ -6577,7 +6577,7 @@ DRIVER_INIT_MEMBER(funworld_state, royalcdc)
uint8_t code;
// this seems correct for the data, plaintext decrypts fine
- ROM[x] = BITSWAP8(ROM[x],2,6,7,4,3,1,5,0);
+ ROM[x] = bitswap<8>(ROM[x],2,6,7,4,3,1,5,0);
// the code uses different encryption, there are conflicts here
// so it's probably address based
@@ -6642,7 +6642,7 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
for (i = start; i < size; i++)
{
- rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
+ rom[i] = bitswap<8>(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
}
{
@@ -6654,7 +6654,7 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
for (i = start; i < size; i++)
{
- a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ a = bitswap<16>(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
rom[a] = buffer[i];
}
}
@@ -6672,7 +6672,7 @@ DRIVER_INIT_MEMBER(funworld_state, dino4)
for (i = startg; i < sizeg; i++)
{
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
+ a = bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
gfxrom[a] = buffer[i];
}
}
@@ -6702,7 +6702,7 @@ DRIVER_INIT_MEMBER(funworld_state, ctunk)
for (i = start; i < size; i++)
{
- rom[i] = BITSWAP8(rom[i], 5, 6, 7, 3, 4, 0, 1, 2);
+ rom[i] = bitswap<8>(rom[i], 5, 6, 7, 3, 4, 0, 1, 2);
}
//buffer = std::make_unique<uint8_t[]>(size);
@@ -6746,7 +6746,7 @@ static void decrypt_rcdino4(uint8_t *rom, int size, uint8_t *gfxrom, int sizeg,
for (i = start; i < size; i++)
{
- rom[i] = BITSWAP8(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
+ rom[i] = bitswap<8>(rom[i], 7, 6, 5, 4, 3, 1, 2, 0);
}
{
@@ -6758,7 +6758,7 @@ static void decrypt_rcdino4(uint8_t *rom, int size, uint8_t *gfxrom, int sizeg,
for (i = start; i < size; i++)
{
- a = BITSWAP16(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ a = bitswap<16>(i, 15, 13, 14, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
rom[a] = buffer[i];
}
@@ -6776,7 +6776,7 @@ static void decrypt_rcdino4(uint8_t *rom, int size, uint8_t *gfxrom, int sizeg,
for (i = startg; i < sizeg; i++)
{
- a = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
+ a = bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
gfxrom[a] = buffer[i];
}
}
@@ -6787,7 +6787,7 @@ static void decrypt_rcdino4(uint8_t *rom, int size, uint8_t *gfxrom, int sizeg,
for (x = 0x0000; x < 0x10000; x++)
{
- src[x] = BITSWAP8(src[x], 7, 6, 4, 5, 3, 2, 1, 0);
+ src[x] = bitswap<8>(src[x], 7, 6, 4, 5, 3, 2, 1, 0);
src[x] = src[x] ^ 0x81;
}
diff --git a/src/mame/drivers/gaiden.cpp b/src/mame/drivers/gaiden.cpp
index 52a9b9d..3435e63 100644
--- a/src/mame/drivers/gaiden.cpp
+++ b/src/mame/drivers/gaiden.cpp
@@ -1621,7 +1621,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu)
memcpy(&buffer[0], ROM, size);
for( i = 0; i < size; i++ )
{
- ROM[i] = buffer[BITSWAP24(i,23,22,21,20,
+ ROM[i] = buffer[bitswap<24>(i,23,22,21,20,
19,18,17,15,
16,14,13,12,
11,10, 9, 8,
@@ -1638,7 +1638,7 @@ void gaiden_state::descramble_drgnbowl(int descramble_cpu)
memcpy(&buffer[0],ROM,size);
for( i = 0; i < size; i++ )
{
- ROM[i] = buffer[BITSWAP24(i,23,22,21,20,
+ ROM[i] = buffer[bitswap<24>(i,23,22,21,20,
19,18,16,17,
15,14,13, 4,
3,12,11,10,
@@ -1672,7 +1672,7 @@ void gaiden_state::descramble_mastninj_gfx(uint8_t* src)
int i;
for (i = 0;i < len; i++)
{
- buffer[i] = src[BITSWAP24(i,
+ buffer[i] = src[bitswap<24>(i,
23,22,21,20,
19,18,17,16,
15,5,14,13,12,
@@ -1688,7 +1688,7 @@ void gaiden_state::descramble_mastninj_gfx(uint8_t* src)
int i;
for (i = 0; i < len; i++)
{
- buffer[i] = src[BITSWAP24(i,
+ buffer[i] = src[bitswap<24>(i,
23,22,21,20,
19,18,17,16,
15,6,14,13,12,
diff --git a/src/mame/drivers/galaga.cpp b/src/mame/drivers/galaga.cpp
index 463a013..b90d89a 100644
--- a/src/mame/drivers/galaga.cpp
+++ b/src/mame/drivers/galaga.cpp
@@ -3442,14 +3442,14 @@ DRIVER_INIT_MEMBER(xevious_state,xevios)
rom = memregion("gfx3")->base();
for (A = 0x5000;A < 0x7000;A++)
{
- rom[A] = BITSWAP8(rom[A],1,3,5,7,0,2,4,6);
+ rom[A] = bitswap<8>(rom[A],1,3,5,7,0,2,4,6);
}
/* convert one of tile map ROMs to the format used by Xevious */
rom = memregion("gfx4")->base();
for (A = 0x0000;A < 0x1000;A++)
{
- rom[A] = BITSWAP8(rom[A],3,7,5,1,2,6,4,0);
+ rom[A] = bitswap<8>(rom[A],3,7,5,1,2,6,4,0);
}
DRIVER_INIT_CALL(xevious);
diff --git a/src/mame/drivers/galaxian.cpp b/src/mame/drivers/galaxian.cpp
index eb23347..ca36d31 100644
--- a/src/mame/drivers/galaxian.cpp
+++ b/src/mame/drivers/galaxian.cpp
@@ -1017,7 +1017,7 @@ void galaxian_state::monsterz_set_latch()
{
// read from a rom (which one?? "a-3e.k3" from audiocpu ($2700-$2fff) looks very suspicious)
uint8_t *rom = memregion("audiocpu")->base();
- m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a BITSWAP8
+ m_protection_result = rom[0x2000 | (m_protection_state & 0x1fff)]; // probably needs a bitswap<8>
// and an irq on the main z80 afterwards
m_maincpu->set_input_line(0, HOLD_LINE );
@@ -1096,7 +1096,7 @@ READ8_MEMBER(galaxian_state::frogger_sound_timer_r)
{
/* same as regular Konami sound but with bits 3,5 swapped */
uint8_t konami_value = konami_sound_timer_r(space, 0);
- return BITSWAP8(konami_value, 7,6,3,4,5,2,1,0);
+ return bitswap<8>(konami_value, 7,6,3,4,5,2,1,0);
}
@@ -2096,13 +2096,13 @@ READ8_MEMBER(galaxian_state::froggeram_ppi8255_r)
uint8_t result = 0xff;
if (offset & 0x0100) result &= m_ppi8255[0]->read(space, offset & 3);
if (offset & 0x0200) result &= m_ppi8255[1]->read(space, offset & 3);
- return BITSWAP8(result, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(result, 0, 1, 2, 3, 4, 5, 6, 7);
}
WRITE8_MEMBER(galaxian_state::froggeram_ppi8255_w)
{
// same as theend, but accesses are scrambled
- data = BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ data = bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
if (offset & 0x0100) m_ppi8255[0]->write(space, offset & 3, data);
if (offset & 0x0200) m_ppi8255[1]->write(space, offset & 3, data);
}
@@ -6352,7 +6352,7 @@ void galaxian_state::decode_mooncrst(int length, uint8_t *dest)
uint8_t res = data;
if (BIT(data,1)) res ^= 0x40;
if (BIT(data,5)) res ^= 0x04;
- if ((offs & 1) == 0) res = BITSWAP8(res,7,2,5,4,3,6,1,0);
+ if ((offs & 1) == 0) res = bitswap<8>(res,7,2,5,4,3,6,1,0);
dest[offs] = res;
}
}
@@ -6437,7 +6437,7 @@ void galaxian_state::decode_dingoe()
/* Swap bit0 with bit4 */
if (offs & 0x02)
- data = BITSWAP8(data, 7,6,5,0,3,2,1,4);
+ data = bitswap<8>(data, 7,6,5,0,3,2,1,4);
rombase[offs] = data;
}
}
@@ -6450,7 +6450,7 @@ void galaxian_state::decode_frogger_sound()
/* the first ROM of the sound CPU has data lines D0 and D1 swapped */
for (offs = 0; offs < 0x800; offs++)
- rombase[offs] = BITSWAP8(rombase[offs], 7,6,5,4,3,2,0,1);
+ rombase[offs] = bitswap<8>(rombase[offs], 7,6,5,4,3,2,0,1);
}
// froggermc has a bigger first ROM of the sound CPU, thus a different decode
@@ -6461,7 +6461,7 @@ void galaxian_state::decode_froggermc_sound()
/* the first ROM of the sound CPU has data lines D0 and D1 swapped */
for (offs = 0; offs < 0x1000; offs++)
- rombase[offs] = BITSWAP8(rombase[offs], 7,6,5,4,3,2,0,1);
+ rombase[offs] = bitswap<8>(rombase[offs], 7,6,5,4,3,2,0,1);
}
@@ -6472,7 +6472,7 @@ void galaxian_state::decode_frogger_gfx()
/* the 2nd gfx ROM has data lines D0 and D1 swapped */
for (offs = 0x0800; offs < 0x1000; offs++)
- rombase[offs] = BITSWAP8(rombase[offs], 7,6,5,4,3,2,0,1);
+ rombase[offs] = bitswap<8>(rombase[offs], 7,6,5,4,3,2,0,1);
}
@@ -6557,7 +6557,7 @@ void galaxian_state::decode_victoryc()
if (i & 0x04) src[i] ^= 0x40;
if (i & 0x01) src[i] ^= 0x08;
- src[i] = BITSWAP8(src[i], 6, 3, 5, 4, 2, 7, 1, 0);
+ src[i] = bitswap<8>(src[i], 6, 3, 5, 4, 2, 7, 1, 0);
}
}
diff --git a/src/mame/drivers/gladiatr.cpp b/src/mame/drivers/gladiatr.cpp
index fa20baf..e77bcdd 100644
--- a/src/mame/drivers/gladiatr.cpp
+++ b/src/mame/drivers/gladiatr.cpp
@@ -299,7 +299,7 @@ READ8_MEMBER(gladiatr_state::cctl_p2_r)
READ8_MEMBER(gladiatr_state::ucpu_p2_r)
{
- return BITSWAP8(m_dsw1->read(), 0,1,2,3,4,5,6,7);
+ return bitswap<8>(m_dsw1->read(), 0,1,2,3,4,5,6,7);
}
WRITE8_MEMBER(gladiatr_state::ccpu_p2_w)
@@ -356,7 +356,7 @@ WRITE8_MEMBER(gladiatr_state::csnd_p1_w)
READ8_MEMBER(gladiatr_state::csnd_p2_r)
{
- return BITSWAP8(m_dsw2->read(), 2,3,4,5,6,7,1,0);
+ return bitswap<8>(m_dsw2->read(), 2,3,4,5,6,7,1,0);
}
diff --git a/src/mame/drivers/goldnpkr.cpp b/src/mame/drivers/goldnpkr.cpp
index a17b444..ae90052 100644
--- a/src/mame/drivers/goldnpkr.cpp
+++ b/src/mame/drivers/goldnpkr.cpp
@@ -11042,7 +11042,7 @@ DRIVER_INIT_MEMBER(goldnpkr_state, flcnw)
for (i = start; i < size; i++)
{
ROM[i] = ROM[i] ^ 0xa0;
- ROM[i] = BITSWAP8(ROM[i], 7, 6, 3, 4, 5, 2, 1, 0);
+ ROM[i] = bitswap<8>(ROM[i], 7, 6, 3, 4, 5, 2, 1, 0);
}
}
diff --git a/src/mame/drivers/goldstar.cpp b/src/mame/drivers/goldstar.cpp
index 046830f..5d56ee2 100644
--- a/src/mame/drivers/goldstar.cpp
+++ b/src/mame/drivers/goldstar.cpp
@@ -11967,7 +11967,7 @@ DRIVER_INIT_MEMBER(wingco_state, magoddsc)
if ((A & 4) == 4)
ROM[A] ^= 0x01;
- ROM[A] = BITSWAP8(ROM[A], 3,6,5,4,7,2,1,0);
+ ROM[A] = bitswap<8>(ROM[A], 3,6,5,4,7,2,1,0);
}
}
@@ -13361,10 +13361,10 @@ DRIVER_INIT_MEMBER(cmaster_state, fb2010)
switch(i & 0x22)
{
- case 0x00: x = BITSWAP8(x^0x4c^0xff, 0,4,7,6,5,1,3,2); break;
- case 0x02: x = BITSWAP8(x^0xc0^0xff, 7,6,0,5,3,2,1,4); break; // 67053214
- case 0x20: x = BITSWAP8(x^0x6b^0xff, 4,3,2,7,5,6,0,1); break;
- case 0x22: x = BITSWAP8(x^0x23^0xff, 0,6,1,3,4,5,2,7); break;
+ case 0x00: x = bitswap<8>(x^0x4c^0xff, 0,4,7,6,5,1,3,2); break;
+ case 0x02: x = bitswap<8>(x^0xc0^0xff, 7,6,0,5,3,2,1,4); break; // 67053214
+ case 0x20: x = bitswap<8>(x^0x6b^0xff, 4,3,2,7,5,6,0,1); break;
+ case 0x22: x = bitswap<8>(x^0x23^0xff, 0,6,1,3,4,5,2,7); break;
}
ROM[i] = x;
@@ -15373,9 +15373,9 @@ uint8_t cb3_state::cb3_decrypt(uint8_t cipherText, uint16_t address)
idx = BIT(cipherText, 1) | (BIT(address,0) << 1) | (BIT(address, 4) << 2);
if (rotation[idx] == 0)
- output = BITSWAP8(cipherText, 5, 6, 3, 4, 7, 2, 1, 0); // rotates bit #3, #5 and #7 in one direction...
+ output = bitswap<8>(cipherText, 5, 6, 3, 4, 7, 2, 1, 0); // rotates bit #3, #5 and #7 in one direction...
else
- output = BITSWAP8(cipherText, 3, 6, 7, 4, 5, 2, 1, 0); // ... or in the other
+ output = bitswap<8>(cipherText, 3, 6, 7, 4, 5, 2, 1, 0); // ... or in the other
return output ^ sbox[idx];
}
@@ -15437,7 +15437,7 @@ DRIVER_INIT_MEMBER(cb3_state, chrygld)
for (A = 0; A < 0x10000; A++)
{
uint8_t dat = ROM[A];
- dat = BITSWAP8(dat, 5, 6, 3, 4, 7, 2, 1, 0);
+ dat = bitswap<8>(dat, 5, 6, 3, 4, 7, 2, 1, 0);
ROM[A] = dat;
}
@@ -15494,14 +15494,14 @@ DRIVER_INIT_MEMBER(cmaster_state, nfb96sea)
uint8_t x = ROM[i];
switch(i & 7)
{
- case 0: x = BITSWAP8(x ^ 0x80, 1, 6, 7, 4, 5, 2, 3, 0); break;
- case 1: x = BITSWAP8(x ^ 0xa0, 5, 6, 3, 4, 1, 2, 7, 0); break;
- case 2: x = BITSWAP8(x ^ 0x02, 5, 6, 3, 4, 1, 2, 7, 0); break;
- case 3: x = BITSWAP8(x ^ 0xa0, 3, 6, 1, 4, 7, 2, 5, 0); break;
- case 4: x = BITSWAP8(x ^ 0x82, 3, 6, 1, 4, 7, 2, 5, 0); break;
- case 5: x = BITSWAP8(x ^ 0x02, 1, 6, 7, 4, 5, 2, 3, 0); break;
- case 6: x = BITSWAP8(x ^ 0x08, 3, 6, 1, 4, 7, 2, 5, 0); break;
- case 7: x = BITSWAP8(x ^ 0x80, 5, 6, 3, 4, 1, 2, 7, 0); break;
+ case 0: x = bitswap<8>(x ^ 0x80, 1, 6, 7, 4, 5, 2, 3, 0); break;
+ case 1: x = bitswap<8>(x ^ 0xa0, 5, 6, 3, 4, 1, 2, 7, 0); break;
+ case 2: x = bitswap<8>(x ^ 0x02, 5, 6, 3, 4, 1, 2, 7, 0); break;
+ case 3: x = bitswap<8>(x ^ 0xa0, 3, 6, 1, 4, 7, 2, 5, 0); break;
+ case 4: x = bitswap<8>(x ^ 0x82, 3, 6, 1, 4, 7, 2, 5, 0); break;
+ case 5: x = bitswap<8>(x ^ 0x02, 1, 6, 7, 4, 5, 2, 3, 0); break;
+ case 6: x = bitswap<8>(x ^ 0x08, 3, 6, 1, 4, 7, 2, 5, 0); break;
+ case 7: x = bitswap<8>(x ^ 0x80, 5, 6, 3, 4, 1, 2, 7, 0); break;
}
ROM[i] = x;
@@ -15518,10 +15518,10 @@ DRIVER_INIT_MEMBER(cmaster_state, schery97)
uint8_t x = ROM[i];
switch(i & 0x12)
{
- case 0x00: x = BITSWAP8(x ^ 0x3e, 1, 0, 7, 6, 5, 4, 3, 2); break;
- case 0x02: x = BITSWAP8(x ^ 0x4d, 0, 7, 6, 5, 4, 3, 2, 1); break;
- case 0x10: x = BITSWAP8(x ^ 0x24, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 0x12: x = BITSWAP8(x ^ 0xbb, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x00: x = bitswap<8>(x ^ 0x3e, 1, 0, 7, 6, 5, 4, 3, 2); break;
+ case 0x02: x = bitswap<8>(x ^ 0x4d, 0, 7, 6, 5, 4, 3, 2, 1); break;
+ case 0x10: x = bitswap<8>(x ^ 0x24, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 0x12: x = bitswap<8>(x ^ 0xbb, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
@@ -15540,10 +15540,10 @@ DRIVER_INIT_MEMBER(cmaster_state, schery97a)
uint8_t x = ROM[i];
switch(i & 6)
{
- case 0: x = BITSWAP8(x ^ 0xb9, 4, 0, 6, 7, 3, 1, 5, 2); break;
- case 2: x = BITSWAP8(x ^ 0x8f, 6, 7, 4, 0, 3, 2, 1, 5); break;
- case 4: x = BITSWAP8(x ^ 0xd2, 3, 4, 0, 2, 5, 6, 1, 7); break;
- case 6: x = BITSWAP8(x ^ 0xd1, 6, 0, 2, 1, 4, 5, 3, 7); break;
+ case 0: x = bitswap<8>(x ^ 0xb9, 4, 0, 6, 7, 3, 1, 5, 2); break;
+ case 2: x = bitswap<8>(x ^ 0x8f, 6, 7, 4, 0, 3, 2, 1, 5); break;
+ case 4: x = bitswap<8>(x ^ 0xd2, 3, 4, 0, 2, 5, 6, 1, 7); break;
+ case 6: x = bitswap<8>(x ^ 0xd1, 6, 0, 2, 1, 4, 5, 3, 7); break;
}
ROM[i] = x;
@@ -15563,10 +15563,10 @@ DRIVER_INIT_MEMBER(cmaster_state, skill98)
uint8_t x = ROM[i];
switch(i & 0x12)
{
- case 0x00: x = BITSWAP8(x ^ 0x21, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 0x02: x = BITSWAP8(x ^ 0x45, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 0x10: x = BITSWAP8(x ^ 0x23, 4, 3, 2, 1, 0, 7, 6, 5); break;
- case 0x12: x = BITSWAP8(x ^ 0x5b, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x00: x = bitswap<8>(x ^ 0x21, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 0x02: x = bitswap<8>(x ^ 0x45, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 0x10: x = bitswap<8>(x ^ 0x23, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x12: x = bitswap<8>(x ^ 0x5b, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
@@ -15585,10 +15585,10 @@ DRIVER_INIT_MEMBER(cmaster_state, nfb96_c1)
switch(i & 0x12)
{
- case 0x00: x = BITSWAP8(x ^ 0xf5, 6, 4, 3, 7, 0, 1, 5, 2); break;
- case 0x02: x = BITSWAP8(x ^ 0xe6, 4, 6, 3, 0, 7, 2, 1, 5); break;
- case 0x10: x = BITSWAP8(x ^ 0x34, 0, 3, 5, 2, 4, 6, 1, 7); break;
- case 0x12: x = BITSWAP8(x ^ 0xc6, 2, 0, 4, 1, 6, 5, 3, 7); break;
+ case 0x00: x = bitswap<8>(x ^ 0xf5, 6, 4, 3, 7, 0, 1, 5, 2); break;
+ case 0x02: x = bitswap<8>(x ^ 0xe6, 4, 6, 3, 0, 7, 2, 1, 5); break;
+ case 0x10: x = bitswap<8>(x ^ 0x34, 0, 3, 5, 2, 4, 6, 1, 7); break;
+ case 0x12: x = bitswap<8>(x ^ 0xc6, 2, 0, 4, 1, 6, 5, 3, 7); break;
}
ROM[i] = x;
}
@@ -15606,10 +15606,10 @@ DRIVER_INIT_MEMBER(cmaster_state, nfb96_c2)
switch(i & 0x22)
{
- case 0x00: x = BITSWAP8(x ^ 0x5f, 6, 4, 3, 7, 0, 5, 2, 1); break;
- case 0x02: x = BITSWAP8(x ^ 0xe7, 4, 6, 3, 0, 7, 5, 1, 2); break;
- case 0x20: x = BITSWAP8(x ^ 0x18, 0, 3, 5, 2, 4, 7, 1, 6); break;
- case 0x22: x = BITSWAP8(x ^ 0x74, 2, 0, 4, 1, 6, 7, 3, 5); break;
+ case 0x00: x = bitswap<8>(x ^ 0x5f, 6, 4, 3, 7, 0, 5, 2, 1); break;
+ case 0x02: x = bitswap<8>(x ^ 0xe7, 4, 6, 3, 0, 7, 5, 1, 2); break;
+ case 0x20: x = bitswap<8>(x ^ 0x18, 0, 3, 5, 2, 4, 7, 1, 6); break;
+ case 0x22: x = bitswap<8>(x ^ 0x74, 2, 0, 4, 1, 6, 7, 3, 5); break;
}
ROM[i] = x;
@@ -15627,10 +15627,10 @@ DRIVER_INIT_MEMBER(cmaster_state, nfb96_d)
switch(i & 5)
{
- case 0: x = BITSWAP8(x ^ 0x6a, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 1: x = BITSWAP8(x ^ 0xcc, 0, 7, 6, 5, 4, 3, 2, 1); break;
- case 4: x = BITSWAP8(x ^ 0x8f, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 5: x = BITSWAP8(x ^ 0x93, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0: x = bitswap<8>(x ^ 0x6a, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 1: x = bitswap<8>(x ^ 0xcc, 0, 7, 6, 5, 4, 3, 2, 1); break;
+ case 4: x = bitswap<8>(x ^ 0x8f, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 5: x = bitswap<8>(x ^ 0x93, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
}
@@ -15654,10 +15654,10 @@ DRIVER_INIT_MEMBER(cmaster_state, nfb96_dk)
switch(i & 5)
{
- case 0: x = BITSWAP8(x ^ 0xce, 1, 0, 7, 6, 5, 4, 3, 2); break;
- case 1: x = BITSWAP8(x ^ 0x9e, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 4: x = BITSWAP8(x ^ 0xc3, 0, 7, 6, 5, 4, 3, 2, 1); break;
- case 5: x = BITSWAP8(x ^ 0xdb, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0: x = bitswap<8>(x ^ 0xce, 1, 0, 7, 6, 5, 4, 3, 2); break;
+ case 1: x = bitswap<8>(x ^ 0x9e, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 4: x = bitswap<8>(x ^ 0xc3, 0, 7, 6, 5, 4, 3, 2, 1); break;
+ case 5: x = bitswap<8>(x ^ 0xdb, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
}
@@ -15675,10 +15675,10 @@ DRIVER_INIT_MEMBER(cmaster_state, rp35)
switch(i & 3)
{
- case 0: x = BITSWAP8(x ^ 0x2a, 0, 7, 6, 5, 4, 3, 2, 1); break;
- case 1: x = BITSWAP8(x ^ 0x1c, 4, 3, 2, 1, 0, 7, 6, 5); break;
- case 2: x = BITSWAP8(x ^ 0x4f, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 3: x = BITSWAP8(x ^ 0x23, 1, 0, 7, 6, 5, 4, 3, 2); break;
+ case 0: x = bitswap<8>(x ^ 0x2a, 0, 7, 6, 5, 4, 3, 2, 1); break;
+ case 1: x = bitswap<8>(x ^ 0x1c, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 2: x = bitswap<8>(x ^ 0x4f, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 3: x = bitswap<8>(x ^ 0x23, 1, 0, 7, 6, 5, 4, 3, 2); break;
}
ROM[i] = x;
}
@@ -15697,10 +15697,10 @@ DRIVER_INIT_MEMBER(cmaster_state, rp36)
switch(i & 5)
{
- case 0: x = BITSWAP8(x ^ 0xee, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 1: x = BITSWAP8(x ^ 0x9f, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 4: x = BITSWAP8(x ^ 0xc7, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 5: x = BITSWAP8(x ^ 0xc3, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 0: x = bitswap<8>(x ^ 0xee, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 1: x = bitswap<8>(x ^ 0x9f, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 4: x = bitswap<8>(x ^ 0xc7, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 5: x = bitswap<8>(x ^ 0xc3, 3, 2, 1, 0, 7, 6, 5, 4); break;
}
ROM[i] = x;
@@ -15719,10 +15719,10 @@ DRIVER_INIT_MEMBER(cmaster_state, rp36c3)
switch(i & 0xa)
{
- case 0x0: x = BITSWAP8(x ^ 0xfd, 6, 4, 0, 7, 3, 1, 5, 2); break;
- case 0x2: x = BITSWAP8(x ^ 0xee, 4, 6, 7, 0, 3, 2, 1, 5); break;
- case 0x8: x = BITSWAP8(x ^ 0x2c, 0, 3, 4, 2, 5, 6, 1, 7); break;
- case 0xa: x = BITSWAP8(x ^ 0xd6, 2, 0, 6, 1, 4, 5, 3, 7); break;
+ case 0x0: x = bitswap<8>(x ^ 0xfd, 6, 4, 0, 7, 3, 1, 5, 2); break;
+ case 0x2: x = bitswap<8>(x ^ 0xee, 4, 6, 7, 0, 3, 2, 1, 5); break;
+ case 0x8: x = bitswap<8>(x ^ 0x2c, 0, 3, 4, 2, 5, 6, 1, 7); break;
+ case 0xa: x = bitswap<8>(x ^ 0xd6, 2, 0, 6, 1, 4, 5, 3, 7); break;
}
ROM[i] = x;
@@ -15741,10 +15741,10 @@ DRIVER_INIT_MEMBER(cmaster_state, rp96sub) // 95 33 95 33 70 6C 70 6C... XORs s
switch(i & 5)
{
- case 0: x = BITSWAP8(x ^ 0x6a, 7, 6, 5, 4, 3, 2, 1, 0); break;
- case 1: x = BITSWAP8(x ^ 0xcc, 7, 6, 5, 4, 3, 2, 1, 0); break;
- case 4: x = BITSWAP8(x ^ 0x8f, 7, 6, 5, 4, 3, 2, 1, 0); break;
- case 5: x = BITSWAP8(x ^ 0x93, 7, 6, 5, 4, 3, 2, 1, 0); break;
+ case 0: x = bitswap<8>(x ^ 0x6a, 7, 6, 5, 4, 3, 2, 1, 0); break;
+ case 1: x = bitswap<8>(x ^ 0xcc, 7, 6, 5, 4, 3, 2, 1, 0); break;
+ case 4: x = bitswap<8>(x ^ 0x8f, 7, 6, 5, 4, 3, 2, 1, 0); break;
+ case 5: x = bitswap<8>(x ^ 0x93, 7, 6, 5, 4, 3, 2, 1, 0); break;
}
ROM[i] = x;
@@ -15764,10 +15764,10 @@ DRIVER_INIT_MEMBER(cmaster_state, po33)
switch(i & 0x14)
{
- case 0x00: x = BITSWAP8(x ^ 0xde, 2, 1, 0, 7, 6, 5, 4, 3); break;
- case 0x04: x = BITSWAP8(x ^ 0x3c, 0, 7, 6, 5, 4, 3, 2, 1); break;
- case 0x10: x = BITSWAP8(x ^ 0x2f, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 0x14: x = BITSWAP8(x ^ 0x5b, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x00: x = bitswap<8>(x ^ 0xde, 2, 1, 0, 7, 6, 5, 4, 3); break;
+ case 0x04: x = bitswap<8>(x ^ 0x3c, 0, 7, 6, 5, 4, 3, 2, 1); break;
+ case 0x10: x = bitswap<8>(x ^ 0x2f, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 0x14: x = bitswap<8>(x ^ 0x5b, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
@@ -15787,10 +15787,10 @@ DRIVER_INIT_MEMBER(cmaster_state, match133)
switch(i & 0x12)
{
- case 0x00: x = BITSWAP8(x ^ 0xde, 3, 2, 1, 0, 7, 6, 5, 4); break;
- case 0x02: x = BITSWAP8(x ^ 0x3d, 1, 0, 7, 6, 5, 4, 3, 2); break;
- case 0x10: x = BITSWAP8(x ^ 0x2f, 4, 3, 2, 1, 0, 7, 6, 5); break;
- case 0x12: x = BITSWAP8(x ^ 0x5c, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x00: x = bitswap<8>(x ^ 0xde, 3, 2, 1, 0, 7, 6, 5, 4); break;
+ case 0x02: x = bitswap<8>(x ^ 0x3d, 1, 0, 7, 6, 5, 4, 3, 2); break;
+ case 0x10: x = bitswap<8>(x ^ 0x2f, 4, 3, 2, 1, 0, 7, 6, 5); break;
+ case 0x12: x = bitswap<8>(x ^ 0x5c, 4, 3, 2, 1, 0, 7, 6, 5); break;
}
ROM[i] = x;
@@ -15884,17 +15884,17 @@ DRIVER_INIT_MEMBER(goldstar_state, super9)
uint8_t *src = memregion("gfx1")->base();
for (i = 0; i < 0x20000; i++)
{
-// src[i] = BITSWAP8(src[i], 7, 4, 2, 1, 6, 5, 3, 0);
-// src[i] = BITSWAP8(src[i], 7, 3, 2, 6, 1, 5, 4, 0);
- src[i] = BITSWAP8(src[i], 7, 3, 2, 6, 5, 1, 4, 0);
+// src[i] = bitswap<8>(src[i], 7, 4, 2, 1, 6, 5, 3, 0);
+// src[i] = bitswap<8>(src[i], 7, 3, 2, 6, 1, 5, 4, 0);
+ src[i] = bitswap<8>(src[i], 7, 3, 2, 6, 5, 1, 4, 0);
}
uint8_t *src2 = memregion("gfx2")->base();
for (i = 0; i < 0x8000; i++)
{
-// src2[i] = BITSWAP8(src2[i], 7, 4, 2, 1, 6, 5, 3, 0);
-// src2[i] = BITSWAP8(src2[i], 7, 3, 2, 6, 1, 5, 4, 0);
- src2[i] = BITSWAP8(src2[i], 3, 7, 6, 2, 5, 1, 0, 4); // endianess
+// src2[i] = bitswap<8>(src2[i], 7, 4, 2, 1, 6, 5, 3, 0);
+// src2[i] = bitswap<8>(src2[i], 7, 3, 2, 6, 1, 5, 4, 0);
+ src2[i] = bitswap<8>(src2[i], 3, 7, 6, 2, 5, 1, 0, 4); // endianess
}
}
@@ -15909,7 +15909,7 @@ DRIVER_INIT_MEMBER(cb3_state, cb3e)
for (i = 0; i < 0x10000; i++)
{
uint8_t dat = ROM[i];
- dat = BITSWAP8(dat, 5, 6, 3, 4, 7, 2, 1, 0);
+ dat = bitswap<8>(dat, 5, 6, 3, 4, 7, 2, 1, 0);
ROM[i] = dat;
}
@@ -15918,14 +15918,14 @@ DRIVER_INIT_MEMBER(cb3_state, cb3e)
uint8_t *src = memregion("gfx1")->base();
for (i = 0; i < 0x20000; i++)
{
- src[i] = BITSWAP8(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
+ src[i] = bitswap<8>(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
}
/* bank 2 graphics */
uint8_t *src2 = memregion("gfx2")->base();
for (i = 0; i < 0x8000; i++)
{
- src2[i] = BITSWAP8(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
+ src2[i] = bitswap<8>(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
}
}
@@ -15936,14 +15936,14 @@ DRIVER_INIT_MEMBER(goldstar_state, wcherry)
uint8_t *src = memregion("gfx1")->base();
for (i = 0; i < 0x20000; i++)
{
- src[i] = BITSWAP8(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
+ src[i] = bitswap<8>(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
}
/* bank 2 graphics */
uint8_t *src2 = memregion("gfx2")->base();
for (i = 0; i < 0x8000; i++)
{
- src2[i] = BITSWAP8(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
+ src2[i] = bitswap<8>(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
}
}
@@ -15961,14 +15961,14 @@ DRIVER_INIT_MEMBER(wingco_state, flaming7)
uint8_t *src = memregion("gfx1")->base();
for (i = 0; i < 0x20000; i++)
{
- src[i] = BITSWAP8(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
+ src[i] = bitswap<8>(src[i], 4, 3, 2, 5, 1, 6, 0, 7); // OK
}
/* bank 2 graphics */
uint8_t *src2 = memregion("gfx2")->base();
for (i = 0; i < 0x8000; i++)
{
- src2[i] = BITSWAP8(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
+ src2[i] = bitswap<8>(src2[i], 3, 4, 2, 5, 1, 6, 0, 7); // OK
}
/* Patch to bypass the iButton electronic serial number check.
diff --git a/src/mame/drivers/gts3.cpp b/src/mame/drivers/gts3.cpp
index 427912f..67af5c9 100644
--- a/src/mame/drivers/gts3.cpp
+++ b/src/mame/drivers/gts3.cpp
@@ -220,7 +220,7 @@ WRITE8_MEMBER( gts3_state::segbank_w )
uint32_t seg1,seg2;
m_segment[offset] = data;
seg1 = m_segment[offset&2] | (m_segment[offset|1] << 8);
- seg2 = BITSWAP32(seg1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,14,9,7,13,11,10,6,8,12,5,4,3,3,2,1,0,0);
+ seg2 = bitswap<32>(seg1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,14,9,7,13,11,10,6,8,12,5,4,3,3,2,1,0,0);
output().set_digit_value(m_digit+(BIT(offset, 1) ? 0 : 20), seg2);
}
diff --git a/src/mame/drivers/gts3a.cpp b/src/mame/drivers/gts3a.cpp
index 2ef0a33..f59c551 100644
--- a/src/mame/drivers/gts3a.cpp
+++ b/src/mame/drivers/gts3a.cpp
@@ -232,7 +232,7 @@ WRITE8_MEMBER( gts3a_state::segbank_w )
uint32_t seg1,seg2;
m_segment[offset] = data;
seg1 = m_segment[offset&2] | (m_segment[offset|1] << 8);
- seg2 = BITSWAP32(seg1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,14,9,7,13,11,10,6,8,12,5,4,3,3,2,1,0,0);
+ seg2 = bitswap<32>(seg1,16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,14,9,7,13,11,10,6,8,12,5,4,3,3,2,1,0,0);
output().set_digit_value(m_digit+(BIT(offset, 1) ? 0 : 20), seg2);
}
diff --git a/src/mame/drivers/gts80.cpp b/src/mame/drivers/gts80.cpp
index e5b3d81..9e3db98 100644
--- a/src/mame/drivers/gts80.cpp
+++ b/src/mame/drivers/gts80.cpp
@@ -295,7 +295,7 @@ WRITE8_MEMBER( gts80_state::port2a_w )
m_port2 = data;
static const uint8_t patterns[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0 }; // 7448
uint16_t seg1 = (uint16_t)patterns[m_segment & 15];
- uint16_t seg2 = BITSWAP16(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
+ uint16_t seg2 = bitswap<16>(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
switch (data & 0x70)
{
case 0x10: // player 1&2
diff --git a/src/mame/drivers/gts80a.cpp b/src/mame/drivers/gts80a.cpp
index 2865607..584e822 100644
--- a/src/mame/drivers/gts80a.cpp
+++ b/src/mame/drivers/gts80a.cpp
@@ -286,7 +286,7 @@ WRITE8_MEMBER( gts80a_state::port2a_w )
m_port2 = data;
static const uint8_t patterns[16] = { 0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7c,0x07,0x7f,0x67,0x58,0x4c,0x62,0x69,0x78,0 }; // 7448
uint16_t seg1 = (uint16_t)patterns[m_segment & 15];
- uint16_t seg2 = BITSWAP16(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
+ uint16_t seg2 = bitswap<16>(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
switch (data & 0x70)
{
case 0x10: // player 1&2
diff --git a/src/mame/drivers/gts80b.cpp b/src/mame/drivers/gts80b.cpp
index e6bcb34..ef0d713 100644
--- a/src/mame/drivers/gts80b.cpp
+++ b/src/mame/drivers/gts80b.cpp
@@ -338,7 +338,7 @@ WRITE8_MEMBER( gts80b_state::port2b_w )
else
{ // display a character
segment = patterns[m_dispcmd & 0x7f]; // ignore blank/inverse bit
- segment = BITSWAP16(segment, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 3, 2, 1, 0, 0);
+ segment = bitswap<16>(segment, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 3, 2, 1, 0, 0);
output().set_digit_value(m_digit[i]+i*20, segment);
m_digit[i]++; // auto-increment pointer
if (m_digit[i] > 19) m_digit[i] = 0; // check for overflow
diff --git a/src/mame/drivers/h8.cpp b/src/mame/drivers/h8.cpp
index 0d645cd..d2a28e5 100644
--- a/src/mame/drivers/h8.cpp
+++ b/src/mame/drivers/h8.cpp
@@ -170,7 +170,7 @@ WRITE8_MEMBER( h8_state::portf1_w )
//d1 segment a
//d0 segment g
- m_segment = 0xff ^ BITSWAP8(data, 7, 0, 6, 5, 4, 3, 2, 1);
+ m_segment = 0xff ^ bitswap<8>(data, 7, 0, 6, 5, 4, 3, 2, 1);
if (m_digit) output().set_digit_value(m_digit, m_segment);
}
diff --git a/src/mame/drivers/halleys.cpp b/src/mame/drivers/halleys.cpp
index 75e1a64..6c677e8 100644
--- a/src/mame/drivers/halleys.cpp
+++ b/src/mame/drivers/halleys.cpp
@@ -2154,8 +2154,8 @@ void halleys_state::init_common()
for (i=0; i<0x10000; i++)
{
- addr = BITSWAP16(i,15,14,13,12,11,10,1,0,4,5,6,3,7,8,9,2);
- buf[i] = BITSWAP8(rom[addr],0,7,6,5,1,4,2,3);
+ addr = bitswap<16>(i,15,14,13,12,11,10,1,0,4,5,6,3,7,8,9,2);
+ buf[i] = bitswap<8>(rom[addr],0,7,6,5,1,4,2,3);
}
memcpy(rom, buf, 0x10000);
diff --git a/src/mame/drivers/hankin.cpp b/src/mame/drivers/hankin.cpp
index cb46a01..26eb97e 100644
--- a/src/mame/drivers/hankin.cpp
+++ b/src/mame/drivers/hankin.cpp
@@ -283,7 +283,7 @@ WRITE8_MEMBER( hankin_state::ic10_a_w )
for (i = 0; i < 5; i++)
{
seg1 = patterns[m_segment[i]];
- seg2 = BITSWAP16(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
+ seg2 = bitswap<16>(seg1, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0);
output().set_digit_value(i*10+m_digit, seg2);
}
}
diff --git a/src/mame/drivers/hh_amis2k.cpp b/src/mame/drivers/hh_amis2k.cpp
index 0639bf2..b6ce7c7 100644
--- a/src/mame/drivers/hh_amis2k.cpp
+++ b/src/mame/drivers/hh_amis2k.cpp
@@ -140,7 +140,7 @@ void wildfire_state::display_update()
if (m_display_cache[i] != active_state[i])
{
if (index_is_7segled(i))
- output().set_digit_value(i, BITSWAP8(active_state[i],7,0,1,2,3,4,5,6) & 0x7f);
+ output().set_digit_value(i, bitswap<8>(active_state[i],7,0,1,2,3,4,5,6) & 0x7f);
for (int j = 0; j < 8; j++)
output().set_lamp_value(i*10 + j, active_state[i] >> j & 1);
diff --git a/src/mame/drivers/hh_cop400.cpp b/src/mame/drivers/hh_cop400.cpp
index 8f533e9..27762e3 100644
--- a/src/mame/drivers/hh_cop400.cpp
+++ b/src/mame/drivers/hh_cop400.cpp
@@ -486,7 +486,7 @@ void einvaderc_state::prepare_display()
set_display_segmask(7, 0x7f);
// update display
- u8 l = BITSWAP8(m_l,7,6,0,1,2,3,4,5);
+ u8 l = bitswap<8>(m_l,7,6,0,1,2,3,4,5);
u16 grid = (m_d | m_g << 4 | m_sk << 8 | m_so << 9) ^ 0x0ff;
display_matrix(8, 10, l, grid);
}
diff --git a/src/mame/drivers/hh_hmcs40.cpp b/src/mame/drivers/hh_hmcs40.cpp
index 8d6ddde..5f70d40 100644
--- a/src/mame/drivers/hh_hmcs40.cpp
+++ b/src/mame/drivers/hh_hmcs40.cpp
@@ -375,7 +375,7 @@ WRITE8_MEMBER(bambball_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 plate = BITSWAP16(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2);
+ u16 plate = bitswap<16>(m_plate,13,8,4,12,9,10,14,1,7,0,15,11,6,3,5,2);
display_matrix(16, 9, plate, m_grid);
}
@@ -484,8 +484,8 @@ public:
void bmboxing_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
- u32 plate = BITSWAP16(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
+ u32 plate = bitswap<16>(m_plate,15,14,13,12,1,2,0,3,11,4,10,7,5,6,9,8);
display_matrix(12, 9, plate, grid);
}
@@ -623,8 +623,8 @@ public:
void bfriskyt_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP24(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<24>(m_plate,23,22,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21);
display_matrix(22, 8, plate, grid);
}
@@ -755,8 +755,8 @@ WRITE8_MEMBER(packmon_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,0,1,2,3,4,5,6,19,18,17,16,15,14,13,12,11,10,9,8,7);
display_matrix(20, 10, plate, grid);
}
@@ -865,8 +865,8 @@ public:
void msthawk_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
- u32 plate = BITSWAP24(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
+ u32 plate = bitswap<24>(m_plate,23,22,21,19,20,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
display_matrix(21, 10, plate, grid);
}
@@ -997,8 +997,8 @@ WRITE8_MEMBER(bzaxxon_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800;
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,6,7,8,9,10,5,4,3,2,1,0);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,5,7,0,1,2,3,4,6,19,16,17,18,15,14,13,12,10,8,9,11) | 0x800;
display_matrix(20, 11, plate, grid);
}
@@ -1117,8 +1117,8 @@ WRITE8_MEMBER(zackman_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP32(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12);
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<32>(m_plate,31,30,27,0,1,2,3,4,5,6,7,8,9,10,11,24,25,26,29,28,23,22,21,20,19,18,17,16,15,14,13,12);
display_matrix(29, 8, plate, grid);
}
@@ -1232,8 +1232,8 @@ public:
void bpengo_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP32(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<32>(m_plate,31,30,29,28,23,22,21,16,17,18,19,20,27,26,25,24,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
display_matrix(25, 8, plate, grid);
}
@@ -1360,8 +1360,8 @@ public:
void bbtime_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5);
- u32 plate = BITSWAP32(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1;
+ u8 grid = bitswap<8>(m_grid,7,6,0,1,2,3,4,5);
+ u32 plate = bitswap<32>(m_plate,31,30,29,28,25,24,26,27,22,23,15,14,12,11,10,8,7,6,4,1,5,9,13,3,2,16,17,18,19,20,0,21) | 0x1;
display_matrix(28, 6, plate, grid);
}
@@ -1485,8 +1485,8 @@ WRITE8_MEMBER(bdoramon_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,7,6);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0);
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,7,6);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,11,19,18,17,16,15,14,13,12,10,9,8,7,6,5,4,3,2,1,0);
display_matrix(19, 8, plate, grid);
}
@@ -1584,8 +1584,8 @@ WRITE8_MEMBER(bultrman_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,18,17,16,15,14,13,12,3,11,10,9,8,7,6,5,4,1,2);
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,0,18,17,16,15,14,13,12,3,11,10,9,8,7,6,5,4,1,2);
display_matrix(18, 8, plate, grid);
}
@@ -1672,7 +1672,7 @@ public:
void machiman_state::prepare_display()
{
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
display_matrix(19, 5, plate, m_grid);
}
@@ -1802,7 +1802,7 @@ READ8_MEMBER(pairmtch_state::input_r)
WRITE8_MEMBER(pairmtch_state::sound_w)
{
// R5x: soundlatch (to audiocpu R2x)
- m_soundlatch->write(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3));
+ m_soundlatch->write(space, 0, bitswap<8>(data,7,6,5,4,0,1,2,3));
}
@@ -1811,7 +1811,7 @@ WRITE8_MEMBER(pairmtch_state::sound_w)
WRITE8_MEMBER(pairmtch_state::sound2_w)
{
// R2x: soundlatch (to maincpu R5x)
- m_soundlatch2->write(space, 0, BITSWAP8(data,7,6,5,4,0,1,2,3));
+ m_soundlatch2->write(space, 0, bitswap<8>(data,7,6,5,4,0,1,2,3));
}
WRITE16_MEMBER(pairmtch_state::speaker_w)
@@ -1924,7 +1924,7 @@ WRITE8_MEMBER(alnattck_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,18,17,16,11,9,8,10,7,2,0,1,3,4,5,6,12,13,14,15);
display_matrix(20, 10, plate, m_grid);
}
@@ -2054,7 +2054,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(cdkong_state::speaker_decay_sim)
void cdkong_state::prepare_display()
{
- u32 plate = BITSWAP32(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800;
+ u32 plate = bitswap<32>(m_plate,31,30,29,24,0,16,8,1,23,17,9,2,18,10,25,27,26,3,15,27,11,11,14,22,6,13,21,5,19,12,20,4) | 0x800800;
display_matrix(29, 11, plate, m_grid);
}
@@ -2172,8 +2172,8 @@ public:
void cgalaxn_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3);
- u16 plate = BITSWAP16(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,1,2,0,11,10,9,8,7,6,5,4,3);
+ u16 plate = bitswap<16>(m_plate,15,14,6,5,4,3,2,1,7,8,9,10,11,0,12,13);
display_matrix(15, 12, plate, grid);
}
@@ -2307,8 +2307,8 @@ WRITE8_MEMBER(cpacman_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10);
- u32 plate = BITSWAP32(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10);
+ u32 plate = bitswap<32>(m_plate,31,30,29,28,27,0,1,2,3,8,9,10,11,16,17,18,19,25,26,23,22,21,20,24,15,14,13,12,4,5,6,7);
display_matrix(27, 11, plate, grid);
}
@@ -2424,8 +2424,8 @@ WRITE8_MEMBER(cmspacmn_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1);
- u64 plate = BIT(m_plate,15)<<32 | BITSWAP32(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080;
+ u16 grid = bitswap<16>(m_grid,15,14,13,11,10,9,8,7,6,5,4,3,2,1,0,1);
+ u64 plate = BIT(m_plate,15)<<32 | bitswap<32>(m_plate,14,13,12,4,5,6,7,24,23,25,22,21,20,13,24,3,19,14,12,11,24,2,10,8,7,25,0,9,1,18,17,16) | 0x1004080;
display_matrix(33, 12, plate, grid);
}
@@ -2540,7 +2540,7 @@ void sag_state::prepare_display()
// grid 8-11 are 7segs
set_display_segmask(0xf00, 0x7f);
- u8 seg = BITSWAP8(m_plate,3,4,5,6,7,8,9,10);
+ u8 seg = bitswap<8>(m_plate,3,4,5,6,7,8,9,10);
for (int y = 8; y < 12; y++)
m_display_state[y] = (m_grid >> y & 1) ? seg : 0;
@@ -2670,8 +2670,8 @@ public:
void egalaxn2_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8);
+ u16 grid = bitswap<16>(m_grid,15,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,15,14,13,12,7,6,5,4,3,2,1,0,19,18,17,16,11,10,9,8);
display_matrix(24, 15, plate, grid);
}
@@ -2870,8 +2870,8 @@ protected:
void eturtles_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0);
- u32 plate = BITSWAP32(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13);
+ u16 grid = bitswap<16>(m_grid,15,1,14,13,12,11,10,9,8,7,6,5,4,3,2,0);
+ u32 plate = bitswap<32>(m_plate,31,30,11,12,18,19,16,17,22,15,20,21,27,26,23,25,24,2,3,1,0,6,4,5,10,9,2,8,7,14,1,13);
display_matrix(30, 15, plate | (grid >> 5 & 8), grid); // grid 8 also forces plate 3 high
}
@@ -3049,8 +3049,8 @@ public:
void estargte_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1);
- u32 plate = BITSWAP32(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13);
+ u16 grid = bitswap<16>(m_grid,15,0,14,13,12,11,10,9,8,7,6,5,4,3,2,1);
+ u32 plate = bitswap<32>(m_plate,31,30,29,15,17,19,21,23,25,27,26,24,3,22,20,18,16,14,12,10,8,6,4,2,0,1,3,5,7,9,11,13);
display_matrix(29, 14, plate, grid);
}
@@ -3166,8 +3166,8 @@ WRITE8_MEMBER(ghalien_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,14,12,10,8,9,13,15,2,0,1,3,11,7,5,4,6,19,17,16,18);
display_matrix(20, 10, plate, grid);
}
@@ -3285,8 +3285,8 @@ WRITE8_MEMBER(gckong_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10);
- u32 plate = BITSWAP32(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000;
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,0,1,2,3,4,5,6,7,8,9,10);
+ u32 plate = bitswap<32>(m_plate,31,30,29,28,27,26,25,6,7,8,12,13,14,15,16,17,18,17,16,12,11,10,9,8,7,6,5,4,3,2,1,0) | 0x8000;
display_matrix(32, 11, plate, grid);
}
@@ -3408,7 +3408,7 @@ WRITE8_MEMBER(gdigdug_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u32 plate = BITSWAP32(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16);
+ u32 plate = bitswap<32>(m_plate,30,31,0,1,2,3,4,5,6,7,20,21,22,27,26,25,28,29,24,23,15,14,13,12,8,9,10,11,19,18,17,16);
display_matrix(32, 9, plate, m_grid);
}
@@ -3528,7 +3528,7 @@ public:
void mwcbaseb_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
display_matrix(16, 8, m_plate, grid);
}
@@ -3688,7 +3688,7 @@ WRITE8_MEMBER(pbqbert_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u32 plate = BITSWAP32(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000;
+ u32 plate = bitswap<32>(m_plate,31,30,24,25,26,27,28,15,14,29,13,12,11,10,9,8,7,6,5,4,3,2,1,0,16,17,18,19,20,21,22,23) | 0x400000;
display_matrix(30, 8, plate, m_grid);
}
@@ -3776,8 +3776,8 @@ public:
void kingman_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
- u32 plate = BITSWAP24(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
+ u32 plate = bitswap<24>(m_plate,23,6,7,5,4,3,2,1,0,13,12,20,19,18,17,16,10,11,9,8,14,15,13,12);
display_matrix(23, 9, plate, grid);
}
@@ -3897,8 +3897,8 @@ public:
void tmtron_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0);
- u32 plate = BITSWAP24(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,1,2,3,4,5,6,7,8,9,0);
+ u32 plate = bitswap<24>(m_plate,23,5,2,21,1,6,7,9,10,11,21,0,19,3,4,8,3,18,17,16,12,13,14,15);
display_matrix(23, 10, plate, grid);
}
@@ -4023,7 +4023,7 @@ WRITE8_MEMBER(vinvader_state::plate_w)
m_plate = (m_plate & ~(0xf << shift)) | (data << shift);
// update display
- u16 plate = BITSWAP16(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0);
+ u16 plate = bitswap<16>(m_plate,15,11,7,3,10,6,14,2,9,5,13,1,8,4,12,0);
display_matrix(12, 9, plate, m_grid);
}
diff --git a/src/mame/drivers/hh_melps4.cpp b/src/mame/drivers/hh_melps4.cpp
index f502800..9dbdd38 100644
--- a/src/mame/drivers/hh_melps4.cpp
+++ b/src/mame/drivers/hh_melps4.cpp
@@ -235,8 +235,8 @@ public:
void cfrogger_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11);
- u16 plate = BITSWAP16(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,0,1,2,3,4,5,6,7,8,9,10,11);
+ u16 plate = bitswap<16>(m_plate,12,4,13,5,14,6,15,7,3,11,2,10,1,9,0,8);
display_matrix(16, 12, plate, grid);
}
@@ -351,8 +351,8 @@ public:
void gjungler_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,8,9,10,11,13,16,15,14,13,12,7,0,6,1,5,2,4,3) | 0x2000;
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0,1);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,18,8,9,10,11,13,16,15,14,13,12,7,0,6,1,5,2,4,3) | 0x2000;
display_matrix(18, 12, plate, grid);
}
diff --git a/src/mame/drivers/hh_pic16.cpp b/src/mame/drivers/hh_pic16.cpp
index ca8e2a9..d7e0365 100644
--- a/src/mame/drivers/hh_pic16.cpp
+++ b/src/mame/drivers/hh_pic16.cpp
@@ -1395,7 +1395,7 @@ WRITE8_MEMBER(uspbball_state::write_a)
WRITE8_MEMBER(uspbball_state::write_b)
{
// B: digit segment data
- m_b = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ m_b = bitswap<8>(data,0,1,2,3,4,5,6,7);
prepare_display();
}
diff --git a/src/mame/drivers/hh_tms1k.cpp b/src/mame/drivers/hh_tms1k.cpp
index be2a9f5..3511785 100644
--- a/src/mame/drivers/hh_tms1k.cpp
+++ b/src/mame/drivers/hh_tms1k.cpp
@@ -1775,7 +1775,7 @@ DEVICE_IMAGE_LOAD_MEMBER(quizwizc_state, cartridge)
// get cartridge pinout K1 to R connections
std::string pinout(image.get_feature("pinout"));
m_pinout = std::stoul(pinout, nullptr, 2) & 0xe7;
- m_pinout = BITSWAP8(m_pinout,4,3,7,5,2,1,6,0) << 4;
+ m_pinout = bitswap<8>(m_pinout,4,3,7,5,2,1,6,0) << 4;
return image_init_result::PASS;
}
@@ -1807,7 +1807,7 @@ WRITE16_MEMBER(quizwizc_state::write_r)
WRITE16_MEMBER(quizwizc_state::write_o)
{
// O0-O7: led/digit segment data
- m_o = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ m_o = bitswap<8>(data,7,0,1,2,3,4,5,6);
prepare_display();
}
@@ -3894,7 +3894,7 @@ WRITE16_MEMBER(f2pbball_state::write_r)
WRITE16_MEMBER(f2pbball_state::write_o)
{
// O0-O7: led state
- m_o = BITSWAP8(data,0,7,6,5,4,3,2,1);
+ m_o = bitswap<8>(data,0,7,6,5,4,3,2,1);
prepare_display();
}
@@ -4133,7 +4133,7 @@ protected:
void gpoker_state::prepare_display()
{
set_display_segmask(0x7ff, 0x20ff); // 7seg + bottom-right diagonal
- u16 segs = BITSWAP16(m_o, 15,14,7,12,11,10,9,8,6,6,5,4,3,2,1,0) & 0x20ff;
+ u16 segs = bitswap<16>(m_o, 15,14,7,12,11,10,9,8,6,6,5,4,3,2,1,0) & 0x20ff;
display_matrix(14, 11, segs | (m_r >> 3 & 0xf00), m_r & 0x7ff);
}
@@ -4385,8 +4385,8 @@ public:
void ginv1000_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,9,8,7);
- u16 plate = BITSWAP16(m_plate,15,14,13,12,3,4,7,8,9,10,11,2,6,5,1,0);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,9,8,7);
+ u16 plate = bitswap<16>(m_plate,15,14,13,12,3,4,7,8,9,10,11,2,6,5,1,0);
display_matrix(12, 10, plate, grid);
}
@@ -4637,7 +4637,7 @@ void fxmcr165_state::prepare_display()
{
// 7seg digit from O0-O6
m_display_segmask[0] = 0x7f;
- m_display_state[0] = BITSWAP8(m_o,7,2,6,5,4,3,1,0) & 0x7f;
+ m_display_state[0] = bitswap<8>(m_o,7,2,6,5,4,3,1,0) & 0x7f;
// leds from R4-R10
m_display_state[1] = m_r >> 4 & 0x7f;
@@ -4774,7 +4774,7 @@ WRITE16_MEMBER(elecdet_state::write_r)
// R0-R6: select digit
set_display_segmask(0x7f, 0x7f);
- display_matrix(7, 7, BITSWAP8(m_o,7,5,2,1,4,0,6,3), data);
+ display_matrix(7, 7, bitswap<8>(m_o,7,5,2,1,4,0,6,3), data);
}
WRITE16_MEMBER(elecdet_state::write_o)
@@ -5332,7 +5332,7 @@ WRITE32_MEMBER(horseran_state::lcd_output_w)
// col5-11 and col13-19 are 7segs
for (int i = 0; i < 2; i++)
- m_display_state[3 + (offset << 1 | i)] = BITSWAP8(data >> (4+8*i),7,3,5,2,0,1,4,6) & 0x7f;
+ m_display_state[3 + (offset << 1 | i)] = bitswap<8>(data >> (4+8*i),7,3,5,2,0,1,4,6) & 0x7f;
set_display_segmask(0x3f<<3, 0x7f);
set_display_size(24, 3+6);
@@ -6519,7 +6519,7 @@ void mbdtower_state::prepare_display()
// update current state
if (~m_r & 0x10)
{
- u8 o = BITSWAP8(m_o,7,0,4,3,2,1,6,5) & 0x7f;
+ u8 o = bitswap<8>(m_o,7,0,4,3,2,1,6,5) & 0x7f;
m_display_state[2] = (m_o & 0x80) ? o : 0;
m_display_state[1] = (m_o & 0x80) ? 0 : o;
m_display_state[0] = (m_r >> 8 & 1) | (m_r >> 4 & 0xe);
@@ -7090,7 +7090,7 @@ WRITE16_MEMBER(stopthief_state::write_r)
{
// R0-R2: select digit
set_display_segmask(7, 0x7f);
- display_matrix(7, 3, BITSWAP8(m_o,3,5,2,1,4,0,6,7) & 0x7f, data & 7);
+ display_matrix(7, 3, bitswap<8>(m_o,3,5,2,1,4,0,6,7) & 0x7f, data & 7);
// R3-R8(tied together): speaker out
int level = 0;
diff --git a/src/mame/drivers/hh_ucom4.cpp b/src/mame/drivers/hh_ucom4.cpp
index bad818d..79293b8 100644
--- a/src/mame/drivers/hh_ucom4.cpp
+++ b/src/mame/drivers/hh_ucom4.cpp
@@ -281,8 +281,8 @@ public:
void ufombs_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8);
- u16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,3,2,1,0,4,5,6,7,8);
+ u16 plate = bitswap<16>(m_plate,15,14,13,12,11,7,10,6,9,5,8,4,0,1,2,3);
display_matrix(10, 9, plate, grid);
}
@@ -394,7 +394,7 @@ public:
void ssfball_state::prepare_display()
{
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,10,9,8,0,1,2,4,5,6);
display_matrix(16, 9, plate, m_grid);
}
@@ -538,7 +538,7 @@ public:
void bmsoccer_state::prepare_display()
{
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,11,7,3,12,17,13,18,16,14,15,8,4,0,9,5,1,10,6,2);
display_matrix(16, 9, plate, m_grid);
}
@@ -661,8 +661,8 @@ public:
void bmsafari_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
- u16 plate = BITSWAP16(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,0,1,2,3,4,5,6,7,8);
+ u16 plate = bitswap<16>(m_plate,15,14,13,12,11,7,10,2,9,5,8,4,0,1,6,3);
display_matrix(10, 9, plate, grid);
}
@@ -771,7 +771,7 @@ public:
void splasfgt_state::prepare_display()
{
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,18,17,13,1,0,8,6,0,10,11,14,15,16,9,5,7,4,2,3);
display_matrix(16, 9, plate, m_grid);
}
@@ -923,8 +923,8 @@ public:
void bcclimbr_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,7,6,0,1,2,3,4,5);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
+ u8 grid = bitswap<8>(m_grid,7,6,0,1,2,3,4,5);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,16,17,18,19,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0);
display_matrix(20, 6, plate, grid);
}
@@ -1141,8 +1141,8 @@ public:
void invspace_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,8,9,7,6,5,4,3,2,1,0);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,9,14,13,8,15,11,10,7,11,3,2,6,10,1,5,9,0,4,8);
display_matrix(19, 9, plate, grid);
}
@@ -1243,7 +1243,7 @@ public:
void efball_state::prepare_display()
{
- u16 plate = BITSWAP16(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7);
+ u16 plate = bitswap<16>(m_plate,15,14,13,12,11,4,3,0,2,1,6,10,9,5,8,7);
display_matrix(11, 10, plate, m_grid);
}
@@ -1356,8 +1356,8 @@ public:
void galaxy2_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
- u16 plate = BITSWAP16(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
+ u16 plate = bitswap<16>(m_plate,15,3,2,6,1,5,4,0,11,10,7,12,14,13,8,9);
display_matrix(15, 10, plate, grid);
}
@@ -1467,8 +1467,8 @@ public:
void astrocmd_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,8,4,5,6,7,0,1,2,3);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,3,2,12,13,14,15,16,17,18,0,1,4,8,5,9,7,11,6,10);
display_matrix(17, 9, plate, grid);
}
@@ -1746,8 +1746,8 @@ public:
void mvbfree_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
- u16 plate = BITSWAP16(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
+ u16 grid = bitswap<16>(m_grid,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
+ u16 plate = bitswap<16>(m_plate,15,14,13,12,11,10,0,1,2,3,4,5,6,7,8,9);
display_matrix(10, 14, plate, grid);
}
@@ -1967,8 +1967,8 @@ public:
void tccombat_state::prepare_display()
{
- u16 grid = BITSWAP16(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6);
+ u16 grid = bitswap<16>(m_grid,15,14,13,12,11,10,9,8,3,2,1,0,7,6,5,4);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,11,15,3,10,14,2,9,13,1,0,12,8,15,1,5,0,3,7,2,6);
display_matrix(20, 9, plate, grid);
}
@@ -2229,8 +2229,8 @@ public:
void tmpacman_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100;
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,16,17,18,11,10,9,8,0,2,3,1,4,5,6,7,12,13,14,15) | 0x100;
display_matrix(19, 8, plate, grid);
}
@@ -2334,7 +2334,7 @@ public:
void tmscramb_state::prepare_display()
{
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400;
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,18,17,3,15,2,14,1,13,16,0,12,8,4,9,5,10,6,11,7) | 0x400;
display_matrix(17, 10, plate, m_grid);
}
@@ -2436,8 +2436,8 @@ public:
void tcaveman_state::prepare_display()
{
- u8 grid = BITSWAP8(m_grid,0,1,2,3,4,5,6,7);
- u32 plate = BITSWAP24(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40;
+ u8 grid = bitswap<8>(m_grid,0,1,2,3,4,5,6,7);
+ u32 plate = bitswap<24>(m_plate,23,22,21,20,19,10,11,5,6,7,8,0,9,2,18,17,16,3,15,14,13,12,4,1) | 0x40;
display_matrix(19, 8, plate, grid);
}
diff --git a/src/mame/drivers/hnayayoi.cpp b/src/mame/drivers/hnayayoi.cpp
index 12bc4ec..01d8479 100644
--- a/src/mame/drivers/hnayayoi.cpp
+++ b/src/mame/drivers/hnayayoi.cpp
@@ -694,7 +694,7 @@ DRIVER_INIT_MEMBER(hnayayoi_state,hnfubuki)
/* swap data bits 0 and 1 */
for (i = 0; i < len; i++)
{
- rom[i] = BITSWAP8(rom[i],7,6,5,4,3,2,0,1);
+ rom[i] = bitswap<8>(rom[i],7,6,5,4,3,2,0,1);
}
}
diff --git a/src/mame/drivers/hprot1.cpp b/src/mame/drivers/hprot1.cpp
index 56d9913..03bac457 100644
--- a/src/mame/drivers/hprot1.cpp
+++ b/src/mame/drivers/hprot1.cpp
@@ -100,7 +100,7 @@ DRIVER_INIT_MEMBER( hprot1_state, hprot1 )
bitswapped_ROM[i] = ROM[i];
for(i=0x0000;i<0x10000;i++)
- ROM[BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 3, 2, 1, 0, 4, 5, 6, 7)] = bitswapped_ROM[i];
+ ROM[bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 8, 3, 2, 1, 0, 4, 5, 6, 7)] = bitswapped_ROM[i];
}
//A4 = display RS
diff --git a/src/mame/drivers/hshavoc.cpp b/src/mame/drivers/hshavoc.cpp
index 4a9e621..ae7d7ad 100644
--- a/src/mame/drivers/hshavoc.cpp
+++ b/src/mame/drivers/hshavoc.cpp
@@ -131,7 +131,7 @@ DRIVER_INIT_MEMBER(md_boot_state,hshavoc)
for (x = 0; x < rom_size / 2; x++)
{
- src[x] = BITSWAP16(src[x],
+ src[x] = bitswap<16>(src[x],
7, 15,6, 14,
5, 2, 1, 10,
13,4, 12,3,
@@ -152,7 +152,7 @@ DRIVER_INIT_MEMBER(md_boot_state,hshavoc)
if (src[x] & 0x0100)
src[x] ^= 0x0004;
- src[x] = BITSWAP16(src[x], 15,14,13,12,
+ src[x] = bitswap<16>(src[x], 15,14,13,12,
11,9, 10,8,
7, 6, 5, 4,
3, 2, 1, 0 );
@@ -162,13 +162,13 @@ DRIVER_INIT_MEMBER(md_boot_state,hshavoc)
/* START e? from e80000 to end you need THIS ALONE to match the genesis rom */
for (x = rom_size / 2; x < 0x100000 / 2; x++)
{
- src[x] = BITSWAP16(src[x],
+ src[x] = bitswap<16>(src[x],
7, 15,6, 14,
5, 2, 1, 10,
13,4, 12,3,
11,0, 8, 9 );
- src[x] = BITSWAP16(src[x],
+ src[x] = bitswap<16>(src[x],
15,14,13,12,
11,10,9, 2,
7, 6, 5, 4,
@@ -192,7 +192,7 @@ DRIVER_INIT_MEMBER(md_boot_state,hshavoc)
{
src[x] ^= 0x0107; //? seems conditional..
- src[x] = BITSWAP16(src[x],
+ src[x] = bitswap<16>(src[x],
15,13,14,12,
11,10,9, 0,
8, 6, 5, 4,
diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp
index 5e4ae38..dd9ead3 100644
--- a/src/mame/drivers/igs011.cpp
+++ b/src/mame/drivers/igs011.cpp
@@ -827,7 +827,7 @@ void igs011_state::lhb2_decrypt()
if ((i & 0x3080) != 0x3080 && (i & 0x3090) != 0x3010)
x ^= 0x0020;
- j = BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
+ j = bitswap<24>(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
result_data[j] = x;
}
@@ -849,7 +849,7 @@ void igs011_state::nkishusp_decrypt()
uint16_t x = src[i];
// lhb2 address scrambling
- j = BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
+ j = bitswap<24>(i, 23,22,21,20,19,18,17,16,15,14,13, 8, 11,10, 9, 2, 7,6,5,4,3, 12, 1,0);
// ryukobou xor:
@@ -1047,7 +1047,7 @@ void igs011_state::lhb2_gfx_decrypt()
std::vector<uint8_t> result_data(rom_size);
for (i=0; i<rom_size; i++)
- result_data[i] = src[BITSWAP24(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)];
+ result_data[i] = src[bitswap<24>(i, 23,22,21,20, 19, 17,16,15, 13,12, 10,9,8,7,6,5,4, 2,1, 3, 11, 14, 18, 0)];
memcpy(src,&result_data[0],rom_size);
}
@@ -1060,7 +1060,7 @@ void igs011_state::drgnwrld_gfx_decrypt()
std::vector<uint8_t> result_data(rom_size);
for (i=0; i<rom_size; i++)
- result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)];
+ result_data[i] = src[bitswap<24>(i, 23,22,21,20,19,18,17,16,15, 12, 13, 14, 11,10,9,8,7,6,5,4,3,2,1,0)];
memcpy(src,&result_data[0],rom_size);
}
@@ -1742,7 +1742,7 @@ READ16_MEMBER(igs011_state::lhb2_igs003_r)
break;
case 0x03:
- return BITSWAP16(m_igs003_prot_hold, 14,11,8,6,4,3,1,0, 5,2,9,7,10,13,12,15) & 0xff;
+ return bitswap<16>(m_igs003_prot_hold, 14,11,8,6,4,3,1,0, 5,2,9,7,10,13,12,15) & 0xff;
// Protection:
// 0544FE: 20 21 22 24 25 26 27 28 2A 2B 2C 2D 2E 30 31 32 33 34
@@ -2010,7 +2010,7 @@ READ16_MEMBER(igs011_state::vbowl_igs003_r)
case 0x01: return ioport("IN1")->read();
case 0x03:
- return BITSWAP16(m_igs003_prot_hold, 14,11,8,6,4,3,1,0, 5,2,9,7,10,13,12,15) & 0xff;
+ return bitswap<16>(m_igs003_prot_hold, 14,11,8,6,4,3,1,0, 5,2,9,7,10,13,12,15) & 0xff;
case 0x20: return 0x49;
case 0x21: return 0x47;
diff --git a/src/mame/drivers/igs017.cpp b/src/mame/drivers/igs017.cpp
index f88b351..f71cb18 100644
--- a/src/mame/drivers/igs017.cpp
+++ b/src/mame/drivers/igs017.cpp
@@ -225,24 +225,24 @@ uint16_t igs017_state::mgcs_palette_bitswap(uint16_t bgr)
{
bgr = ((bgr & 0xff00) >> 8) | ((bgr & 0x00ff) << 8);
- return BITSWAP16(bgr, 7, 8, 9, 2, 14, 3, 13, 15, 12, 11, 10, 0, 1, 4, 5, 6);
+ 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)
{
// bgr = ((bgr & 0xff00) >> 8) | ((bgr & 0x00ff) << 8);
- return BITSWAP16(bgr, 15,9,13,12,11,5,4,8,7,6,0,14,3,2,1,10);
+ 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)
{
// bitswap
- return BITSWAP16(bgr, 15,12,3,6,10,5,4,2,9,13,8,7,11,1,0,14);
+ 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)
{
- return BITSWAP16(bgr, 15,14,9,4,11,10,12,3,7,6,5,8,13,2,1,0);
+ return bitswap<16>(bgr, 15,14,9,4,11,10,12,3,7,6,5,8,13,2,1,0);
}
@@ -297,7 +297,7 @@ void igs017_state::decrypt_program_rom(int mask, int a7, int a6, int a5, int a4,
// address lines swap
for (i = 0;i < length;i++)
{
- int addr = (i & ~0xff) | BITSWAP8(i,a7,a6,a5,a4,a3,a2,a1,a0);
+ int addr = (i & ~0xff) | bitswap<8>(i,a7,a6,a5,a4,a3,a2,a1,a0);
rom[i] = tmp[addr];
}
@@ -363,7 +363,7 @@ void igs017_state::tjsb_decrypt_sprites()
memcpy(tmp.get(), rom, length);
for (i = 0; i < length; i++)
{
- addr = (i & ~0xff) | BITSWAP8(i,7,6,5,2,1,4,3,0);
+ addr = (i & ~0xff) | bitswap<8>(i,7,6,5,2,1,4,3,0);
rom[i] = tmp[addr];
}
@@ -371,7 +371,7 @@ void igs017_state::tjsb_decrypt_sprites()
for (i = 0; i < length; i += 2)
{
uint16_t data = (rom[i+1] << 8) | rom[i+0]; // x-22222-11111-00000
- data = BITSWAP16(data, 15, 14,13,12,11,10, 9,1,7,6,5, 4,3,2,8,0);
+ data = bitswap<16>(data, 15, 14,13,12,11,10, 9,1,7,6,5, 4,3,2,8,0);
rom[i+0] = data;
rom[i+1] = data >> 8;
}
@@ -447,8 +447,8 @@ void igs017_state::mgcs_decrypt_tiles()
memcpy(&tmp[0],rom,length);
for (i = 0;i < length;i++)
{
- int addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,12,11,10,6,7,8,9,5,4,3,2,1,0);
- rom[i^1] = BITSWAP8(tmp[addr],0,1,2,3,4,5,6,7);
+ int addr = (i & ~0xffff) | bitswap<16>(i,15,14,13,12,11,10,6,7,8,9,5,4,3,2,1,0);
+ rom[i^1] = bitswap<8>(tmp[addr],0,1,2,3,4,5,6,7);
}
}
@@ -463,10 +463,10 @@ void igs017_state::mgcs_flip_sprites()
uint16_t pixels = (rom[i+1] << 8) | rom[i+0];
// flip bits
- pixels = BITSWAP16(pixels,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
+ pixels = bitswap<16>(pixels,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
// flip pixels
- pixels = BITSWAP16(pixels,15, 0,1,2,3,4, 5,6,7,8,9, 10,11,12,13,14);
+ pixels = bitswap<16>(pixels,15, 0,1,2,3,4, 5,6,7,8,9, 10,11,12,13,14);
rom[i+0] = pixels;
rom[i+1] = pixels >> 8;
@@ -507,8 +507,8 @@ void igs017_state::tarzan_decrypt_tiles()
memcpy(&tmp[0],rom,length);
for (i = 0;i < length;i++)
{
- int addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,12,11,7,8,6,10,9,5,4,3,2,1,0);
- rom[i] = BITSWAP8(tmp[addr],0,1,2,3,4,5,6,7);
+ int addr = (i & ~0xffff) | bitswap<16>(i,15,14,13,12,11,7,8,6,10,9,5,4,3,2,1,0);
+ rom[i] = bitswap<8>(tmp[addr],0,1,2,3,4,5,6,7);
}
}
@@ -765,7 +765,7 @@ void igs017_state::lhzb2_decrypt_tiles()
memcpy(&tmp[0], rom, length);
for (i = 0; i < length; i++)
{
- addr = (i & ~0xffffff) | BITSWAP24(i,23,22,21,20,19,18,17,1,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0);
+ addr = (i & ~0xffffff) | bitswap<24>(i,23,22,21,20,19,18,17,1,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,0);
rom[i] = tmp[addr];
}
}
@@ -781,7 +781,7 @@ void igs017_state::lhzb2_decrypt_sprites()
memcpy(tmp.get(), rom, length);
for (i = 0; i < length; i++)
{
- addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,6,7,10,9,8,11,12,5,4,3,2,1,0);
+ addr = (i & ~0xffff) | bitswap<16>(i,15,14,13,6,7,10,9,8,11,12,5,4,3,2,1,0);
rom[i] = tmp[addr];
}
@@ -789,7 +789,7 @@ void igs017_state::lhzb2_decrypt_sprites()
for (i = 0;i < length;i+=2)
{
uint16_t data = (rom[i+1] << 8) | rom[i+0]; // x-22222-11111-00000
- data = BITSWAP16(data, 15, 7,6,5,4,3, 2,1,0,14,13, 12,11,10,9,8);
+ data = bitswap<16>(data, 15, 7,6,5,4,3, 2,1,0,14,13, 12,11,10,9,8);
rom[i+0] = data;
rom[i+1] = data >> 8;
}
@@ -989,7 +989,7 @@ void igs017_state::slqz2_decrypt_tiles()
memcpy(&tmp[0],rom,length);
for (i = 0;i < length;i++)
{
- int addr = (i & ~0xff) | BITSWAP8(i,7,4,5,6,3,2,1,0);
+ int addr = (i & ~0xff) | bitswap<8>(i,7,4,5,6,3,2,1,0);
rom[i] = tmp[addr];
}
}
@@ -1096,9 +1096,9 @@ void igs017_state::spkrform_decrypt_sprites()
for (i = 0; i < length; i++)
{
if (i & 0x80000)
- addr = (i & ~0xff) | BITSWAP8(i,7,6,3,4,5,2,1,0);
+ addr = (i & ~0xff) | bitswap<8>(i,7,6,3,4,5,2,1,0);
else
- addr = (i & ~0xffff) | BITSWAP16(i,15,14,13,12,11,10, 4, 8,7,6,5, 9,3,2,1,0);
+ addr = (i & ~0xffff) | bitswap<16>(i,15,14,13,12,11,10, 4, 8,7,6,5, 9,3,2,1,0);
rom[i] = tmp[addr];
}
@@ -1412,7 +1412,7 @@ READ16_MEMBER(igs017_state::mgcs_magic_r)
case 0x01:
{
- uint16_t ret = BITSWAP8( (BITSWAP8(m_scramble_data, 0,1,2,3,4,5,6,7) + 1) & 3, 4,5,6,7, 0,1,2,3);
+ uint16_t ret = bitswap<8>( (bitswap<8>(m_scramble_data, 0,1,2,3,4,5,6,7) + 1) & 3, 4,5,6,7, 0,1,2,3);
logerror("%s: reading %02x from igs_magic = %02x\n", machine().describe_context(), ret, m_igs_magic[0]);
return ret;
}
@@ -1627,7 +1627,7 @@ READ16_MEMBER(igs017_state::mgdha_magic_r)
return ioport("BUTTONS")->read();
case 0x02:
- return BITSWAP8(ioport("DSW2")->read(), 0,1,2,3,4,5,6,7);
+ return bitswap<8>(ioport("DSW2")->read(), 0,1,2,3,4,5,6,7);
case 0x03:
{
diff --git a/src/mame/drivers/igs_m027.cpp b/src/mame/drivers/igs_m027.cpp
index a2389ee..d3932cf 100644
--- a/src/mame/drivers/igs_m027.cpp
+++ b/src/mame/drivers/igs_m027.cpp
@@ -212,7 +212,7 @@ void igs_m027_state::sdwx_gfx_decrypt()
std::vector<uint8_t> result_data(rom_size);
for (i=0; i<rom_size; i++)
- result_data[i] = src[BITSWAP24(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)];
+ result_data[i] = src[bitswap<24>(i, 23,22,21,20,19,18,17,16,15,14,13,12,11,8,7,6,10,9,5,4,3,2,1,0)];
for (i=0; i<rom_size; i+=0x200)
{
diff --git a/src/mame/drivers/igspoker.cpp b/src/mame/drivers/igspoker.cpp
index 5b805f3..882bf27 100644
--- a/src/mame/drivers/igspoker.cpp
+++ b/src/mame/drivers/igspoker.cpp
@@ -2605,7 +2605,7 @@ DRIVER_INIT_MEMBER(igspoker_state,number10)
memcpy(&tmp[0],rom,length);
for (A = 0; A < length; A++)
{
- int addr = (A & ~0xffff) | BITSWAP16(A,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
+ int addr = (A & ~0xffff) | bitswap<16>(A,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
rom[A] = tmp[addr];
}
}
diff --git a/src/mame/drivers/inder.cpp b/src/mame/drivers/inder.cpp
index ae429be..230c3c4 100644
--- a/src/mame/drivers/inder.cpp
+++ b/src/mame/drivers/inder.cpp
@@ -1121,7 +1121,7 @@ WRITE8_MEMBER( inder_state::sw_w )
WRITE8_MEMBER( inder_state::sn_w )
{
- m_sn->write(space, 0, BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7));
+ m_sn->write(space, 0, bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7));
}
WRITE8_MEMBER( inder_state::sndcmd_lapbylap_w )
diff --git a/src/mame/drivers/jack.cpp b/src/mame/drivers/jack.cpp
index eccc17d..9bcf5b5 100644
--- a/src/mame/drivers/jack.cpp
+++ b/src/mame/drivers/jack.cpp
@@ -1590,16 +1590,16 @@ DRIVER_INIT_MEMBER(jack_state,striv)
if (A & 0x1000)
{
if (A & 4)
- ROM[A] = BITSWAP8(data,7,2,5,1,3,6,4,0) ^ 1;
+ ROM[A] = bitswap<8>(data,7,2,5,1,3,6,4,0) ^ 1;
else
- ROM[A] = BITSWAP8(data,0,2,5,1,3,6,4,7) ^ 0x81;
+ ROM[A] = bitswap<8>(data,0,2,5,1,3,6,4,7) ^ 0x81;
}
else
{
if (A & 4)
- ROM[A] = BITSWAP8(data,7,2,5,1,3,6,4,0) ^ 1;
+ ROM[A] = bitswap<8>(data,7,2,5,1,3,6,4,0) ^ 1;
else
- ROM[A] = BITSWAP8(data,0,2,5,1,3,6,4,7);
+ ROM[A] = bitswap<8>(data,0,2,5,1,3,6,4,7);
}
}
diff --git a/src/mame/drivers/jclub2.cpp b/src/mame/drivers/jclub2.cpp
index 7ee386c..096d73f 100644
--- a/src/mame/drivers/jclub2.cpp
+++ b/src/mame/drivers/jclub2.cpp
@@ -1499,7 +1499,7 @@ DRIVER_INIT_MEMBER(darkhors_state,darkhors)
std::vector<uint8_t> temp(len);
for (int i = 0; i < len; i++)
- temp[i] = eeprom[BITSWAP8(i,7,5,4,3,2,1,0,6)];
+ temp[i] = eeprom[bitswap<8>(i,7,5,4,3,2,1,0,6)];
memcpy(eeprom, &temp[0], len);
}
diff --git a/src/mame/drivers/jongkyo.cpp b/src/mame/drivers/jongkyo.cpp
index 6e0eb84..082da98 100644
--- a/src/mame/drivers/jongkyo.cpp
+++ b/src/mame/drivers/jongkyo.cpp
@@ -564,7 +564,7 @@ DRIVER_INIT_MEMBER(jongkyo_state,jongkyo)
/* first of all, do a simple bitswap */
for (int i = 0x6000; i < 0x8c00; ++i)
{
- rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0);
+ rom[i] = bitswap<8>(rom[i], 7,6,5,3,4,2,1,0);
}
uint8_t *opcodes = auto_alloc_array(machine(), uint8_t, 0x6c00+0x400*8);
diff --git a/src/mame/drivers/jp.cpp b/src/mame/drivers/jp.cpp
index 821f220..d66d3ba 100644
--- a/src/mame/drivers/jp.cpp
+++ b/src/mame/drivers/jp.cpp
@@ -256,7 +256,7 @@ void jp_state::update_display()
if (t == 8)
{ // ball number
segment = m_disp_data >> 6;
- output().set_digit_value(94, BITSWAP8(segment, 0, 1, 2, 3, 4, 5, 6, 7) ^ 0xff);
+ output().set_digit_value(94, bitswap<8>(segment, 0, 1, 2, 3, 4, 5, 6, 7) ^ 0xff);
}
else if (t < 8)
{ // main displays
diff --git a/src/mame/drivers/k28.cpp b/src/mame/drivers/k28.cpp
index c78a73c..965bf62 100644
--- a/src/mame/drivers/k28.cpp
+++ b/src/mame/drivers/k28.cpp
@@ -337,7 +337,7 @@ WRITE_LINE_MEMBER(k28_state::mcu_prog_w)
// output 0-15: digit segment data
u16 seg_data = (u16)(m_vfd_shiftreg >> 19);
- seg_data = BITSWAP16(seg_data,0,1,13,9,10,12,14,8,3,4,5,2,15,11,6,7);
+ seg_data = bitswap<16>(seg_data,0,1,13,9,10,12,14,8,3,4,5,2,15,11,6,7);
// output 16-24: digit select
u16 digit_sel = (u16)(m_vfd_shiftreg >> 10) & 0x1ff;
diff --git a/src/mame/drivers/kaneko16.cpp b/src/mame/drivers/kaneko16.cpp
index a39e972..7e535c7 100644
--- a/src/mame/drivers/kaneko16.cpp
+++ b/src/mame/drivers/kaneko16.cpp
@@ -278,14 +278,14 @@ WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_oki_w)
READ16_MEMBER(kaneko16_berlwall_state::berlwall_spriteram_r)
{
- offset = BITSWAP16(offset, 15, 14, 13, 12, 2, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0);
+ offset = bitswap<16>(offset, 15, 14, 13, 12, 2, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0);
offset ^= 0x800;
return m_spriteram[offset];
}
WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_spriteram_w)
{
- offset = BITSWAP16(offset, 15, 14, 13, 12, 2, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0);
+ offset = bitswap<16>(offset, 15, 14, 13, 12, 2, 11, 10, 9, 8, 7, 6, 5, 4, 3, 1, 0);
offset ^= 0x800;
COMBINE_DATA(&m_spriteram[offset]);
}
@@ -294,7 +294,7 @@ READ16_MEMBER(kaneko16_berlwall_state::berlwall_spriteregs_r)
{
if (offset & 0x4)
return 0;
- offset = BITSWAP8(offset, 7, 6, 5, 2, 4, 3, 1, 0);
+ offset = bitswap<8>(offset, 7, 6, 5, 2, 4, 3, 1, 0);
return m_kaneko_spr->kaneko16_sprites_regs_r(space, offset, mem_mask);
}
@@ -302,7 +302,7 @@ WRITE16_MEMBER(kaneko16_berlwall_state::berlwall_spriteregs_w)
{
if (offset & 0x4)
return;
- offset = BITSWAP8(offset, 7, 6, 5, 2, 4, 3, 1, 0);
+ offset = bitswap<8>(offset, 7, 6, 5, 2, 4, 3, 1, 0);
m_kaneko_spr->kaneko16_sprites_regs_w(space, offset, data, mem_mask);
}
diff --git a/src/mame/drivers/kas89.cpp b/src/mame/drivers/kas89.cpp
index d2a067c..cf1bddc 100644
--- a/src/mame/drivers/kas89.cpp
+++ b/src/mame/drivers/kas89.cpp
@@ -841,7 +841,7 @@ DRIVER_INIT_MEMBER(kas89_state,kas89)
/* Unscrambling data lines */
for ( i = 0; i < memsize; i++ )
{
- mem[i] = BITSWAP8(mem[i], 3, 1, 0, 5, 6, 4, 7, 2);
+ mem[i] = bitswap<8>(mem[i], 3, 1, 0, 5, 6, 4, 7, 2);
}
/* Unscrambling address lines */
@@ -849,7 +849,7 @@ DRIVER_INIT_MEMBER(kas89_state,kas89)
memcpy(&buf[0], mem, memsize);
for ( i = 0; i < memsize; i++ )
{
- mem[BITSWAP16(i, 15, 14, 5, 6, 3, 0, 12, 1, 9, 13, 4, 7, 10, 8, 2, 11)] = buf[i];
+ mem[bitswap<16>(i, 15, 14, 5, 6, 3, 0, 12, 1, 9, 13, 4, 7, 10, 8, 2, 11)] = buf[i];
}
}
diff --git a/src/mame/drivers/kingdrby.cpp b/src/mame/drivers/kingdrby.cpp
index 90f87d7..36f94ac 100644
--- a/src/mame/drivers/kingdrby.cpp
+++ b/src/mame/drivers/kingdrby.cpp
@@ -904,7 +904,7 @@ PALETTE_INIT_MEMBER(kingdrby_state,kingdrbb)
for(i = 0; i < 0x200; i++)
{
/* this set has an extra address line shuffle applied on the prom */
- prom[i] = raw_prom[BITSWAP16(i, 15,14,13,12,11,10,9,8,7,6,5,0,1,2,3,4)+0x1000];
+ 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++)
diff --git a/src/mame/drivers/kurukuru.cpp b/src/mame/drivers/kurukuru.cpp
index d9c774e..1494be1 100644
--- a/src/mame/drivers/kurukuru.cpp
+++ b/src/mame/drivers/kurukuru.cpp
@@ -604,7 +604,7 @@ WRITE8_MEMBER(kurukuru_state::kurukuru_adpcm_reset_w)
bit 2 = S2
bit 3 = S1
*/
- m_adpcm->playmode_w(BITSWAP8((data>>1), 7,6,5,4,3,0,1,2));
+ m_adpcm->playmode_w(bitswap<8>((data>>1), 7,6,5,4,3,0,1,2));
m_adpcm->reset_w(data & 1);
}
diff --git a/src/mame/drivers/lasso.cpp b/src/mame/drivers/lasso.cpp
index c391fdc..2cf4d92 100644
--- a/src/mame/drivers/lasso.cpp
+++ b/src/mame/drivers/lasso.cpp
@@ -64,7 +64,7 @@ READ8_MEMBER(lasso_state::sound_status_r)
WRITE8_MEMBER(lasso_state::sound_select_w)
{
- uint8_t to_write = BITSWAP8(*m_chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
+ uint8_t to_write = bitswap<8>(*m_chip_data, 0, 1, 2, 3, 4, 5, 6, 7);
if (~data & 0x01) /* chip #0 */
m_sn_1->write(space, 0, to_write);
diff --git a/src/mame/drivers/lbeach.cpp b/src/mame/drivers/lbeach.cpp
index fd9e89d..2ecda22 100644
--- a/src/mame/drivers/lbeach.cpp
+++ b/src/mame/drivers/lbeach.cpp
@@ -202,7 +202,7 @@ WRITE8_MEMBER(lbeach_state::lbeach_fg_vram_w)
READ8_MEMBER(lbeach_state::lbeach_in1_r)
{
// d6,7(steering wheel) need to be swapped
- return BITSWAP8(ioport("IN1")->read(),6,7,5,4,3,2,1,0);
+ return bitswap<8>(ioport("IN1")->read(),6,7,5,4,3,2,1,0);
}
READ8_MEMBER(lbeach_state::lbeach_in2_r)
diff --git a/src/mame/drivers/lc80.cpp b/src/mame/drivers/lc80.cpp
index ca64d77..1033512 100644
--- a/src/mame/drivers/lc80.cpp
+++ b/src/mame/drivers/lc80.cpp
@@ -164,7 +164,7 @@ WRITE8_MEMBER( lc80_state::pio1_pa_w )
*/
- m_segment = BITSWAP8(~data, 4, 3, 1, 6, 7, 5, 0, 2);
+ m_segment = bitswap<8>(~data, 4, 3, 1, 6, 7, 5, 0, 2);
update_display();
}
diff --git a/src/mame/drivers/legionna.cpp b/src/mame/drivers/legionna.cpp
index 21936a8..e864610 100644
--- a/src/mame/drivers/legionna.cpp
+++ b/src/mame/drivers/legionna.cpp
@@ -1054,7 +1054,7 @@ void legionna_state::descramble_legionnaire_gfx(uint8_t* src)
int i;
for (i = 0;i < len; i++)
{
- buffer[i] = src[BITSWAP24(i,
+ buffer[i] = src[bitswap<24>(i,
23,22,21,20,
19,18,17,16,
6,5,15,14,13,12,
diff --git a/src/mame/drivers/lemmings.cpp b/src/mame/drivers/lemmings.cpp
index 900a464..023acc8 100644
--- a/src/mame/drivers/lemmings.cpp
+++ b/src/mame/drivers/lemmings.cpp
@@ -51,7 +51,7 @@ READ16_MEMBER(lemmings_state::lemmings_trackball_r)
READ16_MEMBER( lemmings_state::lem_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -60,7 +60,7 @@ READ16_MEMBER( lemmings_state::lem_protection_region_0_146_r )
WRITE16_MEMBER( lemmings_state::lem_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/looping.cpp b/src/mame/drivers/looping.cpp
index 9f0e58c..610e063 100644
--- a/src/mame/drivers/looping.cpp
+++ b/src/mame/drivers/looping.cpp
@@ -913,7 +913,7 @@ DRIVER_INIT_MEMBER(looping_state,looping)
/* bitswap the TMS9995 ROMs */
for (i = 0; i < length; i++)
- rom[i] = BITSWAP8(rom[i], 0,1,2,3,4,5,6,7);
+ rom[i] = bitswap<8>(rom[i], 0,1,2,3,4,5,6,7);
/* install protection handlers */
m_maincpu->space(AS_PROGRAM).install_read_handler(0x7000, 0x7007, read8_delegate(FUNC(looping_state::protection_r), this));
diff --git a/src/mame/drivers/ltcasino.cpp b/src/mame/drivers/ltcasino.cpp
index 05df8f2..37035b3 100644
--- a/src/mame/drivers/ltcasino.cpp
+++ b/src/mame/drivers/ltcasino.cpp
@@ -723,7 +723,7 @@ DRIVER_INIT_MEMBER(ltcasino_state,mv4in1)
int i;
uint8_t *rom = memregion("maincpu")->base();
for(i=0;i<0x10000;i++)
- rom[i]=BITSWAP8(rom[i],7,6,5,4,3,1,2,0);
+ rom[i]=bitswap<8>(rom[i],7,6,5,4,3,1,2,0);
}
diff --git a/src/mame/drivers/ltd.cpp b/src/mame/drivers/ltd.cpp
index 83c848d..f8b14c6 100644
--- a/src/mame/drivers/ltd.cpp
+++ b/src/mame/drivers/ltd.cpp
@@ -306,7 +306,7 @@ WRITE8_MEMBER( ltd_state::port1_w )
if (m_port2 & 0x10)
{
uint8_t row = m_digit & 15;
- uint8_t segment = BITSWAP8(data, 7, 0, 1, 2, 3, 4, 5, 6);
+ uint8_t segment = bitswap<8>(data, 7, 0, 1, 2, 3, 4, 5, 6);
switch (m_counter)
{
diff --git a/src/mame/drivers/m90.cpp b/src/mame/drivers/m90.cpp
index b121752..2ed7cb6 100644
--- a/src/mame/drivers/m90.cpp
+++ b/src/mame/drivers/m90.cpp
@@ -1248,10 +1248,10 @@ DRIVER_INIT_MEMBER(m90_state,bomblord)
for (int i = 0; i < 0x100000 / 2; i += 4)
{
- ROM[i+0]=BITSWAP16(ROM[i+0],0xc,0x8,0xd,0xe,0xf,0xb,0xa,0x9,0x6,0x4,0x7,0x3,0x1,0x2,0x0,0x5);
- ROM[i+1]=BITSWAP16(ROM[i+1],0xc,0xb,0xd,0xa,0xe,0x9,0xf,0x8,0x0,0x6,0x1,0x5,0x3,0x4,0x2,0x7);
- ROM[i+2]=BITSWAP16(ROM[i+2],0xd,0x9,0xc,0x8,0xe,0xf,0xa,0xb,0x4,0x7,0x3,0x2,0x5,0x6,0x1,0x0);
- ROM[i+3]=BITSWAP16(ROM[i+3],0xe,0xd,0xf,0x8,0xb,0xa,0x9,0xc,0x6,0x3,0x7,0x5,0x0,0x1,0x4,0x2);
+ ROM[i+0]=bitswap<16>(ROM[i+0],0xc,0x8,0xd,0xe,0xf,0xb,0xa,0x9,0x6,0x4,0x7,0x3,0x1,0x2,0x0,0x5);
+ ROM[i+1]=bitswap<16>(ROM[i+1],0xc,0xb,0xd,0xa,0xe,0x9,0xf,0x8,0x0,0x6,0x1,0x5,0x3,0x4,0x2,0x7);
+ ROM[i+2]=bitswap<16>(ROM[i+2],0xd,0x9,0xc,0x8,0xe,0xf,0xa,0xb,0x4,0x7,0x3,0x2,0x5,0x6,0x1,0x0);
+ ROM[i+3]=bitswap<16>(ROM[i+3],0xe,0xd,0xf,0x8,0xb,0xa,0x9,0xc,0x6,0x3,0x7,0x5,0x0,0x1,0x4,0x2);
}
}
diff --git a/src/mame/drivers/madalien.cpp b/src/mame/drivers/madalien.cpp
index 7ca8b82..497830f 100644
--- a/src/mame/drivers/madalien.cpp
+++ b/src/mame/drivers/madalien.cpp
@@ -43,11 +43,11 @@ READ8_MEMBER(madalien_state::shift_r)
READ8_MEMBER(madalien_state::shift_rev_r)
{
uint8_t hi = *m_shift_hi ^ 0x07;
- uint8_t lo = BITSWAP8(*m_shift_lo,0,1,2,3,4,5,6,7);
+ uint8_t lo = bitswap<8>(*m_shift_lo,0,1,2,3,4,5,6,7);
uint8_t ret = shift_common(hi, lo);
- return BITSWAP8(ret,7,0,1,2,3,4,5,6) & 0x7f;
+ return bitswap<8>(ret,7,0,1,2,3,4,5,6) & 0x7f;
}
diff --git a/src/mame/drivers/mcr3.cpp b/src/mame/drivers/mcr3.cpp
index ba1aba9..b1d42fc 100644
--- a/src/mame/drivers/mcr3.cpp
+++ b/src/mame/drivers/mcr3.cpp
@@ -268,7 +268,7 @@ WRITE8_MEMBER(mcr3_state::maxrpm_op6_w)
/* when both the write and the enable are low, it's a write to the ADC0844 */
if (!(data & 0x40) && !(data & 0x20))
- m_maxrpm_adc->write(space, 0, BITSWAP8(m_maxrpm_adc_control, 7, 6, 5, 4, 2, 3, 1, 0));
+ m_maxrpm_adc->write(space, 0, bitswap<8>(m_maxrpm_adc_control, 7, 6, 5, 4, 2, 3, 1, 0));
/* low 5 bits control the turbo CS */
m_turbo_cheap_squeak->write(space, offset, data);
diff --git a/src/mame/drivers/meadows.cpp b/src/mame/drivers/meadows.cpp
index 5ae137b..39242ae 100644
--- a/src/mame/drivers/meadows.cpp
+++ b/src/mame/drivers/meadows.cpp
@@ -141,7 +141,7 @@
READ8_MEMBER(meadows_state::hsync_chain_r)
{
uint8_t val = m_screen->hpos();
- return BITSWAP8(val,0,1,2,3,4,5,6,7);
+ return bitswap<8>(val,0,1,2,3,4,5,6,7);
}
diff --git a/src/mame/drivers/megadrvb.cpp b/src/mame/drivers/megadrvb.cpp
index 22dfbbe..d0cbc41 100644
--- a/src/mame/drivers/megadrvb.cpp
+++ b/src/mame/drivers/megadrvb.cpp
@@ -812,12 +812,12 @@ DRIVER_INIT_MEMBER(md_boot_state,mk3mdb)
if (x & 0x80000)
{
rom[x] = rom[x] ^ 0xff;
- rom[x] = BITSWAP8(rom[x], 0,3,2,5,4,6,7,1);
+ rom[x] = bitswap<8>(rom[x], 0,3,2,5,4,6,7,1);
}
else
{
rom[x] = rom[x] ^ 0xff;
- rom[x] = BITSWAP8(rom[x], 4,0,7,1,3,6,2,5);
+ rom[x] = bitswap<8>(rom[x], 4,0,7,1,3,6,2,5);
}
}
@@ -826,11 +826,11 @@ DRIVER_INIT_MEMBER(md_boot_state,mk3mdb)
if (x & 0x80000)
{
rom[x] = rom[x] ^ 0xff;
- rom[x] = BITSWAP8(rom[x], 2,7,5,4,1,0,3,6);
+ rom[x] = bitswap<8>(rom[x], 2,7,5,4,1,0,3,6);
}
else
{
- rom[x] = BITSWAP8(rom[x], 6,1,4,2,7,0,3,5);
+ rom[x] = bitswap<8>(rom[x], 6,1,4,2,7,0,3,5);
}
}
@@ -874,12 +874,12 @@ DRIVER_INIT_MEMBER(md_boot_state,srmdb)
for (int x = 0x00001; x < 0x40000; x += 2)
{
- rom[x] = BITSWAP8(rom[x] ^ 0xff, 5,1,6,2,4,3,7,0);
+ rom[x] = bitswap<8>(rom[x] ^ 0xff, 5,1,6,2,4,3,7,0);
}
for (int x = 0x40001; x < 0x80000; x += 2)
{
- rom[x] = BITSWAP8(rom[x] ^ 0x00, 2,6,1,5,0,7,3,4);
+ rom[x] = bitswap<8>(rom[x] ^ 0x00, 2,6,1,5,0,7,3,4);
}
// boot vectors don't seem to be valid, so they are patched...
diff --git a/src/mame/drivers/megasys1.cpp b/src/mame/drivers/megasys1.cpp
index 023c570..0682885 100644
--- a/src/mame/drivers/megasys1.cpp
+++ b/src/mame/drivers/megasys1.cpp
@@ -4329,7 +4329,7 @@ void megasys1_state::jitsupro_gfx_unmangle(const char *region)
/* data lines swap: 76543210 -> 43576210 */
for (i = 0;i < size;i++)
- rom[i] = BITSWAP8(rom[i],0x4,0x3,0x5,0x7,0x6,0x2,0x1,0x0);
+ rom[i] = bitswap<8>(rom[i],0x4,0x3,0x5,0x7,0x6,0x2,0x1,0x0);
std::vector<uint8_t> buffer(size);
@@ -4339,7 +4339,7 @@ void megasys1_state::jitsupro_gfx_unmangle(const char *region)
for (i = 0;i < size;i++)
{
int a = (i & ~0xffff) |
- BITSWAP16(i,0xf,0xe,0x8,0xc,0xb,0x3,0x9,0xd,0x7,0x6,0x5,0x4,0xa,0x2,0x1,0x0);
+ bitswap<16>(i,0xf,0xe,0x8,0xc,0xb,0x3,0x9,0xd,0x7,0x6,0x5,0x4,0xa,0x2,0x1,0x0);
rom[i] = buffer[a];
}
@@ -4353,7 +4353,7 @@ void megasys1_state::stdragona_gfx_unmangle(const char *region)
/* data lines swap: 76543210 -> 37564210 */
for (i = 0;i < size;i++)
- rom[i] = BITSWAP8(rom[i],3,7,5,6,4,2,1,0);
+ rom[i] = bitswap<8>(rom[i],3,7,5,6,4,2,1,0);
std::vector<uint8_t> buffer(size);
@@ -4363,7 +4363,7 @@ void megasys1_state::stdragona_gfx_unmangle(const char *region)
for (i = 0;i < size;i++)
{
int a = (i & ~0xffff) |
- BITSWAP16(i,0xf,0xe,0x3,0xc,0xb,0xd,0x9,0xa,0x7,0x6,0x5,0x4,0x8,0x2,0x1,0x0);
+ bitswap<16>(i,0xf,0xe,0x3,0xc,0xb,0xd,0x9,0xa,0x7,0x6,0x5,0x4,0x8,0x2,0x1,0x0);
rom[i] = buffer[a];
}
diff --git a/src/mame/drivers/mephisto_montec.cpp b/src/mame/drivers/mephisto_montec.cpp
index b01caad..c0db9fa 100644
--- a/src/mame/drivers/mephisto_montec.cpp
+++ b/src/mame/drivers/mephisto_montec.cpp
@@ -162,8 +162,8 @@ WRITE8_MEMBER(mephisto_montec_state::montec_lcd_clk_w)
if (m_display.shift == 8)
{
- if (m_lcd_mux & 0x01) output().set_digit_value(0 + m_display.pos, BITSWAP8(m_display.data, 0,3,2,7,6,5,4,1));
- if (m_lcd_mux & 0x02) output().set_digit_value(4 + m_display.pos, BITSWAP8(m_display.data, 0,3,2,7,6,5,4,1));
+ if (m_lcd_mux & 0x01) output().set_digit_value(0 + m_display.pos, bitswap<8>(m_display.data, 0,3,2,7,6,5,4,1));
+ if (m_lcd_mux & 0x02) output().set_digit_value(4 + m_display.pos, bitswap<8>(m_display.data, 0,3,2,7,6,5,4,1));
m_display.shift = 0;
m_display.pos = (m_display.pos + 1) & 3;
diff --git a/src/mame/drivers/merit.cpp b/src/mame/drivers/merit.cpp
index e360fc2..8195deb 100644
--- a/src/mame/drivers/merit.cpp
+++ b/src/mame/drivers/merit.cpp
@@ -204,20 +204,20 @@ READ8_MEMBER(merit_state::questions_r)
WRITE8_MEMBER(merit_state::low_offset_w)
{
offset = (offset & 0xf0) | ((offset - m_decryption_key) & 0x0f);
- offset = BITSWAP8(offset,7,6,5,4,0,1,2,3);
+ offset = bitswap<8>(offset,7,6,5,4,0,1,2,3);
m_question_address = (m_question_address & 0xffff00) | offset;
}
WRITE8_MEMBER(merit_state::med_offset_w)
{
offset = (offset & 0xf0) | ((offset - m_decryption_key) & 0x0f);
- offset = BITSWAP8(offset,7,6,5,4,0,1,2,3);
+ offset = bitswap<8>(offset,7,6,5,4,0,1,2,3);
m_question_address = (m_question_address & 0xff00ff) | (offset << 8);
}
WRITE8_MEMBER(merit_state::high_offset_w)
{
- offset = BITSWAP8(offset,7,6,5,4,0,1,2,3);
+ offset = bitswap<8>(offset,7,6,5,4,0,1,2,3);
m_question_address = (m_question_address & 0x00ffff) | (offset << 16);
}
diff --git a/src/mame/drivers/metlfrzr.cpp b/src/mame/drivers/metlfrzr.cpp
index 9a0acea..f57c531 100644
--- a/src/mame/drivers/metlfrzr.cpp
+++ b/src/mame/drivers/metlfrzr.cpp
@@ -449,14 +449,14 @@ DRIVER_INIT_MEMBER(metlfrzr_state, metlfrzr)
m_decrypted_opcodes[A] ^= 0x02;
if (BIT(A,9) || !BIT(A,5) || BIT(A,3))
- m_decrypted_opcodes[A] = BITSWAP8(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
+ m_decrypted_opcodes[A] = bitswap<8>(m_decrypted_opcodes[A],7,6,1,4,3,2,5,0);
/* decode the data */
if (BIT(A,5))
rom[A] ^= 0x40;
if (BIT(A,9) || !BIT(A,5))
- rom[A] = BITSWAP8(rom[A],7,6,1,4,3,2,5,0);
+ rom[A] = bitswap<8>(rom[A],7,6,1,4,3,2,5,0);
}
}
diff --git a/src/mame/drivers/metro.cpp b/src/mame/drivers/metro.cpp
index 87a6edb..0b1220e 100644
--- a/src/mame/drivers/metro.cpp
+++ b/src/mame/drivers/metro.cpp
@@ -5535,7 +5535,7 @@ DRIVER_INIT_MEMBER(metro_state,balcube)
for (unsigned i = 0; i < len; i+=2)
{
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
}
metro_common();
@@ -5552,11 +5552,11 @@ DRIVER_INIT_MEMBER(metro_state,dharmak)
{
uint8_t dat;
dat = src[i + 1];
- dat = BITSWAP8(dat, 7,3,2,4, 5,6,1,0);
+ dat = bitswap<8>(dat, 7,3,2,4, 5,6,1,0);
src[i + 1] = dat;
dat = src[i + 3];
- dat = BITSWAP8(dat, 7,2,5,4, 3,6,1,0);
+ dat = bitswap<8>(dat, 7,2,5,4, 3,6,1,0);
src[i + 3] = dat;
}
diff --git a/src/mame/drivers/minicom.cpp b/src/mame/drivers/minicom.cpp
index e094f8d..cdc3766 100644
--- a/src/mame/drivers/minicom.cpp
+++ b/src/mame/drivers/minicom.cpp
@@ -212,7 +212,7 @@ WRITE8_MEMBER(minicom_state::minicom_io_w)
if (BIT(changed,4) || BIT(changed,5))
{
- output().set_digit_value(m_digit_index, BITSWAP16(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF);
+ output().set_digit_value(m_digit_index, bitswap<16>(m_display_data, 9, 1, 3, 11, 12, 4, 2, 10, 14, 6, 7, 5, 0, 15, 13, 8) & 0x3FFF);
}
m_p[offset]=data;
}
diff --git a/src/mame/drivers/mirax.cpp b/src/mame/drivers/mirax.cpp
index 8c110a8..dd359f3 100644
--- a/src/mame/drivers/mirax.cpp
+++ b/src/mame/drivers/mirax.cpp
@@ -583,13 +583,13 @@ DRIVER_INIT_MEMBER(mirax_state,mirax)
int i;
for(i=0x0000;i<0x4000;i++)
- ROM[BITSWAP16(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (BITSWAP8(DATA[i], 1, 3, 7, 0, 5, 6, 4, 2) ^ 0xff);
+ ROM[bitswap<16>(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (bitswap<8>(DATA[i], 1, 3, 7, 0, 5, 6, 4, 2) ^ 0xff);
for(i=0x4000;i<0x8000;i++)
- ROM[BITSWAP16(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (BITSWAP8(DATA[i], 2, 1, 0, 6, 7, 5, 3, 4) ^ 0xff);
+ ROM[bitswap<16>(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (bitswap<8>(DATA[i], 2, 1, 0, 6, 7, 5, 3, 4) ^ 0xff);
for(i=0x8000;i<0xc000;i++)
- ROM[BITSWAP16(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (BITSWAP8(DATA[i], 1, 3, 7, 0, 5, 6, 4, 2) ^ 0xff);
+ ROM[bitswap<16>(i, 15,14,13,12,11,10,9, 5,7,6,8, 4,3,2,1,0)] = (bitswap<8>(DATA[i], 1, 3, 7, 0, 5, 6, 4, 2) ^ 0xff);
}
GAME( 1985, mirax, 0, mirax, mirax, mirax_state, mirax, ROT90, "Current Technologies", "Mirax (set 1)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/missb2.cpp b/src/mame/drivers/missb2.cpp
index 751ade7..32c7b6e 100644
--- a/src/mame/drivers/missb2.cpp
+++ b/src/mame/drivers/missb2.cpp
@@ -164,12 +164,12 @@ WRITE8_MEMBER(missb2_state::missb2_bg_bank_w)
WRITE8_MEMBER(missb2_state::missb2_oki_w)
{
- m_oki->write_command(BITSWAP8(data, 7,5,6,4,3,1,2,0));
+ m_oki->write_command(bitswap<8>(data, 7,5,6,4,3,1,2,0));
}
READ8_MEMBER(missb2_state::missb2_oki_r)
{
- return BITSWAP8(m_oki->read_status(), 7,5,6,4,3,1,2,0);
+ return bitswap<8>(m_oki->read_status(), 7,5,6,4,3,1,2,0);
}
/* Memory Maps */
diff --git a/src/mame/drivers/missile.cpp b/src/mame/drivers/missile.cpp
index 3b84b23..cf5cd3a 100644
--- a/src/mame/drivers/missile.cpp
+++ b/src/mame/drivers/missile.cpp
@@ -1466,8 +1466,8 @@ DRIVER_INIT_MEMBER(missile_state,missilem)
// decrypt rom and put in maincpu region (result looks correct, but is untested)
for (int i = 0; i < 0x10000; i++)
{
- int a = BITSWAP16(i, 15,2,3,0,8,9,7,5,1,4,6,14,13,12,10,11);
- int d = BITSWAP8(src[a], 3,2,4,5,6,1,7,0);
+ int a = bitswap<16>(i, 15,2,3,0,8,9,7,5,1,4,6,14,13,12,10,11);
+ int d = bitswap<8>(src[a], 3,2,4,5,6,1,7,0);
a = i;
a ^= (~a >> 1 & 0x400);
diff --git a/src/mame/drivers/mk1.cpp b/src/mame/drivers/mk1.cpp
index d2e4137..ccad87f 100644
--- a/src/mame/drivers/mk1.cpp
+++ b/src/mame/drivers/mk1.cpp
@@ -99,10 +99,10 @@ WRITE8_MEMBER( mk1_state::mk1_f8_w )
/* 0 is high and allows also input */
m_f8[offset] = data;
- if ( ! ( m_f8[1] & 1 ) ) m_led[0] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 );
- if ( ! ( m_f8[1] & 2 ) ) m_led[1] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 );
- if ( ! ( m_f8[1] & 4 ) ) m_led[2] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 );
- if ( ! ( m_f8[1] & 8 ) ) m_led[3] = BITSWAP8( m_f8[0],2,1,3,4,5,6,7,0 );
+ if ( ! ( m_f8[1] & 1 ) ) m_led[0] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 );
+ if ( ! ( m_f8[1] & 2 ) ) m_led[1] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 );
+ if ( ! ( m_f8[1] & 4 ) ) m_led[2] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 );
+ if ( ! ( m_f8[1] & 8 ) ) m_led[3] = bitswap<8>( m_f8[0],2,1,3,4,5,6,7,0 );
}
static ADDRESS_MAP_START( mk1_mem, AS_PROGRAM, 8, mk1_state )
diff --git a/src/mame/drivers/mkit09.cpp b/src/mame/drivers/mkit09.cpp
index c87a6ae..9495534 100644
--- a/src/mame/drivers/mkit09.cpp
+++ b/src/mame/drivers/mkit09.cpp
@@ -173,7 +173,7 @@ WRITE8_MEMBER( mkit09_state::pa_w )
data ^= 0xff;
if (m_keydata > 3)
{
- output().set_digit_value(m_keydata, BITSWAP8(data, 7, 0, 5, 6, 4, 2, 1, 3));
+ output().set_digit_value(m_keydata, bitswap<8>(data, 7, 0, 5, 6, 4, 2, 1, 3));
m_keydata = 0;
}
diff --git a/src/mame/drivers/monzagp.cpp b/src/mame/drivers/monzagp.cpp
index f3ad865..2418948 100644
--- a/src/mame/drivers/monzagp.cpp
+++ b/src/mame/drivers/monzagp.cpp
@@ -235,7 +235,7 @@ uint32_t monzagp_state::screen_update_monzagp(screen_device &screen, bitmap_ind1
bitmap.pix16(y, x) = color;
// collisions
- uint8_t coll_prom_addr = BITSWAP8(tile_idx, 7, 6, 5, 4, 2, 0, 1, 3);
+ uint8_t coll_prom_addr = bitswap<8>(tile_idx, 7, 6, 5, 4, 2, 0, 1, 3);
uint8_t collisions = collisions_prom[((mycar && othercars) ? 0 : 0x80) | (inv ? 0x40 : 0) | (coll_prom_addr << 2) | (mycar ? 0 : 0x02) | (tile_color & 0x01)];
m_collisions_ff |= ((m_collisions_clk ^ collisions) & collisions);
m_collisions_clk = collisions;
@@ -299,7 +299,7 @@ READ8_MEMBER(monzagp_state::port_r)
}
if (!(m_p1 & 0x40)) // digits
{
- data = m_score_ram[BITSWAP8(offset, 3,2,1,0,7,6,5,4)];
+ data = m_score_ram[bitswap<8>(offset, 3,2,1,0,7,6,5,4)];
//printf("ext 6 r P1:%02x P2:%02x %02x\n", m_p1, m_p2, offset);
}
if (!(m_p1 & 0x80))
@@ -350,7 +350,7 @@ WRITE8_MEMBER(monzagp_state::port_w)
if (!(m_p1 & 0x40)) // digits
{
//printf("ext 6 w P1:%02x P2:%02x, %02x = %02x\n", m_p1, m_p2, offset, data);
- offs_t ram_offset = BITSWAP8(offset, 3,2,1,0,7,6,5,4);
+ offs_t ram_offset = bitswap<8>(offset, 3,2,1,0,7,6,5,4);
m_score_ram[ram_offset] = data & 0x0f;
if ((ram_offset & 0x07) == 0)
diff --git a/src/mame/drivers/mpf1.cpp b/src/mame/drivers/mpf1.cpp
index 44a610e..ca03e5a 100644
--- a/src/mame/drivers/mpf1.cpp
+++ b/src/mame/drivers/mpf1.cpp
@@ -276,7 +276,7 @@ READ8_MEMBER( mpf1_state::ppi_pa_r )
WRITE8_MEMBER( mpf1_state::ppi_pb_w )
{
/* swap bits around for the mame 7-segment emulation */
- uint8_t led_data = BITSWAP8(data, 6, 1, 2, 0, 7, 5, 4, 3);
+ uint8_t led_data = bitswap<8>(data, 6, 1, 2, 0, 7, 5, 4, 3);
/* timer to update segments */
m_led_refresh_timer->adjust(attotime::from_usec(70), led_data);
diff --git a/src/mame/drivers/multfish.cpp b/src/mame/drivers/multfish.cpp
index a19bcf0..2d17657 100644
--- a/src/mame/drivers/multfish.cpp
+++ b/src/mame/drivers/multfish.cpp
@@ -275,12 +275,12 @@ WRITE8_MEMBER(igrosoft_gamble_state::igrosoft_gamble_vid_w)
case 1:
coldat ^= m_xor_palette;
coldat ^= ((coldat&0x2) >>1) | ((coldat&0x80) >>3) ;
- coldat = BITSWAP16(coldat,10,15,5,13,8,12,11,2,0,4,7,14,9,3,1,6);
+ coldat = bitswap<16>(coldat,10,15,5,13,8,12,11,2,0,4,7,14,9,3,1,6);
break;
case 2:
coldat ^= m_xor_palette;
coldat ^= ((coldat&0x0001) <<1) ^ ((coldat&0x0010) <<1) ^ ((coldat&0x0010) <<2) ^ ((coldat&0x0020) <<1) ^ ((coldat&0x0080) >>1);
- coldat = BITSWAP16(coldat,4,10,13,14,8,11,15,12,2,6,5,0,7,3,1,9);
+ coldat = bitswap<16>(coldat,4,10,13,14,8,11,15,12,2,6,5,0,7,3,1,9);
break;
case 3:
// WRONG
@@ -463,7 +463,7 @@ A12 <-> A13
for (j = 0; j < (igrosoft_gamble_ROM_SIZE/0x40); j++)
{
- jscr = BITSWAP16(j,15,14,13,4,3,2,0,1,6,7,5,12,11,10,8,9);
+ jscr = bitswap<16>(j,15,14,13,4,3,2,0,1,6,7,5,12,11,10,8,9);
memcpy(&temprom[j*0x40],&igrosoft_gamble_gfx[romoffset+(jscr*0x40)],0x40);
}
@@ -477,7 +477,7 @@ static inline void rom_decodel(uint8_t *romptr, uint8_t *tmprom, uint8_t xor_dat
for (i = 0; i < igrosoft_gamble_ROM_SIZE; i++)
{
- jscr = BITSWAP24(i,23,22,21,20,19,17,14,18,16,15,12,13,11,9,6,10,8,7,4,5,3,2,1,0) ^ xor_add ^ 8;
+ jscr = bitswap<24>(i,23,22,21,20,19,17,14,18,16,15,12,13,11,9,6,10,8,7,4,5,3,2,1,0) ^ xor_add ^ 8;
tmprom[i] = romptr[jscr] ^ xor_data;
}
memcpy(romptr,tmprom,igrosoft_gamble_ROM_SIZE);
@@ -488,7 +488,7 @@ static inline void rom_decodeh(uint8_t *romptr, uint8_t *tmprom, uint8_t xor_dat
for (i = 0; i < igrosoft_gamble_ROM_SIZE; i++)
{
- jscr = BITSWAP24(i,23,22,21,20,19,17,14,18,16,15,12,13,11,9,6,10,8,7,4,5,2,3,1,0) ^ xor_add;
+ jscr = bitswap<24>(i,23,22,21,20,19,17,14,18,16,15,12,13,11,9,6,10,8,7,4,5,2,3,1,0) ^ xor_add;
tmprom[i] = romptr[jscr] ^ xor_data;
}
memcpy(romptr,tmprom,igrosoft_gamble_ROM_SIZE);
@@ -516,7 +516,7 @@ static inline void roment_decodel(uint8_t *romptr, uint8_t *tmprom, uint8_t xor_
for (i = 0; i < igrosoft_gamble_ROM_SIZE; i++)
{
- jscr = BITSWAP24(i,23,22,21,20,19,16,18,17,14,15,12,13,11,8,10,9,6,7,4,5,3,2,1,0) ^ xor_add ^ 8;
+ jscr = bitswap<24>(i,23,22,21,20,19,16,18,17,14,15,12,13,11,8,10,9,6,7,4,5,3,2,1,0) ^ xor_add ^ 8;
tmprom[i] = romptr[jscr] ^ xor_data;
}
memcpy(romptr,tmprom,igrosoft_gamble_ROM_SIZE);
@@ -527,7 +527,7 @@ static inline void roment_decodeh(uint8_t *romptr, uint8_t *tmprom, uint8_t xor_
for (i = 0; i < igrosoft_gamble_ROM_SIZE; i++)
{
- jscr = BITSWAP24(i,23,22,21,20,19,16,18,17,14,15,12,13,11,8,10,9,6,7,4,5,2,3,1,0) ^ xor_add;
+ jscr = bitswap<24>(i,23,22,21,20,19,16,18,17,14,15,12,13,11,8,10,9,6,7,4,5,2,3,1,0) ^ xor_add;
tmprom[i] = romptr[jscr] ^ xor_data;
}
memcpy(romptr,tmprom,igrosoft_gamble_ROM_SIZE);
diff --git a/src/mame/drivers/multi16.cpp b/src/mame/drivers/multi16.cpp
index 0e90f79..5fddd89 100644
--- a/src/mame/drivers/multi16.cpp
+++ b/src/mame/drivers/multi16.cpp
@@ -76,7 +76,7 @@ uint32_t multi16_state::screen_update_multi16(screen_device &screen, bitmap_ind1
{
for(xi=0;xi<16;xi++)
{
- int dot = (BITSWAP16(m_p_vram[count],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-xi)) & 0x1;
+ int dot = (bitswap<16>(m_p_vram[count],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-xi)) & 0x1;
if(screen.visible_area().contains(x*16+xi, y))
bitmap.pix16(y, x*16+xi) = m_palette->pen(dot);
diff --git a/src/mame/drivers/multigam.cpp b/src/mame/drivers/multigam.cpp
index b157777..34a36ab 100644
--- a/src/mame/drivers/multigam.cpp
+++ b/src/mame/drivers/multigam.cpp
@@ -1433,7 +1433,7 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
- addr = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
+ addr = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
rom[i] = buf[addr];
}
@@ -1442,7 +1442,7 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
- addr = BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
+ addr = bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,8,11,12,10,9,7,6,5,4,3,2,1,0);
rom[i] = buf[addr];
}
rom = memregion("gfx1")->base();
@@ -1450,8 +1450,8 @@ DRIVER_INIT_MEMBER(multigam_state,multigmt)
memcpy(&buf[0], rom, size);
for (i = 0; i < size; i++)
{
- addr = BITSWAP24(i,23,22,21,20,19,18,17,15,16,11,10,12,13,14,8,9,1,3,5,7,6,4,2,0);
- rom[i] = BITSWAP8(buf[addr], 4, 7, 3, 2, 5, 1, 6, 0);
+ addr = bitswap<24>(i,23,22,21,20,19,18,17,15,16,11,10,12,13,14,8,9,1,3,5,7,6,4,2,0);
+ rom[i] = bitswap<8>(buf[addr], 4, 7, 3, 2, 5, 1, 6, 0);
}
multigam_switch_prg_rom(space, 0x0, 0x01);
diff --git a/src/mame/drivers/mustache.cpp b/src/mame/drivers/mustache.cpp
index 5e99fdc..6caa21a 100644
--- a/src/mame/drivers/mustache.cpp
+++ b/src/mame/drivers/mustache.cpp
@@ -280,10 +280,10 @@ DRIVER_INIT_MEMBER(mustache_state,mustache)
{
uint16_t w;
- buf[i] = BITSWAP8(gfx1[i], 0,5,2,6,4,1,7,3);
+ buf[i] = bitswap<8>(gfx1[i], 0,5,2,6,4,1,7,3);
w = (gfx1[i+G1] << 8) | gfx1[i+G1*2];
- w = BITSWAP16(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
+ w = bitswap<16>(w, 14,1,13,5,9,2,10,6, 3,8,4,15,0,11,12,7);
buf[i+G1] = w >> 8;
buf[i+G1*2] = w & 0xff;
@@ -291,7 +291,7 @@ DRIVER_INIT_MEMBER(mustache_state,mustache)
/* BG address lines */
for (i = 0; i < 3*G1; i++)
- gfx1[i] = buf[BITSWAP16(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
+ gfx1[i] = buf[bitswap<16>(i,15,14,13,2,1,0,12,11,10,9,8,7,6,5,4,3)];
/* SPR data lines */
for (i=0;i<G2; i++)
@@ -299,7 +299,7 @@ DRIVER_INIT_MEMBER(mustache_state,mustache)
uint16_t w;
w = (gfx2[i] << 8) | gfx2[i+G2];
- w = BITSWAP16(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
+ w = bitswap<16>(w, 5,7,11,4,15,10,3,14, 9,2,13,8,1,12,0,6 );
buf[i] = w >> 8;
buf[i+G2] = w & 0xff;
@@ -307,7 +307,7 @@ DRIVER_INIT_MEMBER(mustache_state,mustache)
/* SPR address lines */
for (i = 0; i < 2*G2; i++)
- gfx2[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];
+ gfx2[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,12,11,10,9,8,7,6,5,4,13,14,3,2,1,0)];
}
diff --git a/src/mame/drivers/mw8080bw.cpp b/src/mame/drivers/mw8080bw.cpp
index d39836e..75d8c8c 100644
--- a/src/mame/drivers/mw8080bw.cpp
+++ b/src/mame/drivers/mw8080bw.cpp
@@ -179,7 +179,7 @@ READ8_MEMBER(mw8080bw_state::mw8080bw_shift_result_rev_r)
{
uint8_t ret = m_mb14241->shift_result_r(space, 0);
- return BITSWAP8(ret,0,1,2,3,4,5,6,7);
+ return bitswap<8>(ret,0,1,2,3,4,5,6,7);
}
diff --git a/src/mame/drivers/namcona1.cpp b/src/mame/drivers/namcona1.cpp
index 43a5f1d..617d6f8 100644
--- a/src/mame/drivers/namcona1.cpp
+++ b/src/mame/drivers/namcona1.cpp
@@ -268,7 +268,7 @@ READ16_MEMBER(namcona1_state::custom_key_r)
if( offset==3 )
{
uint16_t res;
- res = BITSWAP16(m_keyval, 22,26,31,23,18,20,16,30,24,21,25,19,17,29,28,27);
+ res = bitswap<16>(m_keyval, 22,26,31,23,18,20,16,30,24,21,25,19,17,29,28,27);
m_keyval >>= 1;
// printf("popcount(%08X) = %d\n", m_keyval & 0x58000c00, population_count_32(m_keyval & 0x58000c00));
diff --git a/src/mame/drivers/namcos10.cpp b/src/mame/drivers/namcos10.cpp
index be218df..4eae0f4 100644
--- a/src/mame/drivers/namcos10.cpp
+++ b/src/mame/drivers/namcos10.cpp
@@ -789,7 +789,7 @@ static void decrypt_bios( running_machine &machine, const char *regionName, int
for( int i = 0; i < len; i++ )
{
- BIOS[ i ] = BITSWAP16( BIOS[ i ] ^ 0xaaaa,
+ BIOS[ i ] = bitswap<16>( BIOS[ i ] ^ 0xaaaa,
b15, b14, b13, b12, b11, b10, b9, b8, b7, b6, b5, b4, b3, b2, b1, b0 );
}
}
diff --git a/src/mame/drivers/nbmj8688.cpp b/src/mame/drivers/nbmj8688.cpp
index 46b3a37..16cd0b4 100644
--- a/src/mame/drivers/nbmj8688.cpp
+++ b/src/mame/drivers/nbmj8688.cpp
@@ -59,7 +59,7 @@ DRIVER_INIT_MEMBER(nbmj8688_state,mjcamera)
the checksum. */
for (i = 0;i < 0x10000;i++)
{
- rom[i] = BITSWAP8(prot[i],1,6,0,4,2,3,5,7);
+ rom[i] = bitswap<8>(prot[i],1,6,0,4,2,3,5,7);
}
}
@@ -99,7 +99,7 @@ DRIVER_INIT_MEMBER(nbmj8688_state,idhimitu)
the checksum. */
for (i = 0;i < 0x10000;i++)
{
- rom[i] = BITSWAP8(prot[i + 0x10000],4,6,2,1,7,0,3,5);
+ rom[i] = bitswap<8>(prot[i + 0x10000],4,6,2,1,7,0,3,5);
}
}
@@ -116,7 +116,7 @@ DRIVER_INIT_MEMBER(nbmj8688_state,kaguya2)
the checksum. */
for (i = 0;i < 0x10000;i++)
{
- rom[i] = BITSWAP8(prot[i],1,6,0,4,2,3,5,7);
+ rom[i] = bitswap<8>(prot[i],1,6,0,4,2,3,5,7);
}
}
diff --git a/src/mame/drivers/nbmj8891.cpp b/src/mame/drivers/nbmj8891.cpp
index 0addb1e..6b7ddd3 100644
--- a/src/mame/drivers/nbmj8891.cpp
+++ b/src/mame/drivers/nbmj8891.cpp
@@ -64,7 +64,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,gionbana)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
+ prot[i] = bitswap<8>(prot[i],2,7,3,5,0,6,4,1);
}
}
@@ -81,7 +81,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,omotesnd)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
+ prot[i] = bitswap<8>(prot[i],2,7,3,5,0,6,4,1);
}
#endif
@@ -114,7 +114,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,telmahjn)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i + 0x20000],7,0,4,1,5,2,6,3);
+ prot[i] = bitswap<8>(prot[i + 0x20000],7,0,4,1,5,2,6,3);
}
}
@@ -130,7 +130,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,mgmen89)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],5,6,1,0,7,3,2,4);
+ prot[i] = bitswap<8>(prot[i],5,6,1,0,7,3,2,4);
}
}
@@ -150,7 +150,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,mjfocus)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i + 0x20000],7,0,4,1,5,2,6,3);
+ prot[i] = bitswap<8>(prot[i + 0x20000],7,0,4,1,5,2,6,3);
}
}
@@ -190,7 +190,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,mjnanpas)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i + 0x20000],0,5,2,3,6,7,1,4);
+ prot[i] = bitswap<8>(prot[i + 0x20000],0,5,2,3,6,7,1,4);
}
#endif
}
@@ -207,7 +207,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,pairsnb)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],5,6,1,0,7,3,2,4);
+ prot[i] = bitswap<8>(prot[i],5,6,1,0,7,3,2,4);
}
}
@@ -223,7 +223,7 @@ DRIVER_INIT_MEMBER(nbmj8891_state,pairsten)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i + 0x20000],5,6,0,4,3,7,1,2);
+ prot[i] = bitswap<8>(prot[i + 0x20000],5,6,0,4,3,7,1,2);
}
}
diff --git a/src/mame/drivers/nbmj8900.cpp b/src/mame/drivers/nbmj8900.cpp
index ae72ebb..47604a5 100644
--- a/src/mame/drivers/nbmj8900.cpp
+++ b/src/mame/drivers/nbmj8900.cpp
@@ -49,7 +49,7 @@ DRIVER_INIT_MEMBER(nbmj8900_state,ohpaipee)
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
+ prot[i] = bitswap<8>(prot[i],2,7,3,5,0,6,4,1);
}
#else
unsigned char *ROM = memregion("maincpu")->base();
@@ -77,7 +77,7 @@ DRIVER_INIT_MEMBER(nbmj8900_state,togenkyo)
the checksum. */
for (i = 0;i < 0x20000;i++)
{
- prot[i] = BITSWAP8(prot[i],2,7,3,5,0,6,4,1);
+ prot[i] = bitswap<8>(prot[i],2,7,3,5,0,6,4,1);
}
#else
unsigned char *ROM = memregion("maincpu")->base();
diff --git a/src/mame/drivers/neopcb.cpp b/src/mame/drivers/neopcb.cpp
index ae05d62..ca7c8a0 100644
--- a/src/mame/drivers/neopcb.cpp
+++ b/src/mame/drivers/neopcb.cpp
@@ -250,7 +250,7 @@ void neopcb_state::svcpcb_gfx_decrypt()
for (int i = 0; i < rom_size; i += 4)
{
uint32_t rom32 = rom[i] | rom[i+1]<<8 | rom[i+2]<<16 | rom[i+3]<<24;
- rom32 = BITSWAP32(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
+ rom32 = bitswap<32>(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
buf[i] = rom32 & 0xff;
buf[i+1] = (rom32>>8) & 0xff;
buf[i+2] = (rom32>>16) & 0xff;
@@ -259,7 +259,7 @@ void neopcb_state::svcpcb_gfx_decrypt()
for (int i = 0; i < rom_size / 4; i++)
{
- int ofst = BITSWAP24((i & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05);
+ int ofst = bitswap<24>((i & 0x1fffff), 0x17, 0x16, 0x15, 0x04, 0x0b, 0x0e, 0x08, 0x0c, 0x10, 0x00, 0x0a, 0x13, 0x03, 0x06, 0x02, 0x07, 0x0d, 0x01, 0x11, 0x09, 0x14, 0x0f, 0x12, 0x05);
ofst ^= 0x0c8923;
ofst += (i & 0xffe00000);
memcpy(&rom[i * 4], &buf[ofst * 4], 0x04);
@@ -274,7 +274,7 @@ void neopcb_state::svcpcb_s1data_decrypt()
size_t s1_size = memregion("fixed")->bytes();
for (int i = 0; i < s1_size; i++) // Decrypt S
- s1[i] = BITSWAP8(s1[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
+ s1[i] = bitswap<8>(s1[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
}
@@ -294,7 +294,7 @@ void neopcb_state::kf2k3pcb_gfx_decrypt()
for (int i = 0; i < rom_size; i +=4)
{
uint32_t rom32 = rom[i] | rom[i+1]<<8 | rom[i+2]<<16 | rom[i+3]<<24;
- rom32 = BITSWAP32(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
+ rom32 = bitswap<32>(rom32, 0x09, 0x0d, 0x13, 0x00, 0x17, 0x0f, 0x03, 0x05, 0x04, 0x0c, 0x11, 0x1e, 0x12, 0x15, 0x0b, 0x06, 0x1b, 0x0a, 0x1a, 0x1c, 0x14, 0x02, 0x0e, 0x1d, 0x18, 0x08, 0x01, 0x10, 0x19, 0x1f, 0x07, 0x16);
buf[i] = rom32 & 0xff;
buf[i+1] = (rom32>>8) & 0xff;
buf[i+2] = (rom32>>16) & 0xff;
@@ -303,7 +303,7 @@ void neopcb_state::kf2k3pcb_gfx_decrypt()
for (int i = 0; i < rom_size; i+=4)
{
- int ofst = BITSWAP24((i & 0x7fffff), 0x17, 0x15, 0x0a, 0x14, 0x13, 0x16, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00);
+ int ofst = bitswap<24>((i & 0x7fffff), 0x17, 0x15, 0x0a, 0x14, 0x13, 0x16, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00);
ofst ^= 0x000000;
ofst += (i & 0xff800000);
memcpy(&rom[ofst], &buf[i], 0x04);
@@ -333,7 +333,7 @@ void neopcb_state::kf2k3pcb_decrypt_s1data()
dst = memregion("fixed")->base();
for (int i = 0; i < tx_size; i++)
- dst[i] = BITSWAP8(dst[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
+ dst[i] = bitswap<8>(dst[i] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3);
}
@@ -498,7 +498,7 @@ DRIVER_INIT_MEMBER(neopcb_state, kf2k3pcb)
// incorrect
uint8_t* rom = memregion("audiocpu")->base();
for (int i = 0; i < 0x90000; i++)
- rom[i] = BITSWAP8(rom[i], 5, 6, 1, 4, 3, 0, 7, 2);
+ rom[i] = bitswap<8>(rom[i], 5, 6, 1, 4, 3, 0, 7, 2);
kf2k3pcb_gfx_decrypt();
m_cmc_prot->cmc50_gfx_decrypt(spr_region, spr_region_size, KOF2003_GFX_KEY);
diff --git a/src/mame/drivers/newbrain.cpp b/src/mame/drivers/newbrain.cpp
index c4ebd73..b70ad8c 100644
--- a/src/mame/drivers/newbrain.cpp
+++ b/src/mame/drivers/newbrain.cpp
@@ -514,7 +514,7 @@ WRITE8_MEMBER( newbrain_state::cop_d_w )
// COP to VFD serial format, bits 15..0
// A B J I x H G2 C x F G1 E K L M D
- uint16_t value = BITSWAP16(m_402_q, 11, 7, 1, 13, 10, 3, 2, 12, 9, 5, 6, 4, 0, 8, 14, 15) & 0x3fff;
+ uint16_t value = bitswap<16>(m_402_q, 11, 7, 1, 13, 10, 3, 2, 12, 9, 5, 6, 4, 0, 8, 14, 15) & 0x3fff;
output().set_digit_value(m_405_q & 0x0f, value);
if (LOG_VFD) logerror("%s %s vfd segment %u 402.Q %04x data %04x\n", machine().time().as_string(), machine().describe_context(), m_405_q & 0x0f, m_402_q, value);
diff --git a/src/mame/drivers/niyanpai.cpp b/src/mame/drivers/niyanpai.cpp
index 043b83e..214ff58 100644
--- a/src/mame/drivers/niyanpai.cpp
+++ b/src/mame/drivers/niyanpai.cpp
@@ -66,8 +66,8 @@ READ16_MEMBER(niyanpai_state::dipsw_r)
uint8_t dipsw_a = ioport("DSWA")->read();
uint8_t dipsw_b = ioport("DSWB")->read();
- dipsw_a = BITSWAP8(dipsw_a,0,1,2,3,4,5,6,7);
- dipsw_b = BITSWAP8(dipsw_b,0,1,2,3,4,5,6,7);
+ dipsw_a = bitswap<8>(dipsw_a,0,1,2,3,4,5,6,7);
+ dipsw_b = bitswap<8>(dipsw_b,0,1,2,3,4,5,6,7);
return ((dipsw_a << 8) | dipsw_b);
}
diff --git a/src/mame/drivers/nmk16.cpp b/src/mame/drivers/nmk16.cpp
index 21e6786..17820f0 100644
--- a/src/mame/drivers/nmk16.cpp
+++ b/src/mame/drivers/nmk16.cpp
@@ -5383,7 +5383,7 @@ static void decryptcode( running_machine &machine, int a23, int a22, int a21, in
memcpy( &buffer[0], RAM, size );
for( i = 0; i < size; i++ )
{
- RAM[ i ] = buffer[ BITSWAP24( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
+ RAM[ i ] = buffer[ bitswap<24>( i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0 ) ];
}
}
diff --git a/src/mame/drivers/notetaker.cpp b/src/mame/drivers/notetaker.cpp
index ab50d57..1a27b24 100644
--- a/src/mame/drivers/notetaker.cpp
+++ b/src/mame/drivers/notetaker.cpp
@@ -922,16 +922,16 @@ DRIVER_INIT_MEMBER(notetaker_state,notetakr)
uint16_t *temppointer;
uint16_t wordtemp;
uint16_t addrtemp;
- // leave the src pointer alone, since we've only used a 0x1000 long address space
- romdst += 0x7f800; // set the dest pointer to 0xff000 (>>1 because 16 bits data)
- for (int i = 0; i < 0x800; i++)
- {
- wordtemp = BITSWAP16(*romsrc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // data bus is completely reversed
- addrtemp = BITSWAP16(i, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // address bus is completely reversed; 11-15 should always be zero
- temppointer = romdst+(addrtemp&0x7FF);
- *temppointer = wordtemp;
- romsrc++;
- }
+ // leave the src pointer alone, since we've only used a 0x1000 long address space
+ romdst += 0x7f800; // set the dest pointer to 0xff000 (>>1 because 16 bits data)
+ for (int i = 0; i < 0x800; i++)
+ {
+ wordtemp = bitswap<16>(*romsrc, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); // data bus is completely reversed
+ addrtemp = bitswap<11>(i, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // address bus is completely reversed; 11-15 should always be zero
+ temppointer = romdst+(addrtemp&0x7FF);
+ *temppointer = wordtemp;
+ romsrc++;
+ }
}
/* ROM definition */
diff --git a/src/mame/drivers/novag6502.cpp b/src/mame/drivers/novag6502.cpp
index a1a82d1..03957ed 100644
--- a/src/mame/drivers/novag6502.cpp
+++ b/src/mame/drivers/novag6502.cpp
@@ -349,7 +349,7 @@ WRITE64_MEMBER(novag6502_state::cforte_lcd_output_w)
for (int i = 0; i < 4; i++)
m_display_state[dig+3] |= ((rowdata[i] >> (2*dig) & 3) << (2*i));
- m_display_state[dig+3] = BITSWAP8(m_display_state[dig+3],7,2,0,4,6,5,3,1);
+ m_display_state[dig+3] = bitswap<8>(m_display_state[dig+3],7,2,0,4,6,5,3,1);
}
cforte_prepare_display();
diff --git a/src/mame/drivers/nsm.cpp b/src/mame/drivers/nsm.cpp
index bda6dae..cdf8cba 100644
--- a/src/mame/drivers/nsm.cpp
+++ b/src/mame/drivers/nsm.cpp
@@ -106,7 +106,7 @@ WRITE8_MEMBER( nsm_state::cru_w )
for (j = 0; j < 5; j++)
{
segments = m_cru_data[8-j]^0xff;
- output().set_digit_value(j * 10 + i, BITSWAP16(segments, 8, 8, 8, 8, 8, 8, 0, 0, 1, 1, 2, 3, 4, 5, 6, 7));
+ output().set_digit_value(j * 10 + i, bitswap<16>(segments, 8, 8, 8, 8, 8, 8, 0, 0, 1, 1, 2, 3, 4, 5, 6, 7));
}
}
}
diff --git a/src/mame/drivers/nss.cpp b/src/mame/drivers/nss.cpp
index b96ed39..57ce181 100644
--- a/src/mame/drivers/nss.cpp
+++ b/src/mame/drivers/nss.cpp
@@ -1064,7 +1064,7 @@ DRIVER_INIT_MEMBER(nss_state,nss)
uint8_t *PROM = memregion("rp5h01")->base();
for (int i = 0; i < 0x10; i++)
- PROM[i] = BITSWAP8(PROM[i],0,1,2,3,4,5,6,7) ^ 0xff;
+ PROM[i] = bitswap<8>(PROM[i],0,1,2,3,4,5,6,7) ^ 0xff;
DRIVER_INIT_CALL(snes);
}
diff --git a/src/mame/drivers/nycaptor.cpp b/src/mame/drivers/nycaptor.cpp
index 4a54583..e285499 100644
--- a/src/mame/drivers/nycaptor.cpp
+++ b/src/mame/drivers/nycaptor.cpp
@@ -1287,7 +1287,7 @@ DRIVER_INIT_MEMBER(nycaptor_state,bronx)
uint8_t *rom = memregion("maincpu")->base();
for (i = 0; i < 0x20000; i++)
- rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
m_gametype = 1;
}
@@ -1298,7 +1298,7 @@ DRIVER_INIT_MEMBER(nycaptor_state,colt)
uint8_t *rom = memregion("maincpu")->base();
for (i = 0; i < 0x20000; i++)
- rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
m_gametype = 2;
}
diff --git a/src/mame/drivers/ojankohs.cpp b/src/mame/drivers/ojankohs.cpp
index 389e43d..c3b5be3 100644
--- a/src/mame/drivers/ojankohs.cpp
+++ b/src/mame/drivers/ojankohs.cpp
@@ -604,13 +604,13 @@ READ8_MEMBER( ojankohs_state::ojankoc_keymatrix_p2_r )
READ8_MEMBER( ojankohs_state::ojankohs_dipsw1_r )
{
uint8_t data = m_dsw1->read();
- return BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
}
READ8_MEMBER( ojankohs_state::ojankohs_dipsw2_r )
{
uint8_t data = m_dsw2->read();
- return BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ return bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
}
READ8_MEMBER( ojankohs_state::ccasino_dipsw3_r )
diff --git a/src/mame/drivers/omegrace.cpp b/src/mame/drivers/omegrace.cpp
index 14377dd..5236b40 100644
--- a/src/mame/drivers/omegrace.cpp
+++ b/src/mame/drivers/omegrace.cpp
@@ -620,7 +620,7 @@ DRIVER_INIT_MEMBER(omegrace_state,omegrace)
* in a consistent way to the decoder, we swap the bits
* here. */
for (i=0; i<len; i++)
- prom[i] = BITSWAP8(prom[i],7,6,5,4,1,0,3,2);
+ prom[i] = bitswap<8>(prom[i],7,6,5,4,1,0,3,2);
}
diff --git a/src/mame/drivers/pacman.cpp b/src/mame/drivers/pacman.cpp
index 40a4c1a..c596804 100644
--- a/src/mame/drivers/pacman.cpp
+++ b/src/mame/drivers/pacman.cpp
@@ -6914,12 +6914,12 @@ void pacman_state::eyes_decode(uint8_t *data)
for (j = 0; j < 8; j++)
{
- swapbuffer[j] = data[BITSWAP16(j,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2)];
+ swapbuffer[j] = data[bitswap<16>(j,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2)];
}
for (j = 0; j < 8; j++)
{
- data[j] = BITSWAP8(swapbuffer[j],7,4,5,6,3,2,1,0);
+ data[j] = bitswap<8>(swapbuffer[j],7,4,5,6,3,2,1,0);
}
}
@@ -6934,7 +6934,7 @@ DRIVER_INIT_MEMBER(pacman_state,eyes)
RAM = memregion("maincpu")->base();
for (i = 0; i < 0x4000; i++)
{
- RAM[i] = BITSWAP8(RAM[i],7,6,3,4,5,2,1,0);
+ RAM[i] = bitswap<8>(RAM[i],7,6,3,4,5,2,1,0);
}
@@ -6949,10 +6949,10 @@ DRIVER_INIT_MEMBER(pacman_state,eyes)
#define BITSWAP12(val,B11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0) \
- BITSWAP16(val,15,14,13,12,B11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0)
+ bitswap<16>(val,15,14,13,12,B11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0)
#define BITSWAP11(val,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0) \
- BITSWAP16(val,15,14,13,12,11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0)
+ bitswap<16>(val,15,14,13,12,11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0)
void pacman_state::mspacman_install_patches(uint8_t *ROM)
{
@@ -7025,13 +7025,13 @@ DRIVER_INIT_MEMBER(pacman_state,mspacman)
DROM[0x0000+i] = ROM[0x0000+i]; /* pacman.6e */
DROM[0x1000+i] = ROM[0x1000+i]; /* pacman.6f */
DROM[0x2000+i] = ROM[0x2000+i]; /* pacman.6h */
- DROM[0x3000+i] = BITSWAP8(ROM[0xb000+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt u7 */
+ DROM[0x3000+i] = bitswap<8>(ROM[0xb000+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt u7 */
}
for (i = 0; i < 0x800; i++)
{
- DROM[0x8000+i] = BITSWAP8(ROM[0x8000+BITSWAP11(i, 8,7,5,9,10,6,3,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt u5 */
- DROM[0x8800+i] = BITSWAP8(ROM[0x9800+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt half of u6 */
- DROM[0x9000+i] = BITSWAP8(ROM[0x9000+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt half of u6 */
+ DROM[0x8000+i] = bitswap<8>(ROM[0x8000+BITSWAP11(i, 8,7,5,9,10,6,3,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt u5 */
+ DROM[0x8800+i] = bitswap<8>(ROM[0x9800+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt half of u6 */
+ DROM[0x9000+i] = bitswap<8>(ROM[0x9000+BITSWAP12(i,11,3,7,9,10,8,6,5,4,2,1,0)],0,4,5,7,6,3,2,1); /* decrypt half of u6 */
DROM[0x9800+i] = ROM[0x1800+i]; /* mirror of pacman.6f high */
}
for (i = 0; i < 0x1000; i++)
@@ -7102,7 +7102,7 @@ DRIVER_INIT_MEMBER(pacman_state,8bpm)
/* Data lines D0 and D6 swapped */
for( i = 0; i < 0x8000; i++ )
{
- ROM[i] = BITSWAP8(ROM[i],7,0,5,4,3,2,1,6);
+ ROM[i] = bitswap<8>(ROM[i],7,0,5,4,3,2,1,6);
}
membank("bank1")->set_base(&ROM[0 * 0x2000]);
@@ -7119,7 +7119,7 @@ DRIVER_INIT_MEMBER(pacman_state,porky)
/* Data lines D0 and D4 swapped */
for(i = 0; i < 0x10000; i++)
{
- ROM[i] = BITSWAP8(ROM[i],7,6,5,0,3,2,1,4);
+ ROM[i] = bitswap<8>(ROM[i],7,6,5,0,3,2,1,4);
}
membank("bank1")->configure_entries(0, 2, &ROM[0 * 0x2000], 0x8000);
@@ -7185,7 +7185,7 @@ DRIVER_INIT_MEMBER(pacman_state,superabc)
// descramble gfx
for (int i = 0; i < 0x10000; i++)
- dest[i] = src[BITSWAP24(i,23,22,21,20,19,18,17, 12,13,14,16,15, 11,10,9,8,7,6,5,4,3,2,1,0)];
+ dest[i] = src[bitswap<24>(i,23,22,21,20,19,18,17, 12,13,14,16,15, 11,10,9,8,7,6,5,4,3,2,1,0)];
}
READ8_MEMBER(pacman_state::cannonbp_protection_r)
diff --git a/src/mame/drivers/panicr.cpp b/src/mame/drivers/panicr.cpp
index a3558fc..c78b351 100644
--- a/src/mame/drivers/panicr.cpp
+++ b/src/mame/drivers/panicr.cpp
@@ -733,7 +733,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
- w1 = BITSWAP16(w1, 9,12,7,3, 8,13,6,2, 11,14,1,5, 10,15,4,0);
+ w1 = bitswap<16>(w1, 9,12,7,3, 8,13,6,2, 11,14,1,5, 10,15,4,0);
buf[i + 0*size/2] = w1 >> 8;
buf[i + 1*size/2] = w1 & 0xff;
@@ -742,7 +742,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
// text address lines
for (i = 0;i < size;i++)
{
- rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, 2,3,1,0,5,4)];
+ rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6, 2,3,1,0,5,4)];
}
@@ -757,8 +757,8 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
w1 = (rom[i + 0*size/4] << 8) + rom[i + 3*size/4];
w2 = (rom[i + 1*size/4] << 8) + rom[i + 2*size/4];
- w1 = BITSWAP16(w1, 14,12,11,9, 3,2,1,0, 10,15,13,8, 7,6,5,4);
- w2 = BITSWAP16(w2, 3,13,15,4, 12,2,5,11, 14,6,1,10, 8,7,9,0);
+ w1 = bitswap<16>(w1, 14,12,11,9, 3,2,1,0, 10,15,13,8, 7,6,5,4);
+ w2 = bitswap<16>(w2, 3,13,15,4, 12,2,5,11, 14,6,1,10, 8,7,9,0);
buf[i + 0*size/4] = w1 >> 8;
buf[i + 1*size/4] = w1 & 0xff;
@@ -769,7 +769,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
// tiles address lines
for (i = 0;i < size;i++)
{
- rom[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12, 5,4,3,2, 11,10,9,8,7,6, 0,1)];
+ rom[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12, 5,4,3,2, 11,10,9,8,7,6, 0,1)];
}
@@ -784,7 +784,7 @@ DRIVER_INIT_MEMBER(panicr_state,panicr)
w1 = (rom[i + 0*size/2] << 8) + rom[i + 1*size/2];
- w1 = BITSWAP16(w1, 11,5,7,12, 4,10,13,3, 6,14,9,2, 0,15,1,8);
+ w1 = bitswap<16>(w1, 11,5,7,12, 4,10,13,3, 6,14,9,2, 0,15,1,8);
buf[i + 0*size/2] = w1 >> 8;
diff --git a/src/mame/drivers/pbaction.cpp b/src/mame/drivers/pbaction.cpp
index 3741627..20e3944 100644
--- a/src/mame/drivers/pbaction.cpp
+++ b/src/mame/drivers/pbaction.cpp
@@ -494,7 +494,7 @@ DRIVER_INIT_MEMBER(pbaction_state,pbactio3)
/* first of all, do a simple bitswap */
for (i = 0; i < 0xc000; i++)
{
- rom[i] = BITSWAP8(rom[i], 7,6,5,4,1,2,3,0);
+ rom[i] = bitswap<8>(rom[i], 7,6,5,4,1,2,3,0);
}
/* install a protection (?) workaround */
diff --git a/src/mame/drivers/pc88va.cpp b/src/mame/drivers/pc88va.cpp
index 57d5ebe..fc941af 100644
--- a/src/mame/drivers/pc88va.cpp
+++ b/src/mame/drivers/pc88va.cpp
@@ -254,7 +254,7 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
for(x_s=0;x_s<16;x_s++)
{
- pen = (BITSWAP16(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1;
+ pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8) >> (15-x_s)) & 1;
pen = pen & 1 ? fg_col : (bc) ? 8 : -1;
@@ -281,7 +281,7 @@ void pc88va_state::draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
for(x_s=0;x_s<2;x_s++)
{
- pen = (BITSWAP16(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf;
+ pen = (bitswap<16>(tvram[(spda+spr_count) / 2],7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)) >> (16-(x_s*8)) & 0xf;
//if(bc != -1) //transparent pen
bitmap.pix32(yp+y_i, xp+x_i+(x_s)) = m_palette->pen(pen);
diff --git a/src/mame/drivers/pc9801.cpp b/src/mame/drivers/pc9801.cpp
index 036cccb..124824b 100644
--- a/src/mame/drivers/pc9801.cpp
+++ b/src/mame/drivers/pc9801.cpp
@@ -855,7 +855,7 @@ WRITE8_MEMBER(pc9801_state::grcg_w)
else if(offset == 7)
{
// logerror("%02x GRCG TILE %02x\n",data,m_grcg.tile_index);
- m_grcg.tile[m_grcg.tile_index] = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ m_grcg.tile[m_grcg.tile_index] = bitswap<8>(data,0,1,2,3,4,5,6,7);
m_grcg.tile_index ++;
m_grcg.tile_index &= 3;
return;
@@ -1061,24 +1061,24 @@ WRITE8_MEMBER(pc9801_state::pic_w)
READ16_MEMBER(pc9801_state::grcg_gvram_r)
{
uint16_t ret = upd7220_grcg_r(space, (offset + 0x4000) | (m_vram_bank << 16), mem_mask);
- return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ return bitswap<16>(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
}
WRITE16_MEMBER(pc9801_state::grcg_gvram_w)
{
- data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ data = bitswap<16>(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
upd7220_grcg_w(space, (offset + 0x4000) | (m_vram_bank << 16), data, mem_mask);
}
READ16_MEMBER(pc9801_state::grcg_gvram0_r)
{
uint16_t ret = upd7220_grcg_r(space, offset | (m_vram_bank << 16), mem_mask);
- return BITSWAP16(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ return bitswap<16>(ret,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
}
WRITE16_MEMBER(pc9801_state::grcg_gvram0_w)
{
- data = BITSWAP16(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ data = bitswap<16>(data,8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
upd7220_grcg_w(space, offset | (m_vram_bank << 16), data, mem_mask);
}
@@ -2889,7 +2889,7 @@ DRIVER_INIT_MEMBER(pc9801_state,pc9801_kanji)
{
for(j=0;j<0x20;j++)
{
- pcg_tile = BITSWAP16(i,15,14,13,12,11,7,6,5,10,9,8,4,3,2,1,0) << 5;
+ pcg_tile = bitswap<16>(i,15,14,13,12,11,7,6,5,10,9,8,4,3,2,1,0) << 5;
kanji[j+(i << 5)] = raw_kanji[j+pcg_tile];
}
}
diff --git a/src/mame/drivers/pegasus.cpp b/src/mame/drivers/pegasus.cpp
index 2ac3e43..1e214f8 100644
--- a/src/mame/drivers/pegasus.cpp
+++ b/src/mame/drivers/pegasus.cpp
@@ -405,8 +405,8 @@ void pegasus_state::pegasus_decrypt_rom(uint8_t *ROM)
for (int i = 0; i < 0x1000; i++)
{
b = ROM[i];
- j = BITSWAP16(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7);
- b = BITSWAP8(b, 3, 2, 1, 0, 7, 6, 5, 4);
+ j = bitswap<16>(i, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 7);
+ b = bitswap<8>(b, 3, 2, 1, 0, 7, 6, 5, 4);
temp_copy[j & 0xfff] = b;
}
memcpy(ROM, &temp_copy[0], 0x1000);
diff --git a/src/mame/drivers/pengadvb.cpp b/src/mame/drivers/pengadvb.cpp
index f10f8c7..f24999f 100644
--- a/src/mame/drivers/pengadvb.cpp
+++ b/src/mame/drivers/pengadvb.cpp
@@ -293,7 +293,7 @@ void pengadvb_state::pengadvb_decrypt(const char* region)
// data lines swap
for (int i = 0; i < memsize; i++)
{
- mem[i] = BITSWAP8(mem[i],7,6,5,3,4,2,1,0);
+ mem[i] = bitswap<8>(mem[i],7,6,5,3,4,2,1,0);
}
// address line swap
@@ -301,7 +301,7 @@ void pengadvb_state::pengadvb_decrypt(const char* region)
memcpy(&buf[0], mem, memsize);
for (int i = 0; i < memsize; i++)
{
- mem[i] = buf[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,5,11,10,9,8,7,6,12,4,3,2,1,0)];
+ mem[i] = buf[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,5,11,10,9,8,7,6,12,4,3,2,1,0)];
}
}
diff --git a/src/mame/drivers/pet.cpp b/src/mame/drivers/pet.cpp
index 85824fd..3f6a283 100644
--- a/src/mame/drivers/pet.cpp
+++ b/src/mame/drivers/pet.cpp
@@ -635,10 +635,10 @@ void cbm8296_state::read_pla1_eprom(offs_t offset, int phi2, int brw, int noscre
// PLA-EPROM adapter by Joachim Nemetz (Jogi)
uint32_t input = (offset & 0xff00) | phi2 << 7 | brw << 6 | noscreen << 5 | noio << 4 | ramsela << 3 | ramsel9 << 2 | ramon << 1 | norom;
- input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15);
+ input = bitswap<16>(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15);
uint8_t data = m_ue6_rom->base()[input];
- data = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ data = bitswap<8>(data,7,0,1,2,3,4,5,6);
cswff = BIT(data, 0);
cs9 = BIT(data, 1);
@@ -657,7 +657,7 @@ void cbm8296_state::read_pla1_eprom(offs_t offset, int phi2, int brw, int noscre
void cbm8296_state::read_pla2(offs_t offset, int phi2, int brw, int casena1, int &endra, int &noscreen, int &casena2, int &fa15)
{
- uint32_t input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1;
+ uint32_t input = bitswap<8>(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1;
uint32_t data = m_pla2->read(input);
endra = BIT(data, 4);
@@ -670,11 +670,11 @@ void cbm8296_state::read_pla2_eprom(offs_t offset, int phi2, int brw, int casena
{
// PLA-EPROM adapter by Joachim Nemetz (Jogi)
- uint32_t input = BITSWAP8(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1;
- input = BITSWAP16(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15);
+ uint32_t input = bitswap<8>(m_cr, 0,1,2,3,4,5,6,7) << 8 | ((offset >> 8) & 0xf8) | brw << 2 | phi2 << 1 | casena1;
+ input = bitswap<16>(input,13,8,9,7,12,14,11,10,6,5,4,3,2,1,0,15);
uint8_t data = m_ue5_rom->base()[input];
- data = BITSWAP8(data,7,0,1,2,3,4,5,6);
+ data = bitswap<8>(data,7,0,1,2,3,4,5,6);
endra = BIT(data, 4);
noscreen = BIT(data, 5);
diff --git a/src/mame/drivers/pgm2.cpp b/src/mame/drivers/pgm2.cpp
index 4f81686..cc53cce 100644
--- a/src/mame/drivers/pgm2.cpp
+++ b/src/mame/drivers/pgm2.cpp
@@ -120,7 +120,7 @@ WRITE32_MEMBER(pgm2_state::sprite_encryption_w)
COMBINE_DATA(&m_spritekey);
if (!m_sprite_predecrypted)
- m_realspritekey = BITSWAP32(m_spritekey ^ 0x90055555, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
+ m_realspritekey = bitswap<32>(m_spritekey ^ 0x90055555, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31);
}
WRITE32_MEMBER(pgm2_state::encryption_do_w)
@@ -899,7 +899,7 @@ static void iga_u16_decode(uint16_t *rom, int len, int ixor)
if ( (i>>1) & 0x000400) x ^= 0x8000;
rom[i] ^= x;
- rom[i] = BITSWAP16(rom[i], 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ rom[i] = bitswap<16>(rom[i], 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
}
}
@@ -924,7 +924,7 @@ static void iga_u12_decode(uint16_t* rom, int len, int ixor)
if ( (i>>1) & 0x000400) x ^= 0x0000;
rom[i] ^= x;
- rom[i] = BITSWAP16(rom[i], 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
+ rom[i] = bitswap<16>(rom[i], 8,9,10,11,12,13,14,15,0,1,2,3,4,5,6,7);
}
}
@@ -934,7 +934,7 @@ static void sprite_colour_decode(uint16_t* rom, int len)
for (i = 0; i < len / 2; i++)
{
- rom[i] = BITSWAP16(rom[i], 15, 14, /* unused - 6bpp */
+ rom[i] = bitswap<16>(rom[i], 15, 14, /* unused - 6bpp */
13, 12, 11,
5, 4, 3,
7, 6, /* unused - 6bpp */
diff --git a/src/mame/drivers/piggypas.cpp b/src/mame/drivers/piggypas.cpp
index 121150f..ff24686 100644
--- a/src/mame/drivers/piggypas.cpp
+++ b/src/mame/drivers/piggypas.cpp
@@ -59,7 +59,7 @@ WRITE8_MEMBER(piggypas_state::ctrl_w)
WRITE8_MEMBER(piggypas_state::mcs51_tx_callback)
{
// Serial output driver is UCN5833A
- output().set_digit_value(m_digit_idx++, BITSWAP8(data,7,6,4,3,2,1,0,5) & 0x7f);
+ output().set_digit_value(m_digit_idx++, bitswap<8>(data,7,6,4,3,2,1,0,5) & 0x7f);
}
static ADDRESS_MAP_START( piggypas_map, AS_PROGRAM, 8, piggypas_state )
diff --git a/src/mame/drivers/pingpong.cpp b/src/mame/drivers/pingpong.cpp
index d8e1ee4..0393f1f 100644
--- a/src/mame/drivers/pingpong.cpp
+++ b/src/mame/drivers/pingpong.cpp
@@ -568,7 +568,7 @@ DRIVER_INIT_MEMBER(pingpong_state,merlinmm)
/* decrypt program code */
for( i = 0; i < 0x4000; i++ )
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
}
DRIVER_INIT_MEMBER(pingpong_state,cashquiz)
@@ -579,12 +579,12 @@ DRIVER_INIT_MEMBER(pingpong_state,cashquiz)
/* decrypt program code */
ROM = memregion("maincpu")->base();
for( i = 0; i < 0x4000; i++ )
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
/* decrypt questions */
ROM = memregion("user1")->base();
for( i = 0; i < 0x40000; i++ )
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
/* questions banking handlers */
m_maincpu->space(AS_PROGRAM).install_write_handler(0x4000, 0x4000, write8_delegate(FUNC(pingpong_state::cashquiz_question_bank_high_w),this));
diff --git a/src/mame/drivers/pirates.cpp b/src/mame/drivers/pirates.cpp
index 54f83d6..0fa3ca0 100644
--- a/src/mame/drivers/pirates.cpp
+++ b/src/mame/drivers/pirates.cpp
@@ -365,11 +365,11 @@ void pirates_state::decrypt_68k()
int adrl, adrr;
uint8_t vl, vr;
- adrl = BITSWAP24(i,23,22,21,20,19,18,4,8,3,14,2,15,17,0,9,13,10,5,16,7,12,6,1,11);
- vl = BITSWAP8(buf[adrl], 4,2,7,1,6,5,0,3);
+ adrl = bitswap<24>(i,23,22,21,20,19,18,4,8,3,14,2,15,17,0,9,13,10,5,16,7,12,6,1,11);
+ vl = bitswap<8>(buf[adrl], 4,2,7,1,6,5,0,3);
- adrr = BITSWAP24(i,23,22,21,20,19,18,4,10,1,11,12,5,9,17,14,0,13,6,15,8,3,16,7,2);
- vr = BITSWAP8(buf[adrr]>>8, 1,4,7,0,3,5,6,2);
+ adrr = bitswap<24>(i,23,22,21,20,19,18,4,10,1,11,12,5,9,17,14,0,13,6,15,8,3,16,7,2);
+ vr = bitswap<8>(buf[adrr]>>8, 1,4,7,0,3,5,6,2);
rom[i] = (vr<<8) | vl;
}
@@ -390,11 +390,11 @@ void pirates_state::decrypt_p()
for (i=0; i<rom_size/4; i++)
{
- int adr = BITSWAP24(i,23,22,21,20,19,18,10,2,5,9,7,13,16,14,11,4,1,6,12,17,3,0,15,8);
- rom[adr+0*(rom_size/4)] = BITSWAP8(buf[i+0*(rom_size/4)], 2,3,4,0,7,5,1,6);
- rom[adr+1*(rom_size/4)] = BITSWAP8(buf[i+1*(rom_size/4)], 4,2,7,1,6,5,0,3);
- rom[adr+2*(rom_size/4)] = BITSWAP8(buf[i+2*(rom_size/4)], 1,4,7,0,3,5,6,2);
- rom[adr+3*(rom_size/4)] = BITSWAP8(buf[i+3*(rom_size/4)], 2,3,4,0,7,5,1,6);
+ int adr = bitswap<24>(i,23,22,21,20,19,18,10,2,5,9,7,13,16,14,11,4,1,6,12,17,3,0,15,8);
+ rom[adr+0*(rom_size/4)] = bitswap<8>(buf[i+0*(rom_size/4)], 2,3,4,0,7,5,1,6);
+ rom[adr+1*(rom_size/4)] = bitswap<8>(buf[i+1*(rom_size/4)], 4,2,7,1,6,5,0,3);
+ rom[adr+2*(rom_size/4)] = bitswap<8>(buf[i+2*(rom_size/4)], 1,4,7,0,3,5,6,2);
+ rom[adr+3*(rom_size/4)] = bitswap<8>(buf[i+3*(rom_size/4)], 2,3,4,0,7,5,1,6);
}
}
@@ -413,11 +413,11 @@ void pirates_state::decrypt_s()
for (i=0; i<rom_size/4; i++)
{
- int adr = BITSWAP24(i,23,22,21,20,19,18,17,5,12,14,8,3,0,7,9,16,4,2,6,11,13,1,10,15);
- rom[adr+0*(rom_size/4)] = BITSWAP8(buf[i+0*(rom_size/4)], 4,2,7,1,6,5,0,3);
- rom[adr+1*(rom_size/4)] = BITSWAP8(buf[i+1*(rom_size/4)], 1,4,7,0,3,5,6,2);
- rom[adr+2*(rom_size/4)] = BITSWAP8(buf[i+2*(rom_size/4)], 2,3,4,0,7,5,1,6);
- rom[adr+3*(rom_size/4)] = BITSWAP8(buf[i+3*(rom_size/4)], 4,2,7,1,6,5,0,3);
+ int adr = bitswap<24>(i,23,22,21,20,19,18,17,5,12,14,8,3,0,7,9,16,4,2,6,11,13,1,10,15);
+ rom[adr+0*(rom_size/4)] = bitswap<8>(buf[i+0*(rom_size/4)], 4,2,7,1,6,5,0,3);
+ rom[adr+1*(rom_size/4)] = bitswap<8>(buf[i+1*(rom_size/4)], 1,4,7,0,3,5,6,2);
+ rom[adr+2*(rom_size/4)] = bitswap<8>(buf[i+2*(rom_size/4)], 2,3,4,0,7,5,1,6);
+ rom[adr+3*(rom_size/4)] = bitswap<8>(buf[i+3*(rom_size/4)], 4,2,7,1,6,5,0,3);
}
}
@@ -437,8 +437,8 @@ void pirates_state::decrypt_oki()
for (i=0; i<rom_size; i++)
{
- int adr = BITSWAP24(i,23,22,21,20,19,10,16,13,8,4,7,11,14,17,12,6,2,0,5,18,15,3,1,9);
- rom[adr] = BITSWAP8(buf[i], 2,3,4,0,7,5,1,6);
+ int adr = bitswap<24>(i,23,22,21,20,19,10,16,13,8,4,7,11,14,17,12,6,2,0,5,18,15,3,1,9);
+ rom[adr] = bitswap<8>(buf[i], 2,3,4,0,7,5,1,6);
}
}
diff --git a/src/mame/drivers/playch10.cpp b/src/mame/drivers/playch10.cpp
index 2116729..3d7ae01 100644
--- a/src/mame/drivers/playch10.cpp
+++ b/src/mame/drivers/playch10.cpp
@@ -1677,7 +1677,7 @@ DRIVER_INIT_MEMBER(playch10_state,virus)
uint32_t len = memregion("rp5h01")->bytes();
for (int i = 0; i < len; i++)
{
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
ROM[i] ^= 0xff;
}
@@ -1691,7 +1691,7 @@ DRIVER_INIT_MEMBER(playch10_state,ttoon)
uint32_t len = memregion("rp5h01")->bytes();
for (int i = 0; i < len; i++)
{
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
ROM[i] ^= 0xff;
}
diff --git a/src/mame/drivers/pntnpuzl.cpp b/src/mame/drivers/pntnpuzl.cpp
index a58618a..aaf8177 100644
--- a/src/mame/drivers/pntnpuzl.cpp
+++ b/src/mame/drivers/pntnpuzl.cpp
@@ -220,8 +220,8 @@ READ16_MEMBER(pntnpuzl_state::pntnpuzl_280014_r)
if (ioport("IN0")->read() & 0x10)
{
m_touchscr[0] = 0x1b;
- m_touchscr[2] = BITSWAP8(ioport("TOUCHX")->read(),0,1,2,3,4,5,6,7);
- m_touchscr[4] = BITSWAP8(ioport("TOUCHY")->read(),0,1,2,3,4,5,6,7);
+ m_touchscr[2] = bitswap<8>(ioport("TOUCHX")->read(),0,1,2,3,4,5,6,7);
+ m_touchscr[4] = bitswap<8>(ioport("TOUCHY")->read(),0,1,2,3,4,5,6,7);
}
else
m_touchscr[0] = 0;
diff --git a/src/mame/drivers/poly880.cpp b/src/mame/drivers/poly880.cpp
index d3297d0..cddaf75 100644
--- a/src/mame/drivers/poly880.cpp
+++ b/src/mame/drivers/poly880.cpp
@@ -160,7 +160,7 @@ WRITE8_MEMBER( poly880_state::pio1_pa_w )
*/
- m_segment = BITSWAP8(data, 3, 4, 6, 0, 1, 2, 7, 5);
+ m_segment = bitswap<8>(data, 3, 4, 6, 0, 1, 2, 7, 5);
update_display();
}
diff --git a/src/mame/drivers/popeye.cpp b/src/mame/drivers/popeye.cpp
index 7b1acd6..cdbd3c3 100644
--- a/src/mame/drivers/popeye.cpp
+++ b/src/mame/drivers/popeye.cpp
@@ -760,7 +760,7 @@ DRIVER_INIT_MEMBER(popeye_state,skyskipr)
std::vector<uint8_t> buffer(len);
int i;
for (i = 0;i < len; i++)
- buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
+ buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,0,1,2,4,5,9,3,6) ^ 0xfc],3,4,2,5,1,6,0,7);
memcpy(rom,&buffer[0],len);
}
@@ -779,7 +779,7 @@ DRIVER_INIT_MEMBER(popeye_state,popeye)
std::vector<uint8_t> buffer(len);
int i;
for (i = 0;i < len; i++)
- buffer[i] = BITSWAP8(rom[BITSWAP16(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
+ buffer[i] = bitswap<8>(rom[bitswap<16>(i,15,14,13,12,11,10,8,7,6,3,9,5,4,2,1,0) ^ 0x3f],3,4,2,5,1,6,0,7);
memcpy(rom,&buffer[0],len);
}
diff --git a/src/mame/drivers/popobear.cpp b/src/mame/drivers/popobear.cpp
index ab897bf..27983bd 100644
--- a/src/mame/drivers/popobear.cpp
+++ b/src/mame/drivers/popobear.cpp
@@ -139,7 +139,7 @@ WRITE16_MEMBER(popobear_state::vram_w)
COMBINE_DATA(&m_vram[offset]);
// the graphic data for the tiles is in a strange order, rearrange it so that we can use it as tiles..
- int swapped_offset = BITSWAP32(offset, /* unused bits */ 31,30,29,28,27,26,25,24,23,22,21,20,19, /* end unused bits */
+ int swapped_offset = bitswap<32>(offset, /* unused bits */ 31,30,29,28,27,26,25,24,23,22,21,20,19, /* end unused bits */
18,17,16,15,14,13,12,
diff --git a/src/mame/drivers/puckpkmn.cpp b/src/mame/drivers/puckpkmn.cpp
index 28d46aa..3fe4267 100644
--- a/src/mame/drivers/puckpkmn.cpp
+++ b/src/mame/drivers/puckpkmn.cpp
@@ -382,7 +382,7 @@ DRIVER_INIT_MEMBER(md_boot_state,puckpkmn)
int i;
for (i = 0; i < len; i++)
- rom[i] = BITSWAP8(rom[i],1,4,2,0,7,5,3,6);
+ rom[i] = bitswap<8>(rom[i],1,4,2,0,7,5,3,6);
DRIVER_INIT_CALL(megadriv);
}
diff --git a/src/mame/drivers/pve500.cpp b/src/mame/drivers/pve500.cpp
index 5979c5f..08b28bd 100644
--- a/src/mame/drivers/pve500.cpp
+++ b/src/mame/drivers/pve500.cpp
@@ -325,7 +325,7 @@ WRITE8_MEMBER(pve500_state::io_sel_w)
io_SEL = data;
for (int i=0; i<4; i++){
if (BIT(io_SEL, i)){
- LD_data[i] = 0x7F & BITSWAP8(io_LD ^ 0xFF, 7, 0, 1, 2, 3, 4, 5, 6);
+ LD_data[i] = 0x7F & bitswap<8>(io_LD ^ 0xFF, 7, 0, 1, 2, 3, 4, 5, 6);
}
}
}
diff --git a/src/mame/drivers/qix.cpp b/src/mame/drivers/qix.cpp
index 3032ca8..eea7cf4 100644
--- a/src/mame/drivers/qix.cpp
+++ b/src/mame/drivers/qix.cpp
@@ -1312,10 +1312,10 @@ int qix_state::kram3_permut1(int idx, int value)
switch (idx)
{
default:
- case 0: return BITSWAP8(value, 7,6,5,4, 3,2,1,0);
- case 1: return BITSWAP8(value, 7,6,5,4, 0,3,2,1);
- case 2: return BITSWAP8(value, 7,6,5,4, 1,0,3,2);
- case 3: return BITSWAP8(value, 7,6,5,4, 2,3,0,1);
+ case 0: return bitswap<8>(value, 7,6,5,4, 3,2,1,0);
+ case 1: return bitswap<8>(value, 7,6,5,4, 0,3,2,1);
+ case 2: return bitswap<8>(value, 7,6,5,4, 1,0,3,2);
+ case 3: return bitswap<8>(value, 7,6,5,4, 2,3,0,1);
}
}
@@ -1335,7 +1335,7 @@ int qix_state::kram3_permut2(int tbl_index, int idx, const uint8_t *xor_table)
xorval ^= 0x02;
if (idx == 3)
- xorval = BITSWAP8(xorval, 7,6,5,4, 0,2,3,1);
+ xorval = bitswap<8>(xorval, 7,6,5,4, 0,2,3,1);
return xorval;
}
diff --git a/src/mame/drivers/r2dx_v33.cpp b/src/mame/drivers/r2dx_v33.cpp
index 4c22095..4370adb 100644
--- a/src/mame/drivers/r2dx_v33.cpp
+++ b/src/mame/drivers/r2dx_v33.cpp
@@ -903,7 +903,7 @@ DRIVER_INIT_MEMBER(r2dx_v33_state,zerotm2k)
std::vector<uint8_t> buffer(len);
int i;
for (i = 0; i < len; i ++)
- buffer[i] = src[BITSWAP32(i,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,5,6,4,3,2,1,0)];
+ buffer[i] = src[bitswap<32>(i,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,5,6,4,3,2,1,0)];
memcpy(src, &buffer[0], len);
}
diff --git a/src/mame/drivers/raiden.cpp b/src/mame/drivers/raiden.cpp
index e775b8d..8819678 100644
--- a/src/mame/drivers/raiden.cpp
+++ b/src/mame/drivers/raiden.cpp
@@ -741,7 +741,7 @@ void raiden_state::common_decrypt()
static const uint16_t xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 };
uint16_t data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x0f];
- data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0);
+ data = bitswap<16>(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0);
RAM[0xc0000/2 + i] = data;
}
@@ -752,7 +752,7 @@ void raiden_state::common_decrypt()
static const uint16_t xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 };
uint16_t data = RAM[0xc0000/2 + i];
data ^= xor_table[i & 0x07];
- data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6);
+ data = bitswap<16>(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6);
RAM[0xc0000/2 + i] = data;
}
}
diff --git a/src/mame/drivers/rainbow.cpp b/src/mame/drivers/rainbow.cpp
index b8f94aa..2ee85a2 100644
--- a/src/mame/drivers/rainbow.cpp
+++ b/src/mame/drivers/rainbow.cpp
@@ -2863,7 +2863,7 @@ WRITE16_MEMBER(rainbow_state::vram_w)
if(m_GDC_MODE_REGISTER & GDC_MODE_VECTOR) // VT240 : if(SELECT_VECTOR_PATTERN_REGISTER)
{
- chr = BITSWAP8(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx);
+ chr = bitswap<8>(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx);
chr |= (chr << 8);
if(m_patcnt-- == 0)
{
@@ -3121,7 +3121,7 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w)
// -------------------- WRITE BUFFER USED IN WORD MODE ONLY !
// "OUTPUT WRITE BUFFER IS THE INVERSE OF THE INPUT" (quote from 4-3 of the PDF)
// BITSWAP SEEMS NECESSARY (see digits in DOODLE)... !
- m_GDC_WRITE_BUFFER[m_GDC_write_buffer_index++] = ~BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_GDC_WRITE_BUFFER[m_GDC_write_buffer_index++] = ~bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
m_GDC_write_buffer_index &= 0xf; // write up to 16 bytes to port 52h.
break;
@@ -3149,10 +3149,10 @@ WRITE8_MEMBER(rainbow_state::GDC_EXTRA_REGISTER_w)
// There is no specific order for the WRITE_MASK (according to txt/code samples in DEC's PDF).
// NOTE: LOW <-> HI JUXTAPOSITION!
case 4: // 54h Write Mask LOW
- m_GDC_WRITE_MASK = ( BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7) << 8 ) | ( m_GDC_WRITE_MASK & 0x00FF );
+ m_GDC_WRITE_MASK = ( bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7) << 8 ) | ( m_GDC_WRITE_MASK & 0x00FF );
break;
case 5: // 55h Write Mask HIGH
- m_GDC_WRITE_MASK = ( m_GDC_WRITE_MASK & 0xFF00 ) | BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_GDC_WRITE_MASK = ( m_GDC_WRITE_MASK & 0xFF00 ) | bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
break;
} // switch
diff --git a/src/mame/drivers/risc2500.cpp b/src/mame/drivers/risc2500.cpp
index 56049cf..2a8ca42 100644
--- a/src/mame/drivers/risc2500.cpp
+++ b/src/mame/drivers/risc2500.cpp
@@ -77,7 +77,7 @@ uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
// 12 characters 5 x 7
for(int x=0; x<5; x++)
{
- uint8_t gfx = BITSWAP8(m_vram[c*5 + x], 6,5,0,1,2,3,4,7);
+ uint8_t gfx = bitswap<8>(m_vram[c*5 + x], 6,5,0,1,2,3,4,7);
for(int y=0; y<7; y++)
bitmap.pix16(y, 71 - (c*6 + x)) = (gfx >> (y + 1)) & 1;
@@ -86,7 +86,7 @@ uint32_t risc2500_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
// LCD digits and symbols
int data_addr = 0x40 + c * 5;
uint16_t data = ((m_vram[data_addr + 1] & 0x3) << 5) | ((m_vram[data_addr + 2] & 0x7) << 2) | (m_vram[data_addr + 4] & 0x3);
- data = BITSWAP8(data, 7,3,0,1,4,6,5,2) | ((m_vram[data_addr - 1] & 0x04) ? 0x80 : 0);
+ data = bitswap<8>(data, 7,3,0,1,4,6,5,2) | ((m_vram[data_addr - 1] & 0x04) ? 0x80 : 0);
output().set_digit_value(c, data);
output().set_indexed_value("sym", c, BIT(m_vram[data_addr + 1], 2));
diff --git a/src/mame/drivers/rohga.cpp b/src/mame/drivers/rohga.cpp
index 84389cc..b58023b 100644
--- a/src/mame/drivers/rohga.cpp
+++ b/src/mame/drivers/rohga.cpp
@@ -171,7 +171,7 @@ ADDRESS_MAP_END
READ16_MEMBER( rohga_state::wf_protection_region_0_104_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco104->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -180,7 +180,7 @@ READ16_MEMBER( rohga_state::wf_protection_region_0_104_r )
WRITE16_MEMBER( rohga_state::wf_protection_region_0_104_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco104->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -221,7 +221,7 @@ ADDRESS_MAP_END
READ16_MEMBER( rohga_state::nb_protection_region_0_146_r )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -230,7 +230,7 @@ READ16_MEMBER( rohga_state::nb_protection_region_0_146_r )
WRITE16_MEMBER( rohga_state::nb_protection_region_0_146_w )
{
int real_address = 0 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/royalmah.cpp b/src/mame/drivers/royalmah.cpp
index f78d744..684b97e 100644
--- a/src/mame/drivers/royalmah.cpp
+++ b/src/mame/drivers/royalmah.cpp
@@ -312,9 +312,9 @@ PALETTE_INIT_MEMBER(royalmah_state,mjderngr)
uint16_t data = (prom[i] << 8) | prom[i + 0x200];
/* the bits are in reverse order */
- uint8_t r = BITSWAP8((data >> 0) & 0x1f,7,6,5,0,1,2,3,4 );
- uint8_t g = BITSWAP8((data >> 5) & 0x1f,7,6,5,0,1,2,3,4 );
- uint8_t b = BITSWAP8((data >> 10) & 0x1f,7,6,5,0,1,2,3,4 );
+ 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 );
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
diff --git a/src/mame/drivers/s11.cpp b/src/mame/drivers/s11.cpp
index 8c299d7..0f9948e 100644
--- a/src/mame/drivers/s11.cpp
+++ b/src/mame/drivers/s11.cpp
@@ -242,7 +242,7 @@ WRITE8_MEMBER( s11_state::dig1_w )
m_segment2 |= 0x20000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
@@ -266,7 +266,7 @@ WRITE8_MEMBER( s11_state::pia2c_pa_w )
m_segment1 |= 0x10000;
if ((m_segment1 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment1 |= 0x40000;
}
}
@@ -277,7 +277,7 @@ WRITE8_MEMBER( s11_state::pia2c_pb_w )
m_segment1 |= 0x20000;
if ((m_segment1 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe, BITSWAP16(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe, bitswap<16>(m_segment1, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment1 |= 0x40000;
}
}
@@ -300,7 +300,7 @@ WRITE8_MEMBER( s11_state::pia34_pa_w )
m_segment2 |= 0x10000;
if ((m_segment2 & 0x70000) == 0x30000)
{
- output().set_digit_value(m_strobe+16, BITSWAP16(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_strobe+16, bitswap<16>(m_segment2, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
m_segment2 |= 0x40000;
}
}
diff --git a/src/mame/drivers/s11b.cpp b/src/mame/drivers/s11b.cpp
index c48ee63..08e8fe0 100644
--- a/src/mame/drivers/s11b.cpp
+++ b/src/mame/drivers/s11b.cpp
@@ -177,9 +177,9 @@ WRITE8_MEMBER( s11b_state::dig1_w )
if((seg & 0x70000) == 0x30000)
{
if(m_invert)
- output().set_digit_value(get_strobe()+16, BITSWAP16(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe()+16, bitswap<16>(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
else
- output().set_digit_value(get_strobe()+16, BITSWAP16(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe()+16, bitswap<16>(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
seg |= 0x40000;
}
set_segment2(seg);
@@ -193,9 +193,9 @@ WRITE8_MEMBER( s11b_state::pia2c_pa_w )
if((seg & 0x70000) == 0x30000)
{
if(m_invert)
- output().set_digit_value(get_strobe(), BITSWAP16(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe(), bitswap<16>(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
else
- output().set_digit_value(get_strobe(), BITSWAP16(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe(), bitswap<16>(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
seg |= 0x40000;
}
set_segment1(seg);
@@ -209,9 +209,9 @@ WRITE8_MEMBER( s11b_state::pia2c_pb_w )
if((seg & 0x70000) == 0x30000)
{
if(m_invert)
- output().set_digit_value(get_strobe(), BITSWAP16(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe(), bitswap<16>(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
else
- output().set_digit_value(get_strobe(), BITSWAP16(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe(), bitswap<16>(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
seg |= 0x40000;
}
set_segment1(seg);
@@ -225,9 +225,9 @@ WRITE8_MEMBER( s11b_state::pia34_pa_w )
if((seg & 0x70000) == 0x30000)
{
if(m_invert)
- output().set_digit_value(get_strobe()+16, BITSWAP16(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe()+16, bitswap<16>(~seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
else
- output().set_digit_value(get_strobe()+16, BITSWAP16(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(get_strobe()+16, bitswap<16>(seg, 7, 15, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
seg |= 0x40000;
}
set_segment2(seg);
diff --git a/src/mame/drivers/sc1.cpp b/src/mame/drivers/sc1.cpp
index 223c632..2e92685 100644
--- a/src/mame/drivers/sc1.cpp
+++ b/src/mame/drivers/sc1.cpp
@@ -72,7 +72,7 @@ public:
WRITE8_MEMBER( sc1_state::pio_port_a_w )
{
- uint8_t digit = BITSWAP8( data,3,4,6,0,1,2,7,5 );
+ uint8_t digit = bitswap<8>( data,3,4,6,0,1,2,7,5 );
if (m_matrix & 0x04)
output().set_digit_value(3, digit & 0x7f);
diff --git a/src/mame/drivers/sc2.cpp b/src/mame/drivers/sc2.cpp
index 0dc458c..0bbff57 100644
--- a/src/mame/drivers/sc2.cpp
+++ b/src/mame/drivers/sc2.cpp
@@ -118,7 +118,7 @@ void sc2_state::machine_reset()
void sc2_state::sc2_update_display()
{
- uint8_t digit_data = BITSWAP8( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f;
+ uint8_t digit_data = bitswap<8>( m_digit_data,7,0,1,2,3,4,5,6 ) & 0x7f;
if (!BIT(m_led_selected, 0))
{
diff --git a/src/mame/drivers/scregg.cpp b/src/mame/drivers/scregg.cpp
index 778c6cb..30e7c0a 100644
--- a/src/mame/drivers/scregg.cpp
+++ b/src/mame/drivers/scregg.cpp
@@ -419,7 +419,7 @@ DRIVER_INIT_MEMBER(scregg_state,rockduck)
for (x = 0x2000; x < 0x6000; x++)
{
- src[x] = BITSWAP8(src[x],2,0,3,6,1,4,7,5);
+ src[x] = bitswap<8>(src[x],2,0,3,6,1,4,7,5);
}
}
diff --git a/src/mame/drivers/sdk85.cpp b/src/mame/drivers/sdk85.cpp
index 8c89e63..9c1f494 100644
--- a/src/mame/drivers/sdk85.cpp
+++ b/src/mame/drivers/sdk85.cpp
@@ -132,7 +132,7 @@ WRITE8_MEMBER( sdk85_state::scanlines_w )
WRITE8_MEMBER( sdk85_state::digit_w )
{
if (m_digit < 6)
- output().set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff);
+ output().set_digit_value(m_digit, bitswap<8>(data, 3, 2, 1, 0, 7, 6, 5, 4)^0xff);
}
READ8_MEMBER( sdk85_state::kbd_r )
diff --git a/src/mame/drivers/segag80r.cpp b/src/mame/drivers/segag80r.cpp
index 5622b9e..079a86f 100644
--- a/src/mame/drivers/segag80r.cpp
+++ b/src/mame/drivers/segag80r.cpp
@@ -317,11 +317,11 @@ WRITE8_MEMBER(segag80r_state::sindbadm_misc_w)
/* the data lines are flipped */
WRITE8_MEMBER(segag80r_state::sindbadm_sn1_SN76496_w)
{
- m_sn1->write(space, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
+ m_sn1->write(space, offset, bitswap<8>(data, 0,1,2,3,4,5,6,7));
}
WRITE8_MEMBER(segag80r_state::sindbadm_sn2_SN76496_w)
{
- m_sn2->write(space, offset, BITSWAP8(data, 0,1,2,3,4,5,6,7));
+ m_sn2->write(space, offset, bitswap<8>(data, 0,1,2,3,4,5,6,7));
}
diff --git a/src/mame/drivers/segaorun.cpp b/src/mame/drivers/segaorun.cpp
index fcd8de7..f6a59e4 100644
--- a/src/mame/drivers/segaorun.cpp
+++ b/src/mame/drivers/segaorun.cpp
@@ -2964,13 +2964,13 @@ DRIVER_INIT_MEMBER(segaorun_state,outrunb)
uint16_t *word = (uint16_t *)memregion("maincpu")->base();
uint32_t length = memregion("maincpu")->bytes() / 2;
for (uint32_t i = 0; i < length; i++)
- word[i] = BITSWAP16(word[i], 15,14,11,12,13,10,9,8,6,7,5,4,3,2,1,0);
+ word[i] = bitswap<16>(word[i], 15,14,11,12,13,10,9,8,6,7,5,4,3,2,1,0);
// sub CPU: swap bits 14,15 and 2,3
word = (uint16_t *)memregion("subcpu")->base();
length = memregion("subcpu")->bytes() / 2;
for (uint32_t i = 0; i < length; i++)
- word[i] = BITSWAP16(word[i], 14,15,13,12,11,10,9,8,7,6,5,4,2,3,1,0);
+ word[i] = bitswap<16>(word[i], 14,15,13,12,11,10,9,8,7,6,5,4,2,3,1,0);
// road gfx
// rom a-2.bin: swap bits 6,7
@@ -2979,15 +2979,15 @@ DRIVER_INIT_MEMBER(segaorun_state,outrunb)
length = memregion("gfx3")->bytes() / 2;
for (uint32_t i = 0; i < length; i++)
{
- byte[i] = BITSWAP8(byte[i], 6,7,5,4,3,2,1,0);
- byte[i+length] = BITSWAP8(byte[i+length], 7,5,6,4,3,2,1,0);
+ byte[i] = bitswap<8>(byte[i], 6,7,5,4,3,2,1,0);
+ byte[i+length] = bitswap<8>(byte[i+length], 7,5,6,4,3,2,1,0);
}
// Z80 code: swap bits 5,6
byte = memregion("soundcpu")->base();
length = memregion("soundcpu")->bytes();
for (uint32_t i = 0; i < length; i++)
- byte[i] = BITSWAP8(byte[i], 7,5,6,4,3,2,1,0);
+ byte[i] = bitswap<8>(byte[i], 7,5,6,4,3,2,1,0);
}
DRIVER_INIT_MEMBER(segaorun_state,shangon)
diff --git a/src/mame/drivers/segas16b.cpp b/src/mame/drivers/segas16b.cpp
index 19aef83..4e0ec52 100644
--- a/src/mame/drivers/segas16b.cpp
+++ b/src/mame/drivers/segas16b.cpp
@@ -3829,7 +3829,7 @@ void segas16b_state::tilemap_16b_fpointbl_fill_latch(int i, uint16_t* latched_pa
else if (i == 1)
{
// 6661 vs 1666
- latched_pageselect[i] = BITSWAP16(m_bootleg_page[3] ,3, 2, 1, 0 , 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 ) ;
+ latched_pageselect[i] = bitswap<16>(m_bootleg_page[3] ,3, 2, 1, 0 , 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12 ) ;
latched_yscroll[i] = m_bootleg_scroll[0x10/2]+2;
latched_xscroll[i] = -m_bootleg_scroll[0x18/2]-1;
}
@@ -9021,7 +9021,7 @@ DRIVER_INIT_MEMBER(segas16b_state, fpointbla)
for (int i = 0;i < 0x10000;i++)
{
- m_decrypted_opcodes[i] = BITSWAP16(rom[i], 8,9,10,11,12,13,14,15, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_decrypted_opcodes[i] = bitswap<16>(rom[i], 8,9,10,11,12,13,14,15, 0, 1, 2, 3, 4, 5, 6, 7);
}
}
@@ -9372,14 +9372,14 @@ WRITE16_MEMBER( isgsm_state::data_w )
// 8-bit rotation - used by bloxeed
switch (m_data_type & 0xe0)
{
- case 0x00: data = BITSWAP8(data,0,7,6,5,4,3,2,1); break;
- case 0x20: data = BITSWAP8(data,7,6,5,4,3,2,1,0); break;
- case 0x40: data = BITSWAP8(data,6,5,4,3,2,1,0,7); break;
- case 0x60: data = BITSWAP8(data,5,4,3,2,1,0,7,6); break;
- case 0x80: data = BITSWAP8(data,4,3,2,1,0,7,6,5); break;
- case 0xa0: data = BITSWAP8(data,3,2,1,0,7,6,5,4); break;
- case 0xc0: data = BITSWAP8(data,2,1,0,7,6,5,4,3); break;
- case 0xe0: data = BITSWAP8(data,1,0,7,6,5,4,3,2); break;
+ case 0x00: data = bitswap<8>(data,0,7,6,5,4,3,2,1); break;
+ case 0x20: data = bitswap<8>(data,7,6,5,4,3,2,1,0); break;
+ case 0x40: data = bitswap<8>(data,6,5,4,3,2,1,0,7); break;
+ case 0x60: data = bitswap<8>(data,5,4,3,2,1,0,7,6); break;
+ case 0x80: data = bitswap<8>(data,4,3,2,1,0,7,6,5); break;
+ case 0xa0: data = bitswap<8>(data,3,2,1,0,7,6,5,4); break;
+ case 0xc0: data = bitswap<8>(data,2,1,0,7,6,5,4,3); break;
+ case 0xe0: data = bitswap<8>(data,1,0,7,6,5,4,3,2); break;
}
}
@@ -9455,14 +9455,14 @@ WRITE16_MEMBER( isgsm_state::data_w )
// 8-bit rotation - used by tetris
switch (m_data_type & 0xe0)
{
- case 0x00: byte = BITSWAP8(byte,0,7,6,5,4,3,2,1); break;
- case 0x20: byte = BITSWAP8(byte,7,6,5,4,3,2,1,0); break;
- case 0x40: byte = BITSWAP8(byte,6,5,4,3,2,1,0,7); break;
- case 0x60: byte = BITSWAP8(byte,5,4,3,2,1,0,7,6); break;
- case 0x80: byte = BITSWAP8(byte,4,3,2,1,0,7,6,5); break;
- case 0xa0: byte = BITSWAP8(byte,3,2,1,0,7,6,5,4); break;
- case 0xc0: byte = BITSWAP8(byte,2,1,0,7,6,5,4,3); break;
- case 0xe0: byte = BITSWAP8(byte,1,0,7,6,5,4,3,2); break;
+ case 0x00: byte = bitswap<8>(byte,0,7,6,5,4,3,2,1); break;
+ case 0x20: byte = bitswap<8>(byte,7,6,5,4,3,2,1,0); break;
+ case 0x40: byte = bitswap<8>(byte,6,5,4,3,2,1,0,7); break;
+ case 0x60: byte = bitswap<8>(byte,5,4,3,2,1,0,7,6); break;
+ case 0x80: byte = bitswap<8>(byte,4,3,2,1,0,7,6,5); break;
+ case 0xa0: byte = bitswap<8>(byte,3,2,1,0,7,6,5,4); break;
+ case 0xc0: byte = bitswap<8>(byte,2,1,0,7,6,5,4,3); break;
+ case 0xe0: byte = bitswap<8>(byte,1,0,7,6,5,4,3,2); break;
}
}
@@ -9510,7 +9510,7 @@ WRITE16_MEMBER( isgsm_state::cart_security_high_w )
uint32_t isgsm_state::shinfz_security(uint32_t input)
{
- return BITSWAP32(input, 19, 20, 25, 26, 15, 0, 16, 2, 8, 9, 13, 14, 31, 21, 7, 18, 11, 30, 22, 17, 3, 4, 12, 28, 29, 5, 27, 10, 23, 24, 1, 6);
+ return bitswap<32>(input, 19, 20, 25, 26, 15, 0, 16, 2, 8, 9, 13, 14, 31, 21, 7, 18, 11, 30, 22, 17, 3, 4, 12, 28, 29, 5, 27, 10, 23, 24, 1, 6);
}
uint32_t isgsm_state::tetrbx_security(uint32_t input)
@@ -9734,7 +9734,7 @@ DRIVER_INIT_MEMBER(isgsm_state,isgsm)
std::vector<uint16_t> temp(0x20000/2);
uint16_t *rom = (uint16_t *)memregion("bios")->base();
for (int addr = 0; addr < 0x20000/2; addr++)
- temp[addr ^ 0x4127] = BITSWAP16(rom[addr], 6, 14, 4, 2, 12, 10, 8, 0, 1, 9, 11, 13, 3, 5, 7, 15);
+ temp[addr ^ 0x4127] = bitswap<16>(rom[addr], 6, 14, 4, 2, 12, 10, 8, 0, 1, 9, 11, 13, 3, 5, 7, 15);
memcpy(rom, &temp[0], 0x20000);
}
@@ -9745,7 +9745,7 @@ DRIVER_INIT_MEMBER(isgsm_state,shinfz)
std::vector<uint16_t> temp(0x200000/2);
uint16_t *rom = (uint16_t *)memregion("gamecart_rgn")->base();
for (int addr = 0; addr < 0x200000/2; addr++)
- temp[addr ^ 0x68956] = BITSWAP16(rom[addr], 8, 4, 12, 3, 6, 7, 1, 0, 15, 11, 5, 14, 10, 2, 9, 13);
+ temp[addr ^ 0x68956] = bitswap<16>(rom[addr], 8, 4, 12, 3, 6, 7, 1, 0, 15, 11, 5, 14, 10, 2, 9, 13);
memcpy(rom, &temp[0], 0x200000);
m_read_xor = 0x66;
@@ -9759,7 +9759,7 @@ DRIVER_INIT_MEMBER(isgsm_state,tetrbx)
std::vector<uint16_t> temp(0x80000/2);
uint16_t *rom = (uint16_t *)memregion("gamecart_rgn")->base();
for (int addr = 0; addr < 0x80000/2; addr++)
- temp[addr ^ 0x2A6E6] = BITSWAP16(rom[addr], 4, 0, 12, 5, 7, 3, 1, 14, 10, 11, 9, 6, 15, 2, 13, 8);
+ temp[addr ^ 0x2A6E6] = bitswap<16>(rom[addr], 4, 0, 12, 5, 7, 3, 1, 14, 10, 11, 9, 6, 15, 2, 13, 8);
memcpy(rom, &temp[0], 0x80000);
m_read_xor = 0x73;
diff --git a/src/mame/drivers/segaufo.cpp b/src/mame/drivers/segaufo.cpp
index f88c656..5d421cc 100644
--- a/src/mame/drivers/segaufo.cpp
+++ b/src/mame/drivers/segaufo.cpp
@@ -375,7 +375,7 @@ WRITE8_MEMBER(ufo_state::ex_stepper_w)
{
// stepper motor sequence is: 6 c 9 3 6 c 9 3..
// which means d0 and d3 are swapped when compared with UFO board hardware
- stepper_w(space, offset, BITSWAP8(data,4,6,5,7,0,2,1,3));
+ stepper_w(space, offset, bitswap<8>(data,4,6,5,7,0,2,1,3));
}
WRITE8_MEMBER(ufo_state::ex_cp_lamps_w)
diff --git a/src/mame/drivers/seicross.cpp b/src/mame/drivers/seicross.cpp
index 9090f17..a6caf03 100644
--- a/src/mame/drivers/seicross.cpp
+++ b/src/mame/drivers/seicross.cpp
@@ -628,7 +628,7 @@ DRIVER_INIT_MEMBER(seicross_state,friskytb)
// this code is in ROM 6.3h, maps to MCU at dxxx
for (int i = 0; i < 0x7800; i++)
{
- m_decrypted_opcodes[i] = BITSWAP8(ROM[i], 6, 7, 5, 4, 3, 2, 0, 1);
+ m_decrypted_opcodes[i] = bitswap<8>(ROM[i], 6, 7, 5, 4, 3, 2, 0, 1);
}
}
diff --git a/src/mame/drivers/selz80.cpp b/src/mame/drivers/selz80.cpp
index 2016a75..86443fe 100644
--- a/src/mame/drivers/selz80.cpp
+++ b/src/mame/drivers/selz80.cpp
@@ -185,7 +185,7 @@ WRITE8_MEMBER( selz80_state::scanlines_w )
WRITE8_MEMBER( selz80_state::digit_w )
{
- output().set_digit_value(m_digit, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4));
+ output().set_digit_value(m_digit, bitswap<8>(data, 3, 2, 1, 0, 7, 6, 5, 4));
}
READ8_MEMBER( selz80_state::kbd_r )
diff --git a/src/mame/drivers/sfbonus.cpp b/src/mame/drivers/sfbonus.cpp
index 0ae11cd..f0f6854 100644
--- a/src/mame/drivers/sfbonus.cpp
+++ b/src/mame/drivers/sfbonus.cpp
@@ -5896,14 +5896,14 @@ void sfbonus_state::sfbonus_bitswap(
switch(i & 7)
{
- case 0: x = BITSWAP8(x^xor0, b00,b01,b02,b03,b04,b05,b06,b07); break;
- case 1: x = BITSWAP8(x^xor1, b10,b11,b12,b13,b14,b15,b16,b17); break;
- case 2: x = BITSWAP8(x^xor2, b20,b21,b22,b23,b24,b25,b26,b27); break;
- case 3: x = BITSWAP8(x^xor3, b30,b31,b32,b33,b34,b35,b36,b37); break;
- case 4: x = BITSWAP8(x^xor4, b40,b41,b42,b43,b44,b45,b46,b47); break;
- case 5: x = BITSWAP8(x^xor5, b50,b51,b52,b53,b54,b55,b56,b57); break;
- case 6: x = BITSWAP8(x^xor6, b60,b61,b62,b63,b64,b65,b66,b67); break;
- case 7: x = BITSWAP8(x^xor7, b70,b71,b72,b73,b74,b75,b76,b77); break;
+ case 0: x = bitswap<8>(x^xor0, b00,b01,b02,b03,b04,b05,b06,b07); break;
+ case 1: x = bitswap<8>(x^xor1, b10,b11,b12,b13,b14,b15,b16,b17); break;
+ case 2: x = bitswap<8>(x^xor2, b20,b21,b22,b23,b24,b25,b26,b27); break;
+ case 3: x = bitswap<8>(x^xor3, b30,b31,b32,b33,b34,b35,b36,b37); break;
+ case 4: x = bitswap<8>(x^xor4, b40,b41,b42,b43,b44,b45,b46,b47); break;
+ case 5: x = bitswap<8>(x^xor5, b50,b51,b52,b53,b54,b55,b56,b57); break;
+ case 6: x = bitswap<8>(x^xor6, b60,b61,b62,b63,b64,b65,b66,b67); break;
+ case 7: x = bitswap<8>(x^xor7, b70,b71,b72,b73,b74,b75,b76,b77); break;
}
ROM[i] = x;
diff --git a/src/mame/drivers/sfkick.cpp b/src/mame/drivers/sfkick.cpp
index 26e12a7..fda6f6b 100644
--- a/src/mame/drivers/sfkick.cpp
+++ b/src/mame/drivers/sfkick.cpp
@@ -237,7 +237,7 @@ READ8_MEMBER(sfkick_state::ppi_port_b_r)
{
case 0: return m_in0->read();
case 1: return m_in1->read();
- case 2: return BITSWAP8(m_dial->read(),4,5,6,7,3,2,1,0);
+ case 2: return bitswap<8>(m_dial->read(),4,5,6,7,3,2,1,0);
case 3: return m_dsw1->read();
case 4: return m_dsw2->read();
}
diff --git a/src/mame/drivers/simpl156.cpp b/src/mame/drivers/simpl156.cpp
index b822934..4abff40 100644
--- a/src/mame/drivers/simpl156.cpp
+++ b/src/mame/drivers/simpl156.cpp
@@ -1048,7 +1048,7 @@ DRIVER_INIT_MEMBER(simpl156_state,simpl156)
{
uint32_t addr;
- addr = BITSWAP24 (x,23,22,21,0, 20,
+ addr = bitswap<24> (x,23,22,21,0, 20,
19,18,17,16,
15,14,13,12,
11,10,9, 8,
diff --git a/src/mame/drivers/skimaxx.cpp b/src/mame/drivers/skimaxx.cpp
index 3c621dc..89cdd79 100644
--- a/src/mame/drivers/skimaxx.cpp
+++ b/src/mame/drivers/skimaxx.cpp
@@ -296,7 +296,7 @@ WRITE32_MEMBER(skimaxx_state::skimaxx_sub_ctrl_w)
*/
READ32_MEMBER(skimaxx_state::skimaxx_analog_r)
{
- return BITSWAP8(ioport(offset ? "Y" : "X")->read(), 0,1,2,3,4,5,6,7);
+ return bitswap<8>(ioport(offset ? "Y" : "X")->read(), 0,1,2,3,4,5,6,7);
}
/*************************************
diff --git a/src/mame/drivers/skyarmy.cpp b/src/mame/drivers/skyarmy.cpp
index fa494e4..0f73cb7 100644
--- a/src/mame/drivers/skyarmy.cpp
+++ b/src/mame/drivers/skyarmy.cpp
@@ -93,7 +93,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 = BITSWAP8(m_colorram[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
+ int attr = bitswap<8>(m_colorram[tile_index], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
SET_TILE_INFO_MEMBER(0, code, attr, 0);
}
@@ -158,7 +158,7 @@ uint32_t skyarmy_state::screen_update(screen_device &screen, bitmap_ind16 &bitma
for (offs = 0 ; offs < 0x40; offs+=4)
{
- pal = BITSWAP8(m_spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
+ pal = bitswap<8>(m_spriteram[offs+2], 7, 6, 5, 4, 3, 0, 1, 2) & 7;
sx = m_spriteram[offs+3];
sy = 240-(m_spriteram[offs]+1);
diff --git a/src/mame/drivers/snesb.cpp b/src/mame/drivers/snesb.cpp
index 2295706..5b54614 100644
--- a/src/mame/drivers/snesb.cpp
+++ b/src/mame/drivers/snesb.cpp
@@ -745,7 +745,7 @@ DRIVER_INIT_MEMBER(snesb_state,kinstb)
for (i = 0; i < 0x400000; i++)
{
- rom[i] = BITSWAP8(rom[i], 5, 0, 6, 1, 7, 4, 3, 2);
+ rom[i] = bitswap<8>(rom[i], 5, 0, 6, 1, 7, 4, 3, 2);
}
m_shared_ram = std::make_unique<int8_t[]>(0x100);
@@ -775,23 +775,23 @@ DRIVER_INIT_MEMBER(snesb_state,ffight2b)
if (i < 0x10000) /* 0x00000 - 0x0ffff */
{
- rom[i] = BITSWAP8(rom[i],3,1,6,4,7,0,2,5);
+ rom[i] = bitswap<8>(rom[i],3,1,6,4,7,0,2,5);
}
else if (i < 0x20000) /* 0x10000 - 0x1ffff */
{
- rom[i] = BITSWAP8(rom[i],3,7,0,5,1,6,2,4);
+ rom[i] = bitswap<8>(rom[i],3,7,0,5,1,6,2,4);
}
else if (i < 0x30000) /* 0x20000 - 0x2ffff */
{
- rom[i] = BITSWAP8(rom[i],1,7,6,4,5,2,3,0);
+ rom[i] = bitswap<8>(rom[i],1,7,6,4,5,2,3,0);
}
else if (i < 0x40000) /* 0x30000 - 0x3ffff */
{
- rom[i] = BITSWAP8(rom[i],0,3,2,5,4,6,7,1);
+ rom[i] = bitswap<8>(rom[i],0,3,2,5,4,6,7,1);
}
else if (i < 0x150000)
{
- rom[i] = BITSWAP8(rom[i],6,4,0,5,1,3,2,7);
+ rom[i] = bitswap<8>(rom[i],6,4,0,5,1,3,2,7);
}
}
@@ -816,11 +816,11 @@ DRIVER_INIT_MEMBER(snesb_state,iron)
{
if(i < 0x80000)
{
- rom[i] = BITSWAP8(rom[i]^0xff,2,7,1,6,3,0,5,4);
+ rom[i] = bitswap<8>(rom[i]^0xff,2,7,1,6,3,0,5,4);
}
else
{
- rom[i] = BITSWAP8(rom[i],6,3,0,5,1,4,7,2);
+ rom[i] = bitswap<8>(rom[i],6,3,0,5,1,4,7,2);
}
}
@@ -842,12 +842,12 @@ DRIVER_INIT_MEMBER(snesb_state,denseib)
rom[i] = rom[i] ^ 0xff;
switch (i >> 16)
{
- case 0x00: rom[i] = BITSWAP8(rom[i],1,7,0,6,3,4,5,2); break;
- case 0x01: rom[i] = BITSWAP8(rom[i],3,4,7,2,0,6,5,1); break;
- case 0x02: rom[i] = BITSWAP8(rom[i],5,4,2,1,7,0,6,3); break;
- case 0x03: rom[i] = BITSWAP8(rom[i],0,1,3,7,2,6,5,4); break;
+ case 0x00: rom[i] = bitswap<8>(rom[i],1,7,0,6,3,4,5,2); break;
+ case 0x01: rom[i] = bitswap<8>(rom[i],3,4,7,2,0,6,5,1); break;
+ case 0x02: rom[i] = bitswap<8>(rom[i],5,4,2,1,7,0,6,3); break;
+ case 0x03: rom[i] = bitswap<8>(rom[i],0,1,3,7,2,6,5,4); break;
- default: rom[i] = BITSWAP8(rom[i],4,5,1,0,2,3,7,6); break;
+ default: rom[i] = bitswap<8>(rom[i],4,5,1,0,2,3,7,6); break;
}
}
@@ -872,15 +872,15 @@ DRIVER_INIT_MEMBER(snesb_state,legendsb)
u8 val = rom[i] ^ 0xff;
if (i < 0x10000)
- rom[i] = BITSWAP8(val,6,5,4,2,1,0,3,7); // 0x00000 - 0x0ffff
+ rom[i] = bitswap<8>(val,6,5,4,2,1,0,3,7); // 0x00000 - 0x0ffff
else if (i < 0x20000)
- rom[i] = BITSWAP8(val,6,1,3,5,2,0,7,4); // 0x10000 - 0x1ffff
+ rom[i] = bitswap<8>(val,6,1,3,5,2,0,7,4); // 0x10000 - 0x1ffff
else if (i < 0x30000)
- rom[i] = BITSWAP8(val,2,6,3,0,4,5,7,1); // 0x20000 - 0x2ffff
+ rom[i] = bitswap<8>(val,2,6,3,0,4,5,7,1); // 0x20000 - 0x2ffff
else if (i < 0x40000)
- rom[i] = BITSWAP8(val,5,4,2,7,0,3,6,1); // 0x30000 - 0x3ffff
+ rom[i] = bitswap<8>(val,5,4,2,7,0,3,6,1); // 0x30000 - 0x3ffff
else
- rom[i] = BITSWAP8(val,3,6,0,5,1,4,7,2); // 0x40000 - 0xfffff
+ rom[i] = bitswap<8>(val,3,6,0,5,1,4,7,2); // 0x40000 - 0xfffff
}
// boot vector
@@ -926,19 +926,19 @@ DRIVER_INIT_MEMBER(snesb_state,sblast2b)
if (newAddress < 0x10000)
{
- plainText = BITSWAP8(plainText, 6,3,5,4,2,0,7,1) ^ 0xff;
+ plainText = bitswap<8>(plainText, 6,3,5,4,2,0,7,1) ^ 0xff;
}
else if (newAddress < 0x20000)
{
- plainText = BITSWAP8(plainText, 4,0,7,6,3,1,2,5) ^ 0xff;
+ plainText = bitswap<8>(plainText, 4,0,7,6,3,1,2,5) ^ 0xff;
}
else if (newAddress < 0x30000)
{
- plainText = BITSWAP8(plainText, 5,7,6,1,4,3,0,2);
+ plainText = bitswap<8>(plainText, 5,7,6,1,4,3,0,2);
}
else if (newAddress < 0x40000)
{
- plainText = BITSWAP8(plainText, 3,1,2,0,5,6,4,7) ^ 0xff;
+ plainText = bitswap<8>(plainText, 3,1,2,0,5,6,4,7) ^ 0xff;
}
dst[newAddress] = plainText;
}
@@ -996,19 +996,19 @@ DRIVER_INIT_MEMBER(snesb_state,endless)
dst[i] = data_high[src[j]>>4] | data_low[src[j]&0xf];
if (i >= 0x00000 && i < 0x10000) {
- dst[i] = BITSWAP8(dst[i],2,3,4,1,7,0,6,5);
+ dst[i] = bitswap<8>(dst[i],2,3,4,1,7,0,6,5);
}
if (i >= 0x10000 && i < 0x20000) {
- dst[i] = BITSWAP8(dst[i],1,5,6,0,2,4,7,3) ^ 0xff;
+ dst[i] = bitswap<8>(dst[i],1,5,6,0,2,4,7,3) ^ 0xff;
}
if (i >= 0x20000 && i < 0x30000) {
- dst[i] = BITSWAP8(dst[i],3,0,1,6,4,5,2,7);
+ dst[i] = bitswap<8>(dst[i],3,0,1,6,4,5,2,7);
}
if (i >= 0x30000 && i < 0x40000) {
- dst[i] = BITSWAP8(dst[i],0,4,2,3,5,6,7,1) ^ 0xff;
+ dst[i] = bitswap<8>(dst[i],0,4,2,3,5,6,7,1) ^ 0xff;
}
}
diff --git a/src/mame/drivers/snookr10.cpp b/src/mame/drivers/snookr10.cpp
index 64a44c3..44e618f 100644
--- a/src/mame/drivers/snookr10.cpp
+++ b/src/mame/drivers/snookr10.cpp
@@ -209,7 +209,7 @@
digit #3
+-------+ swapped digits 1 & 2
| | +-------+------+
- tile_offset = BITSWAP16((tile_offset & 0xfff),15,14,13,12, 8,9,10,11, 0,1,2,3, 4,5,6,7)
+ tile_offset = bitswap<16>((tile_offset & 0xfff),15,14,13,12, 8,9,10,11, 0,1,2,3, 4,5,6,7)
| | | | | | | | || | | |
inverted inverted|inverted
bitorder bitorder|bitorder
@@ -243,7 +243,7 @@
1st nibble
inverted bitorder
| | | |
- color_index = BITSWAP8(color_index,4,5,6,7,2,3,0,1)
+ color_index = bitswap<8>(color_index,4,5,6,7,2,3,0,1)
<-> <->
2nd nibble
swappeed pairs
@@ -437,7 +437,7 @@
So, the algorithm to properly decrypt the color codes is the following one:
- color_index = BITSWAP8(color_index,7,5,6,4,3,2,1,0)
+ color_index = bitswap<8>(color_index,7,5,6,4,3,2,1,0)
| |
swapped
diff --git a/src/mame/drivers/snowbros.cpp b/src/mame/drivers/snowbros.cpp
index e5e6517..464800f 100644
--- a/src/mame/drivers/snowbros.cpp
+++ b/src/mame/drivers/snowbros.cpp
@@ -2782,7 +2782,7 @@ DRIVER_INIT_MEMBER(snowbros_state,4in1boot)
std::vector<uint8_t> buffer(len);
int i;
for (i = 0;i < len; i++)
- if (i&1) buffer[i] = BITSWAP8(src[i],6,7,5,4,3,2,1,0);
+ if (i&1) buffer[i] = bitswap<8>(src[i],6,7,5,4,3,2,1,0);
else buffer[i] = src[i];
memcpy(src,&buffer[0],len);
@@ -2812,7 +2812,7 @@ DRIVER_INIT_MEMBER(snowbros_state,snowbro3)
std::vector<uint8_t> buffer(len);
int i;
for (i = 0;i < len; i++)
- buffer[i] = src[BITSWAP24(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,3,4,1,2,0)];
+ buffer[i] = src[bitswap<24>(i,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,3,4,1,2,0)];
memcpy(src,&buffer[0],len);
}
@@ -2856,7 +2856,7 @@ DRIVER_INIT_MEMBER(snowbros_state,toto)
for (int i = 0; i < len; i++)
{
- src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
}
src = memregion("gfx1")->base();
@@ -2864,7 +2864,7 @@ DRIVER_INIT_MEMBER(snowbros_state,toto)
for (int i = 0; i < len; i++)
{
- src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
}
src = memregion("soundcpu")->base();
@@ -2872,7 +2872,7 @@ DRIVER_INIT_MEMBER(snowbros_state,toto)
for (int i = 0; i < len; i++)
{
- src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
+ src[i] = bitswap<8>(src[i], 7, 6, 5, 3, 4, 2, 1, 0);
}
// protection? (just return 0x07)
diff --git a/src/mame/drivers/sothello.cpp b/src/mame/drivers/sothello.cpp
index 33b5b2e..28d1e67 100644
--- a/src/mame/drivers/sothello.cpp
+++ b/src/mame/drivers/sothello.cpp
@@ -193,7 +193,7 @@ WRITE8_MEMBER(sothello_state::msm_cfg_w)
bit 2 = S2 1
bit 3 = S1 2
*/
- m_msm->playmode_w(BITSWAP8((data>>1), 7,6,5,4,3,0,1,2));
+ m_msm->playmode_w(bitswap<8>((data>>1), 7,6,5,4,3,0,1,2));
m_msm->reset_w(data & 1);
}
diff --git a/src/mame/drivers/speedbal.cpp b/src/mame/drivers/speedbal.cpp
index cc4d2c4..c20cfe8 100644
--- a/src/mame/drivers/speedbal.cpp
+++ b/src/mame/drivers/speedbal.cpp
@@ -301,7 +301,7 @@ DRIVER_INIT_MEMBER(speedbal_state,speedbal)
for (int i=0;i<0x200;i++)
{
- int j = BITSWAP16(i, 15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7);
+ int j = bitswap<16>(i, 15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7);
memcpy(&temp[i*128], rom+j*128, 128);
}
@@ -380,7 +380,7 @@ DRIVER_INIT_MEMBER(speedbal_state,musicbal)
int bswIdx = xorMask & 3; // ... and the bitswap
// only bits #0, #1, #2 & #7 are affected
- rom[i] = BITSWAP8(rom[i], swapTable[bswIdx][3], 6,5,4,3, swapTable[bswIdx][2], swapTable[bswIdx][1], swapTable[bswIdx][0]) ^ xorTable[addIdx];
+ rom[i] = bitswap<8>(rom[i], swapTable[bswIdx][3], 6,5,4,3, swapTable[bswIdx][2], swapTable[bswIdx][1], swapTable[bswIdx][0]) ^ xorTable[addIdx];
}
DRIVER_INIT_CALL(speedbal);
diff --git a/src/mame/drivers/sshangha.cpp b/src/mame/drivers/sshangha.cpp
index cf3769b..82079a6 100644
--- a/src/mame/drivers/sshangha.cpp
+++ b/src/mame/drivers/sshangha.cpp
@@ -136,7 +136,7 @@ WRITE16_MEMBER(sshangha_state::paletteram16_xbgr_word_be_tilehigh_w)
READ16_MEMBER( sshangha_state::sshangha_protection_region_d_146_r )
{
int real_address = 0x3f4000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -145,7 +145,7 @@ READ16_MEMBER( sshangha_state::sshangha_protection_region_d_146_r )
WRITE16_MEMBER( sshangha_state::sshangha_protection_region_d_146_w )
{
int real_address = 0x3f4000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
@@ -153,7 +153,7 @@ WRITE16_MEMBER( sshangha_state::sshangha_protection_region_d_146_w )
READ16_MEMBER( sshangha_state::sshangha_protection_region_8_146_r )
{
int real_address = 0x3e0000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
uint16_t data = m_deco146->read_data( deco146_addr, mem_mask, cs );
return data;
@@ -162,7 +162,7 @@ READ16_MEMBER( sshangha_state::sshangha_protection_region_8_146_r )
WRITE16_MEMBER( sshangha_state::sshangha_protection_region_8_146_w )
{
int real_address = 0x3e0000 + (offset *2);
- int deco146_addr = BITSWAP32(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
+ int deco146_addr = bitswap<32>(real_address, /* NC */31,30,29,28,27,26,25,24,23,22,21,20,19,18, 13,12,11,/**/ 17,16,15,14, 10,9,8, 7,6,5,4, 3,2,1,0) & 0x7fff;
uint8_t cs = 0;
m_deco146->write_data( space, deco146_addr, data, mem_mask, cs );
}
diff --git a/src/mame/drivers/statriv2.cpp b/src/mame/drivers/statriv2.cpp
index 01d9fb1..fb8ac5c 100644
--- a/src/mame/drivers/statriv2.cpp
+++ b/src/mame/drivers/statriv2.cpp
@@ -1576,7 +1576,7 @@ DRIVER_INIT_MEMBER(statriv2_state, addr_lmhe)
uint32_t address;
for (address = 0; address < length; address++)
- qrom[address] ^= BITSWAP8(address, 4,3,3,2,2,1,1,0);
+ qrom[address] ^= bitswap<8>(address, 4,3,3,2,2,1,1,0);
DRIVER_INIT_CALL(addr_lmh);
}
diff --git a/src/mame/drivers/stv.cpp b/src/mame/drivers/stv.cpp
index 192cbb1..5d77919 100644
--- a/src/mame/drivers/stv.cpp
+++ b/src/mame/drivers/stv.cpp
@@ -172,7 +172,7 @@ READ8_MEMBER(stv_state::critcrsh_ioga_r)
case 0x01:
case 0x03:
res = ioport(lgnames[offset >> 1])->read();
- res = BITSWAP8(res, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3;
+ res = bitswap<8>(res, 2, 3, 0, 1, 6, 7, 5, 4) & 0xf3;
res |= (ioport("PORTC")->read() & 0x10) ? 0x0 : 0x4; // x/y hit latch actually
break;
default: res = stv_ioga_r(space,offset); break;
@@ -1897,11 +1897,11 @@ DRIVER_INIT_MEMBER(stv_state,sanjeon)
{
src[x] = src[x]^0xff;
- src[x] = BITSWAP8(src[x],7,2,5,1, 3,6,4,0);
- src[x] = BITSWAP8(src[x],4,6,5,7, 3,2,1,0);
- src[x] = BITSWAP8(src[x],7,6,5,4, 2,3,1,0);
- src[x] = BITSWAP8(src[x],7,0,5,4, 3,2,1,6);
- src[x] = BITSWAP8(src[x],3,6,5,4, 7,2,1,0);
+ src[x] = bitswap<8>(src[x],7,2,5,1, 3,6,4,0);
+ src[x] = bitswap<8>(src[x],4,6,5,7, 3,2,1,0);
+ src[x] = bitswap<8>(src[x],7,6,5,4, 2,3,1,0);
+ src[x] = bitswap<8>(src[x],7,0,5,4, 3,2,1,6);
+ src[x] = bitswap<8>(src[x],3,6,5,4, 7,2,1,0);
}
diff --git a/src/mame/drivers/suna8.cpp b/src/mame/drivers/suna8.cpp
index 3652152..0d580f9 100644
--- a/src/mame/drivers/suna8.cpp
+++ b/src/mame/drivers/suna8.cpp
@@ -76,7 +76,7 @@ DRIVER_INIT_MEMBER(suna8_state,hardhead)
int table = ((i & 0x0c00) >> 10) | ((i & 0x4000) >> 12);
if (swaptable[table])
- rom[i] = BITSWAP8(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58;
+ rom[i] = bitswap<8>(rom[i], 7,6,5,3,4,2,1,0) ^ 0x58;
}
m_bank0d->set_base(memregion("maincpu")->base());
@@ -118,15 +118,15 @@ uint8_t *suna8_state::brickzn_decrypt()
if (data_swap)
{
- x = BITSWAP8(x, 7,6,5,4,3,2,0,1);
- RAM[i] = BITSWAP8(x, 7,2,3,4,5,6,1,0) ^ 0x10;
+ x = bitswap<8>(x, 7,6,5,4,3,2,0,1);
+ RAM[i] = bitswap<8>(x, 7,2,3,4,5,6,1,0) ^ 0x10;
}
if (opcode_swap)
x ^= 0x80;
if (opcode_swap || data_swap)
- x = BITSWAP8(x, 7,2,3,4,5,6,1,0) ^ 0x10;
+ x = bitswap<8>(x, 7,2,3,4,5,6,1,0) ^ 0x10;
decrypt[i] = x;
@@ -255,7 +255,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
int addr = i;
if (swaptable[(i & 0xff000) >> 12])
- addr = (addr & 0xf0000) | BITSWAP16(addr, 15,14,13,12,11,10,9,8,6,7,5,4,3,2,1,0);
+ addr = (addr & 0xf0000) | bitswap<16>(addr, 15,14,13,12,11,10,9,8,6,7,5,4,3,2,1,0);
RAM[i] = decrypt[addr];
}
@@ -277,9 +277,9 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
x = RAM[i];
- x = BITSWAP8(x, 7,6,5,3,4,2,1,0) ^ 0x41 ^ xortable[table];
+ x = bitswap<8>(x, 7,6,5,3,4,2,1,0) ^ 0x41 ^ xortable[table];
if (swaptable[table])
- x = BITSWAP8(x, 5,6,7,4,3,2,1,0);
+ x = bitswap<8>(x, 5,6,7,4,3,2,1,0);
decrypt[i] = x;
}
@@ -290,7 +290,7 @@ rom13: 0?, 1y, 2n, 3n ?,?,?,? (palettes)
static const uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
if (swaptable[(i & 0x7000) >> 12])
- RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
+ RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x41;
}
m_bank1->configure_entries(0, 16, memregion("maincpu")->base() + 0x10000, 0x4000);
@@ -335,7 +335,7 @@ DRIVER_INIT_MEMBER(suna8_state,starfigh)
int addr = i;
if (swaptable[(i & 0xff000) >> 12])
- addr = BITSWAP24(addr, 23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,6,7,5,4,3,2,1,0);
+ addr = bitswap<24>(addr, 23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,6,7,5,4,3,2,1,0);
RAM[i] = decrypt[addr];
}
@@ -357,9 +357,9 @@ DRIVER_INIT_MEMBER(suna8_state,starfigh)
x = RAM[i];
- x = BITSWAP8(x, 5,6,7,3,4,2,1,0) ^ 0x45 ^ xortable[table];
+ x = bitswap<8>(x, 5,6,7,3,4,2,1,0) ^ 0x45 ^ xortable[table];
if (swaptable[table])
- x = BITSWAP8(x, 5,6,7,4,3,2,1,0) ^ 0x04;
+ x = bitswap<8>(x, 5,6,7,4,3,2,1,0) ^ 0x04;
decrypt[i] = x;
}
@@ -370,7 +370,7 @@ DRIVER_INIT_MEMBER(suna8_state,starfigh)
static const uint8_t swaptable[8] = { 1,1,0,1,0,1,1,0 };
if (swaptable[(i & 0x7000) >> 12])
- RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45;
+ RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x45;
}
@@ -420,7 +420,7 @@ DRIVER_INIT_MEMBER(suna8_state,sparkman)
int addr = i;
if (swaptable[(i & 0xff000) >> 12])
- addr = BITSWAP24(addr, 23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,7,8,6,5,4,3,2,1,0);
+ addr = bitswap<24>(addr, 23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,7,8,6,5,4,3,2,1,0);
RAM[i] = decrypt[addr];
}
@@ -442,9 +442,9 @@ DRIVER_INIT_MEMBER(suna8_state,sparkman)
x = RAM[i];
- x = BITSWAP8(x, 5,6,7,3,4,2,1,0) ^ 0x44 ^ xortable[table];
+ x = bitswap<8>(x, 5,6,7,3,4,2,1,0) ^ 0x44 ^ xortable[table];
if (swaptable[table])
- x = BITSWAP8(x, 5,6,7,4,3,2,1,0) ^ 0x04;
+ x = bitswap<8>(x, 5,6,7,4,3,2,1,0) ^ 0x04;
decrypt[i] = x;
}
@@ -455,7 +455,7 @@ DRIVER_INIT_MEMBER(suna8_state,sparkman)
static const uint8_t swaptable[8] = { 1,1,1,0,1,1,0,1 };
if (swaptable[(i & 0x7000) >> 12])
- RAM[i] = BITSWAP8(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44;
+ RAM[i] = bitswap<8>(RAM[i], 5,6,7,4,3,2,1,0) ^ 0x44;
}
// !!!!!! PATCHES !!!!!!
@@ -785,7 +785,7 @@ WRITE8_MEMBER(suna8_state::brickzn_multi_w)
56 coin in OK?
70 monster hit NO? 58?
*/
- uint8_t remap = (m_remap_sound ? BITSWAP8(data, 7,6,3,4,5,2,1,0) : data);
+ uint8_t remap = (m_remap_sound ? bitswap<8>(data, 7,6,3,4,5,2,1,0) : data);
m_soundlatch->write(space, 0, remap);
diff --git a/src/mame/drivers/superqix.cpp b/src/mame/drivers/superqix.cpp
index 68e2598..3808243 100644
--- a/src/mame/drivers/superqix.cpp
+++ b/src/mame/drivers/superqix.cpp
@@ -423,7 +423,7 @@ READ8_MEMBER(superqix_state_base::nmi_ack_r)
READ8_MEMBER(superqix_state::bootleg_in0_r)
{
- return BITSWAP8(ioport("DSW1")->read(), 0,1,2,3,4,5,6,7);
+ return bitswap<8>(ioport("DSW1")->read(), 0,1,2,3,4,5,6,7);
}
WRITE8_MEMBER(superqix_state::bootleg_flipscreen_w)
@@ -1727,7 +1727,7 @@ DRIVER_INIT_MEMBER(superqix_state_base, perestro)
memcpy(temp,&src[i],16);
for (j = 0;j < 16;j++)
{
- src[i+j] = temp[BITSWAP8(j,7,6,5,4,3,2,0,1)];
+ src[i+j] = temp[bitswap<8>(j,7,6,5,4,3,2,0,1)];
}
}
@@ -1738,7 +1738,7 @@ DRIVER_INIT_MEMBER(superqix_state_base, perestro)
memcpy(temp,&src[i],16);
for (j = 0;j < 16;j++)
{
- src[i+j] = temp[BITSWAP8(j,7,6,5,4,0,1,2,3)];
+ src[i+j] = temp[bitswap<8>(j,7,6,5,4,0,1,2,3)];
}
}
@@ -1749,7 +1749,7 @@ DRIVER_INIT_MEMBER(superqix_state_base, perestro)
memcpy(temp,&src[i],16);
for (j = 0;j < 16;j++)
{
- src[i+j] = temp[BITSWAP8(j,7,6,5,4,1,0,3,2)];
+ src[i+j] = temp[bitswap<8>(j,7,6,5,4,1,0,3,2)];
}
}
}
diff --git a/src/mame/drivers/supertnk.cpp b/src/mame/drivers/supertnk.cpp
index 729b9d5..f1bb64d 100644
--- a/src/mame/drivers/supertnk.cpp
+++ b/src/mame/drivers/supertnk.cpp
@@ -489,7 +489,7 @@ DRIVER_INIT_MEMBER(supertnk_state,supertnk)
for (offs = 0; offs < len; offs++)
{
- rom[offs] = BITSWAP8(rom[offs],0,1,2,3,4,5,6,7);
+ rom[offs] = bitswap<8>(rom[offs],0,1,2,3,4,5,6,7);
}
}
diff --git a/src/mame/drivers/supracan.cpp b/src/mame/drivers/supracan.cpp
index 99014c2..8d33114 100644
--- a/src/mame/drivers/supracan.cpp
+++ b/src/mame/drivers/supracan.cpp
@@ -1093,7 +1093,7 @@ WRITE16_MEMBER( supracan_state::supracan_pram_w )
// swap address around so that 64x64 tile can be decoded as 8x8 tiles..
void supracan_state::write_swapped_byte( int offset, uint8_t byte )
{
- int swapped_offset = BITSWAP32(offset, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,2,1,0,6,5,4,3);
+ int swapped_offset = bitswap<32>(offset, 31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,2,1,0,6,5,4,3);
m_vram_addr_swapped[swapped_offset] = byte;
}
diff --git a/src/mame/drivers/system16.cpp b/src/mame/drivers/system16.cpp
index 6132039..a28dfe8 100644
--- a/src/mame/drivers/system16.cpp
+++ b/src/mame/drivers/system16.cpp
@@ -3947,7 +3947,7 @@ DRIVER_INIT_MEMBER(segas1x_bootleg_state,beautyb)
{
rom[x] = rom[x] ^ 0x2400;
- if (x & 8) rom[x] = BITSWAP16(rom[x],15,14,10,12, 11,13,9,8,
+ if (x & 8) rom[x] = bitswap<16>(rom[x],15,14,10,12, 11,13,9,8,
7,6,5,4, 3,2,1,0 );
}
diff --git a/src/mame/drivers/taito_l.cpp b/src/mame/drivers/taito_l.cpp
index 526f35a..c8a92b4 100644
--- a/src/mame/drivers/taito_l.cpp
+++ b/src/mame/drivers/taito_l.cpp
@@ -2443,7 +2443,7 @@ DRIVER_INIT_MEMBER(taitol_1cpu_state, plottinga)
{
u8 tab[256];
for (unsigned i = 0; i < sizeof(tab); i++)
- tab[i] = BITSWAP8(i, 0, 1, 2, 3, 4, 5, 6, 7);
+ tab[i] = bitswap<8>(i, 0, 1, 2, 3, 4, 5, 6, 7);
for (unsigned i = 0; i < m_main_prg.length(); i++)
m_main_prg[i] = tab[m_main_prg[i]];
diff --git a/src/mame/drivers/tcl.cpp b/src/mame/drivers/tcl.cpp
index e97a409..d0fed6c 100644
--- a/src/mame/drivers/tcl.cpp
+++ b/src/mame/drivers/tcl.cpp
@@ -166,7 +166,7 @@ ROM_START( tcl )
ROM_LOAD( "tcl_pr3.9e", 0x200, 0x100, CRC(50ec383b) SHA1(ae95b92bd3946b40134bcdc22708d5c6b0f4c23e) )
ROM_END
-#define ROL(x,n) (BITSWAP8((x),(7+8-n)&7,(6+8-n)&7,(5+8-n)&7,(4+8-n)&7,(3+8-n)&7,(2+8-n)&7,(1+8-n)&7,(0+8-n)&7))
+#define ROL(x,n) (bitswap<8>((x),(7+8-n)&7,(6+8-n)&7,(5+8-n)&7,(4+8-n)&7,(3+8-n)&7,(2+8-n)&7,(1+8-n)&7,(0+8-n)&7))
#define WRITEDEST( n ) \
dest[idx]=n; \
diff --git a/src/mame/drivers/tec1.cpp b/src/mame/drivers/tec1.cpp
index 1425c2b..2a914bd 100644
--- a/src/mame/drivers/tec1.cpp
+++ b/src/mame/drivers/tec1.cpp
@@ -145,7 +145,7 @@ WRITE8_MEMBER( tec1_state::tec1_segment_w )
d1 segment f
d0 segment a */
- m_segment = BITSWAP8(data, 4, 2, 1, 6, 7, 5, 3, 0);
+ m_segment = bitswap<8>(data, 4, 2, 1, 6, 7, 5, 3, 0);
}
WRITE8_MEMBER( tec1_state::tec1_digit_w )
diff --git a/src/mame/drivers/techno.cpp b/src/mame/drivers/techno.cpp
index eba5c5e..e2b245a 100644
--- a/src/mame/drivers/techno.cpp
+++ b/src/mame/drivers/techno.cpp
@@ -90,12 +90,12 @@ ADDRESS_MAP_END
WRITE16_MEMBER( techno_state::disp1_w )
{
- output().set_digit_value(m_digit, BITSWAP16(data, 12, 10, 8, 14, 13, 9, 11, 15, 7, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_digit, bitswap<16>(data, 12, 10, 8, 14, 13, 9, 11, 15, 7, 6, 5, 4, 3, 2, 1, 0));
}
WRITE16_MEMBER( techno_state::disp2_w )
{
- output().set_digit_value(m_digit+30, BITSWAP16(data, 12, 10, 8, 14, 13, 9, 11, 15, 7, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(m_digit+30, bitswap<16>(data, 12, 10, 8, 14, 13, 9, 11, 15, 7, 6, 5, 4, 3, 2, 1, 0));
}
WRITE16_MEMBER( techno_state::sound_w )
diff --git a/src/mame/drivers/ticalc1x.cpp b/src/mame/drivers/ticalc1x.cpp
index 5e05859..00b78aa 100644
--- a/src/mame/drivers/ticalc1x.cpp
+++ b/src/mame/drivers/ticalc1x.cpp
@@ -98,7 +98,7 @@ WRITE16_MEMBER(cmulti8_state::write_r)
WRITE16_MEMBER(cmulti8_state::write_o)
{
// O0-O7: digit segments
- m_o = BITSWAP8(data,0,4,5,6,7,1,2,3);
+ m_o = bitswap<8>(data,0,4,5,6,7,1,2,3);
prepare_display();
}
@@ -719,7 +719,7 @@ WRITE16_MEMBER(ti1000_state::write_o)
// O0-O3,O5(?): input mux
// O0-O7: digit segments
m_inp_mux = (data & 0xf) | (data >> 1 & 0x10);
- m_o = BITSWAP8(data,7,4,3,2,1,0,6,5);
+ m_o = bitswap<8>(data,7,4,3,2,1,0,6,5);
}
READ8_MEMBER(ti1000_state::read_k)
@@ -984,7 +984,7 @@ public:
WRITE16_MEMBER(lilprof78_state::write_r)
{
// update leds state
- u8 seg = BITSWAP8(m_o,7,4,3,2,1,0,6,5) & 0x7f;
+ u8 seg = bitswap<8>(m_o,7,4,3,2,1,0,6,5) & 0x7f;
u16 r = (data & 7) | (data << 1 & 0x1f0);
set_display_segmask(0x1ff, 0x7f);
display_matrix(7, 9, seg, r, false);
@@ -993,7 +993,7 @@ WRITE16_MEMBER(lilprof78_state::write_r)
m_display_state[3] = (r != 0 && m_o & 0x80) ? 0x41 : 0;
// 6th digit is a custom 7seg for math symbols (see wizatron_state write_r)
- m_display_state[6] = BITSWAP8(m_display_state[6],7,6,1,4,2,3,5,0);
+ m_display_state[6] = bitswap<8>(m_display_state[6],7,6,1,4,2,3,5,0);
display_update();
}
@@ -1108,7 +1108,7 @@ WRITE16_MEMBER(dataman_state::write_r)
WRITE16_MEMBER(dataman_state::write_o)
{
// O0-O6: digit segments A-G
- m_o = BITSWAP8(data,7,1,6,5,4,3,2,0) & 0x7f;
+ m_o = bitswap<8>(data,7,1,6,5,4,3,2,0) & 0x7f;
prepare_display();
}
@@ -1297,7 +1297,7 @@ WRITE16_MEMBER(ti30_state::write_o)
// O0-O2,O4-O7: input mux
// O0-O7: digit segments
m_inp_mux = (data & 7) | (data >> 1 & 0x78);
- m_o = BITSWAP8(data,7,5,2,1,4,0,6,3);
+ m_o = bitswap<8>(data,7,5,2,1,4,0,6,3);
}
READ8_MEMBER(ti30_state::read_k)
diff --git a/src/mame/drivers/tispeak.cpp b/src/mame/drivers/tispeak.cpp
index 3fc841e..f71601c 100644
--- a/src/mame/drivers/tispeak.cpp
+++ b/src/mame/drivers/tispeak.cpp
@@ -585,7 +585,7 @@ WRITE16_MEMBER(tispeak_state::snspell_write_o)
// reorder opla to led14seg, plus DP as d14 and AP as d15:
// note: lantutor and snread VFD has an accent triangle instead of DP, and no AP
// E,D,C,G,B,A,I,M,L,K,N,J,[AP],H,F,[DP] (sidenote: TI KLMN = MAME MLNK)
- m_plate = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
+ m_plate = bitswap<16>(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
prepare_display();
}
@@ -602,7 +602,7 @@ WRITE16_MEMBER(tispeak_state::snmath_write_o)
{
// reorder opla to led14seg, plus DP as d14 and CT as d15:
// [DP],D,C,H,F,B,I,M,L,K,N,J,[CT],E,G,A (sidenote: TI KLMN = MAME MLNK)
- m_plate = BITSWAP16(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15);
+ m_plate = bitswap<16>(data,12,0,10,7,8,9,11,6,3,14,4,13,1,2,5,15);
prepare_display();
}
@@ -636,7 +636,7 @@ WRITE16_MEMBER(tispeak_state::snspellc_write_r)
WRITE16_MEMBER(tispeak_state::snspellc_write_o)
{
// O3210: TMS5100 CTL8124
- m_o = BITSWAP8(data,7,6,5,4,3,0,1,2);
+ m_o = bitswap<8>(data,7,6,5,4,3,0,1,2);
m_tms5100->ctl_w(space, 0, m_o & 0xf);
}
@@ -689,7 +689,7 @@ void tispeak_state::k28_prepare_display(u8 old, u8 data)
WRITE16_MEMBER(tispeak_state::k28_write_r)
{
// R1234: TMS5100 CTL8421
- m_tms5100->ctl_w(space, 0, BITSWAP8(data,0,0,0,0,1,2,3,4) & 0xf);
+ m_tms5100->ctl_w(space, 0, bitswap<8>(data,0,0,0,0,1,2,3,4) & 0xf);
// R0: TMS5100 PDC pin
m_tms5100->pdc_w(data & 1);
diff --git a/src/mame/drivers/tispellb.cpp b/src/mame/drivers/tispellb.cpp
index a34da8e..b2eca5f 100644
--- a/src/mame/drivers/tispellb.cpp
+++ b/src/mame/drivers/tispellb.cpp
@@ -150,7 +150,7 @@ void tispellb_state::prepare_display()
WRITE16_MEMBER(tispellb_state::main_write_o)
{
// reorder opla to led14seg, plus DP as d14 and AP as d15, same as snspell
- m_plate = BITSWAP16(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
+ m_plate = bitswap<16>(data,12,15,10,7,8,9,11,6,13,3,14,0,1,2,4,5);
prepare_display();
}
@@ -199,7 +199,7 @@ WRITE16_MEMBER(tispellb_state::sub_write_o)
READ8_MEMBER(tispellb_state::rev1_ctl_r)
{
// main CTL3210 <- sub O6043
- return BITSWAP8(m_sub_o,7,5,2,1,6,0,4,3) & 0xf;
+ return bitswap<8>(m_sub_o,7,5,2,1,6,0,4,3) & 0xf;
}
WRITE16_MEMBER(tispellb_state::sub_write_r)
diff --git a/src/mame/drivers/tmnt.cpp b/src/mame/drivers/tmnt.cpp
index e351f64..2820732 100644
--- a/src/mame/drivers/tmnt.cpp
+++ b/src/mame/drivers/tmnt.cpp
@@ -4098,7 +4098,7 @@ static void chunky_to_planar(memory_region *rgn)
for (int i = 0; i < len; i++)
{
uint32_t data = little_endianize_int32(ROM[i]);
- data = BITSWAP32(data,31,27,23,19,15,11,7,3,30,26,22,18,14,10,6,2,29,25,21,17,13,9,5,1,28,24,20,16,12,8,4,0);
+ data = bitswap<32>(data,31,27,23,19,15,11,7,3,30,26,22,18,14,10,6,2,29,25,21,17,13,9,5,1,28,24,20,16,12,8,4,0);
ROM[i] = little_endianize_int32(data);
}
}
@@ -4120,9 +4120,9 @@ DRIVER_INIT_MEMBER(tmnt_state, mia)
int B = A & 0x3ff00;
if ((A & 0x3c000) == 0x3c000)
- B |= BITSWAP8(A,7,6,4,2,1,0,5,3);
+ B |= bitswap<8>(A,7,6,4,2,1,0,5,3);
else
- B |= BITSWAP8(A,6,4,2,1,0,7,5,3);
+ B |= bitswap<8>(A,6,4,2,1,0,7,5,3);
gfxdata[A] = temp[B];
}
diff --git a/src/mame/drivers/toaplan2.cpp b/src/mame/drivers/toaplan2.cpp
index 85c9dcb..11128be 100644
--- a/src/mame/drivers/toaplan2.cpp
+++ b/src/mame/drivers/toaplan2.cpp
@@ -473,10 +473,10 @@ DRIVER_INIT_MEMBER(toaplan2_state,pipibibsbl)
for (int i = 0; i < (0x040000/2); i += 4)
{
- ROM[i+0] = BITSWAP16(ROM[i+0],0x1,0x5,0x6,0x7,0x8,0x2,0x0,0x9,0xe,0xd,0x4,0x3,0xf,0xa,0xb,0xc);
- ROM[i+1] = BITSWAP16(ROM[i+1],0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x0,0x2,0x4,0x6,0x8,0xa,0xc,0xe,0x7);
- ROM[i+2] = BITSWAP16(ROM[i+2],0xc,0xd,0xe,0xf,0x8,0x9,0xa,0xb,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
- ROM[i+3] = BITSWAP16(ROM[i+3],0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
+ ROM[i+0] = bitswap<16>(ROM[i+0],0x1,0x5,0x6,0x7,0x8,0x2,0x0,0x9,0xe,0xd,0x4,0x3,0xf,0xa,0xb,0xc);
+ ROM[i+1] = bitswap<16>(ROM[i+1],0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x0,0x2,0x4,0x6,0x8,0xa,0xc,0xe,0x7);
+ ROM[i+2] = bitswap<16>(ROM[i+2],0xc,0xd,0xe,0xf,0x8,0x9,0xa,0xb,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
+ ROM[i+3] = bitswap<16>(ROM[i+3],0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0x3,0x2,0x1,0x0,0x7,0x6,0x5,0x4);
}
}
diff --git a/src/mame/drivers/toki.cpp b/src/mame/drivers/toki.cpp
index 31e6ccd..5d82724 100644
--- a/src/mame/drivers/toki.cpp
+++ b/src/mame/drivers/toki.cpp
@@ -959,7 +959,7 @@ DRIVER_INIT_MEMBER(toki_state,toki)
memcpy(&buffer[0],ROM,0x20000);
for( i = 0; i < 0x20000; i++ )
{
- ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)];
+ ROM[i] = buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)];
}
}
@@ -1014,7 +1014,7 @@ DRIVER_INIT_MEMBER(toki_state,jujuba)
for (i = 0; i < 0x60000/2; i++)
{
- prgrom[i] = BITSWAP16(prgrom[i],15,12,13,14,
+ prgrom[i] = bitswap<16>(prgrom[i],15,12,13,14,
11,10, 9, 8,
7, 6, 5, 3,
4, 2, 1, 0);
@@ -1029,7 +1029,7 @@ DRIVER_INIT_MEMBER(toki_state,jujuba)
memcpy(&buffer[0],ROM,0x20000);
for( i = 0; i < 0x20000; i++ )
{
- ROM[i] = buffer[BITSWAP24(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)];
+ ROM[i] = buffer[bitswap<24>(i,23,22,21,20,19,18,17,16,13,14,15,12,11,10,9,8,7,6,5,4,3,2,1,0)];
}
}
}
diff --git a/src/mame/drivers/trackfld.cpp b/src/mame/drivers/trackfld.cpp
index 462be54..36cdc4f 100644
--- a/src/mame/drivers/trackfld.cpp
+++ b/src/mame/drivers/trackfld.cpp
@@ -1574,7 +1574,7 @@ DRIVER_INIT_MEMBER(trackfld_state, trackfldnz)
/* decrypt program rom */
for (i = 0x6000; i < 0x10000; i++)
- ROM[i] = BITSWAP8(ROM[i], 6, 7, 5, 4, 3, 2, 1, 0);
+ ROM[i] = bitswap<8>(ROM[i], 6, 7, 5, 4, 3, 2, 1, 0);
}
DRIVER_INIT_MEMBER(trackfld_state,atlantol)
@@ -1627,13 +1627,13 @@ DRIVER_INIT_MEMBER(trackfld_state,wizzquiz)
/* decrypt program rom */
for (i = 0; i < 0x2000; i++)
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
ROM = memregion("user1")->base();
/* decrypt questions roms */
for (i = 0; i < 0x40000; i++)
- ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7);
+ ROM[i] = bitswap<8>(ROM[i],0,1,2,3,4,5,6,7);
membank("bank1")->configure_entries(0, 8, ROM, 0x8000);
}
diff --git a/src/mame/drivers/travrusa.cpp b/src/mame/drivers/travrusa.cpp
index 19f2bd3..cb068c2 100644
--- a/src/mame/drivers/travrusa.cpp
+++ b/src/mame/drivers/travrusa.cpp
@@ -587,8 +587,8 @@ DRIVER_INIT_MEMBER(travrusa_state,motorace)
/* The first CPU ROM has the address and data lines scrambled */
for (A = 0; A < 0x2000; A++)
{
- j = BITSWAP16(A,15,14,13,9,7,5,3,1,12,10,8,6,4,2,0,11);
- rom[j] = BITSWAP8(buffer[A],2,7,4,1,6,3,0,5);
+ j = bitswap<16>(A,15,14,13,9,7,5,3,1,12,10,8,6,4,2,0,11);
+ rom[j] = bitswap<8>(buffer[A],2,7,4,1,6,3,0,5);
}
}
@@ -599,7 +599,7 @@ DRIVER_INIT_MEMBER(travrusa_state,shtridra)
/* D3/D4 and D5/D6 swapped */
for (A = 0; A < 0x2000; A++)
- rom[A] = BITSWAP8(rom[A],7,5,6,3,4,2,1,0);
+ rom[A] = bitswap<8>(rom[A],7,5,6,3,4,2,1,0);
}
READ8_MEMBER(travrusa_state::shtridrb_port11_r)
diff --git a/src/mame/drivers/tsispch.cpp b/src/mame/drivers/tsispch.cpp
index d118f93..ac131b6 100644
--- a/src/mame/drivers/tsispch.cpp
+++ b/src/mame/drivers/tsispch.cpp
@@ -270,19 +270,19 @@ DRIVER_INIT_MEMBER(tsispch_state,prose2k)
uint16_t byte23t;
for (int i = 0; i < 0x600; i+= 3)
{
- byte1t = BITSWAP8(dspsrc[0+i], 0, 1, 2, 3, 4, 5, 6, 7);
+ byte1t = bitswap<8>(dspsrc[0+i], 0, 1, 2, 3, 4, 5, 6, 7);
// here's where things get disgusting: if the first byte was an OP or RT, do the following:
if ((byte1t&0x80) == 0x00) // op or rt instruction
{
- byte23t = BITSWAP16( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 15, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7);
+ byte23t = bitswap<16>( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 15, 11, 12, 13, 14, 0, 1, 2, 3, 4, 5, 6, 7);
}
else if ((byte1t&0xC0) == 0x80) // jp instruction
{
- byte23t = BITSWAP16( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 15, 15, 15, 10, 11, 12, 13, 14, 0, 1, 2, 3, 6, 7);
+ byte23t = bitswap<16>( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 15, 15, 15, 10, 11, 12, 13, 14, 0, 1, 2, 3, 6, 7);
}
else // ld instruction
{
- byte23t = BITSWAP16( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 3, 4, 5, 6, 7);
+ byte23t = bitswap<16>( (((uint16_t)dspsrc[1+i]<<8)|dspsrc[2+i]), 8, 9, 10, 11, 12, 13, 14, 0, 1, 2, 3, 3, 4, 5, 6, 7);
}
*dspprg = byte1t<<24 | byte23t<<8;
diff --git a/src/mame/drivers/twins.cpp b/src/mame/drivers/twins.cpp
index 2f8dc45..66d9656 100644
--- a/src/mame/drivers/twins.cpp
+++ b/src/mame/drivers/twins.cpp
@@ -154,13 +154,13 @@ WRITE16_MEMBER(twins_state::twins_pal_w)
dat = m_paletteram[m_paloff];
r = dat & 0x1f;
- r = BITSWAP8(r,7,6,5,0,1,2,3,4);
+ r = bitswap<8>(r,7,6,5,0,1,2,3,4);
g = (dat>>5) & 0x1f;
- g = BITSWAP8(g,7,6,5,0,1,2,3,4);
+ g = bitswap<8>(g,7,6,5,0,1,2,3,4);
b = (dat>>10) & 0x1f;
- b = BITSWAP8(b,7,6,5,0,1,2,3,4);
+ b = bitswap<8>(b,7,6,5,0,1,2,3,4);
m_palette->set_pen_color(m_paloff, pal5bit(r),pal5bit(g),pal5bit(b));
diff --git a/src/mame/drivers/vaportra.cpp b/src/mame/drivers/vaportra.cpp
index 97b5452..2fee7ce 100644
--- a/src/mame/drivers/vaportra.cpp
+++ b/src/mame/drivers/vaportra.cpp
@@ -864,7 +864,7 @@ DRIVER_INIT_MEMBER(vaportra_state,vaportra)
uint8_t *RAM = memregion("maincpu")->base();
for (int i = 0x00000; i < 0x80000; i++)
- RAM[i] = BITSWAP8(RAM[i],0,6,5,4,3,2,1,7);
+ RAM[i] = bitswap<8>(RAM[i],0,6,5,4,3,2,1,7);
}
/******************************************************************************/
diff --git a/src/mame/drivers/vboy.cpp b/src/mame/drivers/vboy.cpp
index de76017..3aabbda 100644
--- a/src/mame/drivers/vboy.cpp
+++ b/src/mame/drivers/vboy.cpp
@@ -62,7 +62,7 @@
m_font[((woffs) + 0x4000)] = dat; /* normal */ \
m_font[((woffs) + 0x8000) ^ 7] = dat; /* flip y */ \
m_font[((woffs) + 0xc000) ^ 7] = dat; /* flip y */ \
- dat = BITSWAP16(dat,1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14); \
+ dat = bitswap<16>(dat,1,0,3,2,5,4,7,6,9,8,11,10,13,12,15,14); \
m_font[((woffs) + 0x10000)] = dat; /* flip x */ \
m_font[((woffs) + 0x14000)] = dat; /* flip x */ \
m_font[((woffs) + 0x18000) ^ 7] = dat; /* flip x+y */ \
diff --git a/src/mame/drivers/vcs80.cpp b/src/mame/drivers/vcs80.cpp
index 2fbbcf7..701887f 100644
--- a/src/mame/drivers/vcs80.cpp
+++ b/src/mame/drivers/vcs80.cpp
@@ -178,7 +178,7 @@ WRITE8_MEMBER( vcs80_state::pio_pb_w )
*/
- uint8_t led_data = BITSWAP8(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0);
+ uint8_t led_data = bitswap<8>(data & 0x7f, 7, 5, 6, 4, 3, 2, 1, 0);
int digit = m_keylatch;
/* skip middle digit */
diff --git a/src/mame/drivers/vega.cpp b/src/mame/drivers/vega.cpp
index 5f0b3bd..fe0fa32 100644
--- a/src/mame/drivers/vega.cpp
+++ b/src/mame/drivers/vega.cpp
@@ -506,7 +506,7 @@ void vega_state::draw_tilemap(screen_device& screen, bitmap_ind16& bitmap, const
int flip=BIT(id,5);
- int num=(BITSWAP8( ((id>>2) &7), 7,6,5,4,3,0,1,2 ));
+ int num=(bitswap<8>( ((id>>2) &7), 7,6,5,4,3,0,1,2 ));
int bank=id&3;
@@ -556,7 +556,7 @@ uint32_t vega_state::screen_update_vega(screen_device &screen, bitmap_ind16 &bit
for(x=0;x<40;++x)
{
int character=m_txt_ram[idx];
- //int color=BITSWAP8(color_lookup[character],7,6,5,4,0,1,2,3)>>1;
+ //int color=bitswap<8>(color_lookup[character],7,6,5,4,0,1,2,3)>>1;
int color=color_lookup[character]&0xf;
/*
bit 0 - unknown
@@ -565,7 +565,7 @@ uint32_t vega_state::screen_update_vega(screen_device &screen, bitmap_ind16 &bit
bit 3 - red
*/
- color=BITSWAP8(color,7,6,5,4,0,1,2,3)&0x7;
+ color=bitswap<8>(color,7,6,5,4,0,1,2,3)&0x7;
color^=0xf;
diff --git a/src/mame/drivers/vt240.cpp b/src/mame/drivers/vt240.cpp
index 6e088ea..c9f5e21 100644
--- a/src/mame/drivers/vt240.cpp
+++ b/src/mame/drivers/vt240.cpp
@@ -338,7 +338,7 @@ READ8_MEMBER(vt240_state::char_buf_r)
WRITE8_MEMBER(vt240_state::char_buf_w)
{
- m_char_buf[m_char_idx++] = BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_char_buf[m_char_idx++] = bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
m_char_idx &= 0xf;
}
@@ -370,7 +370,7 @@ WRITE8_MEMBER(vt240_state::vom_w)
if(!BIT(m_reg0, 2))
{
m_vom[offset] = data;
- data = ~BITSWAP8(data, 1, 0, 3, 2, 5, 4, 7, 6);
+ data = ~bitswap<8>(data, 1, 0, 3, 2, 5, 4, 7, 6);
m_palette->set_pen_color(offset, pal2bit(data >> 6), pal2bit(data >> 6), pal2bit(data >> 6));
m_palette->set_pen_color((offset + 16), pal2bit(data >> 0), pal2bit(data >> 2), pal2bit(data >> 4));
}
@@ -410,7 +410,7 @@ WRITE16_MEMBER(vt240_state::vram_w)
{
if(BIT(m_reg0, 6))
{
- chr = BITSWAP8(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx);
+ chr = bitswap<8>(m_vpat, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx, m_patidx);
if(m_patcnt-- == 0)
{
m_patcnt = m_patmult;
@@ -494,7 +494,7 @@ WRITE16_MEMBER(vt240_state::vram_w)
WRITE8_MEMBER(vt240_state::mask_w)
{
- m_mask = BITSWAP8(data, 0, 1, 2, 3, 4, 5, 6, 7);
+ m_mask = bitswap<8>(data, 0, 1, 2, 3, 4, 5, 6, 7);
}
READ8_MEMBER(vt240_state::nvr_store_r)
diff --git a/src/mame/drivers/wallc.cpp b/src/mame/drivers/wallc.cpp
index 99576cc..7aadaba 100644
--- a/src/mame/drivers/wallc.cpp
+++ b/src/mame/drivers/wallc.cpp
@@ -438,7 +438,7 @@ DRIVER_INIT_MEMBER(wallc_state, wallc)
for (i=0; i<0x2000*2; i++)
{
c = ROM[ i ] ^ 0x55 ^ 0xff; /* NOTE: this can be shortened but now it fully reflects what the bigger module really does */
- c = BITSWAP8(c, 4,2,6,0,7,1,3,5); /* also swapped inside of the bigger module */
+ c = bitswap<8>(c, 4,2,6,0,7,1,3,5); /* also swapped inside of the bigger module */
ROM[ i ] = c;
}
}
@@ -455,12 +455,12 @@ DRIVER_INIT_MEMBER(wallc_state, wallca)
if(i & 0x100)
{
c = ROM[ i ] ^ 0x4a;
- c = BITSWAP8(c, 4,7,1,3,2,0,5,6);
+ c = bitswap<8>(c, 4,7,1,3,2,0,5,6);
}
else
{
c = ROM[ i ] ^ 0xa5;
- c = BITSWAP8(c, 0,2,3,6,1,5,7,4);
+ c = bitswap<8>(c, 0,2,3,6,1,5,7,4);
}
ROM[ i ] = c;
diff --git a/src/mame/drivers/wecleman.cpp b/src/mame/drivers/wecleman.cpp
index b16c150..46cb033 100644
--- a/src/mame/drivers/wecleman.cpp
+++ b/src/mame/drivers/wecleman.cpp
@@ -1386,7 +1386,7 @@ void wecleman_state::bitswap(uint8_t *src,size_t len,int _14,int _13,int _12,int
for (i = 0;i < len;i++)
{
src[i] =
- buffer[BITSWAP24(i,23,22,21,_14,_13,_12,_11,_10,_f,_e,_d,_c,_b,_a,_9,_8,_7,_6,_5,_4,_3,_2,_1,_0)];
+ buffer[::bitswap<24>(i,23,22,21,_14,_13,_12,_11,_10,_f,_e,_d,_c,_b,_a,_9,_8,_7,_6,_5,_4,_3,_2,_1,_0)];
}
}
@@ -1412,7 +1412,7 @@ DRIVER_INIT_MEMBER(wecleman_state,wecleman)
/* TODO: could be wrong, colors have to be fixed. */
/* The only certain thing is that 87 must convert to f0 */
/* otherwise stray lines appear, made of pens 7 & 8 */
- RAM[i] = BITSWAP8(RAM[i],7,0,1,2,3,4,5,6);
+ RAM[i] = ::bitswap<8>(RAM[i],7,0,1,2,3,4,5,6);
}
bitswap(memregion("gfx1")->base(), memregion("gfx1")->bytes(),
diff --git a/src/mame/drivers/wico.cpp b/src/mame/drivers/wico.cpp
index 98f66c2..b7362ed 100644
--- a/src/mame/drivers/wico.cpp
+++ b/src/mame/drivers/wico.cpp
@@ -385,7 +385,7 @@ READ8_MEMBER( wico_state::lampst_r )
j = m_shared_ram[0x7f9 + i];
else
j = 0;
- output().set_digit_value(i * 10 + (m_shared_ram[0x96] & 7), BITSWAP16(j, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(i * 10 + (m_shared_ram[0x96] & 7), bitswap<16>(j, 8, 8, 8, 8, 8, 8, 7, 7, 6, 6, 5, 4, 3, 2, 1, 0));
}
return 0xff;
}
diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp
index 9f56fc9..4e5bcd7 100644
--- a/src/mame/drivers/williams.cpp
+++ b/src/mame/drivers/williams.cpp
@@ -3047,7 +3047,7 @@ DRIVER_INIT_MEMBER(williams_state,defndjeu)
/* apply simple decryption by swapping bits 0 and 7 */
for (i = 0xd000; i < 0x19000; i++)
- rom[i] = BITSWAP8(rom[i],0,6,5,4,3,2,1,7);
+ rom[i] = bitswap<8>(rom[i],0,6,5,4,3,2,1,7);
}
diff --git a/src/mame/drivers/wink.cpp b/src/mame/drivers/wink.cpp
index 6ea8c59..af611eb 100644
--- a/src/mame/drivers/wink.cpp
+++ b/src/mame/drivers/wink.cpp
@@ -437,19 +437,19 @@ DRIVER_INIT_MEMBER(wink_state,wink)
memcpy(&buffer[0],ROM,0x8000);
for (i = 0x0000; i <= 0x1fff; i++)
- ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];
+ ROM[i] = buffer[bitswap<16>(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];
for (i = 0x2000; i <= 0x3fff; i++)
- ROM[i] = buffer[BITSWAP16(i,15,14,13, 10, 7,12, 9, 8,11, 6, 3, 1, 5, 2, 4, 0)];
+ ROM[i] = buffer[bitswap<16>(i,15,14,13, 10, 7,12, 9, 8,11, 6, 3, 1, 5, 2, 4, 0)];
for (i = 0x4000; i <= 0x5fff; i++)
- ROM[i] = buffer[BITSWAP16(i,15,14,13, 7,10,11, 9, 8,12, 6, 1, 3, 4, 2, 5, 0)];
+ ROM[i] = buffer[bitswap<16>(i,15,14,13, 7,10,11, 9, 8,12, 6, 1, 3, 4, 2, 5, 0)];
for (i = 0x6000; i <= 0x7fff; i++)
- ROM[i] = buffer[BITSWAP16(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];
+ ROM[i] = buffer[bitswap<16>(i,15,14,13, 11,12, 7, 9, 8,10, 6, 4, 5, 1, 2, 3, 0)];
for (i = 0; i < 0x8000; i++)
- ROM[i] += BITSWAP8(i & 0xff, 7,5,3,1,6,4,2,0);
+ ROM[i] += bitswap<8>(i & 0xff, 7,5,3,1,6,4,2,0);
}
GAME( 1985, wink, 0, wink, wink, wink_state, wink, ROT0, "Midcoin", "Wink (set 1)", MACHINE_IMPERFECT_SOUND | MACHINE_UNEMULATED_PROTECTION | MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/wiz.cpp b/src/mame/drivers/wiz.cpp
index 9cb19c8..256b9bb 100644
--- a/src/mame/drivers/wiz.cpp
+++ b/src/mame/drivers/wiz.cpp
@@ -1155,7 +1155,7 @@ DRIVER_INIT_MEMBER(wiz_state,stinger)
/* decode the opcodes */
tbl = swap_xor_table[row];
- m_decrypted_opcodes[a] = BITSWAP8(src, tbl[0], 6, tbl[1], 4, tbl[2], 2, 1, 0) ^ tbl[3];
+ m_decrypted_opcodes[a] = bitswap<8>(src, tbl[0], 6, tbl[1], 4, tbl[2], 2, 1, 0) ^ tbl[3];
}
}
}
diff --git a/src/mame/drivers/wpc_an.cpp b/src/mame/drivers/wpc_an.cpp
index 9af1417..3d2475b 100644
--- a/src/mame/drivers/wpc_an.cpp
+++ b/src/mame/drivers/wpc_an.cpp
@@ -199,8 +199,8 @@ void wpc_an_state::device_timer(emu_timer &timer, device_timer_id id, int param,
// update LED segments
for(x=0;x<16;x++)
{
- output().set_digit_value(x,BITSWAP16(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
- output().set_digit_value(x+16,BITSWAP16(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(x,bitswap<16>(m_wpc->get_alphanumeric(x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
+ output().set_digit_value(x+16,bitswap<16>(m_wpc->get_alphanumeric(20+x), 15, 7, 12, 10, 8, 14, 13, 9, 11, 6, 5, 4, 3, 2, 1, 0));
}
m_wpc->reset_alphanumeric();
m_vblank_count++;
diff --git a/src/mame/drivers/z100.cpp b/src/mame/drivers/z100.cpp
index 5042eea..622fe87 100644
--- a/src/mame/drivers/z100.cpp
+++ b/src/mame/drivers/z100.cpp
@@ -616,9 +616,9 @@ WRITE8_MEMBER( z100_state::video_pia_A_w )
*/
m_vram_enable = ((data & 0x80) >> 7) ^ 1;
- m_gbank = BITSWAP8(((data & 0x70) >> 4) ^ 0x7,7,6,5,4,3,1,0,2);
+ m_gbank = bitswap<8>(((data & 0x70) >> 4) ^ 0x7,7,6,5,4,3,1,0,2);
m_flash = ((data & 8) >> 3) ^ 1;
- m_display_mask = BITSWAP8((data & 7) ^ 7,7,6,5,4,3,1,0,2);
+ m_display_mask = bitswap<8>((data & 7) ^ 7,7,6,5,4,3,1,0,2);
}
WRITE8_MEMBER( z100_state::video_pia_B_w )
diff --git a/src/mame/drivers/zapcomputer.cpp b/src/mame/drivers/zapcomputer.cpp
index 455531b..4987095 100644
--- a/src/mame/drivers/zapcomputer.cpp
+++ b/src/mame/drivers/zapcomputer.cpp
@@ -63,7 +63,7 @@ uint8_t zapcomp_state::decode7seg(uint8_t data)
// Bit order for the FAIRCHILD FND-70
// 7-SEGMENT LCD: . g f e d c b a
- return BITSWAP8(patterns[data & 0x0F], 7, 3, 4, 2, 1, 0, 6, 5);
+ return bitswap<8>(patterns[data & 0x0F], 7, 3, 4, 2, 1, 0, 6, 5);
}
WRITE8_MEMBER( zapcomp_state::display_7seg_w )
diff --git a/src/mame/etc/fd1094dp.cpp b/src/mame/etc/fd1094dp.cpp
index 34074d7..ffaf2e1 100644
--- a/src/mame/etc/fd1094dp.cpp
+++ b/src/mame/etc/fd1094dp.cpp
@@ -21,7 +21,7 @@ char srcpath[250],dstfilename[250];
#define BIT(x,n) (((x)>>(n))&1)
-#define BITSWAP16(val,B15,B14,B13,B12,B11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0) \
+#define bitswap<16>(val,B15,B14,B13,B12,B11,B10,B9,B8,B7,B6,B5,B4,B3,B2,B1,B0) \
((BIT(val,B15) << 15) | \
(BIT(val,B14) << 14) | \
(BIT(val,B13) << 13) | \
@@ -265,7 +265,7 @@ static int parametric_decode(int val,int mainkey,int key_F,int gkey1,int gkey2,i
if ((val & 0xe000) == 0x0000)
- val = BITSWAP16(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ val = bitswap<16>(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
else
{
if (val & 0x8000)
@@ -274,9 +274,9 @@ static int parametric_decode(int val,int mainkey,int key_F,int gkey1,int gkey2,i
if (~val & 0x0004) val ^= 0x0022; // 5,1
if (!key_1b) if (~val & 0x1000) val ^= 0x0848; // 11,6,3
if (!global_swap2) if (!key_0c) val ^= 0x4101; // 14,8,0
- if (!key_2b) val = BITSWAP16(val, 15,14,13, 9,11,10,12, 8, 2, 6, 5, 4, 3, 7, 1, 0); // 12,9,7,2
+ if (!key_2b) val = bitswap<16>(val, 15,14,13, 9,11,10,12, 8, 2, 6, 5, 4, 3, 7, 1, 0); // 12,9,7,2
- val = 0x6561 ^ BITSWAP16(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
+ val = 0x6561 ^ bitswap<16>(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
}
if (val & 0x4000)
{
@@ -284,9 +284,9 @@ static int parametric_decode(int val,int mainkey,int key_F,int gkey1,int gkey2,i
if (!key_3a) if (val & 0x0004) val ^= 0x0202; // 9,1
if (!key_6a) if (val & 0x0400) val ^= 0x0004; // 2
if (!key_5b) if (!key_0b) val ^= 0x08a1; // 11,7,5,0
- if (!global_swap0b) val = BITSWAP16(val, 15,14,10,12,11,13, 9, 4, 7, 6, 5, 8, 3, 2, 1, 0); // 13,10,8,4
+ if (!global_swap0b) val = bitswap<16>(val, 15,14,10,12,11,13, 9, 4, 7, 6, 5, 8, 3, 2, 1, 0); // 13,10,8,4
- val = 0x3523 ^ BITSWAP16(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
+ val = 0x3523 ^ bitswap<16>(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
}
if (val & 0x2000)
{
@@ -295,22 +295,22 @@ static int parametric_decode(int val,int mainkey,int key_F,int gkey1,int gkey2,i
if (!key_7a) if (val & 0x0001) val ^= 0x110a; // 12,8,3,1
if (!key_4b) if (!key_0a) val ^= 0x0040; // 6
if (!global_swap0a) if (!key_6b) val ^= 0x0404; // 10,2
- if (!key_5b) val = BITSWAP16(val, 0,14,13,12,15,10, 9, 8, 7, 6,11, 4, 3, 2, 1, 5); // 15,11,5,0
+ if (!key_5b) val = bitswap<16>(val, 0,14,13,12,15,10, 9, 8, 7, 6,11, 4, 3, 2, 1, 5); // 15,11,5,0
- val = 0x99a5 ^ BITSWAP16(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
+ val = 0x99a5 ^ bitswap<16>(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
}
- val = 0x87ff ^ BITSWAP16(val, 5,15,13,14, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
+ val = 0x87ff ^ bitswap<16>(val, 5,15,13,14, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
- if (!global_swap4) val = BITSWAP16(val, 6,14,13,12,11,10, 9, 5, 7,15, 8, 4, 3, 2, 1, 0); // 15-6, 8-5
- if (!global_swap3) val = BITSWAP16(val, 15,12,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 12-13-14
- if (!global_swap2) val = BITSWAP16(val, 15,14,13,12,11, 2, 9, 8,10, 6, 5, 4, 3, 0, 1, 7); // 10-2-0-7
- if (!key_3b) val = BITSWAP16(val, 15,14,13,12,11,10, 4, 8, 7, 6, 5, 9, 1, 2, 3, 0); // 9-4, 3-1
+ if (!global_swap4) val = bitswap<16>(val, 6,14,13,12,11,10, 9, 5, 7,15, 8, 4, 3, 2, 1, 0); // 15-6, 8-5
+ if (!global_swap3) val = bitswap<16>(val, 15,12,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 12-13-14
+ if (!global_swap2) val = bitswap<16>(val, 15,14,13,12,11, 2, 9, 8,10, 6, 5, 4, 3, 0, 1, 7); // 10-2-0-7
+ if (!key_3b) val = bitswap<16>(val, 15,14,13,12,11,10, 4, 8, 7, 6, 5, 9, 1, 2, 3, 0); // 9-4, 3-1
- if (!key_2a) val = BITSWAP16(val, 15,12,13,14,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 14-12
- if (!global_swap1) val = BITSWAP16(val, 15,14,13,12, 9, 8,11,10, 7, 6, 5, 4, 3, 2, 1, 0); // 11...8
- if (!key_5a) val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 4, 5, 7, 6, 3, 2, 1, 0); // 7...4
- if (!global_swap0a) val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 0, 3, 2, 1); // 3...0
+ if (!key_2a) val = bitswap<16>(val, 15,12,13,14,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 14-12
+ if (!global_swap1) val = bitswap<16>(val, 15,14,13,12, 9, 8,11,10, 7, 6, 5, 4, 3, 2, 1, 0); // 11...8
+ if (!key_5a) val = bitswap<16>(val, 15,14,13,12,11,10, 9, 8, 4, 5, 7, 6, 3, 2, 1, 0); // 7...4
+ if (!global_swap0a) val = bitswap<16>(val, 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 0, 3, 2, 1); // 3...0
}
return final_decrypt(val,key_F);
diff --git a/src/mame/machine/315-5881_crypt.cpp b/src/mame/machine/315-5881_crypt.cpp
index 275c561..2d3144a 100644
--- a/src/mame/machine/315-5881_crypt.cpp
+++ b/src/mame/machine/315-5881_crypt.cpp
@@ -617,7 +617,7 @@ uint16_t sega_315_5881_crypt_device::block_decrypt(uint32_t game_key, uint16_t s
// First Feistel Network
- aux = BITSWAP16(counter, 5, 12, 14, 13, 9, 3, 6, 4, 8, 1, 15, 11, 0, 7, 10, 2);
+ aux = bitswap<16>(counter, 5, 12, 14, 13, 9, 3, 6, 4, 8, 1, 15, 11, 0, 7, 10, 2);
// 1st round
B = aux >> 8;
@@ -647,7 +647,7 @@ uint16_t sega_315_5881_crypt_device::block_decrypt(uint32_t game_key, uint16_t s
// Second Feistel Network
- aux = BITSWAP16(data, 14, 3, 8, 12, 13, 7, 15, 4, 6, 2, 9, 5, 11, 0, 1, 10);
+ aux = bitswap<16>(data, 14, 3, 8, 12, 13, 7, 15, 4, 6, 2, 9, 5, 11, 0, 1, 10);
// 1st round
B = aux >> 8;
@@ -664,7 +664,7 @@ uint16_t sega_315_5881_crypt_device::block_decrypt(uint32_t game_key, uint16_t s
aux = (B << 8) | A;
- aux = BITSWAP16(aux, 15, 7, 6, 14, 13, 12, 5, 4, 3, 2, 11, 10, 9, 1, 0, 8);
+ aux = bitswap<16>(aux, 15, 7, 6, 14, 13, 12, 5, 4, 3, 2, 11, 10, 9, 1, 0, 8);
return aux;
}
diff --git a/src/mame/machine/awboard.cpp b/src/mame/machine/awboard.cpp
index ddc49a3..e03f11d 100644
--- a/src/mame/machine/awboard.cpp
+++ b/src/mame/machine/awboard.cpp
@@ -241,10 +241,10 @@ uint16_t aw_rom_board::decrypt(uint16_t cipherText, uint32_t address, const uint
const int* pbox = permutation_table[key>>18];
const sbox_set* ss = &sboxes_table[(key>>16)&3];
- aux = BITSWAP16(cipherText,
+ aux = bitswap<16>(cipherText,
pbox[15],pbox[14],pbox[13],pbox[12],pbox[11],pbox[10],pbox[9],pbox[8],
pbox[7],pbox[6],pbox[5],pbox[4],pbox[3],pbox[2],pbox[1],pbox[0]);
- aux = aux ^ BITSWAP16(address, 13,5,2, 14,10,9,4, 15,11,6,1, 12,8,7,3,0);
+ aux = aux ^ bitswap<16>(address, 13,5,2, 14,10,9,4, 15,11,6,1, 12,8,7,3,0);
b0 = aux&0x1f;
b1 = (aux>>5)&0xf;
diff --git a/src/mame/machine/bfm_bd1.cpp b/src/mame/machine/bfm_bd1.cpp
index b9abdaa..10d1861 100644
--- a/src/mame/machine/bfm_bd1.cpp
+++ b/src/mame/machine/bfm_bd1.cpp
@@ -164,7 +164,7 @@ void bfm_bd1_device::device_reset()
uint16_t bfm_bd1_device::set_display(uint16_t segin)
{
- return BITSWAP16(segin,8,12,11,7,6,4,10,3,14,15,0,13,9,5,1,2);
+ return bitswap<16>(segin,8,12,11,7,6,4,10,3,14,15,0,13,9,5,1,2);
}
void bfm_bd1_device::device_post_load()
diff --git a/src/mame/machine/bfm_bda.cpp b/src/mame/machine/bfm_bda.cpp
index 263db3a..6d2794b 100644
--- a/src/mame/machine/bfm_bda.cpp
+++ b/src/mame/machine/bfm_bda.cpp
@@ -146,7 +146,7 @@ void bfm_bda_device::device_reset()
uint16_t bfm_bda_device::set_display(uint16_t segin)
{
- return BITSWAP16(segin,8,12,11,7,6,4,10,3,14,15,0,13,9,5,1,2);
+ return bitswap<16>(segin,8,12,11,7,6,4,10,3,14,15,0,13,9,5,1,2);
}
void bfm_bda_device::device_post_load()
diff --git a/src/mame/machine/cps2crypt.cpp b/src/mame/machine/cps2crypt.cpp
index ceccdea..96d94a2 100644
--- a/src/mame/machine/cps2crypt.cpp
+++ b/src/mame/machine/cps2crypt.cpp
@@ -557,8 +557,8 @@ static uint16_t feistel(uint16_t val, const int *bitsA, const int *bitsB,
const struct optimised_sbox* boxes1, const struct optimised_sbox* boxes2, const struct optimised_sbox* boxes3, const struct optimised_sbox* boxes4,
uint32_t key1, uint32_t key2, uint32_t key3, uint32_t key4)
{
- uint8_t l = BITSWAP8(val, bitsB[7],bitsB[6],bitsB[5],bitsB[4],bitsB[3],bitsB[2],bitsB[1],bitsB[0]);
- uint8_t r = BITSWAP8(val, bitsA[7],bitsA[6],bitsA[5],bitsA[4],bitsA[3],bitsA[2],bitsA[1],bitsA[0]);
+ uint8_t l = bitswap<8>(val, bitsB[7],bitsB[6],bitsB[5],bitsB[4],bitsB[3],bitsB[2],bitsB[1],bitsB[0]);
+ uint8_t r = bitswap<8>(val, bitsA[7],bitsA[6],bitsA[5],bitsA[4],bitsA[3],bitsA[2],bitsA[1],bitsA[0]);
l ^= fn(r, boxes1, key1);
r ^= fn(l, boxes2, key2);
diff --git a/src/mame/machine/deco102.cpp b/src/mame/machine/deco102.cpp
index 210ee3f..0c643c5 100644
--- a/src/mame/machine/deco102.cpp
+++ b/src/mame/machine/deco102.cpp
@@ -44,7 +44,7 @@ static uint16_t decrypt(uint16_t data, int address, int select_xor)
xorval = xors[j];
// decrypt
- return xorval ^ BITSWAP16(data,
+ return xorval ^ bitswap<16>(data,
bs[0],bs[1],bs[2],bs[3],bs[4],bs[5],bs[6],bs[7],
bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]);
}
diff --git a/src/mame/machine/deco146.cpp b/src/mame/machine/deco146.cpp
index 05bc061..fd15795 100644
--- a/src/mame/machine/deco146.cpp
+++ b/src/mame/machine/deco146.cpp
@@ -1142,7 +1142,7 @@ inline uint16_t reorder(uint16_t input, uint8_t const *weights)
void deco_146_base_device::write_data(address_space &space, uint16_t address, uint16_t data, uint16_t mem_mask, uint8_t &csflags)
{
- address = BITSWAP16(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
+ address = bitswap<16>(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
csflags = 0;
int upper_addr_bits = (address & 0x7800) >> 11;
@@ -1268,7 +1268,7 @@ void deco_146_base_device::write_protport(address_space &space, uint16_t address
uint16_t deco_146_base_device::read_data(uint16_t address, uint16_t mem_mask, uint8_t &csflags)
{
- address = BITSWAP16(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
+ address = bitswap<16>(address>>1, 15,14,13,12,11,10, m_external_addrswap[9],m_external_addrswap[8] ,m_external_addrswap[7],m_external_addrswap[6],m_external_addrswap[5],m_external_addrswap[4],m_external_addrswap[3],m_external_addrswap[2],m_external_addrswap[1],m_external_addrswap[0]) << 1;
uint16_t retdata = 0;
csflags = 0;
diff --git a/src/mame/machine/deco156.cpp b/src/mame/machine/deco156.cpp
index 3258c55..d763611 100644
--- a/src/mame/machine/deco156.cpp
+++ b/src/mame/machine/deco156.cpp
@@ -87,7 +87,7 @@ static void decrypt(uint32_t *src, uint32_t *dst, int length)
switch (a & 3)
{
case 0:
- dword = BITSWAP32( dword ^ 0xec63197a,
+ dword = bitswap<32>( dword ^ 0xec63197a,
1, 4, 7, 28, 22, 18, 20, 9,
16, 10, 30, 2, 31, 24, 19, 29,
6, 21, 23, 11, 12, 13, 5, 0,
@@ -95,7 +95,7 @@ static void decrypt(uint32_t *src, uint32_t *dst, int length)
break;
case 1:
- dword = BITSWAP32( dword ^ 0x58a5a55f,
+ dword = bitswap<32>( dword ^ 0x58a5a55f,
14, 23, 28, 29, 6, 24, 10, 1,
5, 16, 7, 2, 30, 8, 18, 3,
31, 22, 25, 20, 17, 0, 19, 27,
@@ -103,7 +103,7 @@ static void decrypt(uint32_t *src, uint32_t *dst, int length)
break;
case 2:
- dword = BITSWAP32( dword ^ 0xe3a65f16,
+ dword = bitswap<32>( dword ^ 0xe3a65f16,
19, 30, 21, 4, 2, 18, 15, 1,
12, 25, 8, 0, 24, 20, 17, 23,
22, 26, 28, 16, 9, 27, 6, 11,
@@ -111,7 +111,7 @@ static void decrypt(uint32_t *src, uint32_t *dst, int length)
break;
case 3:
- dword = BITSWAP32( dword ^ 0x28d93783,
+ dword = bitswap<32>( dword ^ 0x28d93783,
30, 6, 15, 0, 31, 18, 26, 22,
14, 23, 19, 17, 10, 8, 11, 20,
1, 28, 2, 4, 9, 24, 25, 27,
diff --git a/src/mame/machine/deco222.cpp b/src/mame/machine/deco222.cpp
index 5be4df0..1371f80 100644
--- a/src/mame/machine/deco222.cpp
+++ b/src/mame/machine/deco222.cpp
@@ -31,7 +31,7 @@ void deco_222_device::device_reset()
uint8_t deco_222_device::mi_decrypt::read_sync(uint16_t adr)
{
- return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
+ return bitswap<8>(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
}
util::disasm_interface *deco_222_device::create_disassembler()
@@ -46,7 +46,7 @@ u32 deco_222_device::disassembler::interface_flags() const
u8 deco_222_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
{
- return opcode ? BITSWAP8(value,7,5,6,4,3,2,1,0) : value;
+ return opcode ? bitswap<8>(value,7,5,6,4,3,2,1,0) : value;
}
deco_c10707_device::deco_c10707_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
@@ -68,7 +68,7 @@ void deco_c10707_device::device_reset()
uint8_t deco_c10707_device::mi_decrypt::read_sync(uint16_t adr)
{
- return BITSWAP8(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
+ return bitswap<8>(direct->read_byte(adr) ,7,5,6,4,3,2,1,0);
}
util::disasm_interface *deco_c10707_device::create_disassembler()
@@ -83,5 +83,5 @@ u32 deco_c10707_device::disassembler::interface_flags() const
u8 deco_c10707_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
{
- return opcode ? BITSWAP8(value,7,5,6,4,3,2,1,0) : value;
+ return opcode ? bitswap<8>(value,7,5,6,4,3,2,1,0) : value;
}
diff --git a/src/mame/machine/decocpu6.cpp b/src/mame/machine/decocpu6.cpp
index 9e068e7..f583887 100644
--- a/src/mame/machine/decocpu6.cpp
+++ b/src/mame/machine/decocpu6.cpp
@@ -31,7 +31,7 @@ void deco_cpu6_device::device_reset()
uint8_t deco_cpu6_device::mi_decrypt::read_sync(uint16_t adr)
{
if (adr&1)
- return BITSWAP8(direct->read_byte(adr),6,4,7,5,3,2,1,0);
+ return bitswap<8>(direct->read_byte(adr),6,4,7,5,3,2,1,0);
else
return direct->read_byte(adr);
}
@@ -48,5 +48,5 @@ u32 deco_cpu6_device::disassembler::interface_flags() const
u8 deco_cpu6_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
{
- return opcode && (pc & 1) ? BITSWAP8(value,6,4,7,5,3,2,1,0) : value;
+ return opcode && (pc & 1) ? bitswap<8>(value,6,4,7,5,3,2,1,0) : value;
}
diff --git a/src/mame/machine/decocpu7.cpp b/src/mame/machine/decocpu7.cpp
index 5014406..dd0031f 100644
--- a/src/mame/machine/decocpu7.cpp
+++ b/src/mame/machine/decocpu7.cpp
@@ -30,7 +30,7 @@ uint8_t deco_cpu7_device::mi_decrypt::read_sync(uint16_t adr)
if(had_written) {
had_written = false;
if((adr & 0x0104) == 0x0104)
- res = BITSWAP8(res, 6,5,3,4,2,7,1,0);
+ res = bitswap<8>(res, 6,5,3,4,2,7,1,0);
}
return res;
}
@@ -57,5 +57,5 @@ u32 deco_cpu7_device::disassembler::interface_flags() const
u8 deco_cpu7_device::disassembler::decrypt8(u8 value, offs_t pc, bool opcode) const
{
- return opcode && mintf->had_written && ((pc & 0x104) == 0x104) ? BITSWAP8(value,6,5,3,4,2,7,1,0) : value;
+ return opcode && mintf->had_written && ((pc & 0x104) == 0x104) ? bitswap<8>(value,6,5,3,4,2,7,1,0) : value;
}
diff --git a/src/mame/machine/decocrpt.cpp b/src/mame/machine/decocrpt.cpp
index dda584c..ad5e212 100644
--- a/src/mame/machine/decocrpt.cpp
+++ b/src/mame/machine/decocrpt.cpp
@@ -622,7 +622,7 @@ static void deco_decrypt(running_machine &machine,const char *rgntag,const uint8
if (remap_only)
rom[i] = buffer[addr];
else
- rom[i] = BITSWAP16(buffer[addr] ^ xor_masks[xor_table[addr & 0x7ff]],
+ rom[i] = bitswap<16>(buffer[addr] ^ xor_masks[xor_table[addr & 0x7ff]],
swap_patterns[pat][0],
swap_patterns[pat][1],
swap_patterns[pat][2],
diff --git a/src/mame/machine/epos.cpp b/src/mame/machine/epos.cpp
index 3ead45d..da7f5f1 100644
--- a/src/mame/machine/epos.cpp
+++ b/src/mame/machine/epos.cpp
@@ -36,7 +36,7 @@ static void epos_decrypt_rom(uint8_t *ROM, uint8_t invert, int offset, int *bs)
{
for (int mem = 0; mem < 0x4000; mem++ )
{
- ROM[mem + offset] = BITSWAP8(ROM[mem] ^ invert, bs[0], bs[1], bs[2], bs[3], bs[4], bs[5], bs[6], bs[7]);
+ ROM[mem + offset] = bitswap<8>(ROM[mem] ^ invert, bs[0], bs[1], bs[2], bs[3], bs[4], bs[5], bs[6], bs[7]);
}
}
diff --git a/src/mame/machine/fd1089.cpp b/src/mame/machine/fd1089.cpp
index e364581..15938db 100644
--- a/src/mame/machine/fd1089.cpp
+++ b/src/mame/machine/fd1089.cpp
@@ -290,10 +290,10 @@ uint8_t fd1089_base_device::rearrange_key(uint8_t table, bool opcode)
if (BIT(table,6))
table ^= (1<<7);
- table = BITSWAP8(table,1,0,6,4,3,5,2,7);
+ table = bitswap<8>(table,1,0,6,4,3,5,2,7);
if (BIT(table,6))
- table = BITSWAP8(table,7,6,2,4,5,3,1,0);
+ table = bitswap<8>(table,7,6,2,4,5,3,1,0);
}
else
{
@@ -307,10 +307,10 @@ uint8_t fd1089_base_device::rearrange_key(uint8_t table, bool opcode)
if (BIT(~table,7))
table ^= (1<<6);
- table = BITSWAP8(table,5,6,7,4,2,3,1,0);
+ table = bitswap<8>(table,5,6,7,4,2,3,1,0);
if (BIT(table,6))
- table = BITSWAP8(table,7,6,5,3,2,4,1,0);
+ table = bitswap<8>(table,7,6,5,3,2,4,1,0);
}
if (BIT(table,6))
@@ -342,7 +342,7 @@ uint8_t fd1089a_device::decode(uint8_t val, uint8_t key, bool opcode)
uint8_t table = rearrange_key(key, opcode);
const decrypt_parameters &p = s_addr_params[table >> 4];
- val = BITSWAP8(val, p.s7,p.s6,p.s5,p.s4,p.s3,p.s2,p.s1,p.s0) ^ p.xorval;
+ val = bitswap<8>(val, p.s7,p.s6,p.s5,p.s4,p.s3,p.s2,p.s1,p.s0) ^ p.xorval;
if (BIT(table,3)) val ^= 0x01;
if (BIT(table,0)) val ^= 0xb1;
@@ -369,20 +369,20 @@ uint8_t fd1089a_device::decode(uint8_t val, uint8_t key, bool opcode)
{
if (BIT(val,0)) val ^= 0xc0;
if (BIT(~val,6) ^ BIT(val,4))
- val = BITSWAP8(val, 7,6,5,4,1,0,2,3);
+ val = bitswap<8>(val, 7,6,5,4,1,0,2,3);
}
else
{
if (BIT(~val,6) ^ BIT(val,4))
- val = BITSWAP8(val, 7,6,5,4,0,1,3,2);
+ val = bitswap<8>(val, 7,6,5,4,0,1,3,2);
}
if (BIT(~val,6))
- val = BITSWAP8(val, 7,6,5,4,2,3,0,1);
+ val = bitswap<8>(val, 7,6,5,4,2,3,0,1);
const decrypt_parameters &q = s_data_params_a[family];
val ^= q.xorval;
- val = BITSWAP8(val, q.s7,q.s6,q.s5,q.s4,q.s3,q.s2,q.s1,q.s0);
+ val = bitswap<8>(val, q.s7,q.s6,q.s5,q.s4,q.s3,q.s2,q.s1,q.s0);
return val;
}
@@ -402,7 +402,7 @@ uint8_t fd1089b_device::decode(uint8_t val, uint8_t key, bool opcode)
uint8_t table = rearrange_key(key, opcode);
const decrypt_parameters &p = s_addr_params[table >> 4];
- val = BITSWAP8(val, p.s7,p.s6,p.s5,p.s4,p.s3,p.s2,p.s1,p.s0) ^ p.xorval;
+ val = bitswap<8>(val, p.s7,p.s6,p.s5,p.s4,p.s3,p.s2,p.s1,p.s0) ^ p.xorval;
if (BIT(table,3)) val ^= 0x01;
if (BIT(table,0)) val ^= 0xb1;
@@ -429,17 +429,17 @@ uint8_t fd1089b_device::decode(uint8_t val, uint8_t key, bool opcode)
if (BIT(table,2))
{
- val = BITSWAP8(val, 7,6,5,4,1,0,3,2);
+ val = bitswap<8>(val, 7,6,5,4,1,0,3,2);
if (BIT(table,0) ^ BIT(table,1))
- val = BITSWAP8(val, 7,6,5,4,0,1,3,2);
+ val = bitswap<8>(val, 7,6,5,4,0,1,3,2);
}
else
{
- val = BITSWAP8(val, 7,6,5,4,3,2,0,1);
+ val = bitswap<8>(val, 7,6,5,4,3,2,0,1);
if (BIT(table,0) ^ BIT(table,1))
- val = BITSWAP8(val, 7,6,5,4,1,0,2,3);
+ val = bitswap<8>(val, 7,6,5,4,1,0,2,3);
}
return val;
diff --git a/src/mame/machine/fd1094.cpp b/src/mame/machine/fd1094.cpp
index ed8dfe8..20d33ce 100644
--- a/src/mame/machine/fd1094.cpp
+++ b/src/mame/machine/fd1094.cpp
@@ -815,7 +815,7 @@ uint16_t fd1094_device::decrypt_one(offs_t address, uint16_t val, const uint8_t
if (val & 0x8000) // block invariant: val & 0x8000 != 0
{
- val = BITSWAP16(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
+ val = bitswap<16>(val, 15, 9,10,13, 3,12, 0,14, 6, 5, 2,11, 8, 1, 4, 7);
if (!global_xor1) if (~val & 0x0800) val ^= 0x3002; // 1,12,13
if (true) if (~val & 0x0020) val ^= 0x0044; // 2,6
@@ -823,12 +823,12 @@ uint16_t fd1094_device::decrypt_one(offs_t address, uint16_t val, const uint8_t
if (!global_swap2) if (!key_0c) val ^= 0x0308; // 3,8,9
val ^= 0x6561;
- if (!key_2b) val = BITSWAP16(val,15,10,13,12,11,14,9,8,7,6,0,4,3,2,1,5); // 0-5, 10-14
+ if (!key_2b) val = bitswap<16>(val,15,10,13,12,11,14,9,8,7,6,0,4,3,2,1,5); // 0-5, 10-14
}
if (val & 0x4000) // block invariant: val & 0x4000 != 0
{
- val = BITSWAP16(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
+ val = bitswap<16>(val, 13,14, 7, 0, 8, 6, 4, 2, 1,15, 3,11,12,10, 5, 9);
if (!global_xor0) if (val & 0x0010) val ^= 0x0468; // 3,5,6,10
if (!key_3a) if (val & 0x0100) val ^= 0x0081; // 0,7
@@ -836,12 +836,12 @@ uint16_t fd1094_device::decrypt_one(offs_t address, uint16_t val, const uint8_t
if (!key_5b) if (!key_0b) val ^= 0x3012; // 1,4,12,13
val ^= 0x3523;
- if (!global_swap0b) val = BITSWAP16(val, 2,14,13,12, 9,10,11, 8, 7, 6, 5, 4, 3,15, 1, 0); // 2-15, 9-11
+ if (!global_swap0b) val = bitswap<16>(val, 2,14,13,12, 9,10,11, 8, 7, 6, 5, 4, 3,15, 1, 0); // 2-15, 9-11
}
if (val & 0x2000) // block invariant: val & 0x2000 != 0
{
- val = BITSWAP16(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
+ val = bitswap<16>(val, 10, 2,13, 7, 8, 0, 3,14, 6,15, 1,11, 9, 4, 5,12);
if (!key_4a) if (val & 0x0800) val ^= 0x010c; // 2,3,8
if (!key_1a) if (val & 0x0080) val ^= 0x1000; // 12
@@ -850,27 +850,27 @@ uint16_t fd1094_device::decrypt_one(offs_t address, uint16_t val, const uint8_t
if (!global_swap0a) if (!key_6b) val ^= 0xc000; // 14,15
val ^= 0x99a5;
- if (!key_5b) val = BITSWAP16(val,15,14,13,12,11, 1, 9, 8, 7,10, 5, 6, 3, 2, 4, 0); // 1,4,6,10
+ if (!key_5b) val = bitswap<16>(val,15,14,13,12,11, 1, 9, 8, 7,10, 5, 6, 3, 2, 4, 0); // 1,4,6,10
}
if (val & 0xe000) // block invariant: val & 0xe000 != 0
{
- val = BITSWAP16(val,15,13,14, 5, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
+ val = bitswap<16>(val,15,13,14, 5, 6, 0, 9,10, 4,11, 1, 2,12, 3, 7, 8);
val ^= 0x17ff;
- if (!global_swap4) val = BITSWAP16(val, 15,14,13, 6,11,10, 9, 5, 7,12, 8, 4, 3, 2, 1, 0); // 5-8, 6-12
- if (!global_swap3) val = BITSWAP16(val, 13,15,14,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 15-14-13
- if (!global_swap2) val = BITSWAP16(val, 15,14,13,12,11, 2, 9, 8,10, 6, 5, 4, 3, 0, 1, 7); // 10-2-0-7
- if (!key_3b) val = BITSWAP16(val, 15,14,13,12,11,10, 4, 8, 7, 6, 5, 9, 1, 2, 3, 0); // 9-4, 3-1
- if (!key_2a) val = BITSWAP16(val, 13,14,15,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 13-15
+ if (!global_swap4) val = bitswap<16>(val, 15,14,13, 6,11,10, 9, 5, 7,12, 8, 4, 3, 2, 1, 0); // 5-8, 6-12
+ if (!global_swap3) val = bitswap<16>(val, 13,15,14,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 15-14-13
+ if (!global_swap2) val = bitswap<16>(val, 15,14,13,12,11, 2, 9, 8,10, 6, 5, 4, 3, 0, 1, 7); // 10-2-0-7
+ if (!key_3b) val = bitswap<16>(val, 15,14,13,12,11,10, 4, 8, 7, 6, 5, 9, 1, 2, 3, 0); // 9-4, 3-1
+ if (!key_2a) val = bitswap<16>(val, 13,14,15,12,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0); // 13-15
- if (!global_swap1) val = BITSWAP16(val, 15,14,13,12, 9, 8,11,10, 7, 6, 5, 4, 3, 2, 1, 0); // 11...8
- if (!key_5a) val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 4, 5, 7, 6, 3, 2, 1, 0); // 7...4
- if (!global_swap0a) val = BITSWAP16(val, 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 0, 3, 2, 1); // 3...0
+ if (!global_swap1) val = bitswap<16>(val, 15,14,13,12, 9, 8,11,10, 7, 6, 5, 4, 3, 2, 1, 0); // 11...8
+ if (!key_5a) val = bitswap<16>(val, 15,14,13,12,11,10, 9, 8, 4, 5, 7, 6, 3, 2, 1, 0); // 7...4
+ if (!global_swap0a) val = bitswap<16>(val, 15,14,13,12,11,10, 9, 8, 7, 6, 5, 4, 0, 3, 2, 1); // 3...0
}
- val = BITSWAP16(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ val = bitswap<16>(val, 12,15,14,13,11,10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
if ((val & 0xb080) == 0x8000) val ^= 0x4000;
if ((val & 0xf000) == 0xc000) val ^= 0x0080;
diff --git a/src/mame/machine/gaelcrpt.cpp b/src/mame/machine/gaelcrpt.cpp
index 2dbe0f1..3216639 100644
--- a/src/mame/machine/gaelcrpt.cpp
+++ b/src/mame/machine/gaelcrpt.cpp
@@ -20,10 +20,10 @@ static int decrypt(int const param1, int const param2, int const enc_prev_word,
switch (swap)
{
- case 0: res = BITSWAP16(enc_word, 1, 2, 0,14,12,15, 4, 8,13, 7, 3, 6,11, 5,10, 9); break;
- case 1: res = BITSWAP16(enc_word, 14,10, 4,15, 1, 6,12,11, 8, 0, 9,13, 7, 3, 5, 2); break;
- case 2: res = BITSWAP16(enc_word, 2,13,15, 1,12, 8,14, 4, 6, 0, 9, 5,10, 7, 3,11); break;
- case 3: res = BITSWAP16(enc_word, 3, 8, 1,13,14, 4,15, 0,10, 2, 7,12, 6,11, 9, 5); break;
+ case 0: res = bitswap<16>(enc_word, 1, 2, 0,14,12,15, 4, 8,13, 7, 3, 6,11, 5,10, 9); break;
+ case 1: res = bitswap<16>(enc_word, 14,10, 4,15, 1, 6,12,11, 8, 0, 9,13, 7, 3, 5, 2); break;
+ case 2: res = bitswap<16>(enc_word, 2,13,15, 1,12, 8,14, 4, 6, 0, 9, 5,10, 7, 3,11); break;
+ case 3: res = bitswap<16>(enc_word, 3, 8, 1,13,14, 4,15, 0,10, 2, 7,12, 6,11, 9, 5); break;
}
res ^= param2;
@@ -117,7 +117,7 @@ static int decrypt(int const param1, int const param2, int const enc_prev_word,
res ^= (param1 << 6) | (param1 << 11);
- return BITSWAP16(res, 2,6,0,11,14,12,7,10,5,4,8,3,9,1,13,15);
+ return bitswap<16>(res, 2,6,0,11,14,12,7,10,5,4,8,3,9,1,13,15);
}
diff --git a/src/mame/machine/gb.cpp b/src/mame/machine/gb.cpp
index 0cc70ba..5c4ff89 100644
--- a/src/mame/machine/gb.cpp
+++ b/src/mame/machine/gb.cpp
@@ -723,14 +723,14 @@ READ8_MEMBER(megaduck_state::megaduck_video_r)
data = m_ppu->video_r(space, offset);
if (offset)
return data;
- return BITSWAP8(data,7,0,5,4,6,3,2,1);
+ return bitswap<8>(data,7,0,5,4,6,3,2,1);
}
WRITE8_MEMBER(megaduck_state::megaduck_video_w)
{
if (!offset)
{
- data = BITSWAP8(data,7,3,5,4,2,1,0,6);
+ data = bitswap<8>(data,7,3,5,4,2,1,0,6);
}
if ((offset & 0x0C) && ((offset & 0x0C) ^ 0x0C))
{
diff --git a/src/mame/machine/igs025.cpp b/src/mame/machine/igs025.cpp
index c1e1b3d..81affda 100644
--- a/src/mame/machine/igs025.cpp
+++ b/src/mame/machine/igs025.cpp
@@ -254,7 +254,7 @@ READ16_MEMBER(igs025_device::killbld_igs025_prot_r)
switch (m_kb_cmd)
{
case 0x00:
- return BITSWAP8((m_kb_swap + 1) & 0x7f, 0, 1, 2, 3, 4, 5, 6, 7); // drgw3
+ return bitswap<8>((m_kb_swap + 1) & 0x7f, 0, 1, 2, 3, 4, 5, 6, 7); // drgw3
case 0x01:
return m_kb_reg & 0x7f;
@@ -282,7 +282,7 @@ READ16_MEMBER(igs025_device::killbld_igs025_prot_r)
return 0x3f00 | ((m_kb_game_id >> 24) & 0xff);
default: // >= 5
- return 0x3f00 | BITSWAP8(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
+ return 0x3f00 | bitswap<8>(m_kb_prot_hold, 5, 2, 9, 7, 10, 13, 12, 15);
}
}
diff --git a/src/mame/machine/igs036crypt.cpp b/src/mame/machine/igs036crypt.cpp
index 4f70e6f..ee42774 100644
--- a/src/mame/machine/igs036crypt.cpp
+++ b/src/mame/machine/igs036crypt.cpp
@@ -98,7 +98,7 @@ uint16_t igs036_decryptor::deobfuscate(uint16_t cipherword, int word_address)con
// key-independent manipulation
int shift = rotation(word_address);
int aux = rol(cipherword, shift);
- aux = BITSWAP16(aux, 10,9,8,7,0,15,6,5, 14,13,4,3,12,11,2,1);
+ aux = bitswap<16>(aux, 10,9,8,7,0,15,6,5, 14,13,4,3,12,11,2,1);
return aux;
}
diff --git a/src/mame/machine/jalcrpt.cpp b/src/mame/machine/jalcrpt.cpp
index 45c92d9..9db6afa 100644
--- a/src/mame/machine/jalcrpt.cpp
+++ b/src/mame/machine/jalcrpt.cpp
@@ -19,9 +19,9 @@ void phantasm_rom_decode(running_machine &machine, const char *region)
// [0] def0 189a bc56 7234
// [1] fdb9 7531 eca8 6420
// [2] 0123 4567 ba98 fedc
-#define BITSWAP_0 BITSWAP16(x,0xd,0xe,0xf,0x0,0x1,0x8,0x9,0xa,0xb,0xc,0x5,0x6,0x7,0x2,0x3,0x4)
-#define BITSWAP_1 BITSWAP16(x,0xf,0xd,0xb,0x9,0x7,0x5,0x3,0x1,0xe,0xc,0xa,0x8,0x6,0x4,0x2,0x0)
-#define BITSWAP_2 BITSWAP16(x,0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc)
+#define BITSWAP_0 bitswap<16>(x,0xd,0xe,0xf,0x0,0x1,0x8,0x9,0xa,0xb,0xc,0x5,0x6,0x7,0x2,0x3,0x4)
+#define BITSWAP_1 bitswap<16>(x,0xf,0xd,0xb,0x9,0x7,0x5,0x3,0x1,0xe,0xc,0xa,0x8,0x6,0x4,0x2,0x0)
+#define BITSWAP_2 bitswap<16>(x,0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc)
if (i < 0x08000/2) { if ( (i | (0x248/2)) != i ) {y = BITSWAP_0;} else {y = BITSWAP_1;} }
else if (i < 0x10000/2) { y = BITSWAP_2; }
@@ -54,9 +54,9 @@ void astyanax_rom_decode(running_machine &machine, const char *region)
// [1] fdb9 7531 8ace 0246
// [2] 4567 0123 ba98 fedc
-#define BITSWAP_0 BITSWAP16(x,0xd,0xe,0xf,0x0,0xa,0x9,0x8,0x1,0x6,0x5,0xc,0xb,0x7,0x2,0x3,0x4)
-#define BITSWAP_1 BITSWAP16(x,0xf,0xd,0xb,0x9,0x7,0x5,0x3,0x1,0x8,0xa,0xc,0xe,0x0,0x2,0x4,0x6)
-#define BITSWAP_2 BITSWAP16(x,0x4,0x5,0x6,0x7,0x0,0x1,0x2,0x3,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc)
+#define BITSWAP_0 bitswap<16>(x,0xd,0xe,0xf,0x0,0xa,0x9,0x8,0x1,0x6,0x5,0xc,0xb,0x7,0x2,0x3,0x4)
+#define BITSWAP_1 bitswap<16>(x,0xf,0xd,0xb,0x9,0x7,0x5,0x3,0x1,0x8,0xa,0xc,0xe,0x0,0x2,0x4,0x6)
+#define BITSWAP_2 bitswap<16>(x,0x4,0x5,0x6,0x7,0x0,0x1,0x2,0x3,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc)
if (i < 0x08000/2) { if ( (i | (0x248/2)) != i ) {y = BITSWAP_0;} else {y = BITSWAP_1;} }
else if (i < 0x10000/2) { y = BITSWAP_2; }
@@ -86,10 +86,10 @@ void rodland_rom_decode(running_machine &machine, const char *region)
// [0] d0a9 6ebf 5c72 3814 [1] 4567 0123 ba98 fedc
// [2] fdb9 ce07 5318 a246 [3] 4512 ed3b a967 08fc
-#define BITSWAP_0 BITSWAP16(x,0xd,0x0,0xa,0x9,0x6,0xe,0xb,0xf,0x5,0xc,0x7,0x2,0x3,0x8,0x1,0x4);
-#define BITSWAP_1 BITSWAP16(x,0x4,0x5,0x6,0x7,0x0,0x1,0x2,0x3,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc);
-#define BITSWAP_2 BITSWAP16(x,0xf,0xd,0xb,0x9,0xc,0xe,0x0,0x7,0x5,0x3,0x1,0x8,0xa,0x2,0x4,0x6);
-#define BITSWAP_3 BITSWAP16(x,0x4,0x5,0x1,0x2,0xe,0xd,0x3,0xb,0xa,0x9,0x6,0x7,0x0,0x8,0xf,0xc);
+#define BITSWAP_0 bitswap<16>(x,0xd,0x0,0xa,0x9,0x6,0xe,0xb,0xf,0x5,0xc,0x7,0x2,0x3,0x8,0x1,0x4);
+#define BITSWAP_1 bitswap<16>(x,0x4,0x5,0x6,0x7,0x0,0x1,0x2,0x3,0xb,0xa,0x9,0x8,0xf,0xe,0xd,0xc);
+#define BITSWAP_2 bitswap<16>(x,0xf,0xd,0xb,0x9,0xc,0xe,0x0,0x7,0x5,0x3,0x1,0x8,0xa,0x2,0x4,0x6);
+#define BITSWAP_3 bitswap<16>(x,0x4,0x5,0x1,0x2,0xe,0xd,0x3,0xb,0xa,0x9,0x6,0x7,0x0,0x8,0xf,0xc);
if (i < 0x08000/2) { if ( (i | (0x248/2)) != i ) {y = BITSWAP_0;} else {y = BITSWAP_1;} }
else if (i < 0x10000/2) { if ( (i | (0x248/2)) != i ) {y = BITSWAP_2;} else {y = BITSWAP_3;} }
diff --git a/src/mame/machine/jumpshot.cpp b/src/mame/machine/jumpshot.cpp
index 5cf9cb7..ef569cf 100644
--- a/src/mame/machine/jumpshot.cpp
+++ b/src/mame/machine/jumpshot.cpp
@@ -37,7 +37,7 @@ uint8_t pacman_state::jumpshot_decrypt(int addr, uint8_t e)
method ^= 1;
tbl = swap_xor_table[method];
- return BITSWAP8(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8];
+ return bitswap<8>(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8];
}
diff --git a/src/mame/machine/kaneko_calc3.cpp b/src/mame/machine/kaneko_calc3.cpp
index 13ab946..78aa070 100644
--- a/src/mame/machine/kaneko_calc3.cpp
+++ b/src/mame/machine/kaneko_calc3.cpp
@@ -1224,14 +1224,14 @@ uint8_t kaneko_calc3_device::shift_bits(uint8_t dat, int bits)
{
bits &=0x7;
- if (bits==0) return BITSWAP8(dat, 7,6,5,4,3,2,1,0);
- if (bits==1) return BITSWAP8(dat, 6,5,4,3,2,1,0,7);
- if (bits==2) return BITSWAP8(dat, 5,4,3,2,1,0,7,6);
- if (bits==3) return BITSWAP8(dat, 4,3,2,1,0,7,6,5);
- if (bits==4) return BITSWAP8(dat, 3,2,1,0,7,6,5,4);
- if (bits==5) return BITSWAP8(dat, 2,1,0,7,6,5,4,3);
- if (bits==6) return BITSWAP8(dat, 1,0,7,6,5,4,3,2);
- if (bits==7) return BITSWAP8(dat, 0,7,6,5,4,3,2,1);
+ if (bits==0) return bitswap<8>(dat, 7,6,5,4,3,2,1,0);
+ if (bits==1) return bitswap<8>(dat, 6,5,4,3,2,1,0,7);
+ if (bits==2) return bitswap<8>(dat, 5,4,3,2,1,0,7,6);
+ if (bits==3) return bitswap<8>(dat, 4,3,2,1,0,7,6,5);
+ if (bits==4) return bitswap<8>(dat, 3,2,1,0,7,6,5,4);
+ if (bits==5) return bitswap<8>(dat, 2,1,0,7,6,5,4,3);
+ if (bits==6) return bitswap<8>(dat, 1,0,7,6,5,4,3,2);
+ if (bits==7) return bitswap<8>(dat, 0,7,6,5,4,3,2,1);
return dat;
}
diff --git a/src/mame/machine/m24_z8000.cpp b/src/mame/machine/m24_z8000.cpp
index 4d253af..50a38b4 100644
--- a/src/mame/machine/m24_z8000.cpp
+++ b/src/mame/machine/m24_z8000.cpp
@@ -101,7 +101,7 @@ READ16_MEMBER(m24_z8000_device::pmem_r)
return 0;
offset = (offset & 0x3fff) | (hostseg << 14);
if((hostseg >= 40) && (hostseg <= 47))
- offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); // move A6/A7 so CGA framebuffer appears linear
+ offset = (offset & 0xf0000) | bitswap<16>(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0); // move A6/A7 so CGA framebuffer appears linear
ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8));
return (ret << 8) | (ret >> 8);
}
@@ -116,7 +116,7 @@ WRITE16_MEMBER(m24_z8000_device::pmem_w)
return;
offset = (offset & 0x3fff) | (hostseg << 14);
if((hostseg >= 40) && (hostseg <= 47))
- offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
+ offset = (offset & 0xf0000) | bitswap<16>(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8));
}
@@ -136,7 +136,7 @@ READ16_MEMBER(m24_z8000_device::dmem_r)
return 0;
offset = (offset & 0x3fff) | (hostseg << 14);
if((hostseg >= 40) && (hostseg <= 47))
- offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
+ offset = (offset & 0xf0000) | bitswap<16>(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
ret = m_maincpu->space(AS_PROGRAM).read_word(offset, (mem_mask << 8) | (mem_mask >> 8));
return (ret << 8) | (ret >> 8);
}
@@ -151,7 +151,7 @@ WRITE16_MEMBER(m24_z8000_device::dmem_w)
return;
offset = (offset & 0x3fff) | (hostseg << 14);
if((hostseg >= 40) && (hostseg <= 47))
- offset = (offset & 0xf0000) | BITSWAP16(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
+ offset = (offset & 0xf0000) | bitswap<16>(offset,15,7,6,14,13,12,11,10,9,8,5,4,3,2,1,0);
m_maincpu->space(AS_PROGRAM).write_word(offset, data, (mem_mask << 8) | (mem_mask >> 8));
}
diff --git a/src/mame/machine/mbee.cpp b/src/mame/machine/mbee.cpp
index 0fd17f6..2a9335c 100644
--- a/src/mame/machine/mbee.cpp
+++ b/src/mame/machine/mbee.cpp
@@ -279,7 +279,7 @@ void mbee_state::setup_banks(uint8_t data, bool first_time, uint8_t b_mask)
data &= 0x3f; // (bits 0-5 are referred to as S0-S5)
address_space &mem = m_maincpu->space(AS_PROGRAM);
uint8_t *prom = memregion("pals")->base();
- uint8_t b_data = BITSWAP8(data, 7,5,3,2,4,6,1,0) & 0x3b; // arrange data bits to S0,S1,-,S4,S2,S3
+ uint8_t b_data = bitswap<8>(data, 7,5,3,2,4,6,1,0) & 0x3b; // arrange data bits to S0,S1,-,S4,S2,S3
uint8_t b_bank, b_byte, b_byte_t, b_addr, p_bank = 1;
uint16_t b_vid;
char banktag[10];
@@ -291,11 +291,11 @@ void mbee_state::setup_banks(uint8_t data, bool first_time, uint8_t b_mask)
for (b_bank = 0; b_bank < 16; b_bank++)
{
b_vid = b_bank << 12;
- b_addr = BITSWAP8(b_bank, 7,4,5,3,1,2,6,0) & 0x1f; // arrange address bits to A12,-,A14,A13,A15
+ b_addr = bitswap<8>(b_bank, 7,4,5,3,1,2,6,0) & 0x1f; // arrange address bits to A12,-,A14,A13,A15
// Calculate read-bank
b_byte_t = prom[b_addr | (b_data << 8) | 0x82]; // read-bank (RDS and MREQ are low, RFSH is high)
- b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used
+ b_byte = bitswap<8>(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used
if (first_time || (b_byte != m_bank_array[p_bank]))
{
@@ -327,7 +327,7 @@ void mbee_state::setup_banks(uint8_t data, bool first_time, uint8_t b_mask)
// Calculate write-bank
b_byte_t = prom[b_addr | (b_data << 8) | 0xc0]; // write-bank (XWR and MREQ are low, RFSH is high)
- b_byte = BITSWAP8(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used
+ b_byte = bitswap<8>(b_byte_t, 7,5,0,3,6,2,1,4); // rearrange so that bits 0-2 are rambank, bit 3 = rom select, bit 4 = video select, others not used
if (first_time || (b_byte != m_bank_array[p_bank]))
{
diff --git a/src/mame/machine/mc8123.cpp b/src/mame/machine/mc8123.cpp
index 8a4ff95..bb446f8 100644
--- a/src/mame/machine/mc8123.cpp
+++ b/src/mame/machine/mc8123.cpp
@@ -102,10 +102,10 @@ template <typename T, typename... U> constexpr u8 BITS(T b, U... c) { return (u8
u8 mc8123_device::decrypt_type0(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,7,5,3,1,2,0,6,4);
- if (swap == 1) val = BITSWAP8(val,5,3,7,2,1,0,4,6);
- if (swap == 2) val = BITSWAP8(val,0,3,4,6,7,1,5,2);
- if (swap == 3) val = BITSWAP8(val,0,7,3,2,6,4,1,5);
+ if (swap == 0) val = bitswap<8>(val,7,5,3,1,2,0,6,4);
+ if (swap == 1) val = bitswap<8>(val,5,3,7,2,1,0,4,6);
+ if (swap == 2) val = bitswap<8>(val,0,3,4,6,7,1,5,2);
+ if (swap == 3) val = bitswap<8>(val,0,7,3,2,6,4,1,5);
if (BIT(param,3) && BIT(val,7))
val ^= BITS(5,3,0);
@@ -126,7 +126,7 @@ u8 mc8123_device::decrypt_type0(u8 val, u8 param, unsigned swap)
if (BIT(param,1)) val ^= BITS(7,6);
if (BIT(param,0)) val ^= BITS(5,0);
- if (BIT(param,0)) val = BITSWAP8(val,7,6,5,1,4,3,2,0);
+ if (BIT(param,0)) val = bitswap<8>(val,7,6,5,1,4,3,2,0);
return val;
}
@@ -134,12 +134,12 @@ u8 mc8123_device::decrypt_type0(u8 val, u8 param, unsigned swap)
u8 mc8123_device::decrypt_type1a(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,4,2,6,5,3,7,1,0);
- if (swap == 1) val = BITSWAP8(val,6,0,5,4,3,2,1,7);
- if (swap == 2) val = BITSWAP8(val,2,3,6,1,4,0,7,5);
- if (swap == 3) val = BITSWAP8(val,6,5,1,3,2,7,0,4);
+ if (swap == 0) val = bitswap<8>(val,4,2,6,5,3,7,1,0);
+ if (swap == 1) val = bitswap<8>(val,6,0,5,4,3,2,1,7);
+ if (swap == 2) val = bitswap<8>(val,2,3,6,1,4,0,7,5);
+ if (swap == 3) val = bitswap<8>(val,6,5,1,3,2,7,0,4);
- if (BIT(param,2)) val = BITSWAP8(val,7,6,1,5,3,2,4,0);
+ if (BIT(param,2)) val = bitswap<8>(val,7,6,1,5,3,2,4,0);
if (BIT(val,1)) val ^= BITS(0);
if (BIT(val,6)) val ^= BITS(3);
@@ -155,17 +155,17 @@ u8 mc8123_device::decrypt_type1a(u8 val, u8 param, unsigned swap)
if (BIT(param,3)) val ^= BITS(7,2);
if (BIT(param,1)) val ^= BITS(6,3);
- if (BIT(param,0)) val = BITSWAP8(val,7,6,1,4,3,2,5,0);
+ if (BIT(param,0)) val = bitswap<8>(val,7,6,1,4,3,2,5,0);
return val;
}
u8 mc8123_device::decrypt_type1b(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,1,0,3,2,5,6,4,7);
- if (swap == 1) val = BITSWAP8(val,2,0,5,1,7,4,6,3);
- if (swap == 2) val = BITSWAP8(val,6,4,7,2,0,5,1,3);
- if (swap == 3) val = BITSWAP8(val,7,1,3,6,0,2,5,4);
+ if (swap == 0) val = bitswap<8>(val,1,0,3,2,5,6,4,7);
+ if (swap == 1) val = bitswap<8>(val,2,0,5,1,7,4,6,3);
+ if (swap == 2) val = bitswap<8>(val,6,4,7,2,0,5,1,3);
+ if (swap == 3) val = bitswap<8>(val,7,1,3,6,0,2,5,4);
if (BIT(val,2) && BIT(val,0))
val ^= BITS(7,4);
@@ -190,13 +190,13 @@ u8 mc8123_device::decrypt_type1b(u8 val, u8 param, unsigned swap)
u8 mc8123_device::decrypt_type2a(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,0,1,4,3,5,6,2,7);
- if (swap == 1) val = BITSWAP8(val,6,3,0,5,7,4,1,2);
- if (swap == 2) val = BITSWAP8(val,1,6,4,5,0,3,7,2);
- if (swap == 3) val = BITSWAP8(val,4,6,7,5,2,3,1,0);
+ if (swap == 0) val = bitswap<8>(val,0,1,4,3,5,6,2,7);
+ if (swap == 1) val = bitswap<8>(val,6,3,0,5,7,4,1,2);
+ if (swap == 2) val = bitswap<8>(val,1,6,4,5,0,3,7,2);
+ if (swap == 3) val = bitswap<8>(val,4,6,7,5,2,3,1,0);
if (BIT(val,3) || (BIT(param,1) && BIT(val,2)))
- val = BITSWAP8(val,6,0,7,4,3,2,1,5);
+ val = bitswap<8>(val,6,0,7,4,3,2,1,5);
if (BIT(val,5)) val ^= BITS(7);
if (BIT(val,6)) val ^= BITS(5);
@@ -211,13 +211,13 @@ u8 mc8123_device::decrypt_type2a(u8 val, u8 param, unsigned swap)
if (BIT(param,3))
{
if (BIT(param,0))
- val = BITSWAP8(val,7,6,5,3,4,1,2,0);
+ val = bitswap<8>(val,7,6,5,3,4,1,2,0);
else
- val = BITSWAP8(val,7,6,5,1,2,4,3,0);
+ val = bitswap<8>(val,7,6,5,1,2,4,3,0);
}
else if (BIT(param,0))
{
- val = BITSWAP8(val,7,6,5,2,1,3,4,0);
+ val = bitswap<8>(val,7,6,5,2,1,3,4,0);
}
return val;
@@ -228,10 +228,10 @@ u8 mc8123_device::decrypt_type2b(u8 val, u8 param, unsigned swap)
// only 0x20 possible encryptions for this method - all others have 0x40
// this happens because BIT(param,2) cancels the other three
- if (swap == 0) val = BITSWAP8(val,1,3,4,6,5,7,0,2);
- if (swap == 1) val = BITSWAP8(val,0,1,5,4,7,3,2,6);
- if (swap == 2) val = BITSWAP8(val,3,5,4,1,6,2,0,7);
- if (swap == 3) val = BITSWAP8(val,5,2,3,0,4,7,6,1);
+ if (swap == 0) val = bitswap<8>(val,1,3,4,6,5,7,0,2);
+ if (swap == 1) val = bitswap<8>(val,0,1,5,4,7,3,2,6);
+ if (swap == 2) val = bitswap<8>(val,3,5,4,1,6,2,0,7);
+ if (swap == 3) val = bitswap<8>(val,5,2,3,0,4,7,6,1);
if (BIT(val,7) && BIT(val,3))
val ^= BITS(6,4,0);
@@ -263,22 +263,22 @@ u8 mc8123_device::decrypt_type2b(u8 val, u8 param, unsigned swap)
u8 mc8123_device::decrypt_type3a(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,5,3,1,7,0,2,6,4);
- if (swap == 1) val = BITSWAP8(val,3,1,2,5,4,7,0,6);
- if (swap == 2) val = BITSWAP8(val,5,6,1,2,7,0,4,3);
- if (swap == 3) val = BITSWAP8(val,5,6,7,0,4,2,1,3);
+ if (swap == 0) val = bitswap<8>(val,5,3,1,7,0,2,6,4);
+ if (swap == 1) val = bitswap<8>(val,3,1,2,5,4,7,0,6);
+ if (swap == 2) val = bitswap<8>(val,5,6,1,2,7,0,4,3);
+ if (swap == 3) val = bitswap<8>(val,5,6,7,0,4,2,1,3);
if (BIT(val,2)) val ^= BITS(7,5,4);
if (BIT(val,3)) val ^= BITS(0);
- if (BIT(param,0)) val = BITSWAP8(val,7,2,5,4,3,1,0,6);
+ if (BIT(param,0)) val = bitswap<8>(val,7,2,5,4,3,1,0,6);
if (BIT(val,1)) val ^= BITS(6,0);
if (BIT(val,3)) val ^= BITS(4,2,1);
if (BIT(param,3)) val ^= BITS(4,3);
- if (BIT(val,3)) val = BITSWAP8(val,5,6,7,4,3,2,1,0);
+ if (BIT(val,3)) val = bitswap<8>(val,5,6,7,4,3,2,1,0);
if (BIT(val,5)) val ^= BITS(2,1);
@@ -293,14 +293,14 @@ u8 mc8123_device::decrypt_type3a(u8 val, u8 param, unsigned swap)
u8 mc8123_device::decrypt_type3b(u8 val, u8 param, unsigned swap)
{
- if (swap == 0) val = BITSWAP8(val,3,7,5,4,0,6,2,1);
- if (swap == 1) val = BITSWAP8(val,7,5,4,6,1,2,0,3);
- if (swap == 2) val = BITSWAP8(val,7,4,3,0,5,1,6,2);
- if (swap == 3) val = BITSWAP8(val,2,6,4,1,3,7,0,5);
+ if (swap == 0) val = bitswap<8>(val,3,7,5,4,0,6,2,1);
+ if (swap == 1) val = bitswap<8>(val,7,5,4,6,1,2,0,3);
+ if (swap == 2) val = bitswap<8>(val,7,4,3,0,5,1,6,2);
+ if (swap == 3) val = bitswap<8>(val,2,6,4,1,3,7,0,5);
if (BIT(val,2)) val ^= BITS(7);
- if (BIT(val,7)) val = BITSWAP8(val,7,6,3,4,5,2,1,0);
+ if (BIT(val,7)) val = bitswap<8>(val,7,6,3,4,5,2,1,0);
if (BIT(param,3)) val ^= BITS(7);
@@ -315,7 +315,7 @@ u8 mc8123_device::decrypt_type3b(u8 val, u8 param, unsigned swap)
if (BIT(param,3)) val ^= BITS(7);
if (BIT(param,2)) val ^= BITS(0);
- if (BIT(param,3)) val = BITSWAP8(val,4,6,3,2,5,0,1,7);
+ if (BIT(param,3)) val = bitswap<8>(val,4,6,3,2,5,0,1,7);
if (BIT(val,4)) val ^= BITS(1);
if (BIT(val,5)) val ^= BITS(4);
diff --git a/src/mame/machine/megacd.cpp b/src/mame/machine/megacd.cpp
index 10a0ebd..ce33cc7 100644
--- a/src/mame/machine/megacd.cpp
+++ b/src/mame/machine/megacd.cpp
@@ -842,13 +842,13 @@ READ16_MEMBER( sega_segacd_device::segacd_main_dataram_part1_r )
// used by Heart of the Alien
if(offset<0x30000/2) /* 0x20000 - 0x2ffff */ // 512x256 bitmap. tiles
- offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,8,7,6,5,4,3,2,1,14,13,12,11,10,9,0);
+ offset = bitswap<24>(offset,23,22,21,20,19,18,17,16,15,8,7,6,5,4,3,2,1,14,13,12,11,10,9,0);
else if(offset<0x38000/2) /* 0x30000 - 0x37fff */ // 512x128 bitmap. tiles
- offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,7,6,5,4,3,2,1,13,12,11,10,9,8,0);
+ offset = bitswap<24>(offset,23,22,21,20,19,18,17,16,15,14,7,6,5,4,3,2,1,13,12,11,10,9,8,0);
else if(offset<0x3c000/2) /* 0x38000 - 0x3bfff */ // 512x64 bitmap. tiles
- offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,6,5,4,3,2,1,12,11,10,9,8,7,0);
+ offset = bitswap<24>(offset,23,22,21,20,19,18,17,16,15,14,13,6,5,4,3,2,1,12,11,10,9,8,7,0);
else /* 0x3c000 - 0x3dfff and 0x3e000 - 0x3ffff */ // 512x32 bitmap (x2) -> tiles
- offset = BITSWAP24(offset,23,22,21,20,19,18,17,16,15,14,13,12,5,4,3,2,1,11,10,9,8,7,6,0);
+ offset = bitswap<24>(offset,23,22,21,20,19,18,17,16,15,14,13,12,5,4,3,2,1,11,10,9,8,7,6,0);
offset &=0xffff;
// HOTA cares about this
diff --git a/src/mame/machine/mexico86.cpp b/src/mame/machine/mexico86.cpp
index e473811..cdbccf0 100644
--- a/src/mame/machine/mexico86.cpp
+++ b/src/mame/machine/mexico86.cpp
@@ -106,8 +106,8 @@ void mexico86_state::mcu_simulate( )
m_protection_ram[0x04] = 0x3c | (coin_in_read ^ 3); // coin inputs
- m_protection_ram[0x02] = BITSWAP8(ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1
- m_protection_ram[0x03] = BITSWAP8(ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2
+ m_protection_ram[0x02] = bitswap<8>(ioport("IN1")->read(), 7,6,5,4,2,3,1,0); // player 1
+ m_protection_ram[0x03] = bitswap<8>(ioport("IN2")->read(), 7,6,5,4,2,3,1,0); // player 2
if (m_protection_ram[0x19] == 0xaa) // player 2 active
m_protection_ram[0x1b] = m_protection_ram[0x03];
diff --git a/src/mame/machine/mpu4.cpp b/src/mame/machine/mpu4.cpp
index 838feff..e972a5b 100644
--- a/src/mame/machine/mpu4.cpp
+++ b/src/mame/machine/mpu4.cpp
@@ -2567,13 +2567,13 @@ static void descramble_crystal( uint8_t* region, int start, int end, uint8_t ext
switch (i & 0x58)
{
case 0x00: // same as 0x08
- case 0x08: x = BITSWAP8( x^0xca , 3,2,1,0,7,4,6,5 ); break;
- case 0x10: x = BITSWAP8( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
- case 0x18: x = BITSWAP8( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
- case 0x40: x = BITSWAP8( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
- case 0x48: x = BITSWAP8( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
- case 0x50: x = BITSWAP8( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
- case 0x58: x = BITSWAP8( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
+ case 0x08: x = bitswap<8>( x^0xca , 3,2,1,0,7,4,6,5 ); break;
+ case 0x10: x = bitswap<8>( x^0x30 , 3,0,4,6,1,5,7,2 ); break;
+ case 0x18: x = bitswap<8>( x^0x89 , 4,1,2,5,7,0,6,3 ); break;
+ case 0x40: x = bitswap<8>( x^0x14 , 6,1,4,3,2,5,0,7 ); break;
+ case 0x48: x = bitswap<8>( x^0x40 , 1,0,3,2,5,4,7,6 ); break;
+ case 0x50: x = bitswap<8>( x^0xcb , 3,2,1,0,7,6,5,4 ); break;
+ case 0x58: x = bitswap<8>( x^0xc0 , 2,3,6,0,5,1,7,4 ); break;
}
region[i] = x ^ extra_xor;
}
diff --git a/src/mame/machine/pacplus.cpp b/src/mame/machine/pacplus.cpp
index 981ab9a..67e09c9 100644
--- a/src/mame/machine/pacplus.cpp
+++ b/src/mame/machine/pacplus.cpp
@@ -37,7 +37,7 @@ uint8_t pacman_state::pacplus_decrypt(int addr, uint8_t e)
method ^= 1;
tbl = swap_xor_table[method];
- return BITSWAP8(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8];
+ return bitswap<8>(e,tbl[0],tbl[1],tbl[2],tbl[3],tbl[4],tbl[5],tbl[6],tbl[7]) ^ tbl[8];
}
diff --git a/src/mame/machine/pgmprot_igs027a_type1.cpp b/src/mame/machine/pgmprot_igs027a_type1.cpp
index adfa59a..943b310 100644
--- a/src/mame/machine/pgmprot_igs027a_type1.cpp
+++ b/src/mame/machine/pgmprot_igs027a_type1.cpp
@@ -375,9 +375,9 @@ void pgm_arm_type1_state::pgm_decode_kovlsqh2_tiles()
for (i = 0; i < 0x800000 / 2; i++)
{
- j = BITSWAP24(i, 23, 22, 9, 8, 21, 18, 0, 1, 2, 3, 16, 15, 14, 13, 12, 11, 10, 19, 20, 17, 7, 6, 5, 4);
+ j = bitswap<24>(i, 23, 22, 9, 8, 21, 18, 0, 1, 2, 3, 16, 15, 14, 13, 12, 11, 10, 19, 20, 17, 7, 6, 5, 4);
- dst[j] = BITSWAP16(src[i], 1, 14, 8, 7, 0, 15, 6, 9, 13, 2, 5, 10, 12, 3, 4, 11);
+ dst[j] = bitswap<16>(src[i], 1, 14, 8, 7, 0, 15, 6, 9, 13, 2, 5, 10, 12, 3, 4, 11);
}
memcpy( src, &dst[0], 0x800000 );
@@ -390,7 +390,7 @@ void pgm_arm_type1_state::pgm_decode_kovlsqh2_sprites( uint8_t *src )
for (i = 0; i < 0x800000; i++)
{
- j = BITSWAP24(i, 23, 10, 9, 22, 19, 18, 20, 21, 17, 16, 15, 14, 13, 12, 11, 8, 7, 6, 5, 4, 3, 2, 1, 0);
+ j = bitswap<24>(i, 23, 10, 9, 22, 19, 18, 20, 21, 17, 16, 15, 14, 13, 12, 11, 8, 7, 6, 5, 4, 3, 2, 1, 0);
dst[j] = src[i];
}
@@ -418,9 +418,9 @@ void pgm_arm_type1_state::pgm_decode_kovqhsgs_program()
for (i = 0; i < 0x400000 / 2; i++)
{
- int j = BITSWAP24(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 5, 4, 3, 2, 1, 0);
+ int j = bitswap<24>(i, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 6, 7, 5, 4, 3, 2, 1, 0);
- dst[j] = BITSWAP16(src[i], 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
+ dst[j] = bitswap<16>(src[i], 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 4, 5, 3, 2, 1, 0);
}
memcpy( src, &dst[0], 0x400000 );
@@ -434,7 +434,7 @@ void pgm_arm_type1_state::pgm_decode_kovqhsgs2_program()
for (i = 0; i < 0x400000 / 2; i++)
{
- int j = BITSWAP24(i, 23, 22, 21, 20, 19, 16, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 18, 17, 7);
+ int j = bitswap<24>(i, 23, 22, 21, 20, 19, 16, 15, 14, 13, 12, 11, 10, 9, 8, 0, 1, 2, 3, 4, 5, 6, 18, 17, 7);
dst[j] = src[i];
}
diff --git a/src/mame/machine/pgmprot_igs027a_type3.cpp b/src/mame/machine/pgmprot_igs027a_type3.cpp
index 5dd5088..2a7860b 100644
--- a/src/mame/machine/pgmprot_igs027a_type3.cpp
+++ b/src/mame/machine/pgmprot_igs027a_type3.cpp
@@ -727,7 +727,7 @@ DRIVER_INIT_MEMBER(pgm_arm_type3_state,dmnfrnt)
}
//
-// int j = BITSWAP24(i, 23, 20, 17, 16, 19, 18, 15, 14, 13, 12, 11, 10, 9, 22, 21, 6, 7, 6, 5, 4, 3, 2, 1, 0);
+// int j = bitswap<24>(i, 23, 20, 17, 16, 19, 18, 15, 14, 13, 12, 11, 10, 9, 22, 21, 6, 7, 6, 5, 4, 3, 2, 1, 0);
// buffer[i] = src[j]
// todo, collapse these to an address swap
diff --git a/src/mame/machine/pgmprot_orlegend.cpp b/src/mame/machine/pgmprot_orlegend.cpp
index 9f6d6aa..6961d24 100644
--- a/src/mame/machine/pgmprot_orlegend.cpp
+++ b/src/mame/machine/pgmprot_orlegend.cpp
@@ -61,7 +61,7 @@ READ16_MEMBER(pgm_asic3_state::pgm_asic3_r)
return (m_asic3_latch[2] & 0x7f) | ((ioport("Region")->read() << 6) & 0x80);
case 0x03:
- return BITSWAP8(m_asic3_hold, 5,2,9,7,10,13,12,15);
+ return bitswap<8>(m_asic3_hold, 5,2,9,7,10,13,12,15);
// case $157674, expected return $157686
case 0x20: return 0x49; // "IGS"
diff --git a/src/mame/machine/r2crypt.cpp b/src/mame/machine/r2crypt.cpp
index 3101c69..ad29718 100644
--- a/src/mame/machine/r2crypt.cpp
+++ b/src/mame/machine/r2crypt.cpp
@@ -212,10 +212,10 @@ static uint16_t gm(int i4)
static uint32_t core_decrypt(uint32_t ciphertext, int i1, int i2, int i3, int i4,
const uint8_t *rotate, const uint8_t *x5, const uint16_t *x11, uint32_t preXor, uint32_t carryMask, uint32_t postXor)
{
- uint32_t v1 = BITSWAP32(yrot(ciphertext, rotate[i1]), 25,28,15,19, 6,0,3,24, 11,1,2,30, 16,7,22,17, 31,14,23,9, 27,18,4,10, 13,20,5,12, 8,29,26,21);
+ uint32_t v1 = bitswap<32>(yrot(ciphertext, rotate[i1]), 25,28,15,19, 6,0,3,24, 11,1,2,30, 16,7,22,17, 31,14,23,9, 27,18,4,10, 13,20,5,12, 8,29,26,21);
uint16_t x1Low = (x5[i2]<<11) ^ x11[i3] ^ gm(i4);
- uint32_t x1 = x1Low | (BITSWAP16(x1Low, 0,8,1,9, 2,10,3,11, 4,12,5,13, 6,14,7,15)<<16);
+ uint32_t x1 = x1Low | (bitswap<16>(x1Low, 0,8,1,9, 2,10,3,11, 4,12,5,13, 6,14,7,15)<<16);
return partial_carry_sum32(v1, x1^preXor, carryMask) ^ postXor;
}
diff --git a/src/mame/machine/scramble.cpp b/src/mame/machine/scramble.cpp
index 2a6f978..0684f07 100644
--- a/src/mame/machine/scramble.cpp
+++ b/src/mame/machine/scramble.cpp
@@ -183,12 +183,12 @@ DRIVER_INIT_MEMBER(scramble_state,frogger)
/* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
ROM = memregion("audiocpu")->base();
for (A = 0;A < 0x0800;A++)
- ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
+ ROM[A] = bitswap<8>(ROM[A],7,6,5,4,3,2,0,1);
/* likewise, the 2nd gfx ROM has data lines D0 and D1 swapped. Decode it. */
ROM = memregion("gfx1")->base();
for (A = 0x0800;A < 0x1000;A++)
- ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
+ ROM[A] = bitswap<8>(ROM[A],7,6,5,4,3,2,0,1);
}
DRIVER_INIT_MEMBER(scramble_state,froggers)
@@ -199,7 +199,7 @@ DRIVER_INIT_MEMBER(scramble_state,froggers)
/* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
ROM = memregion("audiocpu")->base();
for (A = 0;A < 0x0800;A++)
- ROM[A] = BITSWAP8(ROM[A],7,6,5,4,3,2,0,1);
+ ROM[A] = bitswap<8>(ROM[A],7,6,5,4,3,2,0,1);
}
#endif
@@ -223,7 +223,7 @@ DRIVER_INIT_MEMBER(scramble_state,devilfsh)
for (j = 0; j < 16; j++)
{
- offs_t newval = BITSWAP8(j,7,6,5,4,2,0,3,1);
+ offs_t newval = bitswap<8>(j,7,6,5,4,2,0,3,1);
swapbuffer[j] = RAM[i + newval];
}
@@ -502,7 +502,7 @@ DRIVER_INIT_MEMBER(scramble_state,hustler)
for (A = 0;A < 0x0800;A++)
- rom[A] = BITSWAP8(rom[A],7,6,5,4,3,2,0,1);
+ rom[A] = bitswap<8>(rom[A],7,6,5,4,3,2,0,1);
}
}
@@ -514,7 +514,7 @@ DRIVER_INIT_MEMBER(scramble_state,hustlerd)
for (A = 0;A < 0x0800;A++)
- rom[A] = BITSWAP8(rom[A],7,6,5,4,3,2,0,1);
+ rom[A] = bitswap<8>(rom[A],7,6,5,4,3,2,0,1);
}
DRIVER_INIT_MEMBER(scramble_state,billiard)
@@ -545,7 +545,7 @@ DRIVER_INIT_MEMBER(scramble_state,billiard)
rom[A] ^= xormask;
- rom[A] = BITSWAP8(rom[A],6,1,2,5,4,3,0,7);
+ rom[A] = bitswap<8>(rom[A],6,1,2,5,4,3,0,7);
}
/* the first ROM of the second CPU has data lines D0 and D1 swapped. Decode it. */
@@ -554,7 +554,7 @@ DRIVER_INIT_MEMBER(scramble_state,billiard)
for (A = 0;A < 0x0800;A++)
- rom[A] = BITSWAP8(rom[A],7,6,5,4,3,2,0,1);
+ rom[A] = bitswap<8>(rom[A],7,6,5,4,3,2,0,1);
}
}
@@ -580,7 +580,7 @@ DRIVER_INIT_MEMBER(scramble_state,ad2083)
for (i=0; i<len; i++)
{
c = ROM[i] ^ 0x35;
- c = BITSWAP8(c, 6,2,5,1,7,3,4,0); /* also swapped inside of the bigger module */
+ c = bitswap<8>(c, 6,2,5,1,7,3,4,0); /* also swapped inside of the bigger module */
ROM[i] = c;
}
}
@@ -650,24 +650,24 @@ DRIVER_INIT_MEMBER(scramble_state,harem)
for (int i = 0; i < size; i++)
{
uint8_t x = ROM[i];
- opcodes[size * 0 + i] = BITSWAP8(x, 7,0,5,2,3,4,1,6);
- data [size * 0 + i] = BITSWAP8(x, 7,6,5,0,3,4,1,2);
+ opcodes[size * 0 + i] = bitswap<8>(x, 7,0,5,2,3,4,1,6);
+ data [size * 0 + i] = bitswap<8>(x, 7,6,5,0,3,4,1,2);
}
// decryption 09
for (int i = 0; i < size; i++)
{
uint8_t x = ROM[i];
- opcodes[size * 1 + i] = BITSWAP8(x, 7,0,5,6,3,2,1,4);
- data [size * 1 + i] = BITSWAP8(x, 7,4,5,0,3,6,1,2);
+ opcodes[size * 1 + i] = bitswap<8>(x, 7,0,5,6,3,2,1,4);
+ data [size * 1 + i] = bitswap<8>(x, 7,4,5,0,3,6,1,2);
}
// decryption 0a
for (int i = 0; i < size; i++)
{
uint8_t x = ROM[i];
- opcodes[size * 2 + i] = BITSWAP8(x, 7,2,5,6,3,0,1,4);
- data [size * 2 + i] = BITSWAP8(x, 7,2,5,4,3,0,1,6);
+ opcodes[size * 2 + i] = bitswap<8>(x, 7,2,5,6,3,0,1,4);
+ data [size * 2 + i] = bitswap<8>(x, 7,2,5,4,3,0,1,6);
}
membank("rombank")->set_base (m_harem_decrypted_data.get());
diff --git a/src/mame/machine/segacrp2_device.cpp b/src/mame/machine/segacrp2_device.cpp
index 2ac8828..38cebe5 100644
--- a/src/mame/machine/segacrp2_device.cpp
+++ b/src/mame/machine/segacrp2_device.cpp
@@ -76,11 +76,11 @@ static void decode(uint8_t *rom, uint8_t *decrypted,
/* decode the opcodes */
tbl = swaptable[swap_table[2*row]];
- decrypted[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row];
+ decrypted[A] = bitswap<8>(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row];
/* decode the data */
tbl = swaptable[swap_table[2*row+1]];
- rom[A] = BITSWAP8(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1];
+ rom[A] = bitswap<8>(src,7,tbl[0],5,tbl[1],3,tbl[2],1,tbl[3]) ^ xor_table[2*row+1];
}
}
diff --git a/src/mame/machine/segas32.cpp b/src/mame/machine/segas32.cpp
index debf075..2424a49 100644
--- a/src/mame/machine/segas32.cpp
+++ b/src/mame/machine/segas32.cpp
@@ -46,7 +46,7 @@ void segas32_v25_state::decrypt_protrom()
// unscramble the address lines
for(i = 0; i < 0x10000; i++)
- rom[i] = temp[BITSWAP16(i, 14, 11, 15, 12, 13, 4, 3, 7, 5, 10, 2, 8, 9, 6, 1, 0)];
+ rom[i] = temp[bitswap<16>(i, 14, 11, 15, 12, 13, 4, 3, 7, 5, 10, 2, 8, 9, 6, 1, 0)];
}
diff --git a/src/mame/machine/seibuspi.cpp b/src/mame/machine/seibuspi.cpp
index 316e733..d27ff9a 100644
--- a/src/mame/machine/seibuspi.cpp
+++ b/src/mame/machine/seibuspi.cpp
@@ -171,7 +171,7 @@ void seibuspi_sprite_decrypt(uint8_t *src, int rom_size)
/* first of all, permutate 16 of the 48 bits */
bs = spi_bitswap[key_table[addr & 0xff]&0xf];
- y3 = BITSWAP16(y3, bs[0],bs[1],bs[2],bs[3],bs[4],bs[5],bs[6],bs[7],
+ y3 = bitswap<16>(y3, bs[0],bs[1],bs[2],bs[3],bs[4],bs[5],bs[6],bs[7],
bs[8],bs[9],bs[10],bs[11],bs[12],bs[13],bs[14],bs[15]);
@@ -350,7 +350,7 @@ void seibuspi_rise10_sprite_decrypt(uint8_t *rom, int size)
uint32_t plane54,plane3210;
plane54 = rom[0*size+2*i] + (rom[0*size+2*i+1] << 8);
- plane3210 = BITSWAP32(
+ plane3210 = bitswap<32>(
rom[2*size+2*i] + (rom[2*size+2*i+1] << 8) + (rom[1*size+2*i] << 16) + (rom[1*size+2*i+1] << 24),
23,13,24,4,16,12,25,30,
3,5,29,17,14,22,2,11,
diff --git a/src/mame/machine/subsino.cpp b/src/mame/machine/subsino.cpp
index 06cf790..507616c 100644
--- a/src/mame/machine/subsino.cpp
+++ b/src/mame/machine/subsino.cpp
@@ -20,50 +20,50 @@ extern const uint8_t victor21_xors[8] = { 0x44, 0xbb, 0x66, 0x44, 0xaa, 0x55, 0x
void crsbingo_bitswaps(uint8_t *decrypt, int i)
{
- if ((i&7) == 0) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 1) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,0,3,6,5,4 );
- if ((i&7) == 2) decrypt[i] = BITSWAP8(decrypt[i], 3,2,5,0,7,6,1,4 );
- if ((i&7) == 3) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,0,3,6,1,4 );
- if ((i&7) == 4) decrypt[i] = BITSWAP8(decrypt[i], 7,6,5,0,3,2,1,4 );
- if ((i&7) == 5) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,4,3,6,5,0 );
- if ((i&7) == 6) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,0,3,6,5,4 );
- if ((i&7) == 7) decrypt[i] = BITSWAP8(decrypt[i], 3,2,1,0,7,6,5,4 );
+ if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
+ if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3,2,5,0,7,6,1,4 );
+ if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,0,3,6,1,4 );
+ if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
+ if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
+ if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
+ if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
}
void sharkpy_bitswaps(uint8_t *decrypt, int i)
{
- if ((i&7) == 0) decrypt[i] = BITSWAP8(decrypt[i], 3,2,1,0,7,6,5,4 );
- if ((i&7) == 1) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 2) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,4,3,6,5,0 );
- if ((i&7) == 3) decrypt[i] = BITSWAP8(decrypt[i], 3,6,1,0,7,2,5,4 );
- if ((i&7) == 4) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 5) decrypt[i] = BITSWAP8(decrypt[i], 3,2,5,4,7,6,1,0 );
- if ((i&7) == 6) decrypt[i] = BITSWAP8(decrypt[i], 7,6,1,4,3,2,5,0 );
- if ((i&7) == 7) decrypt[i] = BITSWAP8(decrypt[i], 3,6,1,4,7,2,5,0 );
+ if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
+ if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
+ if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
+ if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3,2,5,4,7,6,1,0 );
+ if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,6,1,4,3,2,5,0 );
+ if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,4,7,2,5,0 );
}
void victor5_bitswaps(uint8_t *decrypt, int i)
{
- if ((i&7) == 0) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 1) decrypt[i] = BITSWAP8(decrypt[i], 7,6,5,0,3,2,1,4 );
- if ((i&7) == 2) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,0,3,6,5,4 );
- if ((i&7) == 3) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,0,3,6,5,4 );
- if ((i&7) == 4) decrypt[i] = BITSWAP8(decrypt[i], 3,2,1,0,7,6,5,4 );
- if ((i&7) == 5) decrypt[i] = BITSWAP8(decrypt[i], 7,6,5,0,3,2,1,4 );
- if ((i&7) == 6) decrypt[i] = BITSWAP8(decrypt[i], 3,6,1,0,7,2,5,4 );
- if ((i&7) == 7) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,4,3,6,5,0 );
+ if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
+ if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
+ if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
+ if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,0,7,6,5,4 );
+ if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,0,3,2,1,4 );
+ if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,0,7,2,5,4 );
+ if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,4,3,6,5,0 );
}
void victor21_bitswaps(uint8_t *decrypt, int i)
{
- if ((i&7) == 0) decrypt[i] = BITSWAP8(decrypt[i], 7,2,1,0,3,6,5,4 );
- if ((i&7) == 1) decrypt[i] = BITSWAP8(decrypt[i], 3,6,1,4,7,2,5,0 );
- if ((i&7) == 2) decrypt[i] = BITSWAP8(decrypt[i], 3,2,1,4,7,6,5,0 );
- if ((i&7) == 3) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 4) decrypt[i] = BITSWAP8(decrypt[i], 7,2,5,4,3,6,1,0 );
- if ((i&7) == 5) decrypt[i] = BITSWAP8(decrypt[i], 3,6,5,0,7,2,1,4 );
- if ((i&7) == 6) decrypt[i] = BITSWAP8(decrypt[i], 7,6,5,4,3,2,1,0 );
- if ((i&7) == 7) decrypt[i] = BITSWAP8(decrypt[i], 3,2,1,4,7,6,5,0 );
+ if ((i&7) == 0) decrypt[i] = bitswap<8>(decrypt[i], 7,2,1,0,3,6,5,4 );
+ if ((i&7) == 1) decrypt[i] = bitswap<8>(decrypt[i], 3,6,1,4,7,2,5,0 );
+ if ((i&7) == 2) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,4,7,6,5,0 );
+ if ((i&7) == 3) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 4) decrypt[i] = bitswap<8>(decrypt[i], 7,2,5,4,3,6,1,0 );
+ if ((i&7) == 5) decrypt[i] = bitswap<8>(decrypt[i], 3,6,5,0,7,2,1,4 );
+ if ((i&7) == 6) decrypt[i] = bitswap<8>(decrypt[i], 7,6,5,4,3,2,1,0 );
+ if ((i&7) == 7) decrypt[i] = bitswap<8>(decrypt[i], 3,2,1,4,7,6,5,0 );
}
// Decrypt:
diff --git a/src/mame/machine/trs80m2kb.cpp b/src/mame/machine/trs80m2kb.cpp
index 97c5dbe..1cefe9d 100644
--- a/src/mame/machine/trs80m2kb.cpp
+++ b/src/mame/machine/trs80m2kb.cpp
@@ -347,5 +347,5 @@ WRITE8_MEMBER( trs80m2_keyboard_device::kb_p2_w )
*/
- m_keylatch = BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f;
+ m_keylatch = bitswap<8>(data, 7, 6, 5, 4, 0, 1, 2, 3) & 0x0f;
}
diff --git a/src/mame/machine/xevious.cpp b/src/mame/machine/xevious.cpp
index e4818ba..f09677d 100644
--- a/src/mame/machine/xevious.cpp
+++ b/src/mame/machine/xevious.cpp
@@ -167,7 +167,7 @@ READ8_MEMBER( xevious_state::battles_input_port_r )
switch ( offset )
{
default:
- case 0: return ~BITSWAP8(ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
+ case 0: return ~bitswap<8>(ioport("IN0H")->read(),7,6,5,4,2,3,1,0);
case 1: return ~ioport("IN1L")->read();
case 2: return ~ioport("IN1H")->read();
case 3: return ~ioport("IN0L")->read();
diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp
index 14af493..0548095 100644
--- a/src/mame/video/agat7.cpp
+++ b/src/mame/video/agat7.cpp
@@ -172,11 +172,11 @@ void agat7video_device::text_update_lores(screen_device &screen, bitmap_ind16 &b
ch = m_ram_dev->read(address);
attr = m_ram_dev->read(address + 1);
if (BIT(attr, 5)) {
- fg = BITSWAP8(attr,7,6,5,3,4,2,1,0) & 15;
+ fg = bitswap<8>(attr,7,6,5,3,4,2,1,0) & 15;
bg = 0;
} else {
fg = 0;
- bg = BITSWAP8(attr,7,6,5,3,4,2,1,0) & 15;
+ bg = bitswap<8>(attr,7,6,5,3,4,2,1,0) & 15;
}
plot_text_character(bitmap, col * 16, row, 2, ch, m_char_ptr, m_char_size, fg, bg);
}
diff --git a/src/mame/video/alesis.cpp b/src/mame/video/alesis.cpp
index 20bdc48..5dead01 100644
--- a/src/mame/video/alesis.cpp
+++ b/src/mame/video/alesis.cpp
@@ -41,7 +41,7 @@ void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t
else
m_lcd_digits[0] &= ~(1<<(y-1));
- output().set_value("digit0", BITSWAP8(m_lcd_digits[0],7,3,1,4,6,5,2,0));
+ output().set_value("digit0", bitswap<8>(m_lcd_digits[0],7,3,1,4,6,5,2,0));
}
break;
case 2:
@@ -56,7 +56,7 @@ void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t
else
m_lcd_digits[1] &= ~(1<<(y-1));
- output().set_value("digit1", BITSWAP8(m_lcd_digits[1],7,3,1,4,6,5,2,0));
+ output().set_value("digit1", bitswap<8>(m_lcd_digits[1],7,3,1,4,6,5,2,0));
}
break;
case 3:
@@ -84,7 +84,7 @@ void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t
else
m_lcd_digits[4] &= ~(1<<y);
- output().set_value("digit4", BITSWAP8(m_lcd_digits[4],7,3,5,2,0,1,4,6));
+ output().set_value("digit4", bitswap<8>(m_lcd_digits[4],7,3,5,2,0,1,4,6));
}
break;
}
@@ -105,7 +105,7 @@ void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t
else
m_lcd_digits[3] &= ~(1<<y);
- output().set_value("digit3", BITSWAP8(m_lcd_digits[3],7,3,5,2,0,1,4,6));
+ output().set_value("digit3", bitswap<8>(m_lcd_digits[3],7,3,5,2,0,1,4,6));
}
break;
case 1:
@@ -120,7 +120,7 @@ void alesis_state::update_lcd_symbols(bitmap_ind16 &bitmap, uint8_t pos, uint8_t
else
m_lcd_digits[2] &= ~(1<<y);
- output().set_value("digit2", BITSWAP8(m_lcd_digits[2],7,3,5,2,0,1,4,6));
+ output().set_value("digit2", bitswap<8>(m_lcd_digits[2],7,3,5,2,0,1,4,6));
}
break;
case 2:
diff --git a/src/mame/video/apple2.cpp b/src/mame/video/apple2.cpp
index a88bdab..180ee08 100644
--- a/src/mame/video/apple2.cpp
+++ b/src/mame/video/apple2.cpp
@@ -529,7 +529,7 @@ void apple2_state::apple2_video_start(const uint8_t *vram, const uint8_t *aux_vr
int len = memregion("gfx1")->bytes();
for (i = 0; i < len; i++)
{
- apple2_font[i] = BITSWAP8(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1);
+ apple2_font[i] = bitswap<8>(apple2_font[i], 7, 7, 6, 5, 4, 3, 2, 1);
}
}
@@ -544,7 +544,7 @@ void apple2_state::apple2_video_start(const uint8_t *vram, const uint8_t *aux_vr
int len = memregion("gfx1")->bytes();
for (i = 0; i < len; i++)
{
- apple2_font[i] = BITSWAP8(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6);
+ apple2_font[i] = bitswap<8>(apple2_font[i], 7, 0, 1, 2, 3, 4, 5, 6);
}
}
diff --git a/src/mame/video/aussiebyte.cpp b/src/mame/video/aussiebyte.cpp
index 495cfd4..23de8c9 100644
--- a/src/mame/video/aussiebyte.cpp
+++ b/src/mame/video/aussiebyte.cpp
@@ -140,7 +140,7 @@ uint8_t aussiebyte_state::crt8002(uint8_t ac_ra, uint8_t ac_chr, uint8_t ac_attr
}
break;
case 1: // external mode
- gfx = BITSWAP8(ac_chr, 0,1,2,3,4,5,6,7);
+ gfx = bitswap<8>(ac_chr, 0,1,2,3,4,5,6,7);
break;
case 2: // thin gfx
break;
diff --git a/src/mame/video/champbas.cpp b/src/mame/video/champbas.cpp
index 9faf377..6ce7f96 100644
--- a/src/mame/video/champbas.cpp
+++ b/src/mame/video/champbas.cpp
@@ -114,7 +114,7 @@ PALETTE_INIT_MEMBER(champbas_state,exctsccr)
/* characters / sprites (3bpp) */
for (int i = 0; i < 0x100; i++)
{
- int swapped_i = BITSWAP8(i, 2, 7, 6, 5, 4, 3, 1, 0);
+ 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);
palette.set_pen_indirect(i, ctabentry);
}
diff --git a/src/mame/video/cvs.cpp b/src/mame/video/cvs.cpp
index afcae1a..f791ac7 100644
--- a/src/mame/video/cvs.cpp
+++ b/src/mame/video/cvs.cpp
@@ -39,7 +39,7 @@ PALETTE_INIT_MEMBER(cvs_state,cvs)
uint8_t ctabentry = color_prom[(i << 8) | attr] & 0x07;
/* bits 0 and 2 are swapped */
- ctabentry = BITSWAP8(ctabentry,7,6,5,4,3,0,1,2);
+ ctabentry = bitswap<8>(ctabentry,7,6,5,4,3,0,1,2);
palette.set_pen_indirect((attr << 3) | i, ctabentry);
}
diff --git a/src/mame/video/decocass.cpp b/src/mame/video/decocass.cpp
index 7c4708a..993be23 100644
--- a/src/mame/video/decocass.cpp
+++ b/src/mame/video/decocass.cpp
@@ -241,7 +241,7 @@ void decocass_state::draw_special_priority(bitmap_ind16 &bitmap, bitmap_ind8 &pr
if ((crossing == 0 || BIT(m_mode_set, 6)) && !BIT(m_mode_set, 5))
return;
- int color = (BITSWAP8(m_color_center_bot, 0, 1, 7, 2, 3, 4, 5, 6) & 0x27) | 0x08;
+ int color = (bitswap<8>(m_color_center_bot, 0, 1, 7, 2, 3, 4, 5, 6) & 0x27) | 0x08;
int sy = 64 - m_part_v_shift + 1;
if (sy < 0)
diff --git a/src/mame/video/dynax.cpp b/src/mame/video/dynax.cpp
index d8eb4a7..6177c37 100644
--- a/src/mame/video/dynax.cpp
+++ b/src/mame/video/dynax.cpp
@@ -38,9 +38,9 @@ PALETTE_INIT_MEMBER(dynax_state,sprtmtch)
{
int x = (color_prom[i] << 8) + color_prom[0x200 + i];
/* The bits are in reverse order! */
- int r = BITSWAP8((x >> 0) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int g = BITSWAP8((x >> 5) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
- int b = BITSWAP8((x >> 10) & 0x1f, 7, 6, 5, 0, 1, 2, 3, 4);
+ 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);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal5bit(b));
}
}
@@ -56,9 +56,9 @@ PALETTE_INIT_MEMBER(dynax_state,janyuki)
{
int x = (color_prom[i] << 8) + color_prom[0x200 + i];
/* The bits are in reverse order! */
- int r = BITSWAP8((x >> 0) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
- int g = BITSWAP8((x >> 5) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
- int b = BITSWAP8((x >> 10) & 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
+ 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);
palette.set_pen_color(i, pal4bit(r), pal4bit(g), pal4bit(b));
}
}
@@ -107,7 +107,7 @@ WRITE8_MEMBER(dynax_state::dynax_blit_dest_w)
{
m_blit_dest = data;
if (m_layer_layout == LAYOUT_HNORIDUR)
- m_blit_dest = BITSWAP8(m_blit_dest ^ 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
+ m_blit_dest = bitswap<8>(m_blit_dest ^ 0x0f, 7, 6, 5, 4, 0, 1, 2, 3);
LOG(("D=%02X ", data));
}
@@ -120,7 +120,7 @@ WRITE8_MEMBER(dynax_state::dynax_blit2_dest_w)
WRITE8_MEMBER(dynax_state::tenkai_blit_dest_w)
{
- dynax_blit_dest_w(space, 0, BITSWAP8(data, 7, 6, 5, 4, 0, 1, 2, 3));
+ dynax_blit_dest_w(space, 0, bitswap<8>(data, 7, 6, 5, 4, 0, 1, 2, 3));
}
/*
@@ -129,7 +129,7 @@ mjembase: b d e -> - 2 4 8
*/
WRITE8_MEMBER(dynax_state::mjembase_blit_dest_w)
{
- dynax_blit_dest_w(space, 0, BITSWAP8(data, 7, 6, 5, 4, 2, 3, 1, 0));
+ dynax_blit_dest_w(space, 0, bitswap<8>(data, 7, 6, 5, 4, 2, 3, 1, 0));
}
@@ -187,7 +187,7 @@ WRITE8_MEMBER(dynax_state::tenkai_blit_palette23_w)
WRITE8_MEMBER(dynax_state::mjembase_blit_palette23_w)
{
- dynax_blit_palette23_w(space, offset, BITSWAP8(data, 3, 2, 1, 0, 7, 6, 5, 4), mem_mask);
+ dynax_blit_palette23_w(space, offset, bitswap<8>(data, 3, 2, 1, 0, 7, 6, 5, 4), mem_mask);
}
@@ -1248,7 +1248,7 @@ WRITE8_MEMBER(dynax_state::hanamai_priority_w)
WRITE8_MEMBER(dynax_state::tenkai_priority_w)
{
- m_hanamai_priority = BITSWAP8(data, 3, 2, 1, 0, 4, 7, 5, 6);
+ m_hanamai_priority = bitswap<8>(data, 3, 2, 1, 0, 4, 7, 5, 6);
}
/*
@@ -1258,7 +1258,7 @@ mjelctrn: priority: 00 20 10 40 30 50; enable: 1,2,8
*/
WRITE8_MEMBER(dynax_state::mjembase_priority_w)
{
- m_hanamai_priority = BITSWAP8(data, 6, 5, 4, 3, 2, 7, 1, 0);
+ m_hanamai_priority = bitswap<8>(data, 6, 5, 4, 3, 2, 7, 1, 0);
}
@@ -1377,7 +1377,7 @@ uint32_t dynax_state::screen_update_hanamai(screen_device &screen, bitmap_ind16
uint32_t dynax_state::screen_update_hnoridur(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int layers_ctrl = ~BITSWAP8(m_hanamai_priority, 7, 6, 5, 4, 0, 1, 2, 3);
+ int layers_ctrl = ~bitswap<8>(m_hanamai_priority, 7, 6, 5, 4, 0, 1, 2, 3);
int lay[4];
int pri;
diff --git a/src/mame/video/gsword.cpp b/src/mame/video/gsword.cpp
index 46e851c..a9b7fe2 100644
--- a/src/mame/video/gsword.cpp
+++ b/src/mame/video/gsword.cpp
@@ -168,7 +168,7 @@ PALETTE_INIT_MEMBER(gsword_state, gsword)
/* sprites */
for (unsigned i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = (BITSWAP8(color_prom[i - 0x100],7,6,5,4,0,1,2,3) & 0x0f) | 0x80;
+ 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);
}
}
diff --git a/src/mame/video/hanaawas.cpp b/src/mame/video/hanaawas.cpp
index 5a16724..85badce 100644
--- a/src/mame/video/hanaawas.cpp
+++ b/src/mame/video/hanaawas.cpp
@@ -56,7 +56,7 @@ PALETTE_INIT_MEMBER(hanaawas_state, hanaawas)
3bpp ones 0x10-0x1f */
for (i = 0; i < 0x100; i++)
{
- int swapped_i = BITSWAP8(i,2,7,6,5,4,3,1,0);
+ int swapped_i = bitswap<8>(i,2,7,6,5,4,3,1,0);
uint8_t ctabentry = color_prom[swapped_i] & 0x0f;
palette.set_pen_indirect(i, ctabentry);
}
diff --git a/src/mame/video/igs017_igs031.cpp b/src/mame/video/igs017_igs031.cpp
index 5a0681f..6b34006 100644
--- a/src/mame/video/igs017_igs031.cpp
+++ b/src/mame/video/igs017_igs031.cpp
@@ -145,8 +145,8 @@ void igs017_igs031_device::video_start()
for (i = 0; i < size ; i++)
{
- rom[i] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
-// rom[i^1] = BITSWAP8(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
+ rom[i] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
+// rom[i^1] = bitswap<8>(rom[i], 0, 1, 2, 3, 4, 5, 6, 7);
}
}
}
diff --git a/src/mame/video/irobot.cpp b/src/mame/video/irobot.cpp
index 0d97e8b..8201279 100644
--- a/src/mame/video/irobot.cpp
+++ b/src/mame/video/irobot.cpp
@@ -53,7 +53,7 @@ PALETTE_INIT_MEMBER(irobot_state, irobot)
int g = 28 * ((color_prom[i] >> 4) & 0x03) * intensity;
int b = 28 * ((color_prom[i] >> 2) & 0x03) * intensity;
- int swapped_i = BITSWAP8(i,7,6,5,4,3,0,1,2);
+ int 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/kan_pand.cpp b/src/mame/video/kan_pand.cpp
index 8f4d4ed..91ca22f 100644
--- a/src/mame/video/kan_pand.cpp
+++ b/src/mame/video/kan_pand.cpp
@@ -235,7 +235,7 @@ WRITE8_MEMBER ( kaneko_pandora_device::spriteram_w )
{
// it's either hooked up oddly on this, or on the 16-bit games
// either way, we swap the address lines so that the spriteram is in the same format
- offset = BITSWAP16(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
+ offset = bitswap<16>(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
if (!m_spriteram)
{
@@ -256,7 +256,7 @@ READ8_MEMBER( kaneko_pandora_device::spriteram_r )
{
// it's either hooked up oddly on this, or on the 16-bit games
// either way, we swap the address lines so that the spriteram is in the same format
- offset = BITSWAP16(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
+ offset = bitswap<16>(offset, 15,14,13,12, 11, 7,6,5,4,3,2,1,0, 10,9,8 );
if (!m_spriteram)
{
diff --git a/src/mame/video/kingobox.cpp b/src/mame/video/kingobox.cpp
index 8335f51..9a81d46 100644
--- a/src/mame/video/kingobox.cpp
+++ b/src/mame/video/kingobox.cpp
@@ -211,7 +211,7 @@ void kingofb_state::kingofb_draw_sprites(bitmap_ind16 &bitmap, const rectangle &
int roffs, bank, code, color, flipx, flipy, sx, sy;
/* the offset into spriteram seems scrambled */
- roffs = BITSWAP16(offs,15,14,13,12,11,10,4,7,6,5,9,8,3,2,1,0) ^ 0x3c;
+ roffs = bitswap<16>(offs,15,14,13,12,11,10,4,7,6,5,9,8,3,2,1,0) ^ 0x3c;
if (roffs & 0x200)
roffs ^= 0x1c0;
diff --git a/src/mame/video/ladybug.cpp b/src/mame/video/ladybug.cpp
index 3f2baa4..0c7268f 100644
--- a/src/mame/video/ladybug.cpp
+++ b/src/mame/video/ladybug.cpp
@@ -83,10 +83,10 @@ void ladybug_state::palette_init_common( palette_device &palette, const uint8_t
{
uint8_t ctabentry = color_prom[(i - 0x20) >> 1];
- ctabentry = BITSWAP8((color_prom[i - 0x20] >> 0) & 0x0f, 7,6,5,4,0,1,2,3);
+ 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 = BITSWAP8((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
+ ctabentry = bitswap<8>((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
palette.set_pen_indirect(i + 0x20, ctabentry);
}
}
diff --git a/src/mame/video/mbee.cpp b/src/mame/video/mbee.cpp
index 37c12ec..deba6df 100644
--- a/src/mame/video/mbee.cpp
+++ b/src/mame/video/mbee.cpp
@@ -434,7 +434,7 @@ PALETTE_INIT_MEMBER( mbee_state, standard )
for (r1 = 0; r1 < 4; r1++)
{
r = bglevel[r1];
- k = BITSWAP8(i, 7, 6, 5, 3, 1, 4, 2, 0);
+ k = bitswap<8>(i, 7, 6, 5, 3, 1, 4, 2, 0);
palette.set_pen_color(k, rgb_t(r, g, b));
i++;
}
diff --git a/src/mame/video/mz700.cpp b/src/mame/video/mz700.cpp
index 0bb0bdd..9a919f9 100644
--- a/src/mame/video/mz700.cpp
+++ b/src/mame/video/mz700.cpp
@@ -32,7 +32,7 @@ uint32_t mz_state::screen_update_mz700(screen_device &screen, bitmap_ind16 &bitm
if (col != oldcol)
{
oldcol = col;
- col = BITSWAP8(col, 7, 3, 4, 6, 5, 0, 2, 1); // turn BRG into RGB
+ col = bitswap<8>(col, 7, 3, 4, 6, 5, 0, 2, 1); // turn BRG into RGB
bg = col & 7;
fg = (col >> 3) & 7;
}
diff --git a/src/mame/video/naughtyb.cpp b/src/mame/video/naughtyb.cpp
index d566a8e..5b395f6 100644
--- a/src/mame/video/naughtyb.cpp
+++ b/src/mame/video/naughtyb.cpp
@@ -91,7 +91,7 @@ PALETTE_INIT_MEMBER(naughtyb_state, naughtyb)
bit1 = (color_prom[i+0x100] >> 1) & 0x01;
b = combine_2_weights(weights, bit0, bit1);
- palette.set_pen_color(BITSWAP8(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/nmk16.cpp b/src/mame/video/nmk16.cpp
index d736707..b48d678 100644
--- a/src/mame/video/nmk16.cpp
+++ b/src/mame/video/nmk16.cpp
@@ -486,7 +486,7 @@ void nmk16_state::nmk16_draw_sprites_swap(bitmap_ind16 &bitmap, const rectangle
for (i = 0; i < 0x100; i++)
{
- int spr = BITSWAP8(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]);
+ int spr = bitswap<8>(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]);
nmk16_draw_sprite(bitmap, cliprect, m_spriteram_old2.get() + (spr * 16/2));
}
}
@@ -497,7 +497,7 @@ void nmk16_state::nmk16_draw_sprites_swap_flipsupported(bitmap_ind16 &bitmap, co
for ( i = 0; i < 0x100; i++ )
{
- int spr = BITSWAP8(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]);
+ int spr = bitswap<8>(i, bittbl[0], bittbl[1], bittbl[2], bittbl[3], bittbl[4], bittbl[5], bittbl[6], bittbl[7]);
nmk16_draw_sprite_flipsupported(bitmap, cliprect, m_spriteram_old2.get() + (spr * 16/2));
}
}
diff --git a/src/mame/video/pc9801.cpp b/src/mame/video/pc9801.cpp
index e9c49d2..c830560 100644
--- a/src/mame/video/pc9801.cpp
+++ b/src/mame/video/pc9801.cpp
@@ -470,14 +470,14 @@ WRITE16_MEMBER(pc9801_state::tvram_w)
/* +0x8000 is trusted (bank 0 is actually used by 16 colors mode) */
READ8_MEMBER(pc9801_state::gvram_r)
{
- return BITSWAP8(m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] >> ((offset & 1) << 3),0,1,2,3,4,5,6,7);
+ return bitswap<8>(m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] >> ((offset & 1) << 3),0,1,2,3,4,5,6,7);
}
WRITE8_MEMBER(pc9801_state::gvram_w)
{
uint16_t ram = m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000];
int mask = (offset & 1) << 3;
- data = BITSWAP8(data,0,1,2,3,4,5,6,7);
+ data = bitswap<8>(data,0,1,2,3,4,5,6,7);
m_video_ram_2[(offset>>1)+0x04000+m_vram_bank*0x10000] = (ram & (0xff00 >> mask)) | (data << mask);
}
diff --git a/src/mame/video/pingpong.cpp b/src/mame/video/pingpong.cpp
index aee2b1a..cced692 100644
--- a/src/mame/video/pingpong.cpp
+++ b/src/mame/video/pingpong.cpp
@@ -77,7 +77,7 @@ PALETTE_INIT_MEMBER(pingpong_state, pingpong)
/* sprites */
for (i = 0x100; i < 0x200; i++)
{
- uint8_t ctabentry = BITSWAP8(color_prom[i],7,6,5,4,0,1,2,3);
+ uint8_t 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/redclash.cpp b/src/mame/video/redclash.cpp
index 49df751..44e98d6 100644
--- a/src/mame/video/redclash.cpp
+++ b/src/mame/video/redclash.cpp
@@ -88,10 +88,10 @@ PALETTE_INIT_MEMBER(redclash_state,redclash)
{
uint8_t ctabentry = color_prom[(i - 0x20) >> 1];
- ctabentry = BITSWAP8((color_prom[i - 0x20] >> 0) & 0x0f, 7,6,5,4,0,1,2,3);
+ 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 = BITSWAP8((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
+ ctabentry = bitswap<8>((color_prom[i - 0x20] >> 4) & 0x0f, 7,6,5,4,0,1,2,3);
palette.set_pen_indirect(i + 0x20, ctabentry);
}
diff --git a/src/mame/video/retofinv.cpp b/src/mame/video/retofinv.cpp
index 34997a7..9495db8 100644
--- a/src/mame/video/retofinv.cpp
+++ b/src/mame/video/retofinv.cpp
@@ -45,7 +45,7 @@ PALETTE_INIT_MEMBER(retofinv_state, retofinv)
for (i = 0; i < 0x800; i++)
{
// descramble the address
- int j = BITSWAP16(i,15,14,13,12,11,10,9,8,7,6,5,4,3,0,1,2);
+ int 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]);
}
}
@@ -83,7 +83,7 @@ PALETTE_INIT_MEMBER(retofinv_state, retofinv_bl)
for (i = 0; i < 0x800; i++)
{
// descramble the data
- palette.set_pen_indirect(i + 0x200, BITSWAP8(clut_prom[i], 4,5,6,7,3,2,1,0));
+ 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/segaic16.cpp b/src/mame/video/segaic16.cpp
index 061ce37..37df010 100644
--- a/src/mame/video/segaic16.cpp
+++ b/src/mame/video/segaic16.cpp
@@ -457,7 +457,7 @@ void draw_virtual_tilemap(screen_device &screen, segaic16_video_device::tilemap_
if (info->flip)
{
- pages = BITSWAP16(pages,
+ pages = bitswap<16>(pages,
3, 2, 1, 0,
7, 6, 5, 4,
11, 10, 9, 8,
diff --git a/src/mame/video/seibu_crtc.cpp b/src/mame/video/seibu_crtc.cpp
index 24a9dcc..32c25de 100644
--- a/src/mame/video/seibu_crtc.cpp
+++ b/src/mame/video/seibu_crtc.cpp
@@ -370,10 +370,10 @@ WRITE16_MEMBER( seibu_crtc_device::write )
/* Sky Smasher / Raiden DX swaps registers [0x10] with [0x20] */
READ16_MEMBER( seibu_crtc_device::read_alt )
{
- return read_word(BITSWAP16(offset,15,14,13,12,11,10,9,8,7,6,5,3,4,2,1,0));
+ return read_word(bitswap<16>(offset,15,14,13,12,11,10,9,8,7,6,5,3,4,2,1,0));
}
WRITE16_MEMBER( seibu_crtc_device::write_alt )
{
- write_word(BITSWAP16(offset,15,14,13,12,11,10,9,8,7,6,5,3,4,2,1,0),data);
+ write_word(bitswap<16>(offset,15,14,13,12,11,10,9,8,7,6,5,3,4,2,1,0),data);
}
diff --git a/src/mame/video/seibuspi.cpp b/src/mame/video/seibuspi.cpp
index 1cadd87..78dfa18 100644
--- a/src/mame/video/seibuspi.cpp
+++ b/src/mame/video/seibuspi.cpp
@@ -40,7 +40,7 @@ custom CRTC on startup!! (writes to 000414)
static uint32_t decrypt_tile(uint32_t val, int tileno, uint32_t key1, uint32_t key2, uint32_t key3)
{
- val = BITSWAP24(val, 18,19,9,5, 10,17,16,20, 21,22,6,11, 15,14,4,23, 0,1,7,8, 13,12,3,2);
+ val = bitswap<24>(val, 18,19,9,5, 10,17,16,20, 21,22,6,11, 15,14,4,23, 0,1,7,8, 13,12,3,2);
return partial_carry_sum24( val, tileno + key1, key2 ) ^ key3;
}
diff --git a/src/mame/video/snookr10.cpp b/src/mame/video/snookr10.cpp
index 7392af1..fb854d7 100644
--- a/src/mame/video/snookr10.cpp
+++ b/src/mame/video/snookr10.cpp
@@ -150,7 +150,7 @@ PALETTE_INIT_MEMBER(snookr10_state, apple10)
g = combine_2_weights(weights_g, bit0, bit1);
/* encrypted color matrix */
- cn = BITSWAP8(i,4,5,6,7,2,3,0,1);
+ cn = bitswap<8>(i,4,5,6,7,2,3,0,1);
palette.set_pen_color(cn, rgb_t(r,g,b));
}
@@ -165,7 +165,7 @@ TILE_GET_INFO_MEMBER(snookr10_state::apple10_get_bg_tile_info)
*/
int offs = tile_index;
int attr = m_videoram[offs] + (m_colorram[offs] << 8);
- int code = BITSWAP16((attr & 0xfff),15,14,13,12,8,9,10,11,0,1,2,3,4,5,6,7); /* encrypted tile matrix */
+ int code = bitswap<16>((attr & 0xfff),15,14,13,12,8,9,10,11,0,1,2,3,4,5,6,7); /* encrypted tile matrix */
int color = m_colorram[offs] >> 4;
SET_TILE_INFO_MEMBER(0, code, color, 0);
@@ -219,7 +219,7 @@ PALETTE_INIT_MEMBER(snookr10_state, crystalc)
g = combine_2_weights(weights_g, bit0, bit1);
/* encrypted color matrix */
- cn = BITSWAP8(i,7,5,6,4,3,2,1,0);
+ cn = bitswap<8>(i,7,5,6,4,3,2,1,0);
palette.set_pen_color(cn, rgb_t(r,g,b));
}
@@ -234,7 +234,7 @@ TILE_GET_INFO_MEMBER(snookr10_state::crystalc_get_bg_tile_info)
*/
int offs = tile_index;
int attr = m_videoram[offs] + (m_colorram[offs] << 8);
- int code = BITSWAP16((attr & 0xfff),15,14,13,12,0,10,5,1,7,6,9,4,3,2,8,11); /* encrypted tile matrix */
+ int code = bitswap<16>((attr & 0xfff),15,14,13,12,0,10,5,1,7,6,9,4,3,2,8,11); /* encrypted tile matrix */
int color = m_colorram[offs] >> 4;
SET_TILE_INFO_MEMBER(0, code, color, 0);
diff --git a/src/mame/video/splash.cpp b/src/mame/video/splash.cpp
index 0cccead..766f6b6 100644
--- a/src/mame/video/splash.cpp
+++ b/src/mame/video/splash.cpp
@@ -78,9 +78,8 @@ WRITE16_MEMBER(splash_state::vram_w)
void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- int sx,sy,color,count,colxor,bitswap;
- colxor = 0; /* splash and some bitmap modes in roldfrog */
- bitswap = 0;
+ int colxor = 0; /* splash and some bitmap modes in roldfrog */
+ int swaps = 0;
if (m_bitmap_type == 1) /* roldfrog */
{
@@ -90,7 +89,7 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
}
else if (m_bitmap_mode[0] == 0x0100)
{
- bitswap = 1;
+ swaps = 1;
}
else if (m_bitmap_mode[0] == 0x0200)
{
@@ -98,56 +97,56 @@ void splash_state::draw_bitmap(bitmap_ind16 &bitmap, const rectangle &cliprect)
}
else if (m_bitmap_mode[0] == 0x0300)
{
- bitswap = 2;
+ swaps = 2;
colxor = 0x7f;
}
else if (m_bitmap_mode[0] == 0x0400)
{
- bitswap = 3;
+ swaps = 3;
}
else if (m_bitmap_mode[0] == 0x0500)
{
- bitswap = 4;
+ swaps = 4;
}
else if (m_bitmap_mode[0] == 0x0600)
{
- bitswap = 5;
+ swaps = 5;
colxor = 0x7f;
}
else if (m_bitmap_mode[0] == 0x0700)
{
- bitswap = 6;
+ swaps = 6;
colxor = 0x55;
}
}
- count = 0;
- for (sy=0;sy<256;sy++)
+ int count = 0;
+ for (int sy=0;sy<256;sy++)
{
- for (sx=0;sx<512;sx++)
+ for (int sx=0;sx<512;sx++)
{
- color = m_pixelram[count]&0xff;
+ int color = m_pixelram[count]&0xff;
count++;
- switch( bitswap )
+ switch (swaps)
{
case 1:
- color = BITSWAP8(color,7,0,1,2,3,4,5,6);
+ color = bitswap<8>(color,7,0,1,2,3,4,5,6);
break;
case 2:
- color = BITSWAP8(color,7,4,6,5,1,0,3,2);
+ color = bitswap<8>(color,7,4,6,5,1,0,3,2);
break;
case 3:
- color = BITSWAP8(color,7,3,2,1,0,6,5,4);
+ color = bitswap<8>(color,7,3,2,1,0,6,5,4);
break;
case 4:
- color = BITSWAP8(color,7,6,4,2,0,5,3,1);
+ color = bitswap<8>(color,7,6,4,2,0,5,3,1);
break;
case 5:
- color = BITSWAP8(color,7,0,6,5,4,3,2,1);
+ color = bitswap<8>(color,7,0,6,5,4,3,2,1);
break;
case 6:
- color = BITSWAP8(color,7,4,3,2,1,0,6,5);
+ color = bitswap<8>(color,7,4,3,2,1,0,6,5);
break;
}
diff --git a/src/mame/video/thepit.cpp b/src/mame/video/thepit.cpp
index cafd973..51086bc 100644
--- a/src/mame/video/thepit.cpp
+++ b/src/mame/video/thepit.cpp
@@ -79,8 +79,8 @@ PALETTE_INIT_MEMBER(thepit_state,suprmous)
for (i = 0; i < 32; i++)
{
- uint8_t b = BITSWAP8(color_prom[i + 0x00], 0, 1, 2, 3, 4, 5, 6, 7);
- uint8_t g = BITSWAP8(color_prom[i + 0x20], 0, 1, 2, 3, 4, 5, 6, 7);
+ 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);
palette.set_pen_color(i, pal5bit(r), pal5bit(g), pal4bit(b));
diff --git a/src/mame/video/tia.cpp b/src/mame/video/tia.cpp
index f4571c1..ccb8434 100644
--- a/src/mame/video/tia.cpp
+++ b/src/mame/video/tia.cpp
@@ -447,7 +447,7 @@ void tia_video_device::draw_sprite_helper(uint8_t* p, uint8_t *col, struct playe
if (REFP & 8)
{
- GRP = BITSWAP8(GRP, 0, 1, 2, 3, 4, 5, 6, 7);
+ GRP = bitswap<8>(GRP, 0, 1, 2, 3, 4, 5, 6, 7);
}
for (i = 0; i < PLAYER_GFX_SLOTS; i++)
@@ -539,9 +539,9 @@ void tia_video_device::draw_playfield_helper(uint8_t* p, uint8_t* col, int horz,
uint8_t COLU, uint8_t REFPF)
{
uint32_t PF =
- (BITSWAP8(PF0, 0, 1, 2, 3, 4, 5, 6, 7) << 0x10) |
- (BITSWAP8(PF1, 7, 6, 5, 4, 3, 2, 1, 0) << 0x08) |
- (BITSWAP8(PF2, 0, 1, 2, 3, 4, 5, 6, 7) << 0x00);
+ (bitswap<8>(PF0, 0, 1, 2, 3, 4, 5, 6, 7) << 0x10) |
+ (bitswap<8>(PF1, 7, 6, 5, 4, 3, 2, 1, 0) << 0x08) |
+ (bitswap<8>(PF2, 0, 1, 2, 3, 4, 5, 6, 7) << 0x00);
int i;
int j;
diff --git a/src/mame/video/tx1.cpp b/src/mame/video/tx1.cpp
index 019b007..dabfc0a 100644
--- a/src/mame/video/tx1.cpp
+++ b/src/mame/video/tx1.cpp
@@ -1499,7 +1499,7 @@ void tx1_state::buggyboy_get_roadpix(int screen, int ls161, uint8_t rva0_6, uint
*rc3 = d0 & d1;
if (rom_flip)
- *rc3 = BITSWAP8(*rc3, 0, 1, 2, 3, 4, 5, 6, 7);
+ *rc3 = bitswap<8>(*rc3, 0, 1, 2, 3, 4, 5, 6, 7);
}
else
*rc3 = 0;
diff --git a/src/mame/video/xevious.cpp b/src/mame/video/xevious.cpp
index 2429afd..9d336b4 100644
--- a/src/mame/video/xevious.cpp
+++ b/src/mame/video/xevious.cpp
@@ -259,7 +259,7 @@ READ8_MEMBER( xevious_state::xevious_bb_r )
/* return BB0 */
dat2 = rom2c[adr_2c];
/* swap bit 6 & 7 */
- dat2 = BITSWAP8(dat2, 6,7,5,4,3,2,1,0);
+ dat2 = bitswap<8>(dat2, 6,7,5,4,3,2,1,0);
/* flip x & y */
if (dat1 & 0x400) dat2 ^= 0x40;
if (dat1 & 0x200) dat2 ^= 0x80;