summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:42 +0200
committer Olivier Galibert <galibert@pobox.com>2020-05-25 16:42:57 +0200
commit22513fb6fe281f5ccb75aaddb6417a12a66c313d (patch)
tree3cf84032cc6482d685a8dbb57e015bd17c7f7fdc
parente42c2d2874cf9c1092c01ab5ce9ef997d465ce25 (diff)
emumem: A little more speedup. cache and specific change syntax, and are not pointers anymore [O. Galibert]
The last(?) two changes are: - Add a template parameter to everything (theoretically the address space width, in practice a level derived from it to keep as much compatibility between widths as possible) so that the shift size becomes a constant. - Change the syntax of declaring and initializing the caches and specifics so that they're embedded in the owner device. Solves lifetime issues and also removes one indirection (looking up the base dispatch pointer through the cache/specific pointer).
-rw-r--r--docs/source/techspecs/device_rom_interface.rst21
-rw-r--r--scripts/src/emu.lua2
-rw-r--r--src/devices/bus/multibus/isbc202.cpp5
-rw-r--r--src/devices/bus/multibus/isbc202.h2
-rw-r--r--src/devices/cpu/8x300/8x300.cpp12
-rw-r--r--src/devices/cpu/8x300/8x300.h6
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.cpp23
-rw-r--r--src/devices/cpu/adsp2100/adsp2100.h8
-rw-r--r--src/devices/cpu/am29000/am29000.cpp15
-rw-r--r--src/devices/cpu/am29000/am29000.h11
-rw-r--r--src/devices/cpu/am29000/am29ops.h10
-rw-r--r--src/devices/cpu/arm/arm.cpp8
-rw-r--r--src/devices/cpu/arm/arm.h2
-rw-r--r--src/devices/cpu/arm7/arm7.cpp12
-rw-r--r--src/devices/cpu/arm7/arm7.h2
-rw-r--r--src/devices/cpu/asap/asap.cpp40
-rw-r--r--src/devices/cpu/asap/asap.h4
-rw-r--r--src/devices/cpu/bcp/dp8344.cpp23
-rw-r--r--src/devices/cpu/bcp/dp8344.h6
-rw-r--r--src/devices/cpu/capricorn/capricorn.cpp10
-rw-r--r--src/devices/cpu/capricorn/capricorn.h4
-rw-r--r--src/devices/cpu/ccpu/ccpu.cpp18
-rw-r--r--src/devices/cpu/ccpu/ccpu.h8
-rw-r--r--src/devices/cpu/cop400/cop400.cpp15
-rw-r--r--src/devices/cpu/cop400/cop400.h7
-rw-r--r--src/devices/cpu/cosmac/cosmac.cpp21
-rw-r--r--src/devices/cpu/cosmac/cosmac.h6
-rw-r--r--src/devices/cpu/cr16b/cr16b.cpp6
-rw-r--r--src/devices/cpu/cr16b/cr16b.h4
-rw-r--r--src/devices/cpu/cubeqcpu/cubeqcpu.cpp18
-rw-r--r--src/devices/cpu/cubeqcpu/cubeqcpu.h13
-rw-r--r--src/devices/cpu/diablo/diablo1300.cpp21
-rw-r--r--src/devices/cpu/diablo/diablo1300.h6
-rw-r--r--src/devices/cpu/dsp16/dsp16.cpp16
-rw-r--r--src/devices/cpu/dsp16/dsp16.h2
-rw-r--r--src/devices/cpu/dsp16/dsp16fe.cpp6
-rw-r--r--src/devices/cpu/dsp16/dsp16fe.h8
-rw-r--r--src/devices/cpu/dsp32/dsp32.cpp20
-rw-r--r--src/devices/cpu/dsp32/dsp32.h4
-rw-r--r--src/devices/cpu/dsp56156/dsp56156.cpp10
-rw-r--r--src/devices/cpu/dsp56156/dsp56156.h6
-rw-r--r--src/devices/cpu/dsp56156/dsp56ops.hxx46
-rw-r--r--src/devices/cpu/dsp56156/dsp56pcu.cpp6
-rw-r--r--src/devices/cpu/dspp/dspp.cpp25
-rw-r--r--src/devices/cpu/dspp/dspp.h8
-rw-r--r--src/devices/cpu/dspp/dsppdrc.cpp8
-rw-r--r--src/devices/cpu/e132xs/e132xs.cpp18
-rw-r--r--src/devices/cpu/e132xs/e132xs.h3
-rw-r--r--src/devices/cpu/esrip/esrip.cpp6
-rw-r--r--src/devices/cpu/esrip/esrip.h4
-rw-r--r--src/devices/cpu/f8/f8.cpp147
-rw-r--r--src/devices/cpu/f8/f8.h7
-rw-r--r--src/devices/cpu/fr/fr.cpp8
-rw-r--r--src/devices/cpu/fr/fr.h4
-rw-r--r--src/devices/cpu/g65816/g65816.cpp7
-rw-r--r--src/devices/cpu/g65816/g65816.h7
-rw-r--r--src/devices/cpu/g65816/g65816cm.h8
-rw-r--r--src/devices/cpu/h6280/h6280.cpp40
-rw-r--r--src/devices/cpu/h6280/h6280.h6
-rw-r--r--src/devices/cpu/h8/h8.cpp18
-rw-r--r--src/devices/cpu/h8/h8.h5
-rw-r--r--src/devices/cpu/h8500/h8500.cpp4
-rw-r--r--src/devices/cpu/h8500/h8500.h2
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.cpp18
-rw-r--r--src/devices/cpu/hphybrid/hphybrid.h6
-rw-r--r--src/devices/cpu/i386/athlon.cpp54
-rw-r--r--src/devices/cpu/i386/athlon.h6
-rw-r--r--src/devices/cpu/i386/i386.cpp4
-rw-r--r--src/devices/cpu/i386/i386.h16
-rw-r--r--src/devices/cpu/i8008/i8008.cpp20
-rw-r--r--src/devices/cpu/i8008/i8008.h6
-rw-r--r--src/devices/cpu/i8085/i8085.cpp32
-rw-r--r--src/devices/cpu/i8085/i8085.h7
-rw-r--r--src/devices/cpu/i86/i86.cpp8
-rw-r--r--src/devices/cpu/i86/i86.h3
-rw-r--r--src/devices/cpu/i960/i960.cpp130
-rw-r--r--src/devices/cpu/i960/i960.h4
-rw-r--r--src/devices/cpu/ie15/ie15.cpp19
-rw-r--r--src/devices/cpu/ie15/ie15.h6
-rw-r--r--src/devices/cpu/jaguar/jaguar.cpp24
-rw-r--r--src/devices/cpu/jaguar/jaguar.h6
-rw-r--r--src/devices/cpu/ks0164/ks0164.cpp78
-rw-r--r--src/devices/cpu/ks0164/ks0164.h4
-rw-r--r--src/devices/cpu/lc8670/lc8670.cpp34
-rw-r--r--src/devices/cpu/lc8670/lc8670.h8
-rw-r--r--src/devices/cpu/lh5801/5801tbl.hxx342
-rw-r--r--src/devices/cpu/lh5801/lh5801.cpp14
-rw-r--r--src/devices/cpu/lh5801/lh5801.h8
-rw-r--r--src/devices/cpu/m37710/m37710.cpp4
-rw-r--r--src/devices/cpu/m37710/m37710.h4
-rw-r--r--src/devices/cpu/m37710/m37710cm.h12
-rw-r--r--src/devices/cpu/m6502/m4510.cpp8
-rw-r--r--src/devices/cpu/m6502/m6502.cpp16
-rw-r--r--src/devices/cpu/m6502/m6502.h4
-rw-r--r--src/devices/cpu/m6502/m6504.cpp8
-rw-r--r--src/devices/cpu/m6502/m6507.cpp8
-rw-r--r--src/devices/cpu/m6502/m6509.cpp12
-rw-r--r--src/devices/cpu/m6502/m6510.cpp16
-rw-r--r--src/devices/cpu/m6502/n2a03.cpp2
-rw-r--r--src/devices/cpu/m6502/r65c19.cpp24
-rw-r--r--src/devices/cpu/m6502/r65c19.h6
-rw-r--r--src/devices/cpu/m6502/st2204.cpp27
-rw-r--r--src/devices/cpu/m6502/st2205u.cpp30
-rw-r--r--src/devices/cpu/m6502/st2xxx.h4
-rw-r--r--src/devices/cpu/m6502/xavix.cpp4
-rw-r--r--src/devices/cpu/m6800/m6800.cpp15
-rw-r--r--src/devices/cpu/m6800/m6800.h4
-rw-r--r--src/devices/cpu/m68000/m68000.h7
-rw-r--r--src/devices/cpu/m68000/m68kcpu.cpp212
-rw-r--r--src/devices/cpu/m6805/6805ops.hxx66
-rw-r--r--src/devices/cpu/m6805/m6805.cpp221
-rw-r--r--src/devices/cpu/m6805/m6805.h224
-rw-r--r--src/devices/cpu/m6805/m6805defs.h54
-rw-r--r--src/devices/cpu/m6805/m68705.cpp44
-rw-r--r--src/devices/cpu/m6805/m68hc05.cpp35
-rw-r--r--src/devices/cpu/m6809/m6809.cpp16
-rw-r--r--src/devices/cpu/m6809/m6809.h4
-rw-r--r--src/devices/cpu/m88000/m88000.cpp6
-rw-r--r--src/devices/cpu/m88000/m88000.h4
-rw-r--r--src/devices/cpu/mb86233/mb86233.cpp59
-rw-r--r--src/devices/cpu/mb86233/mb86233.h8
-rw-r--r--src/devices/cpu/mb86235/mb86235.cpp10
-rw-r--r--src/devices/cpu/mb86235/mb86235.h9
-rw-r--r--src/devices/cpu/mb86235/mb86235fe.cpp2
-rw-r--r--src/devices/cpu/mb86235/mb86235ops.cpp16
-rw-r--r--src/devices/cpu/mb88xx/mb88xx.cpp12
-rw-r--r--src/devices/cpu/mb88xx/mb88xx.h7
-rw-r--r--src/devices/cpu/mc68hc11/mc68hc11.cpp24
-rw-r--r--src/devices/cpu/mc68hc11/mc68hc11.h8
-rw-r--r--src/devices/cpu/mcs40/mcs40.cpp7
-rw-r--r--src/devices/cpu/mcs40/mcs40.h2
-rw-r--r--src/devices/cpu/mcs48/mcs48.cpp14
-rw-r--r--src/devices/cpu/mcs48/mcs48.h17
-rw-r--r--src/devices/cpu/mcs51/mcs51.cpp43
-rw-r--r--src/devices/cpu/mcs51/mcs51.h7
-rw-r--r--src/devices/cpu/mcs96/mcs96.cpp8
-rw-r--r--src/devices/cpu/mcs96/mcs96.h2
-rw-r--r--src/devices/cpu/mips/mips3.cpp24
-rw-r--r--src/devices/cpu/mips/mips3.h5
-rw-r--r--src/devices/cpu/nanoprocessor/nanoprocessor.cpp14
-rw-r--r--src/devices/cpu/nanoprocessor/nanoprocessor.h6
-rw-r--r--src/devices/cpu/nec/nec.cpp12
-rw-r--r--src/devices/cpu/nec/nec.h3
-rw-r--r--src/devices/cpu/nec/v25.cpp8
-rw-r--r--src/devices/cpu/nec/v25.h3
-rw-r--r--src/devices/cpu/pace/pace.cpp26
-rw-r--r--src/devices/cpu/pace/pace.h4
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.cpp13
-rw-r--r--src/devices/cpu/pic16c5x/pic16c5x.h5
-rw-r--r--src/devices/cpu/pic16c62x/pic16c62x.cpp22
-rw-r--r--src/devices/cpu/pic16c62x/pic16c62x.h8
-rw-r--r--src/devices/cpu/powerpc/ppc.h2
-rw-r--r--src/devices/cpu/powerpc/ppccom.cpp18
-rw-r--r--src/devices/cpu/pps4/pps4.cpp25
-rw-r--r--src/devices/cpu/pps4/pps4.h8
-rw-r--r--src/devices/cpu/psx/psx.cpp24
-rw-r--r--src/devices/cpu/psx/psx.h4
-rw-r--r--src/devices/cpu/rii/riscii.cpp121
-rw-r--r--src/devices/cpu/rii/riscii.h6
-rw-r--r--src/devices/cpu/rsp/rsp.cpp32
-rw-r--r--src/devices/cpu/rsp/rsp.h4
-rw-r--r--src/devices/cpu/rsp/rspdrc.cpp12
-rw-r--r--src/devices/cpu/rsp/rspfe.cpp2
-rw-r--r--src/devices/cpu/rx01/rx01.cpp16
-rw-r--r--src/devices/cpu/rx01/rx01.h4
-rw-r--r--src/devices/cpu/s2650/s2650.cpp27
-rw-r--r--src/devices/cpu/s2650/s2650.h5
-rw-r--r--src/devices/cpu/saturn/satops.ipp8
-rw-r--r--src/devices/cpu/saturn/saturn.cpp5
-rw-r--r--src/devices/cpu/saturn/saturn.h4
-rw-r--r--src/devices/cpu/sc61860/sc61860.cpp4
-rw-r--r--src/devices/cpu/sc61860/sc61860.h5
-rw-r--r--src/devices/cpu/sc61860/scops.hxx12
-rw-r--r--src/devices/cpu/scmp/scmp.cpp14
-rw-r--r--src/devices/cpu/scmp/scmp.h4
-rw-r--r--src/devices/cpu/score/score.cpp18
-rw-r--r--src/devices/cpu/score/score.h4
-rw-r--r--src/devices/cpu/se3208/se3208.cpp98
-rw-r--r--src/devices/cpu/se3208/se3208.h8
-rw-r--r--src/devices/cpu/sh/sh.h3
-rw-r--r--src/devices/cpu/sh/sh2.cpp12
-rw-r--r--src/devices/cpu/sh/sh2.h2
-rw-r--r--src/devices/cpu/sh/sh4.cpp24
-rw-r--r--src/devices/cpu/sparc/sparc.cpp6
-rw-r--r--src/devices/cpu/sparc/sparc.h2
-rw-r--r--src/devices/cpu/ssp1601/ssp1601.cpp14
-rw-r--r--src/devices/cpu/ssp1601/ssp1601.h6
-rw-r--r--src/devices/cpu/t11/t11.cpp14
-rw-r--r--src/devices/cpu/t11/t11.h4
-rw-r--r--src/devices/cpu/tms32010/tms32010.cpp24
-rw-r--r--src/devices/cpu/tms32010/tms32010.h8
-rw-r--r--src/devices/cpu/tms32025/tms32025.cpp140
-rw-r--r--src/devices/cpu/tms32025/tms32025.h8
-rw-r--r--src/devices/cpu/tms32031/tms32031.cpp20
-rw-r--r--src/devices/cpu/tms32031/tms32031.h4
-rw-r--r--src/devices/cpu/tms32051/32051ops.hxx2
-rw-r--r--src/devices/cpu/tms32051/tms32051.cpp22
-rw-r--r--src/devices/cpu/tms32051/tms32051.h8
-rw-r--r--src/devices/cpu/tms32082/mp_ops.cpp54
-rw-r--r--src/devices/cpu/tms32082/tms32082.cpp50
-rw-r--r--src/devices/cpu/tms32082/tms32082.h8
-rw-r--r--src/devices/cpu/tms34010/34010gfx.hxx96
-rw-r--r--src/devices/cpu/tms34010/34010ops.h16
-rw-r--r--src/devices/cpu/tms34010/34010ops.hxx6
-rw-r--r--src/devices/cpu/tms34010/tms34010.cpp20
-rw-r--r--src/devices/cpu/tms34010/tms34010.h26
-rw-r--r--src/devices/cpu/tms7000/tms7000.cpp6
-rw-r--r--src/devices/cpu/tms7000/tms7000.h44
-rw-r--r--src/devices/cpu/unsp/unsp.cpp13
-rw-r--r--src/devices/cpu/unsp/unsp.h11
-rw-r--r--src/devices/cpu/unsp/unspdrc.cpp12
-rw-r--r--src/devices/cpu/unsp/unspfe.cpp2
-rw-r--r--src/devices/cpu/upd7725/upd7725.cpp15
-rw-r--r--src/devices/cpu/upd7725/upd7725.h5
-rw-r--r--src/devices/cpu/upd7810/upd7810.cpp4
-rw-r--r--src/devices/cpu/upd7810/upd7810.h4
-rw-r--r--src/devices/cpu/upd7810/upd7810_macros.h8
-rw-r--r--src/devices/cpu/upd78k/upd78k0.cpp14
-rw-r--r--src/devices/cpu/upd78k/upd78k0.h8
-rw-r--r--src/devices/cpu/upd78k/upd78k2.cpp14
-rw-r--r--src/devices/cpu/upd78k/upd78k2.h8
-rw-r--r--src/devices/cpu/upd78k/upd78k3.cpp14
-rw-r--r--src/devices/cpu/upd78k/upd78k3.h9
-rw-r--r--src/devices/cpu/v30mz/v30mz.cpp24
-rw-r--r--src/devices/cpu/v30mz/v30mz.h6
-rw-r--r--src/devices/cpu/v60/v60.cpp16
-rw-r--r--src/devices/cpu/v60/v60.h3
-rw-r--r--src/devices/cpu/v810/v810.cpp32
-rw-r--r--src/devices/cpu/v810/v810.h6
-rw-r--r--src/devices/cpu/vt50/vt50.cpp24
-rw-r--r--src/devices/cpu/vt50/vt50.h4
-rw-r--r--src/devices/cpu/vt61/vt61.cpp9
-rw-r--r--src/devices/cpu/vt61/vt61.h6
-rw-r--r--src/devices/cpu/we32000/we32100.cpp14
-rw-r--r--src/devices/cpu/we32000/we32100.h4
-rw-r--r--src/devices/cpu/xavix2/xavix2.cpp108
-rw-r--r--src/devices/cpu/xavix2/xavix2.h4
-rw-r--r--src/devices/cpu/z180/z180.cpp25
-rw-r--r--src/devices/cpu/z180/z180.h8
-rw-r--r--src/devices/cpu/z180/z180dd.hxx2
-rw-r--r--src/devices/cpu/z180/z180ed.hxx2
-rw-r--r--src/devices/cpu/z180/z180ops.h10
-rw-r--r--src/devices/cpu/z8/z8.cpp28
-rw-r--r--src/devices/cpu/z8/z8.h20
-rw-r--r--src/devices/cpu/z8/z8ops.hxx36
-rw-r--r--src/devices/cpu/z80/z80.cpp27
-rw-r--r--src/devices/cpu/z80/z80.h10
-rw-r--r--src/devices/cpu/z8000/z8000.cpp83
-rw-r--r--src/devices/cpu/z8000/z8000.h26
-rw-r--r--src/devices/cpu/z8000/z8000ops.hxx348
-rw-r--r--src/devices/machine/68307.cpp19
-rw-r--r--src/devices/machine/mc68328.cpp3
-rw-r--r--src/devices/machine/ripple_counter.cpp2
-rw-r--r--src/devices/machine/ripple_counter.h6
-rw-r--r--src/devices/machine/s3c2400.h3
-rw-r--r--src/devices/machine/s3c2410.h3
-rw-r--r--src/devices/machine/s3c2440.h3
-rw-r--r--src/devices/machine/s3c24xx.hxx30
-rw-r--r--src/devices/machine/s3c44b0.cpp14
-rw-r--r--src/devices/machine/s3c44b0.h2
-rw-r--r--src/devices/machine/s_smp.cpp5
-rw-r--r--src/devices/machine/s_smp.h8
-rw-r--r--src/devices/sound/2608intf.cpp2
-rw-r--r--src/devices/sound/2608intf.h3
-rw-r--r--src/devices/sound/8950intf.cpp2
-rw-r--r--src/devices/sound/8950intf.h5
-rw-r--r--src/devices/sound/aica.cpp25
-rw-r--r--src/devices/sound/aica.h4
-rw-r--r--src/devices/sound/aicadsp.cpp10
-rw-r--r--src/devices/sound/aicadsp.h4
-rw-r--r--src/devices/sound/bsmt2000.cpp2
-rw-r--r--src/devices/sound/bsmt2000.h3
-rw-r--r--src/devices/sound/c140.cpp2
-rw-r--r--src/devices/sound/c140.h6
-rw-r--r--src/devices/sound/c352.cpp2
-rw-r--r--src/devices/sound/c352.h3
-rw-r--r--src/devices/sound/es5503.cpp2
-rw-r--r--src/devices/sound/es5503.h6
-rw-r--r--src/devices/sound/es8712.cpp2
-rw-r--r--src/devices/sound/es8712.h3
-rw-r--r--src/devices/sound/gaelco.cpp2
-rw-r--r--src/devices/sound/gaelco.h5
-rw-r--r--src/devices/sound/iremga20.cpp2
-rw-r--r--src/devices/sound/iremga20.h3
-rw-r--r--src/devices/sound/k053260.cpp2
-rw-r--r--src/devices/sound/k053260.h6
-rw-r--r--src/devices/sound/k054539.cpp2
-rw-r--r--src/devices/sound/k054539.h6
-rw-r--r--src/devices/sound/ks0164.cpp22
-rw-r--r--src/devices/sound/ks0164.h2
-rw-r--r--src/devices/sound/multipcm.cpp2
-rw-r--r--src/devices/sound/multipcm.h4
-rw-r--r--src/devices/sound/okim6295.cpp2
-rw-r--r--src/devices/sound/okim6295.h3
-rw-r--r--src/devices/sound/okim6376.cpp3
-rw-r--r--src/devices/sound/okim6376.h4
-rw-r--r--src/devices/sound/okim9810.cpp2
-rw-r--r--src/devices/sound/okim9810.h3
-rw-r--r--src/devices/sound/qs1000.cpp2
-rw-r--r--src/devices/sound/qs1000.h3
-rw-r--r--src/devices/sound/qsound.cpp2
-rw-r--r--src/devices/sound/qsound.h3
-rw-r--r--src/devices/sound/qsoundhle.cpp2
-rw-r--r--src/devices/sound/qsoundhle.h3
-rw-r--r--src/devices/sound/rf5c400.cpp2
-rw-r--r--src/devices/sound/rf5c400.h6
-rw-r--r--src/devices/sound/rf5c68.cpp11
-rw-r--r--src/devices/sound/rf5c68.h14
-rw-r--r--src/devices/sound/rolandpcm.cpp2
-rw-r--r--src/devices/sound/rolandpcm.h4
-rw-r--r--src/devices/sound/s_dsp.cpp4
-rw-r--r--src/devices/sound/s_dsp.h8
-rw-r--r--src/devices/sound/scsp.cpp2
-rw-r--r--src/devices/sound/scsp.h3
-rw-r--r--src/devices/sound/segapcm.cpp2
-rw-r--r--src/devices/sound/segapcm.h3
-rw-r--r--src/devices/sound/swp00.cpp2
-rw-r--r--src/devices/sound/swp00.h3
-rw-r--r--src/devices/sound/swp20.cpp2
-rw-r--r--src/devices/sound/swp20.h4
-rw-r--r--src/devices/sound/swp30.cpp2
-rw-r--r--src/devices/sound/swp30.h3
-rw-r--r--src/devices/sound/upd7759.cpp2
-rw-r--r--src/devices/sound/upd7759.h4
-rw-r--r--src/devices/sound/vlm5030.cpp2
-rw-r--r--src/devices/sound/vlm5030.h4
-rw-r--r--src/devices/sound/vrender0.cpp12
-rw-r--r--src/devices/sound/vrender0.h8
-rw-r--r--src/devices/sound/x1_010.cpp2
-rw-r--r--src/devices/sound/x1_010.h4
-rw-r--r--src/devices/sound/ymf271.cpp2
-rw-r--r--src/devices/sound/ymf271.h3
-rw-r--r--src/devices/sound/ymf278b.cpp2
-rw-r--r--src/devices/sound/ymf278b.h3
-rw-r--r--src/devices/sound/ymz280b.cpp2
-rw-r--r--src/devices/sound/ymz280b.h3
-rw-r--r--src/devices/video/sed1330.cpp6
-rw-r--r--src/devices/video/sed1330.h2
-rw-r--r--src/emu/dirom.cpp285
-rw-r--r--src/emu/dirom.h30
-rw-r--r--src/emu/dirom.ipp109
-rw-r--r--src/emu/emu.h1
-rw-r--r--src/emu/emufwd.h1
-rw-r--r--src/emu/emumem.cpp317
-rw-r--r--src/emu/emumem.h222
-rw-r--r--src/emu/emumem_hea.h4
-rw-r--r--src/emu/emumem_hedp.cpp64
-rw-r--r--src/emu/emumem_hedp.h40
-rw-r--r--src/emu/emumem_hedr.h7
-rw-r--r--src/emu/emumem_hedr.ipp59
-rw-r--r--src/emu/emumem_hedw.h7
-rw-r--r--src/emu/emumem_hedw.ipp59
-rw-r--r--src/emu/emumem_hem.cpp32
-rw-r--r--src/emu/emumem_hem.h16
-rw-r--r--src/emu/emumem_hep.cpp8
-rw-r--r--src/emu/emumem_hep.h4
-rw-r--r--src/emu/emumem_het.cpp12
-rw-r--r--src/emu/emumem_het.h8
-rw-r--r--src/emu/emumem_heu.cpp32
-rw-r--r--src/emu/emumem_heu.h8
-rw-r--r--src/emu/emumem_heun.cpp16
-rw-r--r--src/emu/emumem_heun.h16
-rw-r--r--src/emu/emumem_mud.cpp4
-rw-r--r--src/emu/emumem_mud.h2
-rw-r--r--src/mame/audio/m72.cpp2
-rw-r--r--src/mame/audio/m72.h3
-rw-r--r--src/mame/audio/seibu.cpp2
-rw-r--r--src/mame/audio/seibu.h3
-rw-r--r--src/mame/audio/turrett.cpp4
-rw-r--r--src/mame/audio/wswan.cpp2
-rw-r--r--src/mame/audio/wswan.h3
-rw-r--r--src/mame/drivers/galgames.cpp5
-rw-r--r--src/mame/drivers/mindset.cpp54
-rw-r--r--src/mame/drivers/sun4.cpp1
-rw-r--r--src/mame/includes/osborne1.h5
-rw-r--r--src/mame/includes/turrett.h2
-rw-r--r--src/mame/machine/315-5838_317-0229_comp.cpp2
-rw-r--r--src/mame/machine/315-5838_317-0229_comp.h4
-rw-r--r--src/mame/machine/6883sam.cpp36
-rw-r--r--src/mame/machine/6883sam.h11
-rw-r--r--src/mame/machine/bert.cpp9
-rw-r--r--src/mame/machine/bert.h2
-rw-r--r--src/mame/machine/c117.cpp14
-rw-r--r--src/mame/machine/c117.h4
-rw-r--r--src/mame/machine/cammu.cpp60
-rw-r--r--src/mame/machine/cammu.h6
-rw-r--r--src/mame/machine/deco222.cpp4
-rw-r--r--src/mame/machine/decocpu6.cpp4
-rw-r--r--src/mame/machine/decocpu7.cpp4
-rw-r--r--src/mame/machine/interpro_ioga.cpp27
-rw-r--r--src/mame/machine/interpro_ioga.h2
-rw-r--r--src/mame/machine/konami1.cpp2
-rw-r--r--src/mame/machine/m6502_swap_op_d2_d7.cpp2
-rw-r--r--src/mame/machine/m6502_swap_op_d5_d6.cpp2
-rw-r--r--src/mame/machine/m6502_vtscr.cpp2
-rw-r--r--src/mame/machine/osborne1.cpp4
-rw-r--r--src/mame/video/dynax_blitter_rev2.cpp2
-rw-r--r--src/mame/video/dynax_blitter_rev2.h3
-rw-r--r--src/mame/video/kaneko_grap2.cpp2
-rw-r--r--src/mame/video/kaneko_grap2.h4
-rw-r--r--src/mame/video/sknsspr.cpp2
-rw-r--r--src/mame/video/sknsspr.h5
402 files changed, 3687 insertions, 3756 deletions
diff --git a/docs/source/techspecs/device_rom_interface.rst b/docs/source/techspecs/device_rom_interface.rst
index 576800e634a..366fa763233 100644
--- a/docs/source/techspecs/device_rom_interface.rst
+++ b/docs/source/techspecs/device_rom_interface.rst
@@ -15,12 +15,13 @@ as rom. In the region/block cases, banking is automatically handled.
2. Setup
--------
-| **device_rom_interface**\ (const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian = ENDIANNESS_LITTLE, u8 datawidth = 8)
+| device_rom_interface<AddrWidth, DataWidth=0, AddrShift=0, Endian=ENDIANNESS_LITTLE>
-The constructor of the interface wants, in addition to the standard
-parameters, the address bus width of the dedicated bus. In addition
-the endianness (if not little endian or byte-sized bus) and data bus
-width (if not byte) can be provided.
+The interface is a template that takes the address bus width of the
+dedicated bus as a parameter. In addition the data bus width (if not
+byte), address shift (if not 0) and endianness (if not little endian
+or byte-sized bus) can be provided. Data bus width is 0 for byte, 1
+for word, etc.
| **MCFG_DEVICE_ADDRESS_MAP**\ (AS_0, map)
@@ -41,14 +42,10 @@ rom description for the system, it will be automatically picked up as
the connected rom. An address map has priority over the region if
present in the machine config.
-| void **set_rom_endianness**\ (endianness_t endian)
-| void **set_rom_data_width**\ (u8 width)
-| void **set_rom_addr_width**\ (u8 width)
+| void **override_address_width**\ (u8 width)
-These methods, intended for generic devices with indefinite hardware
-specifications, override the endianness, data bus width and address
-bus width assigned through the constructor. They must be called from
-within the device before **config_complete** time.
+This method allows to override the address bus width. It must be
+called from within the device before **config_complete** time.
| void **set_rom**\ (const void \*base, u32 size);
diff --git a/scripts/src/emu.lua b/scripts/src/emu.lua
index b7736fb4c27..0a5207d5365 100644
--- a/scripts/src/emu.lua
+++ b/scripts/src/emu.lua
@@ -87,7 +87,7 @@ files {
MAME_DIR .. "src/emu/dipalette.h",
MAME_DIR .. "src/emu/dipty.cpp",
MAME_DIR .. "src/emu/dipty.h",
- MAME_DIR .. "src/emu/dirom.cpp",
+ MAME_DIR .. "src/emu/dirom.ipp",
MAME_DIR .. "src/emu/dirom.h",
MAME_DIR .. "src/emu/dirtc.cpp",
MAME_DIR .. "src/emu/dirtc.h",
diff --git a/src/devices/bus/multibus/isbc202.cpp b/src/devices/bus/multibus/isbc202.cpp
index f526fb1648a..fc5b6135664 100644
--- a/src/devices/bus/multibus/isbc202.cpp
+++ b/src/devices/bus/multibus/isbc202.cpp
@@ -219,7 +219,6 @@ isbc202_device::isbc202_device(const machine_config &mconfig, const char *tag, d
, m_cpes(*this , "cpe%u" , 0)
, m_drives(*this , "floppy%u" , 0)
, m_program_config("microprogram" , ENDIANNESS_BIG , 32 , 9 , -2)
- , m_cache(nullptr)
, m_mem_space(nullptr)
{
}
@@ -406,7 +405,7 @@ void isbc202_device::device_start()
save_item(NAME(m_amwrt));
save_item(NAME(m_dlyd_amwrt));
- m_cache = space(AS_PROGRAM).cache<2 , -2 , ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
set_icountptr(m_icount);
space(AS_PROGRAM).install_rom(0 , 0x1ff , memregion("microcode")->base());
@@ -558,7 +557,7 @@ void isbc202_device::execute_run()
do {
m_microcode_addr = m_mcu->addr_r();
debugger_instruction_hook(m_microcode_addr);
- m_code_word = m_cache->read_dword(m_microcode_addr);
+ m_code_word = m_cache.read_dword(m_microcode_addr);
// Unpack microcode into fields
// Bits Field
diff --git a/src/devices/bus/multibus/isbc202.h b/src/devices/bus/multibus/isbc202.h
index c16772e0b6c..dc471e15224 100644
--- a/src/devices/bus/multibus/isbc202.h
+++ b/src/devices/bus/multibus/isbc202.h
@@ -64,7 +64,7 @@ private:
required_device_array<floppy_connector , 4> m_drives;
address_space_config m_program_config;
- memory_access_cache<2 , -2 , ENDIANNESS_BIG> *m_cache;
+ memory_access<9, 2 , -2 , ENDIANNESS_BIG>::cache m_cache;
address_space *m_mem_space;
diff --git a/src/devices/cpu/8x300/8x300.cpp b/src/devices/cpu/8x300/8x300.cpp
index a8a9b9dcdad..1b0aecfc4c4 100644
--- a/src/devices/cpu/8x300/8x300.cpp
+++ b/src/devices/cpu/8x300/8x300.cpp
@@ -14,10 +14,10 @@
#include "8x300dasm.h"
#include "debugger.h"
-#define FETCHOP(a) (m_cache->read_word(a))
+#define FETCHOP(a) (m_cache.read_word(a))
#define CYCLES(x) do { m_icount -= (x); } while (0)
-#define READPORT(a) (m_io->read_byte(a))
-#define WRITEPORT(a,v) (m_io->write_byte((a), (v)))
+#define READPORT(a) (m_io.read_byte(a))
+#define WRITEPORT(a,v) (m_io.write_byte((a), (v)))
#define SRC ((opcode & 0x1f00) >> 8)
#define DST (opcode & 0x001f)
@@ -153,9 +153,9 @@ void n8x300_cpu_device::device_resolve_objects()
void n8x300_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_PC));
save_item(NAME(m_AR));
diff --git a/src/devices/cpu/8x300/8x300.h b/src/devices/cpu/8x300/8x300.h
index b37acb119e0..0c95ddc2002 100644
--- a/src/devices/cpu/8x300/8x300.h
+++ b/src/devices/cpu/8x300/8x300.h
@@ -82,9 +82,9 @@ protected:
int m_icount;
bool m_increment_pc;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
- address_space *m_io;
+ memory_access<13, 1, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<13, 1, -1, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 9, 0, 0, ENDIANNESS_BIG>::specific m_io;
devcb_write8 m_sc_callback; // Select Command (address latch)
diff --git a/src/devices/cpu/adsp2100/adsp2100.cpp b/src/devices/cpu/adsp2100/adsp2100.cpp
index 7ef7136f66d..2f0b609ad5b 100644
--- a/src/devices/cpu/adsp2100/adsp2100.cpp
+++ b/src/devices/cpu/adsp2100/adsp2100.cpp
@@ -417,10 +417,11 @@ void adsp21xx_device::device_start()
m_dmovlay_cb.resolve();
// get our address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, -2, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = has_space(AS_IO) ? &space(AS_IO) : nullptr;
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ if(has_space(AS_IO))
+ space(AS_IO).specific(m_io);
// "core"
save_item(NAME(m_core.ax0.u));
@@ -776,37 +777,37 @@ std::unique_ptr<util::disasm_interface> adsp21xx_device::create_disassembler()
inline uint16_t adsp21xx_device::data_read(uint32_t addr)
{
- return m_data->read_word(addr);
+ return m_data.read_word(addr);
}
inline void adsp21xx_device::data_write(uint32_t addr, uint16_t data)
{
- m_data->write_word(addr, data);
+ m_data.write_word(addr, data);
}
inline uint16_t adsp21xx_device::io_read(uint32_t addr)
{
- return m_io->read_word(addr);
+ return m_io.read_word(addr);
}
inline void adsp21xx_device::io_write(uint32_t addr, uint16_t data)
{
- m_io->write_word(addr, data);
+ m_io.write_word(addr, data);
}
inline uint32_t adsp21xx_device::program_read(uint32_t addr)
{
- return m_program->read_dword(addr);
+ return m_program.read_dword(addr);
}
inline void adsp21xx_device::program_write(uint32_t addr, uint32_t data)
{
- m_program->write_dword(addr, data & 0xffffff);
+ m_program.write_dword(addr, data & 0xffffff);
}
inline uint32_t adsp21xx_device::opcode_read()
{
- return m_cache->read_dword(m_pc);
+ return m_cache.read_dword(m_pc);
}
diff --git a/src/devices/cpu/adsp2100/adsp2100.h b/src/devices/cpu/adsp2100/adsp2100.h
index 6f0e3b07160..9910a7ac2b3 100644
--- a/src/devices/cpu/adsp2100/adsp2100.h
+++ b/src/devices/cpu/adsp2100/adsp2100.h
@@ -429,10 +429,10 @@ protected:
adsp_core m_alt;
// address spaces
- address_space * m_program;
- address_space * m_data;
- address_space * m_io;
- memory_access_cache<2, -2, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<14, 2, -2, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<14, 2, -2, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<14, 1, -1, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<11, 1, -1, ENDIANNESS_LITTLE>::specific m_io;
// tables
uint8_t m_condition_table[0x1000];
diff --git a/src/devices/cpu/am29000/am29000.cpp b/src/devices/cpu/am29000/am29000.cpp
index a3f0c4ca91c..43f221102ae 100644
--- a/src/devices/cpu/am29000/am29000.cpp
+++ b/src/devices/cpu/am29000/am29000.cpp
@@ -130,11 +130,12 @@ device_memory_interface::space_config_vector am29000_cpu_device::memory_space_co
void am29000_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
- m_datacache = m_data->cache<2, 0, ENDIANNESS_BIG>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).cache(m_datacache);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
+
m_cfg = (PRL_AM29000 | PRL_REV_D) << CFG_PRL_SHIFT;
/* Register state for saving */
@@ -511,7 +512,7 @@ uint32_t am29000_cpu_device::read_program_word(uint32_t address)
{
/* TODO: ROM enable? */
if (m_cps & CPS_PI || m_cps & CPS_RE)
- return m_cache->read_dword(address);
+ return m_cache.read_dword(address);
else
{
fatalerror("Am29000 instruction MMU translation enabled!\n");
@@ -658,7 +659,7 @@ void am29000_cpu_device::execute_run()
if (m_cfg & CFG_VF)
{
uint32_t vaddr = m_vab | m_exception_queue[0] * 4;
- uint32_t vect = m_datacache->read_dword(vaddr);
+ uint32_t vect = m_datacache.read_dword(vaddr);
m_pc = vect & ~3;
m_next_pc = m_pc;
diff --git a/src/devices/cpu/am29000/am29000.h b/src/devices/cpu/am29000/am29000.h
index 673ee6237fe..c19eeb8b9f2 100644
--- a/src/devices/cpu/am29000/am29000.h
+++ b/src/devices/cpu/am29000/am29000.h
@@ -629,12 +629,11 @@ protected:
uint32_t m_exec_pc;
uint32_t m_next_pc;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
-
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_datacache;
- address_space *m_io;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_datacache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_data;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_io;
typedef void ( am29000_cpu_device::*opcode_func ) ();
struct op_info {
diff --git a/src/devices/cpu/am29000/am29ops.h b/src/devices/cpu/am29000/am29ops.h
index 3c44c506077..74f6eef48f9 100644
--- a/src/devices/cpu/am29000/am29ops.h
+++ b/src/devices/cpu/am29000/am29ops.h
@@ -947,7 +947,7 @@ void am29000_cpu_device::LOAD()
return;
}
- r = m_data->read_dword(addr);
+ r = m_data.read_dword(addr);
}
}
@@ -1013,7 +1013,7 @@ void am29000_cpu_device::LOADM()
return;
}
- r = m_data->read_dword(addr);
+ r = m_data.read_dword(addr);
}
}
@@ -1035,7 +1035,7 @@ void am29000_cpu_device::LOADM()
for (int32_t cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
- m_r[r] = m_data->read_dword(addr);
+ m_r[r] = m_data.read_dword(addr);
// SET_CHC_CR(cnt - 1);
addr += 4;
@@ -1076,7 +1076,7 @@ void am29000_cpu_device::STORE()
}
}
- m_data->write_dword(addr, m_r[RA]);
+ m_data.write_dword(addr, m_r[RA]);
if (!FREEZE_MODE)
{
@@ -1148,7 +1148,7 @@ void am29000_cpu_device::STOREM()
for (int32_t cnt = 0; cnt <= GET_CHC_CR; ++cnt)
{
- m_data->write_dword(addr, m_r[r]);
+ m_data.write_dword(addr, m_r[r]);
addr += 4;
diff --git a/src/devices/cpu/arm/arm.cpp b/src/devices/cpu/arm/arm.cpp
index 2e3ded89dfb..13a6cf7c64b 100644
--- a/src/devices/cpu/arm/arm.cpp
+++ b/src/devices/cpu/arm/arm.cpp
@@ -498,11 +498,11 @@ void arm_cpu_device::device_start()
m_program = &space(AS_PROGRAM);
if(m_program->endianness() == ENDIANNESS_LITTLE) {
- auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_program->cache(m_cachele);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cachele.read_dword(address); };
} else {
- auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_program->cache(m_cachebe);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cachebe.read_dword(address); };
}
save_item(NAME(m_sArmRegister));
diff --git a/src/devices/cpu/arm/arm.h b/src/devices/cpu/arm/arm.h
index 1c018f16763..bfa16724463 100644
--- a/src/devices/cpu/arm/arm.h
+++ b/src/devices/cpu/arm/arm.h
@@ -64,6 +64,8 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
address_space_config m_program_config;
+ memory_access<26, 2, 0, ENDIANNESS_LITTLE>::cache m_cachele;
+ memory_access<26, 2, 0, ENDIANNESS_BIG>::cache m_cachebe;
int m_icount;
uint32_t m_sArmRegister[27];
diff --git a/src/devices/cpu/arm7/arm7.cpp b/src/devices/cpu/arm7/arm7.cpp
index 0637c42ddc4..d496265d41d 100644
--- a/src/devices/cpu/arm7/arm7.cpp
+++ b/src/devices/cpu/arm7/arm7.cpp
@@ -622,13 +622,13 @@ void arm7_cpu_device::device_start()
m_program = &space(AS_PROGRAM);
if(m_program->endianness() == ENDIANNESS_LITTLE) {
- auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cachele);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cachele.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cachele.read_ptr(address); };
} else {
- auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cachebe);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cachebe.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cachebe.read_ptr(address); };
}
save_item(NAME(m_insn_prefetch_depth));
diff --git a/src/devices/cpu/arm7/arm7.h b/src/devices/cpu/arm7/arm7.h
index 5a7ca665b6f..0a7a451ccfa 100644
--- a/src/devices/cpu/arm7/arm7.h
+++ b/src/devices/cpu/arm7/arm7.h
@@ -139,6 +139,8 @@ protected:
virtual bool get_t_flag() const override;
address_space_config m_program_config;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cachele;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cachebe;
uint32_t m_r[/*NUM_REGS*/37];
diff --git a/src/devices/cpu/asap/asap.cpp b/src/devices/cpu/asap/asap.cpp
index 4b2505d847a..9df9049d5ba 100644
--- a/src/devices/cpu/asap/asap.cpp
+++ b/src/devices/cpu/asap/asap.cpp
@@ -151,9 +151,7 @@ asap_device::asap_device(const machine_config &mconfig, const char *tag, device_
m_ppc(0),
m_nextpc(0),
m_irq_state(0),
- m_icount(0),
- m_program(nullptr),
- m_cache(nullptr)
+ m_icount(0)
{
// initialize the src2val table to contain immediates for low values
for (int i = 0; i < REGBASE; i++)
@@ -183,8 +181,8 @@ asap_device::asap_device(const machine_config &mconfig, const char *tag, device_
void asap_device::device_start()
{
// get our address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
@@ -321,7 +319,7 @@ std::unique_ptr<util::disasm_interface> asap_device::create_disassembler()
inline uint32_t asap_device::readop(offs_t pc)
{
- return m_cache->read_dword(pc);
+ return m_cache.read_dword(pc);
}
@@ -332,7 +330,7 @@ inline uint32_t asap_device::readop(offs_t pc)
inline uint8_t asap_device::readbyte(offs_t address)
{
// no alignment issues with bytes
- return m_program->read_byte(address);
+ return m_program.read_byte(address);
}
@@ -344,10 +342,10 @@ inline uint16_t asap_device::readword(offs_t address)
{
// aligned reads are easy
if (WORD_ALIGNED(address))
- return m_program->read_word(address);
+ return m_program.read_word(address);
// misaligned reads are tricky
- return m_program->read_dword(address & ~3) >> (address & 3);
+ return m_program.read_dword(address & ~3) >> (address & 3);
}
@@ -359,10 +357,10 @@ inline uint32_t asap_device::readlong(offs_t address)
{
// aligned reads are easy
if (DWORD_ALIGNED(address))
- return m_program->read_dword(address);
+ return m_program.read_dword(address);
// misaligned reads are tricky
- return m_program->read_dword(address & ~3) >> (address & 3);
+ return m_program.read_dword(address & ~3) >> (address & 3);
}
@@ -373,7 +371,7 @@ inline uint32_t asap_device::readlong(offs_t address)
inline void asap_device::writebyte(offs_t address, uint8_t data)
{
// no alignment issues with bytes
- m_program->write_byte(address, data);
+ m_program.write_byte(address, data);
}
@@ -386,18 +384,18 @@ inline void asap_device::writeword(offs_t address, uint16_t data)
// aligned writes are easy
if (WORD_ALIGNED(address))
{
- m_program->write_word(address, data);
+ m_program.write_word(address, data);
return;
}
// misaligned writes are tricky
if (!(address & 2))
{
- m_program->write_byte(address + 1, data);
- m_program->write_byte(address + 2, data >> 8);
+ m_program.write_byte(address + 1, data);
+ m_program.write_byte(address + 2, data >> 8);
}
else
- m_program->write_byte(address + 1, data);
+ m_program.write_byte(address + 1, data);
}
@@ -410,7 +408,7 @@ inline void asap_device::writelong(offs_t address, uint32_t data)
// aligned writes are easy
if (DWORD_ALIGNED(address))
{
- m_program->write_dword(address, data);
+ m_program.write_dword(address, data);
return;
}
@@ -418,14 +416,14 @@ inline void asap_device::writelong(offs_t address, uint32_t data)
switch (address & 3)
{
case 1:
- m_program->write_byte(address, data);
- m_program->write_word(address + 1, data >> 8);
+ m_program.write_byte(address, data);
+ m_program.write_word(address + 1, data >> 8);
break;
case 2:
- m_program->write_word(address, data);
+ m_program.write_word(address, data);
break;
case 3:
- m_program->write_byte(address, data);
+ m_program.write_byte(address, data);
break;
}
}
diff --git a/src/devices/cpu/asap/asap.h b/src/devices/cpu/asap/asap.h
index fe14835f247..3adb9ef37f4 100644
--- a/src/devices/cpu/asap/asap.h
+++ b/src/devices/cpu/asap/asap.h
@@ -237,8 +237,8 @@ protected:
uint32_t m_nextpc;
uint8_t m_irq_state;
int m_icount;
- address_space * m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
// src2val table, registers are at the end
uint32_t m_src2val[65536];
diff --git a/src/devices/cpu/bcp/dp8344.cpp b/src/devices/cpu/bcp/dp8344.cpp
index 28c99a8ebed..fcc872855eb 100644
--- a/src/devices/cpu/bcp/dp8344.cpp
+++ b/src/devices/cpu/bcp/dp8344.cpp
@@ -66,9 +66,6 @@ dp8344_device::dp8344_device(const machine_config &mconfig, device_type type, co
: cpu_device(mconfig, type, tag, owner, clock)
, m_inst_config("instruction", ENDIANNESS_LITTLE, 16, 16, -1)
, m_data_config("data", ENDIANNESS_LITTLE, 8, 16, 0)
- , m_inst_space(nullptr)
- , m_data_space(nullptr)
- , m_inst_cache(nullptr)
, m_birq_out_cb(*this)
, m_data_out_cb(*this)
, m_data_dly_cb(*this)
@@ -174,9 +171,9 @@ void dp8344_device::device_resolve_objects()
void dp8344_device::device_start()
{
// get memory spaces
- m_inst_space = &space(AS_PROGRAM);
- m_data_space = &space(AS_DATA);
- m_inst_cache = m_inst_space->cache<1, -1, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_inst_cache);
+ space(AS_PROGRAM).specific(m_inst_space);
+ space(AS_DATA).specific(m_data_space);
set_icountptr(m_icount);
@@ -1490,7 +1487,7 @@ void dp8344_device::execute_set_input(int irqline, int state)
void dp8344_device::prefetch_instruction()
{
- m_latched_instr = m_inst_cache->read_word(m_pc);
+ m_latched_instr = m_inst_cache.read_word(m_pc);
}
@@ -1844,7 +1841,7 @@ void dp8344_device::data_write()
break;
}
- m_data_space->write_byte(m_data_address, m_source_data);
+ m_data_space.write_byte(m_data_address, m_source_data);
}
@@ -1855,7 +1852,7 @@ void dp8344_device::data_write()
void dp8344_device::data_read()
{
- write_register(m_latched_instr & ((m_latched_instr & 0xf000) == 0x9000 ? 0x000f : 0x001f), m_data_space->read_byte(m_data_address));
+ write_register(m_latched_instr & ((m_latched_instr & 0xf000) == 0x9000 ? 0x000f : 0x001f), m_data_space.read_byte(m_data_address));
}
@@ -2086,13 +2083,13 @@ u8 dp8344_device::remote_read(offs_t offset)
{
case 0x00:
// Read from data memory
- data = m_data_space->read_byte(offset);
+ data = m_data_space.read_byte(offset);
break;
case 0x01:
// Read from instruction memory
if (!m_hib && !machine().side_effects_disabled())
- m_latched_instr = m_inst_space->read_word(m_pc);
+ m_latched_instr = m_inst_space.read_word(m_pc);
data = m_hib ? m_latched_instr >> 8 : m_latched_instr & 0xff;
if (!machine().side_effects_disabled())
{
@@ -2133,7 +2130,7 @@ void dp8344_device::remote_write(offs_t offset, u8 data)
{
case 0x00:
// Write to data memory
- m_data_space->write_byte(offset, data);
+ m_data_space.write_byte(offset, data);
break;
case 0x01:
@@ -2146,7 +2143,7 @@ void dp8344_device::remote_write(offs_t offset, u8 data)
{
m_hib = !m_hib;
if (!m_hib)
- m_inst_space->write_word(m_pc++, m_latched_instr);
+ m_inst_space.write_word(m_pc++, m_latched_instr);
}
break;
diff --git a/src/devices/cpu/bcp/dp8344.h b/src/devices/cpu/bcp/dp8344.h
index eca4c3e16d4..95e0a671a0b 100644
--- a/src/devices/cpu/bcp/dp8344.h
+++ b/src/devices/cpu/bcp/dp8344.h
@@ -144,9 +144,9 @@ private:
// address spaces
const address_space_config m_inst_config;
const address_space_config m_data_config;
- address_space *m_inst_space;
- address_space *m_data_space;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_inst_cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::cache m_inst_cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific m_inst_space;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_data_space;
// output callbacks
devcb_write_line m_birq_out_cb;
diff --git a/src/devices/cpu/capricorn/capricorn.cpp b/src/devices/cpu/capricorn/capricorn.cpp
index 799f2859309..0f937891e47 100644
--- a/src/devices/cpu/capricorn/capricorn.cpp
+++ b/src/devices/cpu/capricorn/capricorn.cpp
@@ -172,8 +172,8 @@ void capricorn_cpu_device::device_start()
// Flags
state_add(STATE_GENFLAGS , "GENFLAGS" , m_flags).noshow().formatstr("%9s");
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
save_item(NAME(m_reg));
save_item(NAME(m_arp));
@@ -290,7 +290,7 @@ uint8_t capricorn_cpu_device::RM(ea_addr_t& addr)
res = m_reg[ addr & ARP_DRP_MASK ];
} else {
m_curr_addr = (uint16_t)(addr & ADDR_MASK);
- res = m_program->read_byte(m_flatten ? m_start_addr : m_curr_addr);
+ res = m_program.read_byte(m_flatten ? m_start_addr : m_curr_addr);
}
addr++;
return res;
@@ -302,7 +302,7 @@ void capricorn_cpu_device::WM(ea_addr_t& addr , uint8_t v)
m_reg[ addr & ARP_DRP_MASK ] = v;
} else {
m_curr_addr = (uint16_t)(addr & ADDR_MASK);
- m_program->write_byte(m_flatten ? m_start_addr : m_curr_addr , v);
+ m_program.write_byte(m_flatten ? m_start_addr : m_curr_addr , v);
}
addr++;
}
@@ -311,7 +311,7 @@ uint8_t capricorn_cpu_device::fetch()
{
m_genpc = read_u16(REG_PC | GP_REG_MASK);
start_mem_burst(m_genpc , false);
- return m_cache->read_byte(m_genpc);
+ return m_cache.read_byte(m_genpc);
}
void capricorn_cpu_device::offset_pc(uint16_t offset)
diff --git a/src/devices/cpu/capricorn/capricorn.h b/src/devices/cpu/capricorn/capricorn.h
index 5ec08e84a9f..40bbb2cc3ab 100644
--- a/src/devices/cpu/capricorn/capricorn.h
+++ b/src/devices/cpu/capricorn/capricorn.h
@@ -57,8 +57,8 @@ protected:
private:
address_space_config m_program_config;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount;
diff --git a/src/devices/cpu/ccpu/ccpu.cpp b/src/devices/cpu/ccpu/ccpu.cpp
index 52c235abc5c..55bba0dd96e 100644
--- a/src/devices/cpu/ccpu/ccpu.cpp
+++ b/src/devices/cpu/ccpu/ccpu.cpp
@@ -23,13 +23,13 @@ DEFINE_DEVICE_TYPE(CCPU, ccpu_cpu_device, "ccpu", "Cinematronics CPU")
MACROS
***************************************************************************/
-#define READOP(a) (m_cache->read_byte(a))
+#define READOP(a) (m_cache.read_byte(a))
-#define RDMEM(a) (m_data->read_word((a) & 0xfff))
-#define WRMEM(a,v) (m_data->write_word((a), (v)))
+#define RDMEM(a) (m_data.read_word((a) & 0xfff))
+#define WRMEM(a,v) (m_data.write_word((a), (v)))
-#define READPORT(a) (m_io->read_byte(a))
-#define WRITEPORT(a,v) (m_io->write_byte((a), (v)))
+#define READPORT(a) (m_io.read_byte(a))
+#define WRITEPORT(a,v) (m_io.write_byte((a), (v)))
#define SET_A0 do { m_a0flag = m_A; } while (0)
#define SET_CMP_VAL(x) do { m_cmpacc = *m_acc; m_cmpval = (x) & 0xfff; } while (0)
@@ -107,10 +107,10 @@ void ccpu_cpu_device::device_start()
m_vector_callback.resolve();
assert(!m_vector_callback.isnull());
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_PC));
save_item(NAME(m_A));
diff --git a/src/devices/cpu/ccpu/ccpu.h b/src/devices/cpu/ccpu/ccpu.h
index 24d5c422693..c4377f251e3 100644
--- a/src/devices/cpu/ccpu/ccpu.h
+++ b/src/devices/cpu/ccpu/ccpu.h
@@ -100,10 +100,10 @@ protected:
int m_icount;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<15, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<15, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access<32, 1, -1, ENDIANNESS_BIG>::specific m_data;
+ memory_access< 5, 0, 0, ENDIANNESS_BIG>::specific m_io;
uint16_t m_flags;
};
diff --git a/src/devices/cpu/cop400/cop400.cpp b/src/devices/cpu/cop400/cop400.cpp
index 5c8d2c61be6..22495ff2c92 100644
--- a/src/devices/cpu/cop400/cop400.cpp
+++ b/src/devices/cpu/cop400/cop400.cpp
@@ -96,9 +96,9 @@ DEFINE_DEVICE_TYPE(COP446C, cop446c_cpu_device, "cop446c", "National Semiconduct
MACROS
***************************************************************************/
-#define ROM(a) m_cache->read_byte(a)
-#define RAM_R(a) m_data->read_byte(a)
-#define RAM_W(a, v) m_data->write_byte(a, v)
+#define ROM(a) m_program.read_byte(a)
+#define RAM_R(a) m_data.read_byte(a)
+#define RAM_W(a, v) m_data.write_byte(a, v)
#define IN_G() (m_read_g(0, 0xff) & m_g_mask)
#define IN_L() m_read_l(0, 0xff)
@@ -1073,9 +1073,8 @@ void cop400_cpu_device::device_timer(emu_timer &timer, device_timer_id id, int p
void cop400_cpu_device::device_start()
{
/* find address spaces */
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_program);
+ space(AS_DATA).specific(m_data);
/* find i/o handlers */
m_read_l.resolve_safe(0);
@@ -1125,7 +1124,7 @@ void cop400_cpu_device::device_start()
save_item(NAME(m_second_byte));
// setup debugger state display
- offs_t pc_mask = m_program->addrmask();
+ offs_t pc_mask = m_program.space().addrmask();
using namespace std::placeholders;
state_add(STATE_GENPC, "GENPC", m_pc).mask(pc_mask).noshow();
@@ -1330,7 +1329,7 @@ void cop400_cpu_device::set_flags(uint8_t flags)
m_skl = BIT(flags, 0);
}
-uint8_t cop400_cpu_device::get_m() const
+uint8_t cop400_cpu_device::get_m()
{
auto dis = machine().disable_side_effects();
return RAM_R(B);
diff --git a/src/devices/cpu/cop400/cop400.h b/src/devices/cpu/cop400/cop400.h
index 1427463a9cf..b51732fecf8 100644
--- a/src/devices/cpu/cop400/cop400.h
+++ b/src/devices/cpu/cop400/cop400.h
@@ -184,9 +184,8 @@ protected:
bool m_has_counter;
bool m_has_inil;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
+ memory_access<11, 0, 0, ENDIANNESS_LITTLE>::cache m_program;
+ memory_access< 7, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
uint8_t m_featuremask;
@@ -265,7 +264,7 @@ protected:
uint8_t get_flags() const;
void set_flags(uint8_t flags);
- uint8_t get_m() const;
+ uint8_t get_m();
void set_m(uint8_t m);
void illegal(uint8_t operand);
diff --git a/src/devices/cpu/cosmac/cosmac.cpp b/src/devices/cpu/cosmac/cosmac.cpp
index cc773ebd8a3..6f824b90d64 100644
--- a/src/devices/cpu/cosmac/cosmac.cpp
+++ b/src/devices/cpu/cosmac/cosmac.cpp
@@ -381,10 +381,7 @@ cosmac_device::cosmac_device(const machine_config &mconfig, device_type type, co
m_clear(true),
m_irq(CLEAR_LINE),
m_dmain(CLEAR_LINE),
- m_dmaout(CLEAR_LINE),
- m_program(nullptr),
- m_io(nullptr),
- m_cache(nullptr)
+ m_dmaout(CLEAR_LINE)
{
for (auto & elem : m_ef)
elem = CLEAR_LINE;
@@ -467,9 +464,9 @@ void cosmac_device::device_start()
m_write_tpb.resolve_safe();
// get our address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_pc).callimport().callexport().noshow();
@@ -644,7 +641,7 @@ std::unique_ptr<util::disasm_interface> cdp1805_device::create_disassembler()
inline uint8_t cosmac_device::read_opcode(offs_t pc)
{
- return m_cache->read_byte(pc);
+ return m_cache.read_byte(pc);
}
@@ -654,7 +651,7 @@ inline uint8_t cosmac_device::read_opcode(offs_t pc)
inline uint8_t cosmac_device::read_byte(offs_t address)
{
- return m_program->read_byte(address);
+ return m_program.read_byte(address);
}
@@ -665,7 +662,7 @@ inline uint8_t cosmac_device::read_byte(offs_t address)
inline uint8_t cosmac_device::read_io_byte(offs_t address)
{
- return m_io->read_byte(address);
+ return m_io.read_byte(address);
}
@@ -675,7 +672,7 @@ inline uint8_t cosmac_device::read_io_byte(offs_t address)
inline void cosmac_device::write_byte(offs_t address, uint8_t data)
{
- m_program->write_byte(address, data);
+ m_program.write_byte(address, data);
}
@@ -686,7 +683,7 @@ inline void cosmac_device::write_byte(offs_t address, uint8_t data)
inline void cosmac_device::write_io_byte(offs_t address, uint8_t data)
{
- m_io->write_byte(address, data);
+ m_io.write_byte(address, data);
}
diff --git a/src/devices/cpu/cosmac/cosmac.h b/src/devices/cpu/cosmac/cosmac.h
index 891e7f837a6..314bad599e8 100644
--- a/src/devices/cpu/cosmac/cosmac.h
+++ b/src/devices/cpu/cosmac/cosmac.h
@@ -415,9 +415,9 @@ protected:
// internal stuff
int m_icount;
- address_space * m_program;
- address_space * m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 3, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
// opcode/condition tables
typedef void (cosmac_device::*ophandler)();
diff --git a/src/devices/cpu/cr16b/cr16b.cpp b/src/devices/cpu/cr16b/cr16b.cpp
index e3f330bf3f7..c9c6d414caf 100644
--- a/src/devices/cpu/cr16b/cr16b.cpp
+++ b/src/devices/cpu/cr16b/cr16b.cpp
@@ -18,8 +18,6 @@ DEFINE_DEVICE_TYPE(CR16B, cr16b_device, "cr16b", "CompactRISC CR16B")
cr16b_device::cr16b_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, address_map_constructor map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_space_config("program", ENDIANNESS_LITTLE, 16, 21, 0, map)
- , m_space(nullptr)
- , m_cache(nullptr)
, m_regs{0}
, m_pc(0)
, m_isp(0)
@@ -53,8 +51,8 @@ device_memory_interface::space_config_vector cr16b_device::memory_space_config()
void cr16b_device::device_start()
{
- m_space = &space(AS_PROGRAM);
- m_cache = m_space->cache<1, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_space);
set_icountptr(m_icount);
diff --git a/src/devices/cpu/cr16b/cr16b.h b/src/devices/cpu/cr16b/cr16b.h
index 09334dfeff9..a8028b03108 100644
--- a/src/devices/cpu/cr16b/cr16b.h
+++ b/src/devices/cpu/cr16b/cr16b.h
@@ -42,8 +42,8 @@ protected:
private:
// address space
address_space_config m_space_config;
- address_space *m_space;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<21, 1, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<21, 1, 0, ENDIANNESS_LITTLE>::specific m_space;
// internal state
u16 m_regs[16];
diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
index 85f435a68a1..a33fd877505 100644
--- a/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
+++ b/src/devices/cpu/cubeqcpu/cubeqcpu.cpp
@@ -182,8 +182,8 @@ void cquestsnd_cpu_device::device_start()
assert(m_sound_region_tag != nullptr);
m_sound_data = (u16*)machine().root_device().memregion(m_sound_region_tag)->base();
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<3, -3, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -261,8 +261,8 @@ void cquestrot_cpu_device::device_start()
{
m_linedata_w.resolve_safe();
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<3, -3, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -392,8 +392,8 @@ void cquestlin_cpu_device::device_start()
{
m_linedata_r.resolve_safe(0);
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<3, -3, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
memset(m_ram, 0, sizeof(m_ram));
m_q = 0;
@@ -542,7 +542,7 @@ void cquestsnd_cpu_device::execute_run()
do
{
/* Decode the instruction */
- u64 inst = m_cache->read_qword(SND_PC);
+ u64 inst = m_cache.read_qword(SND_PC);
u32 inslow = inst & 0xffffffff;
u32 inshig = inst >> 32;
@@ -798,7 +798,7 @@ void cquestrot_cpu_device::execute_run()
do
{
/* Decode the instruction */
- u64 inst = m_cache->read_qword(ROT_PC);
+ u64 inst = m_cache.read_qword(ROT_PC);
u32 inslow = inst & 0xffffffff;
u32 inshig = inst >> 32;
@@ -1218,7 +1218,7 @@ void cquestlin_cpu_device::execute_run()
int prog = (m_clkcnt & 3) ? BACKGROUND : FOREGROUND;
m_curpc = LINE_PC;
- u64 inst = m_cache->read_qword(LINE_PC);
+ u64 inst = m_cache.read_qword(LINE_PC);
u32 inslow = inst & 0xffffffff;
u32 inshig = inst >> 32;
diff --git a/src/devices/cpu/cubeqcpu/cubeqcpu.h b/src/devices/cpu/cubeqcpu/cubeqcpu.h
index 9f3f215566a..54070a1bd48 100644
--- a/src/devices/cpu/cubeqcpu/cubeqcpu.h
+++ b/src/devices/cpu/cubeqcpu/cubeqcpu.h
@@ -99,8 +99,9 @@ private:
const char *m_sound_region_tag;
u16 *m_sound_data;
- address_space *m_program;
- memory_access_cache<3, -3, ENDIANNESS_BIG> *m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::specific m_program;
+
int m_icount;
bool do_sndjmp(u8 jmp);
@@ -208,8 +209,8 @@ private:
u8 m_rc;
u8 m_clkcnt;
- address_space *m_program;
- memory_access_cache<3, -3, ENDIANNESS_BIG> *m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::specific m_program;
int m_icount;
// For the debugger
@@ -325,8 +326,8 @@ private:
u32 m_e_stack[32768]; /* Stack DRAM: 32kx20 */
u32 m_o_stack[32768]; /* Stack DRAM: 32kx20 */
- address_space *m_program;
- memory_access_cache<3, -3, ENDIANNESS_BIG> *m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::specific m_program;
int m_icount;
// For the debugger
diff --git a/src/devices/cpu/diablo/diablo1300.cpp b/src/devices/cpu/diablo/diablo1300.cpp
index e9eef2275a9..81fe6e4142b 100644
--- a/src/devices/cpu/diablo/diablo1300.cpp
+++ b/src/devices/cpu/diablo/diablo1300.cpp
@@ -29,29 +29,27 @@
inline uint16_t diablo1300_cpu_device::opcode_read(uint16_t address)
{
- return m_cache->read_word(address);
+ return m_cache.read_word(address);
}
inline uint16_t diablo1300_cpu_device::program_read16(uint16_t address)
{
- return m_program->read_word(address);
+ return m_program.read_word(address);
}
inline void diablo1300_cpu_device::program_write16(uint16_t address, uint16_t data)
{
- m_program->write_word(address, data);
- return;
+ m_program.write_word(address, data);
}
inline uint8_t diablo1300_cpu_device::data_read8(uint16_t address)
{
- return m_data->read_byte(address);
+ return m_data.read_byte(address);
}
inline void diablo1300_cpu_device::data_write8(uint16_t address, uint8_t data)
{
- m_data->write_byte(address, data);
- return;
+ m_data.write_byte(address, data);
}
inline uint8_t diablo1300_cpu_device::read_reg(uint16_t reg)
@@ -98,9 +96,6 @@ diablo1300_cpu_device::diablo1300_cpu_device(const machine_config &mconfig, cons
, m_b(0)
, m_carry(0)
, m_power_on(ASSERT_LINE)
- , m_program(nullptr)
- , m_data(nullptr)
- , m_cache(nullptr)
, m_table(nullptr)
{
// Allocate & setup
@@ -109,9 +104,9 @@ diablo1300_cpu_device::diablo1300_cpu_device(const machine_config &mconfig, cons
void diablo1300_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_data = &space(AS_DATA);
- m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
m_table = memregion("trom");
// register our state for the debugger
diff --git a/src/devices/cpu/diablo/diablo1300.h b/src/devices/cpu/diablo/diablo1300.h
index c4af0f1c56e..ebccc694654 100644
--- a/src/devices/cpu/diablo/diablo1300.h
+++ b/src/devices/cpu/diablo/diablo1300.h
@@ -72,9 +72,9 @@ protected:
int m_icount;
// address spaces
- address_space *m_program;
- address_space *m_data;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<9, 1, -1, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<9, 1, -1, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<5, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
// rom regions
memory_region *m_table;
diff --git a/src/devices/cpu/dsp16/dsp16.cpp b/src/devices/cpu/dsp16/dsp16.cpp
index f0c28c5ca32..778d2efb701 100644
--- a/src/devices/cpu/dsp16/dsp16.cpp
+++ b/src/devices/cpu/dsp16/dsp16.cpp
@@ -186,7 +186,7 @@ dsp16_device_base::dsp16_device_base(
{ "ram", ENDIANNESS_BIG, 16, yaau_bits, -1, std::move(data_map) },
{ "exm", ENDIANNESS_BIG, 16, 16, -1 } }
, m_yaau_bits(yaau_bits)
- , m_workram(*this, "workram"), m_spaces{ nullptr, nullptr, nullptr }, m_pcache(nullptr), m_workram_mask(0U)
+ , m_workram(*this, "workram"), m_spaces{ nullptr, nullptr, nullptr }, m_workram_mask(0U)
, m_drc_cache(CACHE_SIZE), m_core(nullptr, [] (core_state *core) { core->~core_state(); }), m_recompiler()
, m_cache_mode(cache::NONE), m_phase(phase::PURGE), m_int_enable{ 0U, 0U }, m_flags(FLAGS_NONE), m_cache_ptr(0U), m_cache_limit(0U), m_cache_iterations(0U)
, m_exm_in(1U), m_int_in(CLEAR_LINE), m_iack_out(1U)
@@ -231,7 +231,7 @@ void dsp16_device_base::device_start()
m_spaces[AS_PROGRAM] = &space(AS_PROGRAM);
m_spaces[AS_DATA] = &space(AS_DATA);
m_spaces[AS_IO] = &space(AS_IO);
- m_pcache = m_spaces[AS_PROGRAM]->cache<1, -1, ENDIANNESS_BIG>();
+ m_spaces[AS_PROGRAM]->cache(m_pcache);
m_workram_mask = u16((m_workram.bytes() >> 1) - 1);
if (allow_drc())
@@ -1133,7 +1133,7 @@ template <bool Debugger, bool Caching> inline void dsp16_device_base::execute_so
set_predicate(predicate);
if (fetch_target)
- *fetch_target = m_pcache->read_word(fetch_addr);
+ *fetch_target = m_pcache.read_word(fetch_addr);
if (phase::OP1 == m_phase)
{
@@ -1274,7 +1274,7 @@ template <bool Debugger> inline void dsp16_device_base::execute_some_cache()
m_core->op_dau_ad(op) = d;
if (last_instruction)
{
- m_rom_data = m_pcache->read_word(m_core->xaau_pt);
+ m_rom_data = m_pcache.read_word(m_core->xaau_pt);
m_phase = phase::OP2;
}
else
@@ -1289,7 +1289,7 @@ template <bool Debugger> inline void dsp16_device_base::execute_some_cache()
m_core->op_dau_ad(op) = m_core->dau_f1(op);
m_core->dau_temp = s16(m_core->dau_y >> 16);
m_core->dau_set_y(yaau_read<Debugger>(op));
- m_rom_data = m_pcache->read_word(m_core->xaau_pt);
+ m_rom_data = m_pcache.read_word(m_core->xaau_pt);
m_phase = phase::OP2;
break;
@@ -1298,7 +1298,7 @@ template <bool Debugger> inline void dsp16_device_base::execute_some_cache()
m_core->dau_set_y(yaau_read<Debugger>(op));
if (last_instruction)
{
- m_rom_data = m_pcache->read_word(m_core->xaau_pt);
+ m_rom_data = m_pcache.read_word(m_core->xaau_pt);
m_phase = phase::OP2;
}
else
@@ -1384,7 +1384,7 @@ template <bool Debugger> inline void dsp16_device_base::execute_some_cache()
// overlapped fetch of next instruction from ROM
mode_change = true;
m_cache_mode = cache::NONE;
- m_cache[m_cache_ptr = 0] = m_pcache->read_word(m_core->xaau_pc);
+ m_cache[m_cache_ptr = 0] = m_pcache.read_word(m_core->xaau_pc);
m_st_pcbase = m_core->xaau_pc;
}
else
@@ -1420,7 +1420,7 @@ inline void dsp16_device_base::overlap_rom_data_read()
case 0x19: // F1 ; y = a0 ; x = *pt++[i]
case 0x1b: // F1 ; y = a1 ; x = *pt++[i]
case 0x1f: // F1 ; y = Y ; x = *pt++[i]
- m_rom_data = m_pcache->read_word(m_core->xaau_pt);
+ m_rom_data = m_pcache.read_word(m_core->xaau_pt);
break;
}
}
diff --git a/src/devices/cpu/dsp16/dsp16.h b/src/devices/cpu/dsp16/dsp16.h
index 13fa045341b..5cc6c6a67f2 100644
--- a/src/devices/cpu/dsp16/dsp16.h
+++ b/src/devices/cpu/dsp16/dsp16.h
@@ -275,7 +275,7 @@ private:
// memory system access
required_shared_ptr<u16> m_workram;
address_space *m_spaces[3];
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_pcache;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::cache m_pcache;
u16 m_workram_mask;
// recompiler stuff
diff --git a/src/devices/cpu/dsp16/dsp16fe.cpp b/src/devices/cpu/dsp16/dsp16fe.cpp
index 2e79371bdd2..a972d14d8ff 100644
--- a/src/devices/cpu/dsp16/dsp16fe.cpp
+++ b/src/devices/cpu/dsp16/dsp16fe.cpp
@@ -30,7 +30,7 @@ bool dsp16_device_base::frontend::describe(opcode_desc &desc, opcode_desc const
desc.length = 1U;
desc.cycles = 1U;
- u16 const op(m_host.m_pcache->read_word(desc.physpc));
+ u16 const op(m_host.m_pcache.read_word(desc.physpc));
switch (op >> 11)
{
case 0x00: // goto JA
@@ -219,9 +219,9 @@ bool dsp16_device_base::frontend::describe(opcode_desc &desc, opcode_desc const
program fetch helpers
***********************************************************************/
-u16 dsp16_device_base::frontend::read_op(opcode_desc const &desc, u16 offset) const
+u16 dsp16_device_base::frontend::read_op(opcode_desc const &desc, u16 offset)
{
- return m_host.m_pcache->read_word((desc.physpc & XAAU_I_EXT) | ((desc.physpc + offset) & XAAU_I_MASK));
+ return m_host.m_pcache.read_word((desc.physpc & XAAU_I_EXT) | ((desc.physpc + offset) & XAAU_I_MASK));
}
/***********************************************************************
diff --git a/src/devices/cpu/dsp16/dsp16fe.h b/src/devices/cpu/dsp16/dsp16fe.h
index e61c383f2c8..8dc3b96700e 100644
--- a/src/devices/cpu/dsp16/dsp16fe.h
+++ b/src/devices/cpu/dsp16/dsp16fe.h
@@ -66,9 +66,9 @@ protected:
private:
// program fetch helpers
- u16 read_op(opcode_desc const &desc, u16 offset) const;
- u16 read_op(opcode_desc const &desc) const { return read_op(desc, 0U); }
- u16 read_imm(opcode_desc const &desc) const { return read_op(desc, 1U); }
+ u16 read_op(opcode_desc const &desc, u16 offset);
+ u16 read_op(opcode_desc const &desc) { return read_op(desc, 0U); }
+ u16 read_imm(opcode_desc const &desc) { return read_op(desc, 1U); }
// non-trivial instruction helpers
bool describe_goto_b(opcode_desc &desc, u16 op);
@@ -98,7 +98,7 @@ private:
template <typename... T> static void flag_required_output_reg(opcode_desc &desc, T... reg) { flag_reg(desc.regreq, reg...); }
// need access to host device for program fetch
- dsp16_device_base const &m_host;
+ dsp16_device_base &m_host;
// for making sweeping assumptions
u32 m_cache_cycles = 0U, m_cache_last_cycles = 0U, m_cache_flags = 0U;
diff --git a/src/devices/cpu/dsp32/dsp32.cpp b/src/devices/cpu/dsp32/dsp32.cpp
index 6586276395f..c7452161137 100644
--- a/src/devices/cpu/dsp32/dsp32.cpp
+++ b/src/devices/cpu/dsp32/dsp32.cpp
@@ -174,8 +174,6 @@ dsp32c_device::dsp32c_device(const machine_config &mconfig, const char *tag, dev
m_icount(0),
m_lastpins(0),
m_ppc(0),
- m_program(nullptr),
- m_cache(nullptr),
m_output_pins_changed(*this)
{
// set our instruction counter
@@ -191,8 +189,8 @@ void dsp32c_device::device_start()
m_output_pins_changed.resolve_safe();
// get our address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_r[15]).noshow();
@@ -415,17 +413,17 @@ std::unique_ptr<util::disasm_interface> dsp32c_device::create_disassembler()
inline uint32_t dsp32c_device::ROPCODE(offs_t pc)
{
- return m_cache->read_dword(pc);
+ return m_cache.read_dword(pc);
}
inline uint8_t dsp32c_device::RBYTE(offs_t addr)
{
- return m_program->read_byte(addr);
+ return m_program.read_byte(addr);
}
inline void dsp32c_device::WBYTE(offs_t addr, uint8_t data)
{
- m_program->write_byte(addr, data);
+ m_program.write_byte(addr, data);
}
inline uint16_t dsp32c_device::RWORD(offs_t addr)
@@ -434,7 +432,7 @@ inline uint16_t dsp32c_device::RWORD(offs_t addr)
if (!WORD_ALIGNED(addr))
osd_printf_error("Unaligned word read @ %06X, PC=%06X\n", addr, PC);
#endif
- return m_program->read_word(addr);
+ return m_program.read_word(addr);
}
inline uint32_t dsp32c_device::RLONG(offs_t addr)
@@ -443,7 +441,7 @@ inline uint32_t dsp32c_device::RLONG(offs_t addr)
if (!DWORD_ALIGNED(addr))
osd_printf_error("Unaligned long read @ %06X, PC=%06X\n", addr, PC);
#endif
- return m_program->read_dword(addr);
+ return m_program.read_dword(addr);
}
inline void dsp32c_device::WWORD(offs_t addr, uint16_t data)
@@ -452,7 +450,7 @@ inline void dsp32c_device::WWORD(offs_t addr, uint16_t data)
if (!WORD_ALIGNED(addr))
osd_printf_error("Unaligned word write @ %06X, PC=%06X\n", addr, PC);
#endif
- m_program->write_word(addr, data);
+ m_program.write_word(addr, data);
}
inline void dsp32c_device::WLONG(offs_t addr, uint32_t data)
@@ -461,7 +459,7 @@ inline void dsp32c_device::WLONG(offs_t addr, uint32_t data)
if (!DWORD_ALIGNED(addr))
osd_printf_error("Unaligned long write @ %06X, PC=%06X\n", addr, PC);
#endif
- m_program->write_dword(addr, data);
+ m_program.write_dword(addr, data);
}
diff --git a/src/devices/cpu/dsp32/dsp32.h b/src/devices/cpu/dsp32/dsp32.h
index e30de0a29b6..90ede0181fa 100644
--- a/src/devices/cpu/dsp32/dsp32.h
+++ b/src/devices/cpu/dsp32/dsp32.h
@@ -416,8 +416,8 @@ protected:
int m_icount;
uint8_t m_lastpins;
uint32_t m_ppc;
- address_space * m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
devcb_write32 m_output_pins_changed;
// tables
diff --git a/src/devices/cpu/dsp56156/dsp56156.cpp b/src/devices/cpu/dsp56156/dsp56156.cpp
index b6c5b4fd672..04952c0f7d3 100644
--- a/src/devices/cpu/dsp56156/dsp56156.cpp
+++ b/src/devices/cpu/dsp56156/dsp56156.cpp
@@ -141,7 +141,7 @@ device_memory_interface::space_config_vector dsp56156_device::memory_space_confi
/***************************************************************************
MEMORY ACCESSORS
***************************************************************************/
-#define ROPCODE(pc) cpustate->cache->read_word(pc)
+#define ROPCODE(pc) cpustate->cache.read_word(pc)
/***************************************************************************
@@ -291,9 +291,9 @@ void dsp56156_device::device_start()
save_item(NAME(m_core.peripheral_ram));
- m_core.program = &space(AS_PROGRAM);
- m_core.cache = m_core.program->cache<1, -1, ENDIANNESS_LITTLE>();
- m_core.data = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_core.cache);
+ space(AS_PROGRAM).specific(m_core.program);
+ space(AS_DATA).specific(m_core.data);
state_add(DSP56156_PC, "PC", m_core.PCU.pc).formatstr("%04X");
state_add(DSP56156_SR, "SR", m_core.PCU.sr).formatstr("%04X");
@@ -445,7 +445,7 @@ void dsp56156_device::device_reset()
m_core.ppc = m_core.PCU.pc;
/* HACK - Put a jump to 0x0000 at 0x0000 - this keeps the CPU locked to the instruction at address 0x0000 */
- m_core.program->write_word(0x0000, 0x0124);
+ m_core.program.write_word(0x0000, 0x0124);
}
diff --git a/src/devices/cpu/dsp56156/dsp56156.h b/src/devices/cpu/dsp56156/dsp56156.h
index 4b1169f07d9..09801c54407 100644
--- a/src/devices/cpu/dsp56156/dsp56156.h
+++ b/src/devices/cpu/dsp56156/dsp56156.h
@@ -191,9 +191,9 @@ struct dsp56156_core
int interrupt_cycles;
void (*output_pins_changed)(uint32_t pins);
cpu_device *device;
- address_space *program;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *cache;
- address_space *data;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::cache cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific program;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific data;
uint16_t peripheral_ram[0x40];
uint16_t *program_ram;
diff --git a/src/devices/cpu/dsp56156/dsp56ops.hxx b/src/devices/cpu/dsp56156/dsp56ops.hxx
index 52ff4f5560c..d6b2b82f97d 100644
--- a/src/devices/cpu/dsp56156/dsp56ops.hxx
+++ b/src/devices/cpu/dsp56156/dsp56ops.hxx
@@ -2308,7 +2308,7 @@ static size_t dsp56156_op_bfop(dsp56156_core* cpustate, const uint16_t op, const
decode_BBB_bitmask(cpustate, BITS(op2,0xe000), &iVal);
workAddr = assemble_address_from_Pppppp_table(cpustate, BITS(op,0x0020), BITS(op,0x001f));
- previousValue = cpustate->data->read_word(workAddr);
+ previousValue = cpustate->data.read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -2374,7 +2374,7 @@ static size_t dsp56156_op_bfop_1(dsp56156_core* cpustate, const uint16_t op, con
decode_RR_table(cpustate, BITS(op,0x0003), &R);
workAddr = *((uint16_t*)R.addr);
- previousValue = cpustate->data->read_word(workAddr);
+ previousValue = cpustate->data.read_word(workAddr);
workingWord = previousValue;
switch(BITS(op2, 0x1f00))
@@ -3265,7 +3265,7 @@ static size_t dsp56156_op_movec(dsp56156_core* cpustate, const uint16_t op, uint
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(*((uint16_t*)R.addr)) ;
+ uint16_t value = cpustate->data.read_word(*((uint16_t*)R.addr)) ;
typed_pointer temp_src = { &value, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3307,7 +3307,7 @@ static size_t dsp56156_op_movec_1(dsp56156_core* cpustate, const uint16_t op, ui
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3351,7 +3351,7 @@ static size_t dsp56156_op_movec_2(dsp56156_core* cpustate, const uint16_t op, ui
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3402,7 +3402,7 @@ static size_t dsp56156_op_movec_3(dsp56156_core* cpustate, const uint16_t op, co
else
{
/* 16-bit long address */
- uint16_t tempD = cpustate->data->read_word(op2);
+ uint16_t tempD = cpustate->data.read_word(op2);
typed_pointer tempTP = {&tempD, DT_WORD};
SetDestinationValue(tempTP, SD);
}
@@ -3480,7 +3480,7 @@ static size_t dsp56156_op_movec_5(dsp56156_core* cpustate, const uint16_t op, co
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -3543,7 +3543,7 @@ static size_t dsp56156_op_movem(dsp56156_core* cpustate, const uint16_t op, uint
{
/* Read from Program Memory */
typed_pointer data;
- uint16_t ldata = cpustate->program->read_word(*((uint16_t*)R.addr));
+ uint16_t ldata = cpustate->program.read_word(*((uint16_t*)R.addr));
data.addr = &ldata;
data.data_type = DT_WORD;
@@ -3597,7 +3597,7 @@ static size_t dsp56156_op_movep(dsp56156_core* cpustate, const uint16_t op, uint
if (W)
{
- uint16_t data = cpustate->data->read_word(pp);
+ uint16_t data = cpustate->data.read_word(pp);
typed_pointer tempTP;
tempTP.addr = &data;
@@ -3636,7 +3636,7 @@ static size_t dsp56156_op_movep_1(dsp56156_core* cpustate, const uint16_t op, ui
/* A little different than most W if's - opposite read and write */
if (W)
{
- uint16_t data = cpustate->data->read_word(*((uint16_t*)SD.addr));
+ uint16_t data = cpustate->data.read_word(*((uint16_t*)SD.addr));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4663,7 +4663,7 @@ static void execute_x_memory_data_move(dsp56156_core* cpustate, const uint16_t o
if (W)
{
/* From X:<ea> to SD */
- uint16_t data = cpustate->data->read_word(*((uint16_t*)R.addr));
+ uint16_t data = cpustate->data.read_word(*((uint16_t*)R.addr));
typed_pointer tempTP;
tempTP.addr = &data;
@@ -4711,7 +4711,7 @@ static void execute_x_memory_data_move2(dsp56156_core* cpustate, const uint16_t
if (W)
{
/* Write D */
- uint16_t value = cpustate->data->read_word(*mem_offset);
+ uint16_t value = cpustate->data.read_word(*mem_offset);
typed_pointer tempV = {&value, DT_WORD};
SetDestinationValue(tempV, SD);
}
@@ -4739,7 +4739,7 @@ static void execute_x_memory_data_move_with_short_displacement(dsp56156_core* cp
if (W)
{
/* Write D */
- uint16_t tempData = cpustate->data->read_word(memOffset);
+ uint16_t tempData = cpustate->data.read_word(memOffset);
typed_pointer temp_src = { (void*)&tempData, DT_WORD };
SetDestinationValue(temp_src, SD);
}
@@ -4775,13 +4775,13 @@ static void execute_dual_x_memory_data_read(dsp56156_core* cpustate, const uint1
fatalerror("Dsp56156: Unimplemented access to external X Data Memory >= 0xffc0 in Dual X Memory Data Read.\n");
/* First memmove */
- srcVal1 = cpustate->data->read_word(*((uint16_t*)R.addr));
+ srcVal1 = cpustate->data.read_word(*((uint16_t*)R.addr));
tempV.addr = &srcVal1;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D1);
/* Second memmove */
- srcVal2 = cpustate->data->read_word(R3);
+ srcVal2 = cpustate->data.read_word(R3);
tempV.addr = &srcVal2;
tempV.data_type = DT_WORD;
SetDestinationValue(tempV, D2);
@@ -4877,13 +4877,13 @@ static void SetDataMemoryValue(dsp56156_core* cpustate, typed_pointer source, ui
{
switch(source.data_type)
{
- case DT_BYTE: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: cpustate->data->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->data.write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
}
}
@@ -4892,12 +4892,12 @@ static void SetProgramMemoryValue(dsp56156_core* cpustate, typed_pointer source,
{
switch(source.data_type)
{
- case DT_BYTE: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
- case DT_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
- case DT_DOUBLE_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
+ case DT_BYTE: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint8_t*) source.addr) & 0xff) ) ) ; break ;
+ case DT_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint16_t*)source.addr) & 0xffff) ) ) ; break ;
+ case DT_DOUBLE_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( (*((uint32_t*)source.addr) & 0x0000ffff) ) ) ; break ;
/* !!! Is this universal ??? */
/* !!! Forget not, yon shift-limiter !!! */
- case DT_LONG_WORD: cpustate->program->write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
+ case DT_LONG_WORD: cpustate->program.write_word(destinationAddr, (uint16_t)( ((*((uint64_t*)source.addr)) & 0x00000000ffff0000U) >> 16) ) ; break ;
}
}
diff --git a/src/devices/cpu/dsp56156/dsp56pcu.cpp b/src/devices/cpu/dsp56156/dsp56pcu.cpp
index 94ca3b1caae..3714dff41de 100644
--- a/src/devices/cpu/dsp56156/dsp56pcu.cpp
+++ b/src/devices/cpu/dsp56156/dsp56pcu.cpp
@@ -146,8 +146,8 @@ void pcu_reset(dsp56156_core* cpustate)
/* ... */
/* P:$cffe -> Internal P:$07ff low byte */
/* P:$cfff -> Internal P:$07ff high byte */
- uint8_t mem_value_low = cpustate->program->read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */
- uint8_t mem_value_high = cpustate->program->read_byte(mem_offset);
+ uint8_t mem_value_low = cpustate->program.read_byte(mem_offset); /* TODO: IS THIS READING RIGHT? */
+ uint8_t mem_value_high = cpustate->program.read_byte(mem_offset);
cpustate->program_ram[i] = (mem_value_high << 8) | mem_value_low;
}
@@ -168,7 +168,7 @@ void pcu_reset(dsp56156_core* cpustate)
/* they need. Once they've had their fill, they turn bootstrap mode off */
/* and the CPU begins execution at 0x0000; */
/* HACK - Read bit 15 at 0xc000 to see if we're working with the SSIO or host interface. */
- if (cpustate->program->read_word(0xc000<<1) & 0x8000)
+ if (cpustate->program.read_word(0xc000<<1) & 0x8000)
{
cpustate->bootstrap_mode = BOOTSTRAP_SSIX;
cpustate->device->logerror("DSP56156 : Currently in (hacked) bootstrap mode - reading from SSIx.\n");
diff --git a/src/devices/cpu/dspp/dspp.cpp b/src/devices/cpu/dspp/dspp.cpp
index 44ced48c56c..d4f889df01a 100644
--- a/src/devices/cpu/dspp/dspp.cpp
+++ b/src/devices/cpu/dspp/dspp.cpp
@@ -100,8 +100,6 @@ dspp_device::dspp_device(const machine_config &mconfig, device_type type, const
m_dma_write_handler(*this),
m_code_config("code", ENDIANNESS_BIG, 16, 10, -1, code_map_ctor),
m_data_config("data", ENDIANNESS_BIG, 16, 10, -1, data_map_ctor),
- m_code(nullptr),
- m_data(nullptr),
m_output_fifo_start(0),
m_output_fifo_count(0),
m_dspx_reset(0),
@@ -160,12 +158,9 @@ void dspp_device::device_start()
m_dma_write_handler.resolve_safe();
// Get our address spaces
- m_code = &space(AS_PROGRAM);
- m_data = &space(AS_DATA);
- auto code_cache = m_code->cache<1, -1, ENDIANNESS_BIG>();
- m_code_cache = code_cache;
- m_code16 = [code_cache](offs_t address) -> uint16_t { return code_cache->read_word(address); };
- m_codeptr = [code_cache](offs_t address) -> const void * { return code_cache->read_ptr(address); };
+ space(AS_PROGRAM).cache(m_code_cache);
+ space(AS_PROGRAM).specific(m_code);
+ space(AS_DATA).specific(m_data);
// Register our state for the debugger
state_add(DSPP_PC, "PC", m_core->m_pc);
@@ -369,7 +364,7 @@ inline void dspp_device::update_ticks()
uint16_t dspp_device::read_op(offs_t pc)
{
- return m_code_cache->read_word(pc);
+ return m_code_cache.read_word(pc);
}
@@ -379,7 +374,7 @@ uint16_t dspp_device::read_op(offs_t pc)
inline uint16_t dspp_device::read_data(offs_t addr)
{
- return m_data->read_word(addr);
+ return m_data.read_word(addr);
}
@@ -389,7 +384,7 @@ inline uint16_t dspp_device::read_data(offs_t addr)
inline void dspp_device::write_data(offs_t addr, uint16_t data)
{
- m_data->write_word(addr, data);
+ m_data.write_word(addr, data);
}
@@ -2344,12 +2339,12 @@ READ32_MEMBER( dspp_device::read )
if (offset < 0x1000/4)
{
// 16-bit code memory
- return m_code->read_word(offset);
+ return m_code.read_word(offset);
}
else if (offset >= 0x1000/4 && offset < 0x2000/4)
{
// 16-bit data memory and registers
- return m_data->read_word((offset - 0x1000/4));
+ return m_data.read_word((offset - 0x1000/4));
}
else if(offset >= 0x5000/4 && offset < 0x6000/4)
{
@@ -2505,12 +2500,12 @@ WRITE32_MEMBER( dspp_device::write )
if (offset < 0x1000/4)
{
// 16-bit code memory
- m_code->write_word(offset, data);
+ m_code.write_word(offset, data);
}
else if (offset >= 0x1000/4 && offset < 0x2000/4)
{
// 16-bit data memory and registers
- m_data->write_word((offset - 0x1000/4), data);
+ m_data.write_word((offset - 0x1000/4), data);
}
else if(offset >= 0x5000/4 && offset < 0x6000/4)
{
diff --git a/src/devices/cpu/dspp/dspp.h b/src/devices/cpu/dspp/dspp.h
index 1137400da3f..493c88d8ef0 100644
--- a/src/devices/cpu/dspp/dspp.h
+++ b/src/devices/cpu/dspp/dspp.h
@@ -199,11 +199,9 @@ private:
// Address spaces
const address_space_config m_code_config;
const address_space_config m_data_config;
- address_space * m_code;
- address_space * m_data;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_code_cache;
- std::function<uint16_t (offs_t)> m_code16;
- std::function<const void * (offs_t)> m_codeptr;
+ memory_access<10, 1, -1, ENDIANNESS_BIG>::cache m_code_cache;
+ memory_access<10, 1, -1, ENDIANNESS_BIG>::specific m_code;
+ memory_access<10, 1, -1, ENDIANNESS_BIG>::specific m_data;
struct dspp_internal_state
{
diff --git a/src/devices/cpu/dspp/dsppdrc.cpp b/src/devices/cpu/dspp/dsppdrc.cpp
index 68b0c3cb741..947c698576f 100644
--- a/src/devices/cpu/dspp/dsppdrc.cpp
+++ b/src/devices/cpu/dspp/dsppdrc.cpp
@@ -292,7 +292,7 @@ void dspp_device::generate_checksum_block(drcuml_block &block, compiler_state *c
{
uint32_t sum = seqhead->opptr.w[0];
uint32_t addr = seqhead->physpc;
- const void *base = m_codeptr(addr);
+ const void *base = m_code_cache.read_ptr(addr);
UML_MOV(block, I0, 0);
UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x2); // load i0,base,0,word
@@ -306,14 +306,14 @@ void dspp_device::generate_checksum_block(drcuml_block &block, compiler_state *c
{
uint32_t sum = 0;
uint32_t addr = seqhead->physpc;
- const void *base = m_codeptr(addr);
+ const void *base = m_code_cache.read_ptr(addr);
UML_LOAD(block, I0, base, 0, SIZE_WORD, SCALE_x2); // load i0,base,0,dword
sum += seqhead->opptr.w[0];
for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next())
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
addr = curdesc->physpc;
- base = m_codeptr(addr);
+ base = m_code_cache.read_ptr(addr);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_WORD, SCALE_x2); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@@ -830,7 +830,7 @@ void dspp_device::generate_parse_operands(drcuml_block &block, compiler_state *c
uint32_t opoffset = 1;
while (opidx < numops)
{
- operand = m_code16(desc->pc + opoffset);
+ operand = m_code_cache.read_word(desc->pc + opoffset);
opoffset++;
if (operand & 0x8000)
diff --git a/src/devices/cpu/e132xs/e132xs.cpp b/src/devices/cpu/e132xs/e132xs.cpp
index cce03566729..2311ba75a8b 100644
--- a/src/devices/cpu/e132xs/e132xs.cpp
+++ b/src/devices/cpu/e132xs/e132xs.cpp
@@ -1115,24 +1115,24 @@ void hyperstone_device::init(int scale_mask)
m_program = &space(AS_PROGRAM);
if (m_program->data_width() == 16)
{
- auto cache = m_program->cache<1, 0, ENDIANNESS_BIG>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache16);
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache16.read_word(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache16.read_ptr(address); };
}
else
{
- auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
+ m_program->cache(m_cache32);
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache32.read_word(address); };
if (ENDIANNESS_NATIVE != ENDIANNESS_BIG)
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~3));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache32.read_ptr(address & ~3));
if(!(address & 2))
ptr++;
return ptr;
};
else
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~3));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache32.read_ptr(address & ~3));
if(address & 2)
ptr++;
return ptr;
diff --git a/src/devices/cpu/e132xs/e132xs.h b/src/devices/cpu/e132xs/e132xs.h
index 6c838fefb37..fb50a3dfb5b 100644
--- a/src/devices/cpu/e132xs/e132xs.h
+++ b/src/devices/cpu/e132xs/e132xs.h
@@ -305,6 +305,9 @@ protected:
const address_space_config m_program_config;
const address_space_config m_io_config;
address_space *m_program;
+ memory_access<32, 1, 0, ENDIANNESS_BIG>::cache m_cache16;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache32;
+
std::function<u16 (offs_t)> m_pr16;
std::function<const void * (offs_t)> m_prptr;
address_space *m_io;
diff --git a/src/devices/cpu/esrip/esrip.cpp b/src/devices/cpu/esrip/esrip.cpp
index 5fa6788d24b..931b5866308 100644
--- a/src/devices/cpu/esrip/esrip.cpp
+++ b/src/devices/cpu/esrip/esrip.cpp
@@ -192,8 +192,8 @@ void esrip_device::device_start()
/* Allocate image pointer table RAM */
m_ipt_ram.resize(IPT_RAM_SIZE/2);
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<3, -3, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", m_rip_pc).noshow();
@@ -1880,7 +1880,7 @@ void esrip_device::execute_run()
m_pl7 = m_l7;
/* Latch instruction */
- inst = m_cache->read_qword(RIP_PC);
+ inst = m_cache.read_qword(RIP_PC);
in_h = inst >> 32;
in_l = inst & 0xffffffff;
diff --git a/src/devices/cpu/esrip/esrip.h b/src/devices/cpu/esrip/esrip.h
index 19a4cde150d..f58b2d41a97 100644
--- a/src/devices/cpu/esrip/esrip.h
+++ b/src/devices/cpu/esrip/esrip.h
@@ -176,8 +176,8 @@ protected:
std::vector<uint16_t> m_ipt_ram;
uint8_t *m_lbrm;
- address_space *m_program;
- memory_access_cache<3, -3, ENDIANNESS_BIG> *m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<9, 3, -3, ENDIANNESS_BIG>::specific m_program;
int m_icount;
diff --git a/src/devices/cpu/f8/f8.cpp b/src/devices/cpu/f8/f8.cpp
index 6f6ea70512c..9aa27af8f54 100644
--- a/src/devices/cpu/f8/f8.cpp
+++ b/src/devices/cpu/f8/f8.cpp
@@ -108,10 +108,9 @@ void f8_cpu_device::state_string_export(const device_state_entry &entry, std::st
void f8_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_r = space(AS_DATA).cache<0, 0, ENDIANNESS_BIG>();
- m_iospace = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_program);
+ space(AS_DATA).cache(m_r);
+ space(AS_IO).specific(m_ios);
// zerofill
m_debug_pc = 0;
@@ -282,7 +281,7 @@ void f8_cpu_device::ROMC_00(int insttim)
* of PC0.
*/
- m_dbus = m_cache->read_byte(m_pc0);
+ m_dbus = m_program.read_byte(m_pc0);
m_pc0 += 1;
m_icount -= insttim; /* ROMC00 is usually short, not short+long, but DS is long */
}
@@ -295,7 +294,7 @@ void f8_cpu_device::ROMC_01()
* location addressed by PC0; then all devices add the 8-bit value
* on the data bus as signed binary number to PC0.
*/
- m_dbus = m_cache->read_byte(m_pc0);
+ m_dbus = m_program.read_byte(m_pc0);
m_pc0 += (s8)m_dbus;
m_icount -= cL;
}
@@ -308,7 +307,7 @@ void f8_cpu_device::ROMC_02()
* the memory location addressed by DC0; then all devices increment
* DC0.
*/
- m_dbus = m_program->read_byte(m_dc0);
+ m_dbus = m_program.read_byte(m_dc0);
m_dc0 += 1;
m_icount -= cL;
}
@@ -319,7 +318,7 @@ void f8_cpu_device::ROMC_03(int insttim)
* Similiar to 0x00, except that it is used for immediate operands
* fetches (using PC0) instead of instruction fetches.
*/
- m_dbus = m_io = m_cache->read_byte(m_pc0);
+ m_dbus = m_io = m_program.read_byte(m_pc0);
m_pc0 += 1;
m_icount -= insttim;
}
@@ -339,7 +338,7 @@ void f8_cpu_device::ROMC_05()
* Store the data bus contents into the memory location pointed
* to by DC0; increment DC0.
*/
- m_program->write_byte(m_dc0, m_dbus);
+ m_program.write_byte(m_dc0, m_dbus);
m_dc0 += 1;
m_icount -= cL;
}
@@ -413,7 +412,7 @@ void f8_cpu_device::ROMC_0C()
* by PC0 into the data bus; then all devices move the value that
* has just been placed on the data bus into the low order byte of PC0.
*/
- m_dbus = m_cache->read_byte(m_pc0);
+ m_dbus = m_program.read_byte(m_pc0);
m_pc0 = (m_pc0 & 0xff00) | m_dbus;
m_icount -= cL;
}
@@ -436,7 +435,7 @@ void f8_cpu_device::ROMC_0E()
* The value on the data bus is then moved to the low order byte
* of DC0 by all devices.
*/
- m_dbus = m_cache->read_byte(m_pc0);
+ m_dbus = m_program.read_byte(m_pc0);
m_dc0 = (m_dc0 & 0xff00) | m_dbus;
m_icount -= cL;
}
@@ -474,7 +473,7 @@ void f8_cpu_device::ROMC_11()
* data bus. All devices must then move the contents of the
* data bus to the upper byte of DC0.
*/
- m_dbus = m_cache->read_byte(m_pc0);
+ m_dbus = m_program.read_byte(m_pc0);
m_dc0 = (m_dc0 & 0x00ff) | (m_dbus << 8);
m_icount -= cL;
}
@@ -573,7 +572,7 @@ void f8_cpu_device::ROMC_1A()
* register was addressed; the device containing the addressed port
* must place the contents of the data bus into the address port.
*/
- m_iospace->write_byte(m_io, m_dbus);
+ m_ios.write_byte(m_io, m_dbus);
m_icount -= cL;
}
@@ -586,7 +585,7 @@ void f8_cpu_device::ROMC_1B()
* contents of timer and interrupt control registers cannot be read
* back onto the data bus).
*/
- m_dbus = m_iospace->read_byte(m_io);
+ m_dbus = m_ios.read_byte(m_io);
m_icount -= cL;
}
@@ -644,7 +643,7 @@ void f8_cpu_device::illegal()
***************************************************/
void f8_cpu_device::f8_lr_a_ku()
{
- m_a = m_r->read_byte(12);
+ m_a = m_r.read_byte(12);
}
/***************************************************
@@ -653,7 +652,7 @@ void f8_cpu_device::f8_lr_a_ku()
***************************************************/
void f8_cpu_device::f8_lr_a_kl()
{
- m_a = m_r->read_byte(13);
+ m_a = m_r.read_byte(13);
}
/***************************************************
@@ -662,7 +661,7 @@ void f8_cpu_device::f8_lr_a_kl()
***************************************************/
void f8_cpu_device::f8_lr_a_qu()
{
- m_a = m_r->read_byte(14);
+ m_a = m_r.read_byte(14);
}
/***************************************************
@@ -671,7 +670,7 @@ void f8_cpu_device::f8_lr_a_qu()
***************************************************/
void f8_cpu_device::f8_lr_a_ql()
{
- m_a = m_r->read_byte(15);
+ m_a = m_r.read_byte(15);
}
/***************************************************
@@ -680,7 +679,7 @@ void f8_cpu_device::f8_lr_a_ql()
***************************************************/
void f8_cpu_device::f8_lr_ku_a()
{
- m_r->write_byte(12, m_a);
+ m_r.write_byte(12, m_a);
}
/***************************************************
@@ -689,7 +688,7 @@ void f8_cpu_device::f8_lr_ku_a()
***************************************************/
void f8_cpu_device::f8_lr_kl_a()
{
- m_r->write_byte(13, m_a);
+ m_r.write_byte(13, m_a);
}
/***************************************************
@@ -698,7 +697,7 @@ void f8_cpu_device::f8_lr_kl_a()
***************************************************/
void f8_cpu_device::f8_lr_qu_a()
{
- m_r->write_byte(14, m_a);
+ m_r.write_byte(14, m_a);
}
/***************************************************
@@ -707,7 +706,7 @@ void f8_cpu_device::f8_lr_qu_a()
***************************************************/
void f8_cpu_device::f8_lr_ql_a()
{
- m_r->write_byte(15, m_a);
+ m_r.write_byte(15, m_a);
}
/***************************************************
@@ -717,9 +716,9 @@ void f8_cpu_device::f8_lr_ql_a()
void f8_cpu_device::f8_lr_k_p()
{
ROMC_07();
- m_r->write_byte(12, m_dbus);
+ m_r.write_byte(12, m_dbus);
ROMC_0B();
- m_r->write_byte(13, m_dbus);
+ m_r.write_byte(13, m_dbus);
}
/***************************************************
@@ -728,9 +727,9 @@ void f8_cpu_device::f8_lr_k_p()
***************************************************/
void f8_cpu_device::f8_lr_p_k()
{
- m_dbus = m_r->read_byte(12);
+ m_dbus = m_r.read_byte(12);
ROMC_15();
- m_dbus = m_r->read_byte(13);
+ m_dbus = m_r.read_byte(13);
ROMC_18();
}
@@ -758,9 +757,9 @@ void f8_cpu_device::f8_lr_is_a()
***************************************************/
void f8_cpu_device::f8_pk()
{
- m_dbus = m_r->read_byte(13);
+ m_dbus = m_r.read_byte(13);
ROMC_12();
- m_dbus = m_r->read_byte(12);
+ m_dbus = m_r.read_byte(12);
ROMC_14();
}
@@ -770,9 +769,9 @@ void f8_cpu_device::f8_pk()
***************************************************/
void f8_cpu_device::f8_lr_p0_q()
{
- m_dbus = m_r->read_byte(15);
+ m_dbus = m_r.read_byte(15);
ROMC_17();
- m_dbus = m_r->read_byte(14);
+ m_dbus = m_r.read_byte(14);
ROMC_14();
}
@@ -783,9 +782,9 @@ void f8_cpu_device::f8_lr_p0_q()
void f8_cpu_device::f8_lr_q_dc()
{
ROMC_06();
- m_r->write_byte(14, m_dbus);
+ m_r.write_byte(14, m_dbus);
ROMC_09();
- m_r->write_byte(15, m_dbus);
+ m_r.write_byte(15, m_dbus);
}
/***************************************************
@@ -794,9 +793,9 @@ void f8_cpu_device::f8_lr_q_dc()
***************************************************/
void f8_cpu_device::f8_lr_dc_q()
{
- m_dbus = m_r->read_byte(14);
+ m_dbus = m_r.read_byte(14);
ROMC_16();
- m_dbus = m_r->read_byte(15);
+ m_dbus = m_r.read_byte(15);
ROMC_19();
}
@@ -806,9 +805,9 @@ void f8_cpu_device::f8_lr_dc_q()
***************************************************/
void f8_cpu_device::f8_lr_dc_h()
{
- m_dbus = m_r->read_byte(10);
+ m_dbus = m_r.read_byte(10);
ROMC_16();
- m_dbus = m_r->read_byte(11);
+ m_dbus = m_r.read_byte(11);
ROMC_19();
}
@@ -819,9 +818,9 @@ void f8_cpu_device::f8_lr_dc_h()
void f8_cpu_device::f8_lr_h_dc()
{
ROMC_06();
- m_r->write_byte(10, m_dbus);
+ m_r.write_byte(10, m_dbus);
ROMC_09();
- m_r->write_byte(11, m_dbus);
+ m_r.write_byte(11, m_dbus);
}
/***************************************************
@@ -948,7 +947,7 @@ void f8_cpu_device::f8_pop()
void f8_cpu_device::f8_lr_w_j()
{
ROMC_1C(cS);
- m_w = m_r->read_byte(9) & 0x1f;
+ m_w = m_r.read_byte(9) & 0x1f;
}
/***************************************************
@@ -957,7 +956,7 @@ void f8_cpu_device::f8_lr_w_j()
***************************************************/
void f8_cpu_device::f8_lr_j_w()
{
- m_r->write_byte(9, m_w);
+ m_r.write_byte(9, m_w);
}
/***************************************************
@@ -1127,8 +1126,8 @@ void f8_cpu_device::f8_xdc()
void f8_cpu_device::f8_ds_r(int r)
{
CLR_OZCS();
- int d = do_add(m_r->read_byte(r), 0xff);
- m_r->write_byte(r, d);
+ int d = do_add(m_r.read_byte(r), 0xff);
+ m_r.write_byte(r, d);
SET_SZ(d);
}
@@ -1139,8 +1138,8 @@ void f8_cpu_device::f8_ds_r(int r)
void f8_cpu_device::f8_ds_isar()
{
CLR_OZCS();
- int d = do_add(m_r->read_byte(m_is), 0xff);
- m_r->write_byte(m_is, d);
+ int d = do_add(m_r.read_byte(m_is), 0xff);
+ m_r.write_byte(m_is, d);
SET_SZ(d);
}
@@ -1151,8 +1150,8 @@ void f8_cpu_device::f8_ds_isar()
void f8_cpu_device::f8_ds_isar_i()
{
CLR_OZCS();
- int d = do_add(m_r->read_byte(m_is), 0xff);
- m_r->write_byte(m_is, d);
+ int d = do_add(m_r.read_byte(m_is), 0xff);
+ m_r.write_byte(m_is, d);
SET_SZ(d);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1164,8 +1163,8 @@ void f8_cpu_device::f8_ds_isar_i()
void f8_cpu_device::f8_ds_isar_d()
{
CLR_OZCS();
- int d = do_add(m_r->read_byte(m_is), 0xff);
- m_r->write_byte(m_is, d);
+ int d = do_add(m_r.read_byte(m_is), 0xff);
+ m_r.write_byte(m_is, d);
SET_SZ(d);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1176,7 +1175,7 @@ void f8_cpu_device::f8_ds_isar_d()
***************************************************/
void f8_cpu_device::f8_lr_a_r(int r)
{
- m_a = m_r->read_byte(r);
+ m_a = m_r.read_byte(r);
}
/***************************************************
@@ -1185,7 +1184,7 @@ void f8_cpu_device::f8_lr_a_r(int r)
***************************************************/
void f8_cpu_device::f8_lr_a_isar()
{
- m_a = m_r->read_byte(m_is);
+ m_a = m_r.read_byte(m_is);
}
/***************************************************
@@ -1194,7 +1193,7 @@ void f8_cpu_device::f8_lr_a_isar()
***************************************************/
void f8_cpu_device::f8_lr_a_isar_i()
{
- m_a = m_r->read_byte(m_is);
+ m_a = m_r.read_byte(m_is);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1204,7 +1203,7 @@ void f8_cpu_device::f8_lr_a_isar_i()
***************************************************/
void f8_cpu_device::f8_lr_a_isar_d()
{
- m_a = m_r->read_byte(m_is);
+ m_a = m_r.read_byte(m_is);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1214,7 +1213,7 @@ void f8_cpu_device::f8_lr_a_isar_d()
***************************************************/
void f8_cpu_device::f8_lr_r_a(int r)
{
- m_r->write_byte(r, m_a);
+ m_r.write_byte(r, m_a);
}
/***************************************************
@@ -1223,7 +1222,7 @@ void f8_cpu_device::f8_lr_r_a(int r)
***************************************************/
void f8_cpu_device::f8_lr_isar_a()
{
- m_r->write_byte(m_is, m_a);
+ m_r.write_byte(m_is, m_a);
}
/***************************************************
@@ -1232,7 +1231,7 @@ void f8_cpu_device::f8_lr_isar_a()
***************************************************/
void f8_cpu_device::f8_lr_isar_i_a()
{
- m_r->write_byte(m_is, m_a);
+ m_r.write_byte(m_is, m_a);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1242,7 +1241,7 @@ void f8_cpu_device::f8_lr_isar_i_a()
***************************************************/
void f8_cpu_device::f8_lr_isar_d_a()
{
- m_r->write_byte(m_is, m_a);
+ m_r.write_byte(m_is, m_a);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1398,7 +1397,7 @@ void f8_cpu_device::f8_ins_0(int n)
{
ROMC_1C(cS);
CLR_OZCS();
- m_a = m_iospace->read_byte(n);
+ m_a = m_ios.read_byte(n);
SET_SZ(m_a);
}
@@ -1423,7 +1422,7 @@ void f8_cpu_device::f8_ins_1(int n)
void f8_cpu_device::f8_outs_0(int n)
{
ROMC_1C(cS);
- m_iospace->write_byte(n, m_a);
+ m_ios.write_byte(n, m_a);
}
/***************************************************
@@ -1445,7 +1444,7 @@ void f8_cpu_device::f8_outs_1(int n)
void f8_cpu_device::f8_as(int r)
{
CLR_OZCS();
- m_a = do_add(m_a, m_r->read_byte(r));
+ m_a = do_add(m_a, m_r.read_byte(r));
SET_SZ(m_a);
}
@@ -1456,7 +1455,7 @@ void f8_cpu_device::f8_as(int r)
void f8_cpu_device::f8_as_isar()
{
CLR_OZCS();
- m_a = do_add(m_a, m_r->read_byte(m_is));
+ m_a = do_add(m_a, m_r.read_byte(m_is));
SET_SZ(m_a);
}
@@ -1467,7 +1466,7 @@ void f8_cpu_device::f8_as_isar()
void f8_cpu_device::f8_as_isar_i()
{
CLR_OZCS();
- m_a = do_add(m_a, m_r->read_byte(m_is));
+ m_a = do_add(m_a, m_r.read_byte(m_is));
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1479,7 +1478,7 @@ void f8_cpu_device::f8_as_isar_i()
void f8_cpu_device::f8_as_isar_d()
{
CLR_OZCS();
- m_a = do_add(m_a, m_r->read_byte(m_is));
+ m_a = do_add(m_a, m_r.read_byte(m_is));
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1491,7 +1490,7 @@ void f8_cpu_device::f8_as_isar_d()
void f8_cpu_device::f8_asd(int r)
{
ROMC_1C(cS);
- m_a = do_add_decimal(m_a, m_r->read_byte(r));
+ m_a = do_add_decimal(m_a, m_r.read_byte(r));
}
/***************************************************
@@ -1501,7 +1500,7 @@ void f8_cpu_device::f8_asd(int r)
void f8_cpu_device::f8_asd_isar()
{
ROMC_1C(cS);
- m_a = do_add_decimal(m_a, m_r->read_byte(m_is));
+ m_a = do_add_decimal(m_a, m_r.read_byte(m_is));
}
/***************************************************
@@ -1511,7 +1510,7 @@ void f8_cpu_device::f8_asd_isar()
void f8_cpu_device::f8_asd_isar_i()
{
ROMC_1C(cS);
- m_a = do_add_decimal(m_a, m_r->read_byte(m_is));
+ m_a = do_add_decimal(m_a, m_r.read_byte(m_is));
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1522,7 +1521,7 @@ void f8_cpu_device::f8_asd_isar_i()
void f8_cpu_device::f8_asd_isar_d()
{
ROMC_1C(cS);
- m_a = do_add_decimal(m_a, m_r->read_byte(m_is));
+ m_a = do_add_decimal(m_a, m_r.read_byte(m_is));
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1533,7 +1532,7 @@ void f8_cpu_device::f8_asd_isar_d()
void f8_cpu_device::f8_xs(int r)
{
CLR_OZCS();
- m_a ^= m_r->read_byte(r);
+ m_a ^= m_r.read_byte(r);
SET_SZ(m_a);
}
@@ -1544,7 +1543,7 @@ void f8_cpu_device::f8_xs(int r)
void f8_cpu_device::f8_xs_isar()
{
CLR_OZCS();
- m_a ^= m_r->read_byte(m_is);
+ m_a ^= m_r.read_byte(m_is);
SET_SZ(m_a);
}
@@ -1555,7 +1554,7 @@ void f8_cpu_device::f8_xs_isar()
void f8_cpu_device::f8_xs_isar_i()
{
CLR_OZCS();
- m_a ^= m_r->read_byte(m_is);
+ m_a ^= m_r.read_byte(m_is);
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1567,7 +1566,7 @@ void f8_cpu_device::f8_xs_isar_i()
void f8_cpu_device::f8_xs_isar_d()
{
CLR_OZCS();
- m_a ^= m_r->read_byte(m_is);
+ m_a ^= m_r.read_byte(m_is);
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
@@ -1579,7 +1578,7 @@ void f8_cpu_device::f8_xs_isar_d()
void f8_cpu_device::f8_ns(int r)
{
CLR_OZCS();
- m_a &= m_r->read_byte(r);
+ m_a &= m_r.read_byte(r);
SET_SZ(m_a);
}
@@ -1590,7 +1589,7 @@ void f8_cpu_device::f8_ns(int r)
void f8_cpu_device::f8_ns_isar()
{
CLR_OZCS();
- m_a &= m_r->read_byte(m_is);
+ m_a &= m_r.read_byte(m_is);
SET_SZ(m_a);
}
@@ -1601,7 +1600,7 @@ void f8_cpu_device::f8_ns_isar()
void f8_cpu_device::f8_ns_isar_i()
{
CLR_OZCS();
- m_a &= m_r->read_byte(m_is);
+ m_a &= m_r.read_byte(m_is);
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is + 1) & 0x07);
}
@@ -1613,7 +1612,7 @@ void f8_cpu_device::f8_ns_isar_i()
void f8_cpu_device::f8_ns_isar_d()
{
CLR_OZCS();
- m_a &= m_r->read_byte(m_is);
+ m_a &= m_r.read_byte(m_is);
SET_SZ(m_a);
m_is = (m_is & 0x38) | ((m_is - 1) & 0x07);
}
diff --git a/src/devices/cpu/f8/f8.h b/src/devices/cpu/f8/f8.h
index e8851da127e..ed12ecab708 100644
--- a/src/devices/cpu/f8/f8.h
+++ b/src/devices/cpu/f8/f8.h
@@ -66,10 +66,9 @@ private:
u8 m_dbus; /* data bus value */
u16 m_io; /* last I/O address */
u16 m_irq_vector;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_r;
- address_space *m_iospace;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_program;
+ memory_access<6, 0, 0, ENDIANNESS_BIG>::cache m_r;
+ memory_access<8, 0, 0, ENDIANNESS_BIG>::specific m_ios;
int m_icount;
int m_irq_request;
diff --git a/src/devices/cpu/fr/fr.cpp b/src/devices/cpu/fr/fr.cpp
index 187b2782a4f..51ae7313780 100644
--- a/src/devices/cpu/fr/fr.cpp
+++ b/src/devices/cpu/fr/fr.cpp
@@ -18,8 +18,6 @@ DEFINE_DEVICE_TYPE(MB91F155A, mb91f155a_device, "mb91f155a", "Fujitsu MB91F155A"
fr_cpu_device::fr_cpu_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int addrbits, address_map_constructor map)
: cpu_device(mconfig, type, tag, owner, clock)
, m_space_config("program", ENDIANNESS_BIG, 32, addrbits, 0, map)
- , m_space(nullptr)
- , m_cache(nullptr)
, m_regs{0}
, m_pc(0)
, m_ps(0)
@@ -55,8 +53,8 @@ device_memory_interface::space_config_vector fr_cpu_device::memory_space_config(
void fr_cpu_device::device_start()
{
- m_space = &space(AS_PROGRAM);
- m_cache = m_space->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_space);
set_icountptr(m_icount);
@@ -106,7 +104,7 @@ void fr_cpu_device::device_reset()
void fr_cpu_device::execute_run()
{
- m_pc = m_space->read_dword(m_tbr + 0x3fc);
+ m_pc = m_space.read_dword(m_tbr + 0x3fc);
debugger_instruction_hook(m_pc);
diff --git a/src/devices/cpu/fr/fr.h b/src/devices/cpu/fr/fr.h
index 3e931cbff87..60e6eb8469f 100644
--- a/src/devices/cpu/fr/fr.h
+++ b/src/devices/cpu/fr/fr.h
@@ -43,8 +43,8 @@ protected:
private:
// address space
address_space_config m_space_config;
- address_space *m_space;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_BIG>::specific m_space;
// internal state
u32 m_regs[17]; // includes both SSP and USP
diff --git a/src/devices/cpu/g65816/g65816.cpp b/src/devices/cpu/g65816/g65816.cpp
index 1b5ab166ff8..56883b90e6e 100644
--- a/src/devices/cpu/g65816/g65816.cpp
+++ b/src/devices/cpu/g65816/g65816.cpp
@@ -860,10 +860,9 @@ void g65816_device::device_start()
m_execute = nullptr;
m_debugger_temp = 0;
- address_space &program_space = space(AS_PROGRAM);
- m_data_space = has_space(AS_DATA) ? &space(AS_DATA) : &program_space;
- m_program_cache = program_space.cache<0, 0, ENDIANNESS_LITTLE>();
- m_opcode_cache = (has_space(AS_OPCODES) ? space(AS_OPCODES) : program_space).cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_program);
+ (has_space(AS_OPCODES) ? space(AS_OPCODES) : space(AS_PROGRAM)).cache(m_opcode);
+ (has_space(AS_DATA) ? space(AS_DATA) : space(AS_PROGRAM)).specific(m_data);
m_wdm_w.resolve_safe();
diff --git a/src/devices/cpu/g65816/g65816.h b/src/devices/cpu/g65816/g65816.h
index d37017a5de8..5f0c5183ea7 100644
--- a/src/devices/cpu/g65816/g65816.h
+++ b/src/devices/cpu/g65816/g65816.h
@@ -233,9 +233,10 @@ protected:
unsigned m_fastROM; /* SNES specific */
unsigned m_ir; /* Instruction Register */
unsigned m_irq_delay; /* delay 1 instruction before checking irq */
- address_space *m_data_space;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_program_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_opcode_cache;
+ memory_access<24, 0, 0, ENDIANNESS_LITTLE>::cache m_program;
+ memory_access<24, 0, 0, ENDIANNESS_LITTLE>::cache m_opcode;
+ memory_access<24, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+
unsigned m_stopped; /* Sets how the CPU is stopped */
const opcode_func* m_opcodes;
get_reg_func m_get_reg;
diff --git a/src/devices/cpu/g65816/g65816cm.h b/src/devices/cpu/g65816/g65816cm.h
index c31b43fb5e6..e8ae404ddf3 100644
--- a/src/devices/cpu/g65816/g65816cm.h
+++ b/src/devices/cpu/g65816/g65816cm.h
@@ -13,10 +13,10 @@
#undef G65816_CALL_DEBUGGER
#define G65816_CALL_DEBUGGER(x) debugger_instruction_hook(x)
-#define g65816_read_8(addr) m_data_space->read_byte(addr)
-#define g65816_write_8(addr,data) m_data_space->write_byte(addr,data)
-#define g65816_read_8_immediate(A) m_program_cache->read_byte(A)
-#define g65816_read_8_opcode(A) m_opcode_cache->read_byte(A)
+#define g65816_read_8(addr) m_data.read_byte(addr)
+#define g65816_write_8(addr,data) m_data.write_byte(addr,data)
+#define g65816_read_8_immediate(A) m_program.read_byte(A)
+#define g65816_read_8_opcode(A) m_opcode.read_byte(A)
#define g65816_jumping(A)
#define g65816_branching(A)
diff --git a/src/devices/cpu/h6280/h6280.cpp b/src/devices/cpu/h6280/h6280.cpp
index 814f906de81..96ecb18534d 100644
--- a/src/devices/cpu/h6280/h6280.cpp
+++ b/src/devices/cpu/h6280/h6280.cpp
@@ -320,9 +320,9 @@ void h6280_device::device_reset()
#endif
m_io_buffer = 0;
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
/* set I and B flags */
P = _fI | _fB;
@@ -1605,7 +1605,7 @@ inline uint8_t h6280_device::smb(int bit, uint8_t tmp)
inline void h6280_device::st0(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0000,tmp);
+ m_io.write_byte(0x0000,tmp);
}
/* 6280 ********************************************************
@@ -1614,7 +1614,7 @@ inline void h6280_device::st0(uint8_t tmp)
inline void h6280_device::st1(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0002,tmp);
+ m_io.write_byte(0x0002,tmp);
}
/* 6280 ********************************************************
@@ -1623,7 +1623,7 @@ inline void h6280_device::st1(uint8_t tmp)
inline void h6280_device::st2(uint8_t tmp)
{
clear_t();
- m_io->write_byte(0x0003,tmp);
+ m_io.write_byte(0x0003,tmp);
}
/* 6280 ********************************************************
@@ -2329,7 +2329,7 @@ void h6280_device::execute_set_input(int inputnum, int state)
uint8_t h6280_device::program_read8(offs_t addr)
{
check_vdc_vce_penalty(addr);
- return m_program->read_byte(translated(addr));
+ return m_program.read_byte(translated(addr));
}
/***************************************************************
@@ -2338,7 +2338,7 @@ uint8_t h6280_device::program_read8(offs_t addr)
void h6280_device::program_write8(offs_t addr, uint8_t data)
{
check_vdc_vce_penalty(addr);
- m_program->write_byte(translated(addr), data);
+ m_program.write_byte(translated(addr), data);
}
/***************************************************************
@@ -2346,7 +2346,7 @@ void h6280_device::program_write8(offs_t addr, uint8_t data)
***************************************************************/
uint8_t h6280_device::program_read8z(offs_t addr)
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff));
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff));
}
/***************************************************************
@@ -2354,7 +2354,7 @@ uint8_t h6280_device::program_read8z(offs_t addr)
***************************************************************/
void h6280_device::program_write8z(offs_t addr, uint8_t data)
{
- m_program->write_byte((m_mmr[1] << 13) | (addr & 0x1fff), data);
+ m_program.write_byte((m_mmr[1] << 13) | (addr & 0x1fff), data);
}
/***************************************************************
@@ -2362,8 +2362,8 @@ void h6280_device::program_write8z(offs_t addr, uint8_t data)
***************************************************************/
uint16_t h6280_device::program_read16(offs_t addr)
{
- return m_program->read_byte(translated(addr)) |
- (m_program->read_byte(translated(addr + 1)) << 8);
+ return m_program.read_byte(translated(addr)) |
+ (m_program.read_byte(translated(addr + 1)) << 8);
}
/***************************************************************
@@ -2373,13 +2373,13 @@ uint16_t h6280_device::program_read16z(offs_t addr)
{
if ((addr & 0xff) == 0xff)
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
- (m_program->read_byte((m_mmr[1] << 13) | ((addr - 0xff) & 0x1fff)) << 8);
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
+ (m_program.read_byte((m_mmr[1] << 13) | ((addr - 0xff) & 0x1fff)) << 8);
}
else
{
- return m_program->read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
- (m_program->read_byte((m_mmr[1] << 13) | ((addr + 1) & 0x1fff)) << 8);
+ return m_program.read_byte((m_mmr[1] << 13) | (addr & 0x1fff)) |
+ (m_program.read_byte((m_mmr[1] << 13) | ((addr + 1) & 0x1fff)) << 8);
}
}
@@ -2388,7 +2388,7 @@ uint16_t h6280_device::program_read16z(offs_t addr)
***************************************************************/
void h6280_device::push(uint8_t value)
{
- m_program->write_byte((m_mmr[1] << 13) | m_sp.d, value);
+ m_program.write_byte((m_mmr[1] << 13) | m_sp.d, value);
S--;
}
@@ -2398,7 +2398,7 @@ void h6280_device::push(uint8_t value)
void h6280_device::pull(uint8_t &value)
{
S++;
- value = m_program->read_byte((m_mmr[1] << 13) | m_sp.d);
+ value = m_program.read_byte((m_mmr[1] << 13) | m_sp.d);
}
/***************************************************************
@@ -2406,7 +2406,7 @@ void h6280_device::pull(uint8_t &value)
***************************************************************/
uint8_t h6280_device::read_opcode()
{
- return m_cache->read_byte(translated(PCW));
+ return m_cache.read_byte(translated(PCW));
}
/***************************************************************
@@ -2414,7 +2414,7 @@ uint8_t h6280_device::read_opcode()
***************************************************************/
uint8_t h6280_device::read_opcode_arg()
{
- return m_cache->read_byte(translated(PCW));
+ return m_cache.read_byte(translated(PCW));
}
diff --git a/src/devices/cpu/h6280/h6280.h b/src/devices/cpu/h6280/h6280.h
index 923591eec93..22d3ac06ce6 100644
--- a/src/devices/cpu/h6280/h6280.h
+++ b/src/devices/cpu/h6280/h6280.h
@@ -380,9 +380,9 @@ protected:
uint8_t m_timer_scale;
// address spaces
- address_space *m_program;
- address_space *m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<21, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<21, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 2, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
typedef void (h6280_device::*ophandler)();
diff --git a/src/devices/cpu/h8/h8.cpp b/src/devices/cpu/h8/h8.cpp
index eaca5b2a8ea..0b4d35ebbd5 100644
--- a/src/devices/cpu/h8/h8.cpp
+++ b/src/devices/cpu/h8/h8.cpp
@@ -19,7 +19,7 @@
h8_device::h8_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, address_map_constructor map_delegate) :
cpu_device(mconfig, type, tag, owner, clock),
program_config("program", ENDIANNESS_BIG, 16, 16, 0, map_delegate),
- io_config("io", ENDIANNESS_BIG, 16, 16, -1), program(nullptr), io(nullptr), cache(nullptr), PPC(0), NPC(0), PC(0), PIR(0), EXR(0), CCR(0), MAC(0), MACF(0),
+ io_config("io", ENDIANNESS_BIG, 16, 16, -1), PPC(0), NPC(0), PC(0), PIR(0), EXR(0), CCR(0), MAC(0), MACF(0),
TMP1(0), TMP2(0), TMPR(0), inst_state(0), inst_substate(0), icount(0), bcount(0), irq_vector(0), taken_irq_vector(0), irq_level(0), taken_irq_level(0), irq_required(false), irq_nmi(false)
{
supports_advanced = false;
@@ -38,9 +38,9 @@ void h8_device::device_config_complete()
void h8_device::device_start()
{
- program = &space(AS_PROGRAM);
- cache = program->cache<1, 0, ENDIANNESS_BIG>();
- io = &space(AS_IO);
+ space(AS_PROGRAM).cache(cache);
+ space(AS_PROGRAM).specific(program);
+ space(AS_IO).specific(io);
uint32_t pcmask = mode_advanced ? 0xffffff : 0xffff;
state_add<uint32_t>(H8_PC, "PC",
@@ -347,7 +347,7 @@ void h8_device::state_string_export(const device_state_entry &entry, std::string
uint16_t h8_device::read16i(uint32_t adr)
{
icount--;
- return cache->read_word(adr & ~1);
+ return cache.read_word(adr & ~1);
}
uint16_t h8_device::fetch()
@@ -360,25 +360,25 @@ uint16_t h8_device::fetch()
uint8_t h8_device::read8(uint32_t adr)
{
icount--;
- return program->read_byte(adr);
+ return program.read_byte(adr);
}
void h8_device::write8(uint32_t adr, uint8_t data)
{
icount--;
- program->write_byte(adr, data);
+ program.write_byte(adr, data);
}
uint16_t h8_device::read16(uint32_t adr)
{
icount--;
- return program->read_word(adr & ~1);
+ return program.read_word(adr & ~1);
}
void h8_device::write16(uint32_t adr, uint16_t data)
{
icount--;
- program->write_word(adr & ~1, data);
+ program.write_word(adr & ~1, data);
}
bool h8_device::exr_in_stack() const
diff --git a/src/devices/cpu/h8/h8.h b/src/devices/cpu/h8/h8.h
index e343be4fe90..e8e1647288e 100644
--- a/src/devices/cpu/h8/h8.h
+++ b/src/devices/cpu/h8/h8.h
@@ -113,8 +113,9 @@ protected:
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
address_space_config program_config, io_config;
- address_space *program, *io;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *cache;
+ memory_access<32, 1, 0, ENDIANNESS_BIG>::cache cache;
+ memory_access<32, 1, 0, ENDIANNESS_BIG>::specific program;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::specific io;
h8_dma_device *dma_device;
h8_dtc_device *dtc_device;
h8_dma_state *current_dma;
diff --git a/src/devices/cpu/h8500/h8500.cpp b/src/devices/cpu/h8500/h8500.cpp
index 9a0ebc225b0..c96fed16f7f 100644
--- a/src/devices/cpu/h8500/h8500.cpp
+++ b/src/devices/cpu/h8500/h8500.cpp
@@ -16,8 +16,6 @@ h8500_device::h8500_device(const machine_config &mconfig, device_type type, cons
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_BIG, buswidth, addrbits, 0, map)
, m_ram_config("internal RAM", ENDIANNESS_BIG, 16, ramsize, 0, address_map_constructor(FUNC(h8500_device::ram_map), this))
- , m_program(nullptr)
- , m_ram_cache(nullptr)
, m_pc(0)
, m_ppc(0)
, m_sr(0)
@@ -68,7 +66,7 @@ void h8500_device::device_start()
{
m_program = &space(AS_PROGRAM);
if (has_space(AS_DATA))
- m_ram_cache = space(AS_DATA).cache<1, 0, ENDIANNESS_BIG>();
+ space(AS_DATA).cache(m_ram_cache);
set_icountptr(m_icount);
diff --git a/src/devices/cpu/h8500/h8500.h b/src/devices/cpu/h8500/h8500.h
index e3cf3e2aeb1..ede393687a9 100644
--- a/src/devices/cpu/h8500/h8500.h
+++ b/src/devices/cpu/h8500/h8500.h
@@ -50,7 +50,7 @@ private:
address_space_config m_program_config;
address_space_config m_ram_config;
address_space *m_program;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_ram_cache;
+ memory_access<11, 1, 0, ENDIANNESS_BIG>::cache m_ram_cache;
// internal registers
u16 m_pc;
diff --git a/src/devices/cpu/hphybrid/hphybrid.cpp b/src/devices/cpu/hphybrid/hphybrid.cpp
index 0c03210ea04..fae3b8474c7 100644
--- a/src/devices/cpu/hphybrid/hphybrid.cpp
+++ b/src/devices/cpu/hphybrid/hphybrid.cpp
@@ -219,9 +219,9 @@ void hp_hybrid_cpu_device::device_start()
state_add(HPHYBRID_I, "I", m_reg_I).noshow();
}
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_reg_A));
save_item(NAME(m_reg_B));
@@ -1029,7 +1029,7 @@ uint16_t hp_hybrid_cpu_device::RM(uint32_t addr)
m_stm_func(m_curr_cycle | CYCLE_RD_MASK);
m_curr_cycle = 0;
}
- return m_cache->read_word(addr);
+ return m_cache.read_word(addr);
}
}
@@ -1152,7 +1152,7 @@ void hp_hybrid_cpu_device::WM(uint32_t addr , uint16_t v)
m_stm_func(m_curr_cycle | CYCLE_WR_MASK);
m_curr_cycle = 0;
}
- m_program->write_word(addr , v);
+ m_program.write_word(addr , v);
}
}
@@ -1375,13 +1375,13 @@ void hp_hybrid_cpu_device::enter_isr()
uint16_t hp_hybrid_cpu_device::RIO(uint8_t pa , uint8_t ic)
{
m_icount -= IO_RW_CYCLES;
- return m_io->read_word(HP_MAKE_IOADDR(pa, ic));
+ return m_io.read_word(HP_MAKE_IOADDR(pa, ic));
}
void hp_hybrid_cpu_device::WIO(uint8_t pa , uint8_t ic , uint16_t v)
{
m_icount -= IO_RW_CYCLES;
- m_io->write_word(HP_MAKE_IOADDR(pa, ic) , v);
+ m_io.write_word(HP_MAKE_IOADDR(pa, ic) , v);
}
uint8_t hp_hybrid_cpu_device::do_dec_shift_r(uint8_t d1 , uint64_t& mantissa)
@@ -1625,7 +1625,7 @@ bool hp_5061_3011_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_pc
// Extend address, form byte address
uint16_t mask = BIT(tmp_addr , 0) ? 0x00ff : 0xff00;
tmp_addr = add_mae(AEC_CASE_C , tmp_addr >> 1);
- m_program->write_word(tmp_addr , tmp , mask);
+ m_program.write_word(tmp_addr , tmp , mask);
m_icount -= m_w_cycles;
}
} else {
@@ -1992,7 +1992,7 @@ bool hp_09825_67907_cpu_device::execute_no_bpc(uint16_t opcode , uint16_t& next_
m_curr_cycle = 0;
}
uint16_t mask = BIT(*ptr_reg , 15) ? 0xff00 : 0x00ff;
- m_program->write_word(tmp_addr , tmp , mask);
+ m_program.write_word(tmp_addr , tmp , mask);
m_icount -= m_w_cycles;
}
} else {
diff --git a/src/devices/cpu/hphybrid/hphybrid.h b/src/devices/cpu/hphybrid/hphybrid.h
index e9e4263da05..3d4a7cc7536 100644
--- a/src/devices/cpu/hphybrid/hphybrid.h
+++ b/src/devices/cpu/hphybrid/hphybrid.h
@@ -198,14 +198,14 @@ protected:
uint16_t m_reg_r26; // R26 register
uint16_t m_reg_r27; // R27 register
- address_space *m_program;
+ memory_access<22, 1, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<22, 1, -1, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 6, 1, -1, ENDIANNESS_BIG>::specific m_io;
private:
address_space_config m_program_config;
address_space_config m_io_config;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
- address_space *m_io;
uint32_t get_ea(uint16_t opcode);
void do_add(uint16_t& addend1 , uint16_t addend2);
diff --git a/src/devices/cpu/i386/athlon.cpp b/src/devices/cpu/i386/athlon.cpp
index e47f99a2af6..7da09ef271b 100644
--- a/src/devices/cpu/i386/athlon.cpp
+++ b/src/devices/cpu/i386/athlon.cpp
@@ -28,10 +28,11 @@ void athlonxp_device::device_start()
{
i386_common_init();
register_state_i386_x87_xmm();
- m_data = &space(AS_DATA);
- m_opcodes = &space(AS_OPCODES);
- mmacache32 = m_data->cache<2, 0, ENDIANNESS_LITTLE>();
- m_opcodes->install_read_handler(0, 0xffffffff, read32_delegate(*this, FUNC(athlonxp_device::debug_read_memory)));
+ space(AS_DATA).specific(m_data);
+ space(AS_OPCODES).specific(m_opcodes);
+ space(AS_DATA).cache(mmacache32);
+
+ space(AS_OPCODES).install_read_handler(0, 0xffffffff, read32_delegate(*this, FUNC(athlonxp_device::debug_read_memory)));
build_x87_opcode_table();
build_opcode_table(OP_I386 | OP_FPU | OP_I486 | OP_PENTIUM | OP_PPRO | OP_MMX | OP_SSE);
@@ -192,7 +193,6 @@ READ32_MEMBER(athlonxp_device::debug_read_memory)
offs_t address = offset << 2;
int mode = check_cacheable(address);
bool nocache = false;
- address_space *m = m_program;
u8 *data;
if ((mode & 7) == 0)
@@ -207,8 +207,8 @@ READ32_MEMBER(athlonxp_device::debug_read_memory)
return *(u32 *)(data + offset);
}
if (address_mode<1>(address))
- m = m_data;
- return m->read_dword(address);
+ return m_data.read_dword(address);
+ return m_program->read_dword(address);
}
template <class dt, offs_t xorle>
@@ -216,7 +216,6 @@ dt athlonxp_device::opcode_read_cache(offs_t address)
{
int mode = check_cacheable(address);
bool nocache = false;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m = macache32;
u8 *data;
if ((mode & 7) == 0)
@@ -238,28 +237,35 @@ dt athlonxp_device::opcode_read_cache(offs_t address)
offs_t old_address = cache.old();
for (int w = 0; w < 64; w += 4)
- m->write_dword(old_address + w, *(u32 *)(data + w));
+ macache32.write_dword(old_address + w, *(u32 *)(data + w));
}
for (int r = 0; r < 64; r += 4)
- *(u32 *)(data + r) = m->read_dword(address + r);
+ *(u32 *)(data + r) = macache32.read_dword(address + r);
return *(dt *)(data + offset);
}
}
if (address_mode<1>(address))
- m = mmacache32;
+ {
+ if (sizeof(dt) == 1)
+ return mmacache32.read_byte(address);
+ else if (sizeof(dt) == 2)
+ return mmacache32.read_word(address);
+ else
+ return mmacache32.read_dword(address);
+ }
if (sizeof(dt) == 1)
- return m->read_byte(address);
+ return macache32.read_byte(address);
else if (sizeof(dt) == 2)
- return m->read_word(address);
+ return macache32.read_word(address);
else
- return m->read_dword(address);
+ return macache32.read_dword(address);
+
}
uint32_t athlonxp_device::program_read_cache(offs_t address, uint32_t mask)
{
int mode = check_cacheable(address);
bool nocache = false;
- address_space *m = m_program;
u8 *data;
if ((mode & 7) == 0)
@@ -281,23 +287,22 @@ uint32_t athlonxp_device::program_read_cache(offs_t address, uint32_t mask)
offs_t old_address = cache.old();
for (int w = 0; w < 64; w += 4)
- m->write_dword(old_address + w, *(u32 *)(data + w));
+ m_program->write_dword(old_address + w, *(u32 *)(data + w));
}
for (int r = 0; r < 64; r += 4)
- *(u32 *)(data + r) = m->read_dword(address + r);
+ *(u32 *)(data + r) = m_program->read_dword(address + r);
return *(u32 *)(data + offset) & mask;
}
}
if (address_mode<1>(address))
- m = m_data;
- return m->read_dword(address, mask) & mask;
+ return m_data.read_dword(address, mask) & mask;
+ return m_program->read_dword(address, mask) & mask;
}
void athlonxp_device::program_write_cache(offs_t address, uint32_t data, uint32_t mask)
{
int mode = check_cacheable(address);
bool nocache = false;
- address_space *m = m_program;
u8 *dataw;
if ((mode & 7) == 0)
@@ -322,17 +327,18 @@ void athlonxp_device::program_write_cache(offs_t address, uint32_t data, uint32_
offs_t old_address = cache.old();
for (int w = 0; w < 64; w += 4)
- m->write_dword(old_address + w, *(u32 *)(dataw + w));
+ m_program->write_dword(old_address + w, *(u32 *)(dataw + w));
}
for (int r = 0; r < 64; r += 4)
- *(u32 *)(dataw + r) = m->read_dword(address + r);
+ *(u32 *)(dataw + r) = m_program->read_dword(address + r);
*(u32 *)(dataw + offset) = (*(u32 *)(dataw + offset) & ~mask) | (data & mask);
return;
}
}
if (address_mode<0>(address))
- m = m_data;
- m->write_dword(address, data, mask);
+ m_data.write_dword(address, data, mask);
+ else
+ m_program->write_dword(address, data, mask);
}
void athlonxp_device::cache_writeback()
diff --git a/src/devices/cpu/i386/athlon.h b/src/devices/cpu/i386/athlon.h
index a4559fcb682..f7ee68ce962 100644
--- a/src/devices/cpu/i386/athlon.h
+++ b/src/devices/cpu/i386/athlon.h
@@ -55,10 +55,10 @@ private:
DECLARE_READ32_MEMBER(debug_read_memory);
address_space_config m_data_config;
- address_space *m_data;
address_space_config m_opcodes_config;
- address_space *m_opcodes;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *mmacache32;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache mmacache32;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_opcodes;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_data;
uint8_t m_processor_name_string[48];
offs_t m_msr_top_mem;
uint64_t m_msr_sys_cfg;
diff --git a/src/devices/cpu/i386/i386.cpp b/src/devices/cpu/i386/i386.cpp
index 0d42c78ac26..e8fdf6a12ea 100644
--- a/src/devices/cpu/i386/i386.cpp
+++ b/src/devices/cpu/i386/i386.cpp
@@ -1937,9 +1937,9 @@ void i386_device::i386_common_init()
m_program = &space(AS_PROGRAM);
if(m_program->data_width() == 16) {
// for the 386sx
- macache16 = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
+ m_program->cache(macache16);
} else {
- macache32 = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_program->cache(macache32);
}
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/i386/i386.h b/src/devices/cpu/i386/i386.h
index a251cab955f..64730816b66 100644
--- a/src/devices/cpu/i386/i386.h
+++ b/src/devices/cpu/i386/i386.h
@@ -89,9 +89,9 @@ protected:
virtual void cache_clean() {}
// routine to access memory
- virtual u8 mem_pr8(offs_t address) { return macache32->read_byte(address); }
- virtual u16 mem_pr16(offs_t address) { return macache32->read_word(address); }
- virtual u32 mem_pr32(offs_t address) { return macache32->read_dword(address); }
+ virtual u8 mem_pr8(offs_t address) { return macache32.read_byte(address); }
+ virtual u16 mem_pr16(offs_t address) { return macache32.read_word(address); }
+ virtual u32 mem_pr32(offs_t address) { return macache32.read_dword(address); }
address_space_config m_program_config;
address_space_config m_io_config;
@@ -307,8 +307,8 @@ protected:
address_space *m_program;
address_space *m_io;
uint32_t m_a20_mask;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *macache16;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *macache32;
+ memory_access<32, 1, 0, ENDIANNESS_LITTLE>::cache macache16;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache macache32;
int m_cpuid_max_input_value_eax; // Highest CPUID standard function available
uint32_t m_cpuid_id0, m_cpuid_id1, m_cpuid_id2;
@@ -1528,9 +1528,9 @@ public:
i386sx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- virtual u8 mem_pr8(offs_t address) override { return macache16->read_byte(address); };
- virtual u16 mem_pr16(offs_t address) override { return macache16->read_word(address); };
- virtual u32 mem_pr32(offs_t address) override { return macache16->read_dword(address); };
+ virtual u8 mem_pr8(offs_t address) override { return macache16.read_byte(address); };
+ virtual u16 mem_pr16(offs_t address) override { return macache16.read_word(address); };
+ virtual u32 mem_pr32(offs_t address) override { return macache16.read_dword(address); };
virtual uint16_t READ16PL(uint32_t ea, uint8_t privilege) override;
virtual uint32_t READ32PL(uint32_t ea, uint8_t privilege) override;
diff --git a/src/devices/cpu/i8008/i8008.cpp b/src/devices/cpu/i8008/i8008.cpp
index ec404c8902d..0bd6ce04176 100644
--- a/src/devices/cpu/i8008/i8008.cpp
+++ b/src/devices/cpu/i8008/i8008.cpp
@@ -38,8 +38,6 @@ i8008_device::i8008_device(const machine_config &mconfig, const char *tag, devic
: cpu_device(mconfig, I8008, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 14)
, m_io_config("io", ENDIANNESS_LITTLE, 8, 5)
- , m_program(nullptr)
- , m_cache(nullptr)
{
// set our instruction counter
set_icountptr(m_icount);
@@ -52,9 +50,9 @@ i8008_device::i8008_device(const machine_config &mconfig, const char *tag, devic
void i8008_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
// save state
save_item(NAME(m_PC));
@@ -511,11 +509,11 @@ inline void i8008_device::execute_one(int opcode)
if (((opcode>>4)&3)==0) {
// INP
m_icount -= 8;
- m_A = m_io->read_byte((opcode >> 1) & 0x1f);
+ m_A = m_io.read_byte((opcode >> 1) & 0x1f);
} else {
// OUT
m_icount -= 6;
- m_io->write_byte((opcode >> 1) & 0x1f, m_A);
+ m_io.write_byte((opcode >> 1) & 0x1f, m_A);
}
break;
}
@@ -601,7 +599,7 @@ inline void i8008_device::pop_stack()
inline uint8_t i8008_device::rop()
{
- uint8_t retVal = m_cache->read_byte(GET_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(GET_PC.w.l);
GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff;
m_PC = GET_PC;
return retVal;
@@ -618,7 +616,7 @@ inline uint8_t i8008_device::get_reg(uint8_t reg)
case 4 : retVal = m_E; break;
case 5 : retVal = m_H; break;
case 6 : retVal = m_L; break;
- default: retVal = m_program->read_byte((m_H << 8) + m_L); break;
+ default: retVal = m_program.read_byte((m_H << 8) + m_L); break;
}
return retVal;
}
@@ -633,13 +631,13 @@ inline void i8008_device::set_reg(uint8_t reg, uint8_t val)
case 4 : m_E = val; break;
case 5 : m_H = val; break;
case 6 : m_L = val; break;
- default: m_program->write_byte((m_H << 8) + m_L, val); break;
+ default: m_program.write_byte((m_H << 8) + m_L, val); break;
}
}
inline uint8_t i8008_device::arg()
{
- uint8_t retVal = m_cache->read_byte(GET_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(GET_PC.w.l);
GET_PC.w.l = (GET_PC.w.l + 1) & 0x3fff;
m_PC = GET_PC;
return retVal;
diff --git a/src/devices/cpu/i8008/i8008.h b/src/devices/cpu/i8008/i8008.h
index c5b00a1033b..b3183a0640c 100644
--- a/src/devices/cpu/i8008/i8008.h
+++ b/src/devices/cpu/i8008/i8008.h
@@ -81,9 +81,9 @@ protected:
uint8_t m_PARITY[256];
- address_space *m_program;
- address_space *m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<14, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<14, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 5, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
};
// device type definition
diff --git a/src/devices/cpu/i8085/i8085.cpp b/src/devices/cpu/i8085/i8085.cpp
index ab4c439871b..5460ab653ea 100644
--- a/src/devices/cpu/i8085/i8085.cpp
+++ b/src/devices/cpu/i8085/i8085.cpp
@@ -347,10 +347,10 @@ void i8085a_cpu_device::device_start()
}
}
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_opcode_cache = has_space(AS_OPCODES) ? space(AS_OPCODES).cache<0, 0, ENDIANNESS_LITTLE>() : m_cache;
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cprogram);
+ space(AS_PROGRAM).specific(m_program);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_copcodes);
+ space(AS_IO).specific(m_io);
/* resolve callbacks */
m_in_inta_func.resolve();
@@ -670,7 +670,7 @@ u8 i8085a_cpu_device::read_arg()
if (m_in_acknowledge)
return read_inta();
else
- return m_cache->read_byte(m_PC.w.l++);
+ return m_cprogram.read_byte(m_PC.w.l++);
}
PAIR i8085a_cpu_device::read_arg16()
@@ -684,8 +684,8 @@ PAIR i8085a_cpu_device::read_arg16()
}
else
{
- p.b.l = m_cache->read_byte(m_PC.w.l++);
- p.b.h = m_cache->read_byte(m_PC.w.l++);
+ p.b.l = m_cprogram.read_byte(m_PC.w.l++);
+ p.b.h = m_cprogram.read_byte(m_PC.w.l++);
}
return p;
}
@@ -693,7 +693,7 @@ PAIR i8085a_cpu_device::read_arg16()
u8 i8085a_cpu_device::read_op()
{
set_status(0xa2); // instruction fetch
- return m_opcode_cache->read_byte(m_PC.w.l++);
+ return m_copcodes.read_byte(m_PC.w.l++);
}
u8 i8085a_cpu_device::read_inta()
@@ -707,28 +707,28 @@ u8 i8085a_cpu_device::read_inta()
u8 i8085a_cpu_device::read_mem(u32 a)
{
set_status(0x82); // memory read
- return m_program->read_byte(a);
+ return m_program.read_byte(a);
}
void i8085a_cpu_device::write_mem(u32 a, u8 v)
{
set_status(0x00); // memory write
- m_program->write_byte(a, v);
+ m_program.write_byte(a, v);
}
void i8085a_cpu_device::op_push(PAIR p)
{
set_status(0x04); // stack push
- m_program->write_byte(--m_SP.w.l, p.b.h);
- m_program->write_byte(--m_SP.w.l, p.b.l);
+ m_program.write_byte(--m_SP.w.l, p.b.h);
+ m_program.write_byte(--m_SP.w.l, p.b.l);
}
PAIR i8085a_cpu_device::op_pop()
{
PAIR p;
set_status(0x86); // stack pop
- p.b.l = m_program->read_byte(m_SP.w.l++);
- p.b.h = m_program->read_byte(m_SP.w.l++);
+ p.b.l = m_program.read_byte(m_SP.w.l++);
+ p.b.h = m_program.read_byte(m_SP.w.l++);
return p;
}
@@ -1469,7 +1469,7 @@ void i8085a_cpu_device::execute_one(int opcode)
case 0xd3: // OUT nn
set_status(0x10);
m_WZ.d = read_arg();
- m_io->write_byte(m_WZ.d, m_AF.b.h);
+ m_io.write_byte(m_WZ.d, m_AF.b.h);
break;
case 0xd4: // CNC nnnn
op_call(!(m_AF.b.l & CF));
@@ -1505,7 +1505,7 @@ void i8085a_cpu_device::execute_one(int opcode)
case 0xdb: // IN nn
set_status(0x42);
m_WZ.d = read_arg();
- m_AF.b.h = m_io->read_byte(m_WZ.d);
+ m_AF.b.h = m_io.read_byte(m_WZ.d);
break;
case 0xdc: // CC nnnn
op_call(m_AF.b.l & CF);
diff --git a/src/devices/cpu/i8085/i8085.h b/src/devices/cpu/i8085/i8085.h
index 0c67c3a3c56..5378a712e5e 100644
--- a/src/devices/cpu/i8085/i8085.h
+++ b/src/devices/cpu/i8085/i8085.h
@@ -129,10 +129,9 @@ private:
bool m_ietemp; /* import/export temp space */
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_opcode_cache;
- address_space *m_io;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cprogram, m_copcodes;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
/* cycles lookup */
diff --git a/src/devices/cpu/i86/i86.cpp b/src/devices/cpu/i86/i86.cpp
index 8f9697cb97d..50d2039569a 100644
--- a/src/devices/cpu/i86/i86.cpp
+++ b/src/devices/cpu/i86/i86.cpp
@@ -470,11 +470,11 @@ void i8086_common_cpu_device::device_start()
m_opcodes = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
if(m_opcodes->data_width() == 8) {
- auto cache = m_opcodes->cache<0, 0, ENDIANNESS_LITTLE>();
- m_or8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_opcodes->cache(m_cache8);
+ m_or8 = [this](offs_t address) -> u8 { return m_cache8.read_byte(address); };
} else {
- auto cache = m_opcodes->cache<1, 0, ENDIANNESS_LITTLE>();
- m_or8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_opcodes->cache(m_cache16);
+ m_or8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/i86/i86.h b/src/devices/cpu/i86/i86.h
index 3ecf3050dda..f08a8e0c2ba 100644
--- a/src/devices/cpu/i86/i86.h
+++ b/src/devices/cpu/i86/i86.h
@@ -295,6 +295,9 @@ protected:
uint8_t m_test_state;
address_space *m_program, *m_opcodes;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_cache8;
+ memory_access<20, 1, 0, ENDIANNESS_LITTLE>::cache m_cache16;
+
std::function<u8 (offs_t)> m_or8;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/i960/i960.cpp b/src/devices/cpu/i960/i960.cpp
index abf2c089cb2..9db9d6ab095 100644
--- a/src/devices/cpu/i960/i960.cpp
+++ b/src/devices/cpu/i960/i960.cpp
@@ -19,7 +19,7 @@ i960_cpu_device::i960_cpu_device(const machine_config &mconfig, const char *tag,
: cpu_device(mconfig, I960, tag, owner, clock)
, m_stalled(false), m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0)
, m_rcache_pos(0), m_SAT(0), m_PRCB(0), m_PC(0), m_AC(0), m_IP(0), m_PIP(0), m_ICR(0), m_bursting(0), m_immediate_irq(0)
- , m_immediate_vector(0), m_immediate_pri(0), m_program(nullptr), m_cache(nullptr), m_icount(0)
+ , m_immediate_vector(0), m_immediate_pri(0), m_icount(0)
{
std::fill(std::begin(m_r), std::end(m_r), 0);
std::fill(std::begin(m_rcache_frame_addr), std::end(m_rcache_frame_addr), 0);
@@ -41,31 +41,31 @@ device_memory_interface::space_config_vector i960_cpu_device::memory_space_confi
uint32_t i960_cpu_device::i960_read_dword_unaligned(uint32_t address)
{
if (!DWORD_ALIGNED(address))
- return m_program->read_byte(address) | m_program->read_byte(address+1)<<8 | m_program->read_byte(address+2)<<16 | m_program->read_byte(address+3)<<24;
+ return m_program.read_byte(address) | m_program.read_byte(address+1)<<8 | m_program.read_byte(address+2)<<16 | m_program.read_byte(address+3)<<24;
else
- return m_program->read_dword(address);
+ return m_program.read_dword(address);
}
uint16_t i960_cpu_device::i960_read_word_unaligned(uint32_t address)
{
if (!WORD_ALIGNED(address))
- return m_program->read_byte(address) | m_program->read_byte(address+1)<<8;
+ return m_program.read_byte(address) | m_program.read_byte(address+1)<<8;
else
- return m_program->read_word(address);
+ return m_program.read_word(address);
}
void i960_cpu_device::i960_write_dword_unaligned(uint32_t address, uint32_t data)
{
if (!DWORD_ALIGNED(address))
{
- m_program->write_byte(address, data & 0xff);
- m_program->write_byte(address+1, (data>>8)&0xff);
- m_program->write_byte(address+2, (data>>16)&0xff);
- m_program->write_byte(address+3, (data>>24)&0xff);
+ m_program.write_byte(address, data & 0xff);
+ m_program.write_byte(address+1, (data>>8)&0xff);
+ m_program.write_byte(address+2, (data>>16)&0xff);
+ m_program.write_byte(address+3, (data>>24)&0xff);
}
else
{
- m_program->write_dword(address, data);
+ m_program.write_dword(address, data);
}
}
@@ -73,22 +73,22 @@ void i960_cpu_device::i960_write_word_unaligned(uint32_t address, uint16_t data)
{
if (!WORD_ALIGNED(address))
{
- m_program->write_byte(address, data & 0xff);
- m_program->write_byte(address+1, (data>>8)&0xff);
+ m_program.write_byte(address, data & 0xff);
+ m_program.write_byte(address+1, (data>>8)&0xff);
}
else
{
- m_program->write_word(address, data);
+ m_program.write_word(address, data);
}
}
void i960_cpu_device::send_iac(uint32_t adr)
{
uint32_t iac[4];
- iac[0] = m_program->read_dword(adr);
- iac[1] = m_program->read_dword(adr+4);
- iac[2] = m_program->read_dword(adr+8);
- iac[3] = m_program->read_dword(adr+12);
+ iac[0] = m_program.read_dword(adr);
+ iac[1] = m_program.read_dword(adr+4);
+ iac[2] = m_program.read_dword(adr+8);
+ iac[3] = m_program.read_dword(adr+12);
switch(iac[0]>>24) {
case 0x40: // generate irq
@@ -99,8 +99,8 @@ void i960_cpu_device::send_iac(uint32_t adr)
check_irqs();
break;
case 0x80: // store SAT & PRCB in memory
- m_program->write_dword(iac[1], m_SAT);
- m_program->write_dword(iac[1]+4, m_PRCB);
+ m_program.write_dword(iac[1], m_SAT);
+ m_program.write_dword(iac[1]+4, m_PRCB);
break;
case 0x89: // invalidate internal instruction cache
// we do not emulate the instruction cache, so this is safe to ignore
@@ -143,7 +143,7 @@ uint32_t i960_cpu_device::get_ea(uint32_t opcode)
case 0x5: // address of this instruction + the offset dword + 8
// which in reality is "address of next instruction + the offset dword"
- ret = m_cache->read_dword(m_IP);
+ ret = m_cache.read_dword(m_IP);
m_IP += 4;
ret += m_IP;
return ret;
@@ -152,22 +152,22 @@ uint32_t i960_cpu_device::get_ea(uint32_t opcode)
return m_r[abase] + (m_r[index] << scale);
case 0xc:
- ret = m_cache->read_dword(m_IP);
+ ret = m_cache.read_dword(m_IP);
m_IP += 4;
return ret;
case 0xd:
- ret = m_cache->read_dword(m_IP) + m_r[abase];
+ ret = m_cache.read_dword(m_IP) + m_r[abase];
m_IP += 4;
return ret;
case 0xe:
- ret = m_cache->read_dword(m_IP) + (m_r[index] << scale);
+ ret = m_cache.read_dword(m_IP) + (m_r[index] << scale);
m_IP += 4;
return ret;
case 0xf:
- ret = m_cache->read_dword(m_IP) + m_r[abase] + (m_r[index] << scale);
+ ret = m_cache.read_dword(m_IP) + m_r[abase] + (m_r[index] << scale);
m_IP += 4;
return ret;
@@ -430,12 +430,12 @@ void i960_cpu_device::test(uint32_t opcode, int mask)
// interrupt dispatch
void i960_cpu_device::take_interrupt(int vector, int lvl)
{
- int int_tab = m_program->read_dword(m_PRCB+20); // interrupt table
- int int_SP = m_program->read_dword(m_PRCB+24); // interrupt stack
+ int int_tab = m_program.read_dword(m_PRCB+20); // interrupt table
+ int int_SP = m_program.read_dword(m_PRCB+24); // interrupt stack
int SP;
uint32_t IRQV;
- IRQV = m_program->read_dword(int_tab + 36 + (vector-8)*4);
+ IRQV = m_program.read_dword(int_tab + 36 + (vector-8)*4);
// start the process
if(!(m_PC & 0x2000)) // if this is a nested interrupt, don't re-get int_SP
@@ -453,10 +453,10 @@ void i960_cpu_device::take_interrupt(int vector, int lvl)
do_call(IRQV, 7, SP);
// save the processor state
- m_program->write_dword(m_r[I960_FP]-16, m_PC);
- m_program->write_dword(m_r[I960_FP]-12, m_AC);
+ m_program.write_dword(m_r[I960_FP]-16, m_PC);
+ m_program.write_dword(m_r[I960_FP]-12, m_AC);
// store the vector
- m_program->write_dword(m_r[I960_FP]-8, vector-8);
+ m_program.write_dword(m_r[I960_FP]-8, vector-8);
m_PC &= ~0x1f00; // clear priority, state, trace-fault pending, and trace enable
m_PC |= (lvl<<16); // set CPU level to current IRQ level
@@ -465,14 +465,14 @@ void i960_cpu_device::take_interrupt(int vector, int lvl)
void i960_cpu_device::check_irqs()
{
- int int_tab = m_program->read_dword(m_PRCB+20); // interrupt table
+ int int_tab = m_program.read_dword(m_PRCB+20); // interrupt table
int cpu_pri = (m_PC>>16)&0x1f;
int pending_pri;
int lvl, irq, take = -1;
int vword;
static const uint32_t lvlmask[4] = { 0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000 };
- pending_pri = m_program->read_dword(int_tab); // read pending priorities
+ pending_pri = m_program.read_dword(int_tab); // read pending priorities
if ((m_immediate_irq) && ((cpu_pri < m_immediate_pri) || (m_immediate_pri == 31)))
{
@@ -490,14 +490,14 @@ void i960_cpu_device::check_irqs()
wordl = (lvl % 4) * 8;
wordh = (wordl + 8) - 1;
- vword = m_program->read_dword(int_tab + word);
+ vword = m_program.read_dword(int_tab + word);
// take the first vector we find for this level
for (irq = wordh; irq >= wordl; irq--) {
if(vword & (1 << irq)) {
// clear pending bit
vword &= ~(1 << irq);
- m_program->write_dword(int_tab + word, vword);
+ m_program.write_dword(int_tab + word, vword);
take = irq;
break;
}
@@ -509,14 +509,14 @@ void i960_cpu_device::check_irqs()
// try to recover...
pending_pri &= ~(1 << lvl);
- m_program->write_dword(int_tab, pending_pri);
+ m_program.write_dword(int_tab, pending_pri);
return;
}
// if no vectors are waiting for this level, clear the level bit
if(!(vword & lvlmask[lvl % 4])) {
pending_pri &= ~(1 << lvl);
- m_program->write_dword(int_tab, pending_pri);
+ m_program.write_dword(int_tab, pending_pri);
}
take += ((lvl/4) * 32);
@@ -545,7 +545,7 @@ void i960_cpu_device::do_call(uint32_t adr, int type, uint32_t stack)
// flush the current register set to the current frame
FP = m_r[I960_FP] & ~0x3f;
for (i = 0; i < 16; i++) {
- m_program->write_dword(FP + (i*4), m_r[i]);
+ m_program.write_dword(FP + (i*4), m_r[i]);
}
}
else // a cache entry is available, use it
@@ -584,7 +584,7 @@ void i960_cpu_device::do_ret_0()
{
int i;
for(i=0; i<0x10; i++)
- m_r[i] = m_program->read_dword(m_r[I960_FP]+4*i);
+ m_r[i] = m_program.read_dword(m_r[I960_FP]+4*i);
if (m_rcache_pos < 0)
{
@@ -610,8 +610,8 @@ void i960_cpu_device::do_ret()
break;
case 7:
- x = m_program->read_dword(m_r[I960_FP]-16);
- y = m_program->read_dword(m_r[I960_FP]-12);
+ x = m_program.read_dword(m_r[I960_FP]-16);
+ y = m_program.read_dword(m_r[I960_FP]-12);
do_ret_0();
m_AC = y;
// #### test supervisor
@@ -1349,9 +1349,9 @@ void i960_cpu_device::execute_op(uint32_t opcode)
t2 = get_2_ri(opcode);
// interrupt control register
if(t1 == 0xff000004)
- m_ICR = m_program->read_dword(t2);
+ m_ICR = m_program.read_dword(t2);
else
- m_program->write_dword(t1, m_program->read_dword(t2));
+ m_program.write_dword(t1, m_program.read_dword(t2));
m_AC = (m_AC & ~7) | 2;
break;
@@ -1362,10 +1362,10 @@ void i960_cpu_device::execute_op(uint32_t opcode)
if(t1 == 0xff000010)
send_iac(t2);
else {
- m_program->write_dword(t1, m_program->read_dword(t2));
- m_program->write_dword(t1+4, m_program->read_dword(t2+4));
- m_program->write_dword(t1+8, m_program->read_dword(t2+8));
- m_program->write_dword(t1+12, m_program->read_dword(t2+12));
+ m_program.write_dword(t1, m_program.read_dword(t2));
+ m_program.write_dword(t1+4, m_program.read_dword(t2+4));
+ m_program.write_dword(t1+8, m_program.read_dword(t2+8));
+ m_program.write_dword(t1+12, m_program.read_dword(t2+12));
}
m_AC = (m_AC & ~7) | 2;
break;
@@ -1457,8 +1457,8 @@ void i960_cpu_device::execute_op(uint32_t opcode)
switch((opcode >> 7) & 0xf) {
case 0x0: // calls
t1 = get_1_ri(opcode);
- t2 = m_program->read_dword(m_SAT + 152); // get pointer to system procedure table
- t2 = m_program->read_dword(t2 + 48 + (t1 * 4));
+ t2 = m_program.read_dword(m_SAT + 152); // get pointer to system procedure table
+ t2 = m_program.read_dword(t2 + 48 + (t1 * 4));
if ((t2 & 3) != 0)
{
fatalerror("I960: system calls that jump into supervisor mode aren't yet supported\n");
@@ -1477,7 +1477,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
for (i = 0; i < 0x10; i++)
{
- m_program->write_dword(m_rcache_frame_addr[t1] + (i * sizeof(uint32_t)), m_rcache[t1][i]);
+ m_program.write_dword(m_rcache_frame_addr[t1] + (i * sizeof(uint32_t)), m_rcache[t1][i]);
}
}
m_rcache_pos = 0;
@@ -1935,7 +1935,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
case 0x80: { // ldob
m_icount -= 4;
- u8 v = m_program->read_byte(get_ea(opcode));
+ u8 v = m_program.read_byte(get_ea(opcode));
if(!m_stalled)
m_r[(opcode>>19)&0x1f] = v;
break;
@@ -1943,7 +1943,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
case 0x82: // stob
m_icount -= 2;
- m_program->write_byte(get_ea(opcode), m_r[(opcode>>19)&0x1f]);
+ m_program.write_byte(get_ea(opcode), m_r[(opcode>>19)&0x1f]);
break;
case 0x84: // bx
@@ -2113,7 +2113,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
case 0xc0: { // ldib
m_icount -= 4;
- s8 v = m_program->read_byte(get_ea(opcode));
+ s8 v = m_program.read_byte(get_ea(opcode));
if(!m_stalled)
m_r[(opcode>>19)&0x1f] = v;
break;
@@ -2121,7 +2121,7 @@ void i960_cpu_device::execute_op(uint32_t opcode)
case 0xc2: // stib
m_icount -= 2;
- m_program->write_byte(get_ea(opcode), m_r[(opcode>>19)&0x1f]);
+ m_program.write_byte(get_ea(opcode), m_r[(opcode>>19)&0x1f]);
break;
case 0xc8: { // ldis
@@ -2157,7 +2157,7 @@ void i960_cpu_device::execute_run()
m_bursting = 0;
- opcode = m_cache->read_dword(m_IP);
+ opcode = m_cache.read_dword(m_IP);
m_IP += 4;
m_stalled = false;
@@ -2171,7 +2171,7 @@ void i960_cpu_device::execute_run()
void i960_cpu_device::execute_set_input(int irqline, int state)
{
- int int_tab = m_program->read_dword(m_PRCB+20); // interrupt table
+ int int_tab = m_program.read_dword(m_PRCB+20); // interrupt table
int cpu_pri = (m_PC>>16)&0x1f;
int vector =0;
int priority;
@@ -2220,16 +2220,16 @@ void i960_cpu_device::execute_set_input(int irqline, int state)
else
{
// store the interrupt in the "pending" table
- pend = m_program->read_dword(int_tab);
+ pend = m_program.read_dword(int_tab);
pend |= (1 << priority);
- m_program->write_dword(int_tab, pend);
+ m_program.write_dword(int_tab, pend);
// now bitfield-ize the vector
word = ((vector / 32) * 4) + 4;
wordofs = vector % 32;
- pend = m_program->read_dword(int_tab + word);
+ pend = m_program.read_dword(int_tab + word);
pend |= (1 << wordofs);
- m_program->write_dword(int_tab + word, pend);
+ m_program.write_dword(int_tab + word, pend);
}
// and ack it to the core now that it's queued
@@ -2240,8 +2240,8 @@ void i960_cpu_device::execute_set_input(int irqline, int state)
void i960_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
save_item(NAME(m_IP));
save_item(NAME(m_PIP));
@@ -2336,9 +2336,9 @@ void i960_cpu_device::state_string_export(const device_state_entry &entry, std::
void i960_cpu_device::device_reset()
{
- m_SAT = m_program->read_dword(0);
- m_PRCB = m_program->read_dword(4);
- m_IP = m_program->read_dword(12);
+ m_SAT = m_program.read_dword(0);
+ m_PRCB = m_program.read_dword(4);
+ m_IP = m_program.read_dword(12);
m_PC = 0x001f2002;
m_AC = 0;
m_ICR = 0xff000000;
@@ -2348,7 +2348,7 @@ void i960_cpu_device::device_reset()
memset(m_r, 0, sizeof(m_r));
memset(m_rcache, 0, sizeof(m_rcache));
- m_r[I960_FP] = m_program->read_dword(m_PRCB+24);
+ m_r[I960_FP] = m_program.read_dword(m_PRCB+24);
m_r[I960_SP] = m_r[I960_FP] + 64;
m_rcache_pos = 0;
}
diff --git a/src/devices/cpu/i960/i960.h b/src/devices/cpu/i960/i960.h
index 3cc34b73f1f..8ebe214044c 100644
--- a/src/devices/cpu/i960/i960.h
+++ b/src/devices/cpu/i960/i960.h
@@ -137,8 +137,8 @@ private:
int m_immediate_vector;
int m_immediate_pri;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount;
diff --git a/src/devices/cpu/ie15/ie15.cpp b/src/devices/cpu/ie15/ie15.cpp
index 7d4b8499245..828143e1715 100644
--- a/src/devices/cpu/ie15/ie15.cpp
+++ b/src/devices/cpu/ie15/ie15.cpp
@@ -35,7 +35,6 @@ ie15_cpu_device::ie15_cpu_device(const machine_config &mconfig, const char *tag,
: cpu_device(mconfig, IE15_CPU, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 14)
, m_io_config("io", ENDIANNESS_LITTLE, 8, 8), m_A(0), m_CF(0), m_ZF(0), m_RF(0), m_flags(0)
- , m_program(nullptr), m_io(nullptr), m_cache(nullptr)
{
// set our instruction counter
set_icountptr(m_icount);
@@ -48,9 +47,9 @@ ie15_cpu_device::ie15_cpu_device(const machine_config &mconfig, const char *tag,
void ie15_cpu_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
// save state
save_item(NAME(m_PC));
@@ -322,7 +321,7 @@ inline void ie15_cpu_device::execute_one(int opcode)
if (opcode == 0x67)
m_A = 255;
else
- m_A = m_io->read_byte(opcode & 15);
+ m_A = m_io.read_byte(opcode & 15);
update_flags(m_A);
break;
case 0xf0: // ota
@@ -332,7 +331,7 @@ inline void ie15_cpu_device::execute_one(int opcode)
else if (opcode == 0xff)
m_RF = 0;
else
- m_io->write_byte(opcode & 15, m_A);
+ m_io.write_byte(opcode & 15, m_A);
// m_CF = 0;
break;
case 0xc0: // cfl, sfl
@@ -344,7 +343,7 @@ inline void ie15_cpu_device::execute_one(int opcode)
m_CF = 0;
break;
default:
- m_io->write_byte(020 | (opcode & 7), BIT(opcode, 3));
+ m_io.write_byte(020 | (opcode & 7), BIT(opcode, 3));
break;
}
break;
@@ -362,7 +361,7 @@ inline void ie15_cpu_device::execute_one(int opcode)
tmp = 0;
break;
default:
- tmp = m_io->read_byte(020 | tmp);
+ tmp = m_io.read_byte(020 | tmp);
break;
}
@@ -406,14 +405,14 @@ inline void ie15_cpu_device::execute_one(int opcode)
inline uint8_t ie15_cpu_device::rop()
{
- uint8_t retVal = m_cache->read_byte(m_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(m_PC.w.l);
m_PC.w.l = (m_PC.w.l + 1) & 0x0fff;
return retVal;
}
inline uint8_t ie15_cpu_device::arg()
{
- uint8_t retVal = m_cache->read_byte(m_PC.w.l);
+ uint8_t retVal = m_cache.read_byte(m_PC.w.l);
return retVal;
}
diff --git a/src/devices/cpu/ie15/ie15.h b/src/devices/cpu/ie15/ie15.h
index 14f4d82357c..a0885ce55f1 100644
--- a/src/devices/cpu/ie15/ie15.h
+++ b/src/devices/cpu/ie15/ie15.h
@@ -72,9 +72,9 @@ protected:
uint8_t m_RF; // Current register page
uint8_t m_flags; // temporary I/O only
- address_space *m_program;
- address_space *m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<14, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<14, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
};
// device type definition
diff --git a/src/devices/cpu/jaguar/jaguar.cpp b/src/devices/cpu/jaguar/jaguar.cpp
index 875efb90b45..7aeddda468a 100644
--- a/src/devices/cpu/jaguar/jaguar.cpp
+++ b/src/devices/cpu/jaguar/jaguar.cpp
@@ -76,13 +76,13 @@ inline u8 jaguar_cpu_device::CONDITION(u8 x)
return condition_table[x + ((m_flags & 7) << 5)];
}
-inline u8 jaguar_cpu_device::READBYTE(offs_t a) { return m_program->read_byte(a); }
-inline u16 jaguar_cpu_device::READWORD(offs_t a) { return m_program->read_word(a); }
-inline u32 jaguar_cpu_device::READLONG(offs_t a) { return m_program->read_dword(a); }
+inline u8 jaguar_cpu_device::READBYTE(offs_t a) { return m_program.read_byte(a); }
+inline u16 jaguar_cpu_device::READWORD(offs_t a) { return m_program.read_word(a); }
+inline u32 jaguar_cpu_device::READLONG(offs_t a) { return m_program.read_dword(a); }
-inline void jaguar_cpu_device::WRITEBYTE(offs_t a, u8 v) { m_program->write_byte(a, v); }
-inline void jaguar_cpu_device::WRITEWORD(offs_t a, u16 v) { m_program->write_word(a, v); }
-inline void jaguar_cpu_device::WRITELONG(offs_t a, u32 v) { m_program->write_dword(a, v); }
+inline void jaguar_cpu_device::WRITEBYTE(offs_t a, u8 v) { m_program.write_byte(a, v); }
+inline void jaguar_cpu_device::WRITEWORD(offs_t a, u16 v) { m_program.write_word(a, v); }
+inline void jaguar_cpu_device::WRITELONG(offs_t a, u32 v) { m_program.write_dword(a, v); }
/***************************************************************************
@@ -142,7 +142,7 @@ const jaguar_cpu_device::op_func jaguar_cpu_device::dsp_op_table[64] =
MEMORY ACCESSORS
***************************************************************************/
-inline u16 jaguar_cpu_device::ROPCODE(offs_t pc) { return m_cache->read_word(pc); }
+inline u16 jaguar_cpu_device::ROPCODE(offs_t pc) { return m_cache.read_word(pc); }
// SC414200AT
DEFINE_DEVICE_TYPE(JAGUARGPU, jaguargpu_cpu_device, "jaguargpu", "Motorola Atari Jaguar GPU \"Tom\"")
@@ -355,9 +355,9 @@ void jaguar_cpu_device::device_start()
{
init_tables();
- m_program = &space(AS_PROGRAM);
- m_io = &space(AS_IO);
- m_cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
m_cpu_interrupt.resolve_safe();
save_item(NAME(m_r));
@@ -1481,12 +1481,12 @@ READ32_MEMBER(jaguardsp_cpu_device::high_accum_r)
u32 jaguar_cpu_device::iobus_r(offs_t offset, u32 mem_mask)
{
- return m_io->read_dword(offset*4, mem_mask);
+ return m_io.read_dword(offset*4, mem_mask);
}
void jaguar_cpu_device::iobus_w(offs_t offset, u32 data, u32 mem_mask)
{
- m_io->write_dword(offset*4, data, mem_mask);
+ m_io.write_dword(offset*4, data, mem_mask);
}
/***************************************************************************
diff --git a/src/devices/cpu/jaguar/jaguar.h b/src/devices/cpu/jaguar/jaguar.h
index 499a3233f7e..f9e8189b739 100644
--- a/src/devices/cpu/jaguar/jaguar.h
+++ b/src/devices/cpu/jaguar/jaguar.h
@@ -138,9 +138,9 @@ protected:
int m_icount;
int m_bankswitch_icount;
devcb_write_line m_cpu_interrupt;
- address_space *m_program;
- address_space *m_io;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 8, 2, 0, ENDIANNESS_BIG>::specific m_io;
u32 m_internal_ram_start;
u32 m_internal_ram_end;
diff --git a/src/devices/cpu/ks0164/ks0164.cpp b/src/devices/cpu/ks0164/ks0164.cpp
index d7601831a0d..8bb447993a4 100644
--- a/src/devices/cpu/ks0164/ks0164.cpp
+++ b/src/devices/cpu/ks0164/ks0164.cpp
@@ -23,8 +23,8 @@ ks0164_cpu_device::ks0164_cpu_device(const machine_config &mconfig, const char *
void ks0164_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_program_cache = m_program->cache<1, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_PROGRAM).specific(m_program);
state_add(STATE_GENPC, "GENPC", m_r[R_PC]).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_r[R_PC]).callexport().noshow();
@@ -115,15 +115,15 @@ void ks0164_cpu_device::handle_irq()
// Normal irq (not reset), save pc and psw
if(m_r[R_PSW] & F_I)
return;
- m_program->write_word(m_r[R_SP] - 2, m_r[R_PC]);
- m_program->write_word(m_r[R_SP] - 4, m_r[R_PSW]);
+ m_program.write_word(m_r[R_SP] - 2, m_r[R_PC]);
+ m_program.write_word(m_r[R_SP] - 4, m_r[R_PSW]);
m_r[R_SP] -= 4;
m_icount -= 2;
} else
m_irq &= 0xfffe;
m_r[R_PSW] = (m_r[R_PSW] & 0xfff0) | (index ? index - 1 : 0);
- m_r[R_PC] = m_program_cache->read_word(index*2);
+ m_r[R_PC] = m_program_cache.read_word(index*2);
m_icount --;
if(index)
standard_irq_callback(0);
@@ -238,7 +238,7 @@ void ks0164_cpu_device::execute_run()
if(m_irq)
handle_irq();
debugger_instruction_hook(m_r[R_PC]);
- u16 opcode = m_program_cache->read_word(m_r[R_PC]);
+ u16 opcode = m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
// First switch level on bits 15-14 and 2-0
@@ -296,7 +296,7 @@ void ks0164_cpu_device::execute_run()
case 0x15: {
// ALU functions with immediate
// 10ff frrr S... w101
- u16 rv = m_program_cache->read_word(m_r[R_PC]);
+ u16 rv = m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
u16 v = opcode & 0x0008 ? rv : opcode & 0x0080 ? s8(rv) : u8(rv);
@@ -308,7 +308,7 @@ void ks0164_cpu_device::execute_run()
// ALU functions from memory indexed
// 10ff frrr Ssss w110
u16 a = m_r[(opcode >> 4) & 7];
- u16 v = opcode & 0x0008 ? m_program->read_word(a) : opcode & 0x0080 ? s8(m_program->read_byte(a)) : u8(m_program->read_byte(a));
+ u16 v = opcode & 0x0008 ? m_program.read_word(a) : opcode & 0x0080 ? s8(m_program.read_byte(a)) : u8(m_program.read_byte(a));
m_icount -= 2;
do_alu(opcode, v);
@@ -318,9 +318,9 @@ void ks0164_cpu_device::execute_run()
case 0x17: {
// ALU functions from memory indexed and offset
// 10ff frrr Ssss w111
- u16 a = m_r[(opcode >> 4) & 7] + m_program_cache->read_word(m_r[R_PC]);
+ u16 a = m_r[(opcode >> 4) & 7] + m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
- u16 v = opcode & 0x0008 ? m_program->read_word(a) : opcode & 0x0080 ? s8(m_program->read_byte(a)) : u8(m_program->read_byte(a));
+ u16 v = opcode & 0x0008 ? m_program.read_word(a) : opcode & 0x0080 ? s8(m_program.read_byte(a)) : u8(m_program.read_byte(a));
m_icount -= 2;
do_alu(opcode, v);
@@ -336,8 +336,8 @@ void ks0164_cpu_device::execute_run()
int r1 = (opcode >> 8) & 7;
int r2 = (opcode >> 4) & 7;
switch(bitswap<3>(opcode, 11, 7, 3)) {
- case 1: m_program->write_word(m_r[r1], m_r[r2]); m_r[r1] += 2; break;
- case 4: m_r[r1] -= 2; m_program->write_word(m_r[r1], m_r[r2]); break;
+ case 1: m_program.write_word(m_r[r1], m_r[r2]); m_r[r1] += 2; break;
+ case 4: m_r[r1] -= 2; m_program.write_word(m_r[r1], m_r[r2]); break;
default: unk(opcode); break;
}
m_icount --;
@@ -348,7 +348,7 @@ void ks0164_cpu_device::execute_run()
// Min/max with immediate
// 1101 Mrrr Ssss 1000
u16 v1 = m_r[(opcode >> 4) & 7];
- u16 v2 = m_program_cache->read_word(m_r[R_PC]);
+ u16 v2 = m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
u16 res;
switch(bitswap<2>(opcode, 11, 7)) {
@@ -385,10 +385,10 @@ void ks0164_cpu_device::execute_run()
// Push all registers
// 1100 .... .... .001
- m_program->write_word(m_r[R_SP] - 2, m_r[0]);
- m_program->write_word(m_r[R_SP] - 4, m_r[1]);
- m_program->write_word(m_r[R_SP] - 6, m_r[2]);
- m_program->write_word(m_r[R_SP] - 8, m_r[3]);
+ m_program.write_word(m_r[R_SP] - 2, m_r[0]);
+ m_program.write_word(m_r[R_SP] - 4, m_r[1]);
+ m_program.write_word(m_r[R_SP] - 6, m_r[2]);
+ m_program.write_word(m_r[R_SP] - 8, m_r[3]);
m_r[R_SP] -= 8;
break;
}
@@ -396,7 +396,7 @@ void ks0164_cpu_device::execute_run()
case 1: {
// Absolute jump
// 1101 .... .... .001
- m_r[R_PC] = m_program->read_word(m_r[R_PC]);
+ m_r[R_PC] = m_program.read_word(m_r[R_PC]);
break;
}
@@ -429,7 +429,7 @@ void ks0164_cpu_device::execute_run()
int r1 = (opcode >> 8) & 7;
int r2 = (opcode >> 4) & 7;
switch(bitswap<3>(opcode, 11, 7, 3)) {
- case 1: m_r[r1] = m_program->read_word(m_r[r2]); m_r[r2] += 2; break;
+ case 1: m_r[r1] = m_program.read_word(m_r[r2]); m_r[r2] += 2; break;
default: unk(opcode); break;
}
m_icount --;
@@ -440,8 +440,8 @@ void ks0164_cpu_device::execute_run()
// Absolute subroutine call
// 1101 .... .... .010
- u16 a = m_program->read_word(m_r[R_PC]);
- m_program->write_word(m_r[R_SP] - 2, m_r[R_PC] + 2);
+ u16 a = m_program.read_word(m_r[R_PC]);
+ m_program.write_word(m_r[R_SP] - 2, m_r[R_PC] + 2);
m_r[R_SP] -= 2;
m_r[R_PC] = a;
m_icount -= 2;
@@ -453,7 +453,7 @@ void ks0164_cpu_device::execute_run()
// 1110 .rrr bbbb w010
u16 a = m_r[(opcode >> 8) & 7];
- u16 v = opcode & 0x0008 ? m_program->read_word(a) : m_program->read_byte(a);
+ u16 v = opcode & 0x0008 ? m_program.read_word(a) : m_program.read_byte(a);
if(v & (1 << ((opcode >> 4) & 0xf)))
m_r[R_PSW] &= ~F_Z;
else
@@ -476,10 +476,10 @@ void ks0164_cpu_device::execute_run()
// Push all registers
// 1100 .... .... .011
- m_r[0] = m_program->read_word(m_r[R_SP] + 6);
- m_r[1] = m_program->read_word(m_r[R_SP] + 4);
- m_r[2] = m_program->read_word(m_r[R_SP] + 2);
- m_r[3] = m_program->read_word(m_r[R_SP] + 0);
+ m_r[0] = m_program.read_word(m_r[R_SP] + 6);
+ m_r[1] = m_program.read_word(m_r[R_SP] + 4);
+ m_r[2] = m_program.read_word(m_r[R_SP] + 2);
+ m_r[3] = m_program.read_word(m_r[R_SP] + 0);
m_r[R_SP] += 8;
break;
}
@@ -488,7 +488,7 @@ void ks0164_cpu_device::execute_run()
// Return from subroutine
// 1101 .... .... .011
- m_r[R_PC] = m_program->read_word(m_r[R_SP]);
+ m_r[R_PC] = m_program.read_word(m_r[R_SP]);
m_r[R_SP] += 2;
m_icount --;
break;
@@ -498,9 +498,9 @@ void ks0164_cpu_device::execute_run()
// Bit test from memory indexed and offset
// 1110 .rrr bbbb w011
- u16 a = m_r[(opcode >> 8) & 7] + m_program_cache->read_word(m_r[R_PC]);
+ u16 a = m_r[(opcode >> 8) & 7] + m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
- u16 v = opcode & 0x0008 ? m_program->read_word(a) : m_program->read_byte(a);
+ u16 v = opcode & 0x0008 ? m_program.read_word(a) : m_program.read_byte(a);
if(v & (1 << ((opcode >> 4) & 0xf)))
m_r[R_PSW] &= ~F_Z;
else
@@ -552,8 +552,8 @@ void ks0164_cpu_device::execute_run()
// Return from interrupt
// 1101 .... .... .100
- m_r[R_PSW] = m_program->read_word(m_r[R_SP] + 0);
- m_r[R_PC] = m_program->read_word(m_r[R_SP] + 2);
+ m_r[R_PSW] = m_program.read_word(m_r[R_SP] + 0);
+ m_r[R_PC] = m_program.read_word(m_r[R_SP] + 2);
m_r[R_SP] += 4;
m_icount -= 2;
break;
@@ -573,7 +573,7 @@ void ks0164_cpu_device::execute_run()
case 3: {
// Decrement and branch
int r = (opcode >> 8) & 7;
- u16 a = m_program_cache->read_word(m_r[R_PC]);
+ u16 a = m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
m_r[r] --;
@@ -638,8 +638,8 @@ void ks0164_cpu_device::execute_run()
// Compare with immediate and branch if equal
// 1111 .rrr .... .101
- u16 v = m_program_cache->read_word(m_r[R_PC]);
- u16 a = m_program_cache->read_word(m_r[R_PC] + 2);
+ u16 v = m_program_cache.read_word(m_r[R_PC]);
+ u16 a = m_program_cache.read_word(m_r[R_PC] + 2);
m_r[R_PC] += 4;
do_alu((opcode & 0x07ff) | 0x1000, v);
@@ -668,9 +668,9 @@ void ks0164_cpu_device::execute_run()
// 1110 .rrr .sss w110
u16 a = m_r[(opcode >> 8) & 7];
if(opcode & 0x0008)
- m_program->write_word(a, m_r[(opcode >> 4) & 7]);
+ m_program.write_word(a, m_r[(opcode >> 4) & 7]);
else
- m_program->write_byte(a, m_r[(opcode >> 4) & 7]);
+ m_program.write_byte(a, m_r[(opcode >> 4) & 7]);
break;
}
@@ -721,12 +721,12 @@ void ks0164_cpu_device::execute_run()
case 2: {
// Write memory indexed and offset
// 1110 .rrr .sss w111
- u16 a = m_r[(opcode >> 8) & 7] + m_program_cache->read_word(m_r[R_PC]);
+ u16 a = m_r[(opcode >> 8) & 7] + m_program_cache.read_word(m_r[R_PC]);
m_r[R_PC] += 2;
if(opcode & 0x0008)
- m_program->write_word(a, m_r[(opcode >> 4) & 7]);
+ m_program.write_word(a, m_r[(opcode >> 4) & 7]);
else
- m_program->write_byte(a, m_r[(opcode >> 4) & 7]);
+ m_program.write_byte(a, m_r[(opcode >> 4) & 7]);
break;
}
diff --git a/src/devices/cpu/ks0164/ks0164.h b/src/devices/cpu/ks0164/ks0164.h
index cdad1b693d9..1df7e6f5e4b 100644
--- a/src/devices/cpu/ks0164/ks0164.h
+++ b/src/devices/cpu/ks0164/ks0164.h
@@ -50,8 +50,8 @@ protected:
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
const address_space_config m_program_config;
- address_space *m_program;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_program_cache;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::cache m_program_cache;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_program;
void handle_irq();
u16 snz(u16 r);
diff --git a/src/devices/cpu/lc8670/lc8670.cpp b/src/devices/cpu/lc8670/lc8670.cpp
index 728e823beb5..4d03d6c5c0e 100644
--- a/src/devices/cpu/lc8670/lc8670.cpp
+++ b/src/devices/cpu/lc8670/lc8670.cpp
@@ -194,10 +194,10 @@ lc8670_cpu_device::lc8670_cpu_device(const machine_config &mconfig, const char *
void lc8670_cpu_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
// set our instruction counter
set_icountptr(m_icount);
@@ -973,11 +973,11 @@ uint8_t lc8670_cpu_device::regs_r(offs_t offset)
case 0x1d:
return m_timer1[1];
case 0x44:
- return (REG_P1 & REG_P1DDR) | (m_io->read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff));
+ return (REG_P1 & REG_P1DDR) | (m_io.read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff));
case 0x4c:
- return (REG_P3 & REG_P3DDR) | (m_io->read_byte(LC8670_PORT3) & (REG_P3DDR ^ 0xff));
+ return (REG_P3 & REG_P3DDR) | (m_io.read_byte(LC8670_PORT3) & (REG_P3DDR ^ 0xff));
case 0x5c:
- return m_io->read_byte(LC8670_PORT7) | 0xf0; // 4-bit read-only port
+ return m_io.read_byte(LC8670_PORT7) | 0xf0; // 4-bit read-only port
case 0x66:
{
uint8_t data = m_vtrbf[((REG_VRMAD2<<8) | REG_VRMAD1) & 0x1ff];
@@ -1041,10 +1041,10 @@ void lc8670_cpu_device::regs_w(offs_t offset, uint8_t data)
m_clock_changed = true;
break;
case 0x44:
- m_io->write_byte(LC8670_PORT1, ((data | (m_p1_data & REG_P1FCR)) & REG_P1DDR) | (m_io->read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff)));
+ m_io.write_byte(LC8670_PORT1, ((data | (m_p1_data & REG_P1FCR)) & REG_P1DDR) | (m_io.read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff)));
break;
case 0x4c:
- m_io->write_byte(LC8670_PORT3, (data & REG_P3DDR) | (m_io->read_byte(LC8670_PORT3) & (REG_P3DDR ^ 0xff)));
+ m_io.write_byte(LC8670_PORT3, (data & REG_P3DDR) | (m_io.read_byte(LC8670_PORT3) & (REG_P3DDR ^ 0xff)));
break;
case 0x66:
m_vtrbf[((REG_VRMAD2<<8) | REG_VRMAD1) & 0x1ff] = data;
@@ -1076,7 +1076,7 @@ void lc8670_cpu_device::regs_w(offs_t offset, uint8_t data)
inline uint8_t lc8670_cpu_device::fetch()
{
- uint8_t data = m_cache->read_byte(m_pc);
+ uint8_t data = m_cache.read_byte(m_pc);
set_pc(m_pc + 1);
@@ -1085,12 +1085,12 @@ inline uint8_t lc8670_cpu_device::fetch()
inline uint8_t lc8670_cpu_device::read_data(uint16_t offset)
{
- return m_data->read_byte(offset);
+ return m_data.read_byte(offset);
}
inline void lc8670_cpu_device::write_data(uint16_t offset, uint8_t data)
{
- m_data->write_byte(offset, data);
+ m_data.write_byte(offset, data);
}
inline uint8_t lc8670_cpu_device::read_data_latch(uint16_t offset)
@@ -1116,7 +1116,7 @@ inline void lc8670_cpu_device::write_data_latch(uint16_t offset, uint8_t data)
inline void lc8670_cpu_device::update_port1(uint8_t data)
{
m_p1_data = data;
- m_io->write_byte(LC8670_PORT1, ((REG_P1 | (m_p1_data & REG_P1FCR)) & REG_P1DDR) | (m_io->read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff)));
+ m_io.write_byte(LC8670_PORT1, ((REG_P1 | (m_p1_data & REG_P1FCR)) & REG_P1DDR) | (m_io.read_byte(LC8670_PORT1) & (REG_P1DDR ^ 0xff)));
}
inline void lc8670_cpu_device::set_pc(uint16_t new_pc)
@@ -1205,7 +1205,7 @@ inline void lc8670_cpu_device::check_p3int()
{
if (REG_P3INT & 0x04)
{
- if ((m_io->read_byte(LC8670_PORT3) ^ 0xff) & (REG_P3DDR ^ 0xff) & REG_P3)
+ if ((m_io.read_byte(LC8670_PORT3) ^ 0xff) & (REG_P3DDR ^ 0xff) & REG_P3)
{
REG_P3INT |= 0x02;
if (REG_P3INT & 0x01)
@@ -1450,7 +1450,7 @@ int lc8670_cpu_device::op_ldf()
uint16_t addr = REG_TRL | (REG_TRH<<8);
m_bankswitch_func(REG_FPR & 0x01 ? 2 : 1);
- REG_A = m_program->read_byte(addr);
+ REG_A = m_program.read_byte(addr);
CHECK_P();
m_bankswitch_func(((REG_EXT & 0x01) ? 1 : (REG_EXT & 0x08) ? 0 : 2));
@@ -1462,7 +1462,7 @@ int lc8670_cpu_device::op_stf()
uint16_t addr = REG_TRL | (REG_TRH<<8);
m_bankswitch_func(REG_FPR & 0x01 ? 2 : 1);
- m_program->write_byte(addr, REG_A);
+ m_program.write_byte(addr, REG_A);
m_bankswitch_func(((REG_EXT & 0x01) ? 1 : (REG_EXT & 0x08) ? 0 : 2));
return 2;
@@ -1687,7 +1687,7 @@ int lc8670_cpu_device::op_ror()
int lc8670_cpu_device::op_ldc()
{
- REG_A = m_program->read_byte(((REG_TRH<<8) | REG_TRL) + REG_A);
+ REG_A = m_program.read_byte(((REG_TRH<<8) | REG_TRL) + REG_A);
CHECK_P();
return 2;
diff --git a/src/devices/cpu/lc8670/lc8670.h b/src/devices/cpu/lc8670/lc8670.h
index 8293ed66f26..890472d689f 100644
--- a/src/devices/cpu/lc8670/lc8670.h
+++ b/src/devices/cpu/lc8670/lc8670.h
@@ -189,10 +189,10 @@ private:
address_space_config m_data_config;
address_space_config m_io_config;
- address_space * m_program; // program space (ROM or flash)
- address_space * m_data; // internal RAM/register
- address_space * m_io; // I/O ports
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program; // program space (ROM or flash)
+ memory_access< 9, 0, 0, ENDIANNESS_BIG>::specific m_data; // internal RAM/register
+ memory_access< 8, 0, 0, ENDIANNESS_BIG>::specific m_io; // I/O ports
// timers
static const device_timer_id BASE_TIMER = 1;
diff --git a/src/devices/cpu/lh5801/5801tbl.hxx b/src/devices/cpu/lh5801/5801tbl.hxx
index fef1ca8b23a..a15389681ea 100644
--- a/src/devices/cpu/lh5801/5801tbl.hxx
+++ b/src/devices/cpu/lh5801/5801tbl.hxx
@@ -23,8 +23,8 @@ uint8_t lh5801_cpu_device::lh5801_add_generic(int left, int right, int carry)
uint16_t lh5801_cpu_device::lh5801_readop_word()
{
- uint16_t r = m_cache->read_byte(P++) << 8;
- r |= m_cache->read_byte(P++);
+ uint16_t r = m_cache.read_byte(P++) << 8;
+ r |= m_cache.read_byte(P++);
return r;
}
@@ -162,7 +162,7 @@ void lh5801_cpu_device::lh5801_lda(uint8_t data)
void lh5801_cpu_device::lh5801_lde(PAIR *reg)
{
// or z flag depends on reg
- m_a = m_program->read_byte(reg->w.l--);
+ m_a = m_program.read_byte(reg->w.l--);
m_t &= ~Z;
if (!m_a)
{
@@ -172,13 +172,13 @@ void lh5801_cpu_device::lh5801_lde(PAIR *reg)
void lh5801_cpu_device::lh5801_sde(PAIR *reg)
{
- m_program->write_byte(reg->w.l--, m_a);
+ m_program.write_byte(reg->w.l--, m_a);
}
void lh5801_cpu_device::lh5801_lin(PAIR *reg)
{
// or z flag depends on reg
- m_a = m_program->read_byte(reg->w.l++);
+ m_a = m_program.read_byte(reg->w.l++);
m_t &= ~Z;
if (!m_a)
{
@@ -188,7 +188,7 @@ void lh5801_cpu_device::lh5801_lin(PAIR *reg)
void lh5801_cpu_device::lh5801_sin(PAIR *reg)
{
- m_program->write_byte(reg->w.l++, m_a);
+ m_program.write_byte(reg->w.l++, m_a);
}
void lh5801_cpu_device::lh5801_dec(uint8_t *adr)
@@ -204,7 +204,7 @@ void lh5801_cpu_device::lh5801_inc(uint8_t *adr)
void lh5801_cpu_device::lh5801_pop()
{
S++;
- m_a = m_program->read_byte(S);
+ m_a = m_program.read_byte(S);
m_t &= ~Z;
if (!m_a)
{
@@ -214,33 +214,33 @@ void lh5801_cpu_device::lh5801_pop()
void lh5801_cpu_device::lh5801_pop_word(PAIR *reg)
{
- reg->w.l = (m_program->read_byte(S + 1) << 8) | m_program->read_byte(S + 2);
+ reg->w.l = (m_program.read_byte(S + 1) << 8) | m_program.read_byte(S + 2);
S += 2;
// z flag?
}
void lh5801_cpu_device::lh5801_rtn()
{
- P = (m_program->read_byte(S + 1) << 8) | m_program->read_byte(S + 2);
+ P = (m_program.read_byte(S + 1) << 8) | m_program.read_byte(S + 2);
S += 2;
}
void lh5801_cpu_device::lh5801_rti()
{
- P = (m_program->read_byte(S + 1) << 8) | m_program->read_byte(S + 2);
- m_t = m_program->read_byte(S + 3);
+ P = (m_program.read_byte(S + 1) << 8) | m_program.read_byte(S + 2);
+ m_t = m_program.read_byte(S + 3);
S += 3;
}
void lh5801_cpu_device::lh5801_push(uint8_t data)
{
- m_program->write_byte(S--, data);
+ m_program.write_byte(S--, data);
}
void lh5801_cpu_device::lh5801_push_word(uint16_t data)
{
- m_program->write_byte(S--, data & 0xff);
- m_program->write_byte(S--, data >> 8);
+ m_program.write_byte(S--, data & 0xff);
+ m_program.write_byte(S--, data >> 8);
}
void lh5801_cpu_device::lh5801_jmp(uint16_t adr)
@@ -250,7 +250,7 @@ void lh5801_cpu_device::lh5801_jmp(uint16_t adr)
void lh5801_cpu_device::lh5801_branch_plus(int taken)
{
- uint8_t t = m_cache->read_byte(P++);
+ uint8_t t = m_cache.read_byte(P++);
if (taken)
{
m_icount -= 3;
@@ -260,7 +260,7 @@ void lh5801_cpu_device::lh5801_branch_plus(int taken)
void lh5801_cpu_device::lh5801_branch_minus(int taken)
{
- uint8_t t = m_cache->read_byte(P++);
+ uint8_t t = m_cache.read_byte(P++);
if (taken)
{
m_icount -= 3;
@@ -270,7 +270,7 @@ void lh5801_cpu_device::lh5801_branch_minus(int taken)
void lh5801_cpu_device::lh5801_lop()
{
- uint8_t t = m_cache->read_byte(P++);
+ uint8_t t = m_cache.read_byte(P++);
m_icount -= 8;
if (UL--)
{
@@ -291,8 +291,8 @@ void lh5801_cpu_device::lh5801_vector(int taken, int nr)
if (taken)
{
lh5801_push_word(P);
- P = m_program->read_byte(0xff00 + nr) << 8;
- P |= m_program->read_byte(0xff00 + nr + 1);
+ P = m_program.read_byte(0xff00 + nr) << 8;
+ P |= m_program.read_byte(0xff00 + nr + 1);
m_icount -= 13;
}
m_t &= ~Z; // after the jump?
@@ -397,23 +397,23 @@ void lh5801_cpu_device::lh5801_instruction_fd()
{
int adr;
- int oper = m_cache->read_byte(P++);
+ int oper = m_cache.read_byte(P++);
switch (oper)
{
case 0x01:
- lh5801_sbc(m_io->read_byte(X));
+ lh5801_sbc(m_io.read_byte(X));
m_icount -= 11;
break;
case 0x03:
- lh5801_adc(m_io->read_byte(X));
+ lh5801_adc(m_io.read_byte(X));
m_icount -= 11;
break;
case 0x05:
- lh5801_lda(m_io->read_byte(X));
+ lh5801_lda(m_io.read_byte(X));
m_icount -= 10;
break;
case 0x07:
- lh5801_cpa(m_a, m_io->read_byte(X));
+ lh5801_cpa(m_a, m_io.read_byte(X));
m_icount -= 11;
break;
case 0x08: // TODO: What does this opcode actually do?
@@ -421,7 +421,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x09:
- lh5801_and(m_io->read_byte(X));
+ lh5801_and(m_io.read_byte(X));
m_icount -= 11;
break;
case 0x0a:
@@ -429,39 +429,39 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 15;
break;
case 0x0b:
- lh5801_ora(m_io->read_byte(X));
+ lh5801_ora(m_io.read_byte(X));
m_icount -= 11;
break;
case 0x0c:
- lh5801_dcs(m_io->read_byte(X));
+ lh5801_dcs(m_io.read_byte(X));
m_icount -= 17;
break;
case 0x0d:
- lh5801_eor(m_io->read_byte(X));
+ lh5801_eor(m_io.read_byte(X));
m_icount -= 11;
break;
case 0x0e:
- m_io->write_byte(X, m_a);
+ m_io.write_byte(X, m_a);
m_icount -= 10;
break;
case 0x0f:
- lh5801_bit(m_io->read_byte(X), m_a);
+ lh5801_bit(m_io.read_byte(X), m_a);
m_icount -= 11;
break;
case 0x11:
- lh5801_sbc(m_io->read_byte(Y));
+ lh5801_sbc(m_io.read_byte(Y));
m_icount -= 11;
break;
case 0x13:
- lh5801_adc(m_io->read_byte(Y));
+ lh5801_adc(m_io.read_byte(Y));
m_icount -= 11;
break;
case 0x15:
- lh5801_lda(m_io->read_byte(Y));
+ lh5801_lda(m_io.read_byte(Y));
m_icount -= 10;
break;
case 0x17:
- lh5801_cpa(m_a, m_io->read_byte(Y));
+ lh5801_cpa(m_a, m_io.read_byte(Y));
m_icount -= 11;
break;
case 0x18:
@@ -469,7 +469,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x19:
- lh5801_and(m_io->read_byte(Y));
+ lh5801_and(m_io.read_byte(Y));
m_icount -= 11;
break;
case 0x1a:
@@ -477,38 +477,38 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 15;
break;
case 0x1b:
- lh5801_ora(m_io->read_byte(Y));
+ lh5801_ora(m_io.read_byte(Y));
m_icount -= 11;
break;
case 0x1c:
- lh5801_dcs(m_io->read_byte(Y));
+ lh5801_dcs(m_io.read_byte(Y));
m_icount -= 17;
break;
case 0x1d:
- lh5801_eor(m_io->read_byte(Y));
+ lh5801_eor(m_io.read_byte(Y));
m_icount -= 11;
break;
- case 0x1e: m_io->write_byte(Y,m_a);
+ case 0x1e: m_io.write_byte(Y,m_a);
m_icount -= 10;
break;
case 0x1f:
- lh5801_bit(m_io->read_byte(Y),m_a);
+ lh5801_bit(m_io.read_byte(Y),m_a);
m_icount -= 11;
break;
case 0x21:
- lh5801_sbc(m_io->read_byte(U));
+ lh5801_sbc(m_io.read_byte(U));
m_icount -= 11;
break;
case 0x23:
- lh5801_adc(m_io->read_byte(U));
+ lh5801_adc(m_io.read_byte(U));
m_icount -= 11;
break;
case 0x25:
- lh5801_lda(m_io->read_byte(U));
+ lh5801_lda(m_io.read_byte(U));
m_icount -= 10;
break;
case 0x27:
- lh5801_cpa(m_a, m_io->read_byte(U));
+ lh5801_cpa(m_a, m_io.read_byte(U));
m_icount -= 11;
break;
case 0x28:
@@ -516,7 +516,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x29:
- lh5801_and(m_io->read_byte(U));
+ lh5801_and(m_io.read_byte(U));
m_icount -= 11;
break;
case 0x2a:
@@ -524,22 +524,22 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 15;
break;
case 0x2b:
- lh5801_ora(m_io->read_byte(U));
+ lh5801_ora(m_io.read_byte(U));
m_icount -= 11;
break;
case 0x2c:
- lh5801_dcs(m_io->read_byte(U));
+ lh5801_dcs(m_io.read_byte(U));
m_icount -= 17;
break;
case 0x2d:
- lh5801_eor(m_io->read_byte(U));
+ lh5801_eor(m_io.read_byte(U));
m_icount -= 11;
break;
- case 0x2e: m_io->write_byte(U,m_a);
+ case 0x2e: m_io.write_byte(U,m_a);
m_icount -= 10;
break;
case 0x2f:
- lh5801_bit(m_io->read_byte(U),m_a);
+ lh5801_bit(m_io.read_byte(U),m_a);
m_icount -= 11;
break;
case 0x40:
@@ -555,7 +555,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x49:
- lh5801_and_mem(*m_io, X, m_cache->read_byte(P++));
+ lh5801_and_mem(m_io.space(), X, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x4a: // What does this opcode actually do?
@@ -563,7 +563,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x4b:
- lh5801_ora_mem(*m_io, X, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_io.space(), X, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x4c: /*off*/
@@ -571,7 +571,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 8;
break;
case 0x4d:
- lh5801_bit(m_io->read_byte(X), m_cache->read_byte(P++));
+ lh5801_bit(m_io.read_byte(X), m_cache.read_byte(P++));
m_icount -= 14;
break;
case 0x4e:
@@ -579,7 +579,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x4f:
- lh5801_add_mem(*m_io, X, m_cache->read_byte(P++));
+ lh5801_add_mem(m_io.space(), X, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x50:
@@ -595,7 +595,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x59:
- lh5801_and_mem(*m_io, Y, m_cache->read_byte(P++));
+ lh5801_and_mem(m_io.space(), Y, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x5a:
@@ -603,11 +603,11 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x5b:
- lh5801_ora_mem(*m_io, Y, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_io.space(), Y, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x5d:
- lh5801_bit(m_io->read_byte(Y), m_cache->read_byte(P++));
+ lh5801_bit(m_io.read_byte(Y), m_cache.read_byte(P++));
m_icount -= 14;
break;
case 0x5e:
@@ -615,7 +615,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break; // P=X
case 0x5f:
- lh5801_add_mem(*m_io, Y, m_cache->read_byte(P++));
+ lh5801_add_mem(m_io.space(), Y, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x60:
@@ -627,7 +627,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 9;
break;
case 0x69:
- lh5801_and_mem(*m_io, U, m_cache->read_byte(P++));
+ lh5801_and_mem(m_io.space(), U, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x6a:
@@ -635,15 +635,15 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 11;
break;
case 0x6b:
- lh5801_ora_mem(*m_io, U, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_io.space(), U, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x6d:
- lh5801_bit(m_io->read_byte(X), m_cache->read_byte(P++));
+ lh5801_bit(m_io.read_byte(X), m_cache.read_byte(P++));
m_icount -= 14;
break;
case 0x6f:
- lh5801_add_mem(*m_io, U, m_cache->read_byte(P++));
+ lh5801_add_mem(m_io.space(), U, m_cache.read_byte(P++));
m_icount -= 17;
break;
case 0x81: /*sie*/
@@ -659,7 +659,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 12;
break;
case 0x8c:
- lh5801_dca(m_io->read_byte(X));
+ lh5801_dca(m_io.read_byte(X));
m_icount -= 19;
break;
case 0x8e:
@@ -671,23 +671,23 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 14;
break;
case 0x9c:
- lh5801_dca(m_io->read_byte(Y));
+ lh5801_dca(m_io.read_byte(Y));
m_icount -= 19;
break;
case 0xa1:
- lh5801_sbc(m_io->read_byte(lh5801_readop_word()));
+ lh5801_sbc(m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xa3:
- lh5801_adc(m_io->read_byte(lh5801_readop_word()));
+ lh5801_adc(m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xa5:
- lh5801_lda(m_io->read_byte(lh5801_readop_word()));
+ lh5801_lda(m_io.read_byte(lh5801_readop_word()));
m_icount -= 16;
break;
case 0xa7:
- lh5801_cpa(m_a, m_io->read_byte(lh5801_readop_word()));
+ lh5801_cpa(m_a, m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xa8:
@@ -695,7 +695,7 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 14;
break;
case 0xa9:
- lh5801_and(m_io->read_byte(lh5801_readop_word()));
+ lh5801_and(m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xaa:
@@ -703,23 +703,23 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 9;
break;
case 0xab:
- lh5801_ora(m_io->read_byte(lh5801_readop_word()));
+ lh5801_ora(m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xac:
- lh5801_dca(m_io->read_byte(U));
+ lh5801_dca(m_io.read_byte(U));
m_icount -= 19;
break;
case 0xad:
- lh5801_eor(m_io->read_byte(lh5801_readop_word()));
+ lh5801_eor(m_io.read_byte(lh5801_readop_word()));
m_icount -= 17;
break;
case 0xae:
- m_io->write_byte(lh5801_readop_word(), m_a);
+ m_io.write_byte(lh5801_readop_word(), m_a);
m_icount -= 16;
break;
case 0xaf:
- lh5801_bit(m_io->read_byte(lh5801_readop_word()), m_a);
+ lh5801_bit(m_io.read_byte(lh5801_readop_word()), m_a);
m_icount -= 17;
break;
case 0xb1: /*hlt*/
@@ -758,11 +758,11 @@ void lh5801_cpu_device::lh5801_instruction_fd()
m_icount -= 9;
break;
case 0xd3:
- lh5801_drr(*m_io, X);
+ lh5801_drr(m_io.space(), X);
m_icount -= 16;
break;
case 0xd7:
- lh5801_drl(*m_io, X);
+ lh5801_drl(m_io.space(), X);
m_icount -= 16;
break;
case 0xda:
@@ -779,12 +779,12 @@ void lh5801_cpu_device::lh5801_instruction_fd()
break;
case 0xe9:
adr = lh5801_readop_word();
- lh5801_and_mem(*m_io, adr, m_cache->read_byte(P++));
+ lh5801_and_mem(m_io.space(), adr, m_cache.read_byte(P++));
m_icount -= 23;
break;
case 0xeb:
adr = lh5801_readop_word();
- lh5801_ora_mem(*m_io, adr, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_io.space(), adr, m_cache.read_byte(P++));
m_icount -= 23;
break;
case 0xec:
@@ -793,12 +793,12 @@ void lh5801_cpu_device::lh5801_instruction_fd()
break;
case 0xed:
adr = lh5801_readop_word();
- lh5801_bit(m_io->read_byte(adr), m_cache->read_byte(P++));
+ lh5801_bit(m_io.read_byte(adr), m_cache.read_byte(P++));
m_icount -= 20;
break;
case 0xef:
adr = lh5801_readop_word();
- lh5801_add_mem(*m_io, adr, m_cache->read_byte(P++));
+ lh5801_add_mem(m_io.space(), adr, m_cache.read_byte(P++));
m_icount -= 23;
break;
@@ -811,14 +811,14 @@ void lh5801_cpu_device::lh5801_instruction()
{
int adr;
- int oper = m_cache->read_byte(P++);
+ int oper = m_cache.read_byte(P++);
switch (oper) {
case 0x00:
lh5801_sbc(XL);
m_icount -= 6;
break;
case 0x01:
- lh5801_sbc(m_program->read_byte(X));
+ lh5801_sbc(m_program.read_byte(X));
m_icount -= 7;
break;
case 0x02:
@@ -826,7 +826,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x03:
- lh5801_adc(m_program->read_byte(X));
+ lh5801_adc(m_program.read_byte(X));
m_icount -= 7;
break;
case 0x04:
@@ -834,7 +834,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x05:
- lh5801_lda(m_program->read_byte(X));
+ lh5801_lda(m_program.read_byte(X));
m_icount -= 6;
break;
case 0x06:
@@ -842,7 +842,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x07:
- lh5801_cpa(m_a, m_program->read_byte(X));
+ lh5801_cpa(m_a, m_program.read_byte(X));
m_icount -= 7;
break;
case 0x08:
@@ -850,7 +850,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x09:
- lh5801_and(m_program->read_byte(X));
+ lh5801_and(m_program.read_byte(X));
m_icount -= 7;
break;
case 0x0a:
@@ -858,23 +858,23 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x0b:
- lh5801_ora(m_program->read_byte(X));
+ lh5801_ora(m_program.read_byte(X));
m_icount -= 7;
break;
case 0x0c:
- lh5801_dcs(m_program->read_byte(X));
+ lh5801_dcs(m_program.read_byte(X));
m_icount -= 13;
break;
case 0x0d:
- lh5801_eor(m_program->read_byte(X));
+ lh5801_eor(m_program.read_byte(X));
m_icount -= 7;
break;
case 0x0e:
- m_program->write_byte(X,m_a);
+ m_program.write_byte(X,m_a);
m_icount -= 6;
break;
case 0x0f:
- lh5801_bit(m_program->read_byte(X),m_a);
+ lh5801_bit(m_program.read_byte(X),m_a);
m_icount -= 7;
break;
case 0x10:
@@ -882,7 +882,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x11:
- lh5801_sbc(m_program->read_byte(Y));
+ lh5801_sbc(m_program.read_byte(Y));
m_icount -= 7;
break;
case 0x12:
@@ -890,7 +890,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x13:
- lh5801_adc(m_program->read_byte(Y));
+ lh5801_adc(m_program.read_byte(Y));
m_icount -= 7;
break;
case 0x14:
@@ -898,7 +898,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x15:
- lh5801_lda(m_program->read_byte(Y));
+ lh5801_lda(m_program.read_byte(Y));
m_icount -= 6;
break;
case 0x16:
@@ -906,7 +906,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x17:
- lh5801_cpa(m_a, m_program->read_byte(Y));
+ lh5801_cpa(m_a, m_program.read_byte(Y));
m_icount -= 7;
break;
case 0x18:
@@ -914,7 +914,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x19:
- lh5801_and(m_program->read_byte(Y));
+ lh5801_and(m_program.read_byte(Y));
m_icount -= 7;
break;
case 0x1a:
@@ -922,22 +922,22 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x1b:
- lh5801_ora(m_program->read_byte(Y));
+ lh5801_ora(m_program.read_byte(Y));
m_icount -= 7;
break;
case 0x1c:
- lh5801_dcs(m_program->read_byte(Y));
+ lh5801_dcs(m_program.read_byte(Y));
m_icount -= 13;
break;
case 0x1d:
- lh5801_eor(m_program->read_byte(Y));
+ lh5801_eor(m_program.read_byte(Y));
m_icount -= 7;
break;
- case 0x1e: m_program->write_byte(Y,m_a);
+ case 0x1e: m_program.write_byte(Y,m_a);
m_icount -= 6;
break;
case 0x1f:
- lh5801_bit(m_program->read_byte(Y),m_a);
+ lh5801_bit(m_program.read_byte(Y),m_a);
m_icount -= 7;
break;
case 0x20:
@@ -945,7 +945,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x21:
- lh5801_sbc(m_program->read_byte(U));
+ lh5801_sbc(m_program.read_byte(U));
m_icount -= 7;
break;
case 0x22:
@@ -953,7 +953,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x23:
- lh5801_adc(m_program->read_byte(U));
+ lh5801_adc(m_program.read_byte(U));
m_icount -= 7;
break;
case 0x24:
@@ -961,7 +961,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x25:
- lh5801_lda(m_program->read_byte(U));
+ lh5801_lda(m_program.read_byte(U));
m_icount -= 6;
break;
case 0x26:
@@ -969,7 +969,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0x27:
- lh5801_cpa(m_a, m_program->read_byte(U));
+ lh5801_cpa(m_a, m_program.read_byte(U));
m_icount -= 7;
break;
case 0x28:
@@ -977,7 +977,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x29:
- lh5801_and(m_program->read_byte(U));
+ lh5801_and(m_program.read_byte(U));
m_icount -= 7;
break;
case 0x2a:
@@ -985,23 +985,23 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0x2b:
- lh5801_ora(m_program->read_byte(U));
+ lh5801_ora(m_program.read_byte(U));
m_icount -= 7;
break;
case 0x2c:
- lh5801_dcs(m_program->read_byte(U));
+ lh5801_dcs(m_program.read_byte(U));
m_icount -= 13;
break;
case 0x2d:
- lh5801_eor(m_program->read_byte(U));
+ lh5801_eor(m_program.read_byte(U));
m_icount -= 7;
break;
case 0x2e:
- m_program->write_byte(U, m_a);
+ m_program.write_byte(U, m_a);
m_icount -= 6;
break;
case 0x2f:
- lh5801_bit(m_program->read_byte(U), m_a);
+ lh5801_bit(m_program.read_byte(U), m_a);
m_icount -= 7;
break;
case 0x38: /*nop*/
@@ -1037,34 +1037,34 @@ void lh5801_cpu_device::lh5801_instruction()
lh5801_lde(&m_x);
m_icount -= 6;
break;
- case 0x48: XH=m_cache->read_byte(P++);
+ case 0x48: XH=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x49:
- lh5801_and_mem(*m_program, X, m_cache->read_byte(P++));
+ lh5801_and_mem(m_program.space(), X, m_cache.read_byte(P++));
m_icount -= 13;
break;
- case 0x4a: XL=m_cache->read_byte(P++);
+ case 0x4a: XL=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x4b:
- lh5801_ora_mem(*m_program, X, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_program.space(), X, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x4c:
- lh5801_cpa(XH, m_cache->read_byte(P++));
+ lh5801_cpa(XH, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x4d:
- lh5801_bit(m_program->read_byte(X), m_cache->read_byte(P++));
+ lh5801_bit(m_program.read_byte(X), m_cache.read_byte(P++));
m_icount -= 10;
break;
case 0x4e:
- lh5801_cpa(XL, m_cache->read_byte(P++));
+ lh5801_cpa(XL, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x4f:
- lh5801_add_mem(*m_program, X, m_cache->read_byte(P++));
+ lh5801_add_mem(m_program.space(), X, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x50:
@@ -1097,34 +1097,34 @@ void lh5801_cpu_device::lh5801_instruction()
lh5801_lde(&m_y);
m_icount -= 6;
break;
- case 0x58: YH=m_cache->read_byte(P++);
+ case 0x58: YH=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x59:
- lh5801_and_mem(*m_program, Y, m_cache->read_byte(P++));
+ lh5801_and_mem(m_program.space(), Y, m_cache.read_byte(P++));
m_icount -= 13;
break;
- case 0x5a: YL=m_cache->read_byte(P++);
+ case 0x5a: YL=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x5b:
- lh5801_ora_mem(*m_program, Y, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_program.space(), Y, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x5c:
- lh5801_cpa(YH, m_cache->read_byte(P++));
+ lh5801_cpa(YH, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x5d:
- lh5801_bit(m_program->read_byte(Y), m_cache->read_byte(P++));
+ lh5801_bit(m_program.read_byte(Y), m_cache.read_byte(P++));
m_icount -= 10;
break;
case 0x5e:
- lh5801_cpa(YL, m_cache->read_byte(P++));
+ lh5801_cpa(YL, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x5f:
- lh5801_add_mem(*m_program, Y, m_cache->read_byte(P++));
+ lh5801_add_mem(m_program.space(), Y, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x60:
@@ -1157,34 +1157,34 @@ void lh5801_cpu_device::lh5801_instruction()
lh5801_lde(&m_u);
m_icount -= 6;
break;
- case 0x68: UH=m_cache->read_byte(P++);
+ case 0x68: UH=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x69:
- lh5801_and_mem(*m_program, U, m_cache->read_byte(P++));
+ lh5801_and_mem(m_program.space(), U, m_cache.read_byte(P++));
m_icount -= 13;
break;
- case 0x6a: UL=m_cache->read_byte(P++);
+ case 0x6a: UL=m_cache.read_byte(P++);
m_icount -= 6;
break;
case 0x6b:
- lh5801_ora_mem(*m_program, U, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_program.space(), U, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x6c:
- lh5801_cpa(UH, m_cache->read_byte(P++));
+ lh5801_cpa(UH, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x6d:
- lh5801_bit(m_program->read_byte(U), m_cache->read_byte(P++));
+ lh5801_bit(m_program.read_byte(U), m_cache.read_byte(P++));
m_icount -= 10;
break;
case 0x6e:
- lh5801_cpa(UL, m_cache->read_byte(P++));
+ lh5801_cpa(UL, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0x6f:
- lh5801_add_mem(*m_program, U, m_cache->read_byte(P++));
+ lh5801_add_mem(m_program.space(), U, m_cache.read_byte(P++));
m_icount -= 13;
break;
case 0x80:
@@ -1235,7 +1235,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 8;
break;
case 0x8c:
- lh5801_dca(m_program->read_byte(X));
+ lh5801_dca(m_program.read_byte(X));
m_icount -= 15;
break;
case 0x8d:
@@ -1295,7 +1295,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 8;
break;
case 0x9c:
- lh5801_dca(m_program->read_byte(Y));
+ lh5801_dca(m_program.read_byte(Y));
m_icount -= 15;
break;
case 0x9d:
@@ -1319,11 +1319,11 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xa1:
- lh5801_sbc(m_program->read_byte(lh5801_readop_word()));
+ lh5801_sbc(m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xa3:
- lh5801_adc(m_program->read_byte(lh5801_readop_word()));
+ lh5801_adc(m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xa4:
@@ -1331,7 +1331,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 5;
break;
case 0xa5:
- lh5801_lda(m_program->read_byte(lh5801_readop_word()));
+ lh5801_lda(m_program.read_byte(lh5801_readop_word()));
m_icount -= 12;
break;
case 0xa6:
@@ -1339,7 +1339,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xa7:
- lh5801_cpa(m_a, m_program->read_byte(lh5801_readop_word()));
+ lh5801_cpa(m_a, m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xa8: /*spv*/
@@ -1347,7 +1347,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 4;
break;
case 0xa9:
- lh5801_and(m_program->read_byte(lh5801_readop_word()));
+ lh5801_and(m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xaa:
@@ -1355,39 +1355,39 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xab:
- lh5801_ora(m_program->read_byte(lh5801_readop_word()));
+ lh5801_ora(m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xac:
- lh5801_dca(m_program->read_byte(U));
+ lh5801_dca(m_program.read_byte(U));
m_icount -= 15;
break;
case 0xad:
- lh5801_eor(m_program->read_byte(lh5801_readop_word()));
+ lh5801_eor(m_program.read_byte(lh5801_readop_word()));
m_icount -= 13;
break;
case 0xae:
- m_program->write_byte(lh5801_readop_word(), m_a);
+ m_program.write_byte(lh5801_readop_word(), m_a);
m_icount -= 12;
break;
case 0xaf:
- lh5801_bit(m_program->read_byte(lh5801_readop_word()), m_a);
+ lh5801_bit(m_program.read_byte(lh5801_readop_word()), m_a);
m_icount -= 13;
break;
case 0xb1:
- lh5801_sbc(m_cache->read_byte(P++));
+ lh5801_sbc(m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xb3:
- lh5801_adc(m_cache->read_byte(P++));
+ lh5801_adc(m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xb5:
- lh5801_lda(m_cache->read_byte(P++));
+ lh5801_lda(m_cache.read_byte(P++));
m_icount -= 6;
break;
case 0xb7:
- lh5801_cpa(m_a, m_cache->read_byte(P++));
+ lh5801_cpa(m_a, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xb8: /*rpv*/
@@ -1395,7 +1395,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 4;
break;
case 0xb9:
- lh5801_and(m_cache->read_byte(P++));
+ lh5801_and(m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xba:
@@ -1403,11 +1403,11 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 12;
break;
case 0xbb:
- lh5801_ora(m_cache->read_byte(P++));
+ lh5801_ora(m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xbd:
- lh5801_eor(m_cache->read_byte(P++));
+ lh5801_eor(m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xbe:
@@ -1415,39 +1415,39 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 19;
break;
case 0xbf:
- lh5801_bit(m_a, m_cache->read_byte(P++));
+ lh5801_bit(m_a, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xc1:
- lh5801_vector(!(m_t&C), m_cache->read_byte(P++));
+ lh5801_vector(!(m_t&C), m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xc3:
- lh5801_vector(m_t&C, m_cache->read_byte(P++));
+ lh5801_vector(m_t&C, m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xc5:
- lh5801_vector(!(m_t&H), m_cache->read_byte(P++));
+ lh5801_vector(!(m_t&H), m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xc7:
- lh5801_vector(m_t&H, m_cache->read_byte(P++));
+ lh5801_vector(m_t&H, m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xc9:
- lh5801_vector(!(m_t&Z), m_cache->read_byte(P++));
+ lh5801_vector(!(m_t&Z), m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xcb:
- lh5801_vector(m_t & Z, m_cache->read_byte(P++));
+ lh5801_vector(m_t & Z, m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xcd:
- lh5801_vector(1, m_cache->read_byte(P++));
+ lh5801_vector(1, m_cache.read_byte(P++));
m_icount -= 7;
break;
case 0xcf:
- lh5801_vector(m_t & V, m_cache->read_byte(P++));
+ lh5801_vector(m_t & V, m_cache.read_byte(P++));
m_icount -= 8;
break;
case 0xd1:
@@ -1455,7 +1455,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xd3:
- lh5801_drr(*m_program, X);
+ lh5801_drr(m_program.space(), X);
m_icount -= 12;
break;
case 0xd5:
@@ -1463,7 +1463,7 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xd7:
- lh5801_drl(*m_program, X);
+ lh5801_drl(m_program.space(), X);
m_icount -= 12;
break;
case 0xd9:
@@ -1492,22 +1492,22 @@ void lh5801_cpu_device::lh5801_instruction()
break;
case 0xe9:
adr = lh5801_readop_word();
- lh5801_and_mem(*m_program, adr, m_cache->read_byte(P++));
+ lh5801_and_mem(m_program.space(), adr, m_cache.read_byte(P++));
m_icount -= 19;
break;
case 0xeb:
adr = lh5801_readop_word();
- lh5801_ora_mem(*m_program, adr, m_cache->read_byte(P++));
+ lh5801_ora_mem(m_program.space(), adr, m_cache.read_byte(P++));
m_icount -= 19;
break;
case 0xed:
adr = lh5801_readop_word();
- lh5801_bit(m_program->read_byte(adr), m_cache->read_byte(P++));
+ lh5801_bit(m_program.read_byte(adr), m_cache.read_byte(P++));
m_icount -= 16;
break;
case 0xef:
adr = lh5801_readop_word();
- lh5801_add_mem(*m_program, adr, m_cache->read_byte(P++));
+ lh5801_add_mem(m_program.space(), adr, m_cache.read_byte(P++));
m_icount -= 19;
break;
case 0xf1:
@@ -1515,11 +1515,11 @@ void lh5801_cpu_device::lh5801_instruction()
m_icount -= 6;
break;
case 0xf5: /*tin*/
- m_program->write_byte(Y++, m_program->read_byte(X++));
+ m_program.write_byte(Y++, m_program.read_byte(X++));
m_icount -= 7;
break;
case 0xf7: /*cin*/
- lh5801_cpa(m_a, m_program->read_byte(X++));
+ lh5801_cpa(m_a, m_program.read_byte(X++));
m_icount -= 7;
break;
case 0xf9:
diff --git a/src/devices/cpu/lh5801/lh5801.cpp b/src/devices/cpu/lh5801/lh5801.cpp
index f650b0887fa..da156333eb0 100644
--- a/src/devices/cpu/lh5801/lh5801.cpp
+++ b/src/devices/cpu/lh5801/lh5801.cpp
@@ -90,9 +90,9 @@ device_memory_interface::space_config_vector lh5801_cpu_device::memory_space_con
void lh5801_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_io = &space(AS_IO);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
m_in_func.resolve_safe(0);
@@ -172,7 +172,7 @@ void lh5801_cpu_device::state_string_export(const device_state_entry &entry, std
void lh5801_cpu_device::device_reset()
{
- P = (m_program->read_byte(0xfffe) << 8) | m_program->read_byte(0xffff);
+ P = (m_program.read_byte(0xfffe) << 8) | m_program.read_byte(0xffff);
m_idle = 0;
@@ -190,7 +190,7 @@ void lh5801_cpu_device::check_irq()
lh5801_push(m_t);
m_t &= ~IE;
lh5801_push_word(P);
- P = (m_program->read_byte(0xfffc) << 8) | m_program->read_byte(0xfffd);
+ P = (m_program.read_byte(0xfffc) << 8) | m_program.read_byte(0xfffd);
}
else if (m_ir_flipflop[1] && (m_t & IE))
{
@@ -199,7 +199,7 @@ void lh5801_cpu_device::check_irq()
lh5801_push(m_t);
m_t &= ~IE;
lh5801_push_word(P);
- P = (m_program->read_byte(0xfffa) << 8) | m_program->read_byte(0xfffb);
+ P = (m_program.read_byte(0xfffa) << 8) | m_program.read_byte(0xfffb);
}
else if (m_ir_flipflop[2] && (m_t & IE))
{
@@ -208,7 +208,7 @@ void lh5801_cpu_device::check_irq()
lh5801_push(m_t);
m_t &= ~IE;
lh5801_push_word(P);
- P = (m_program->read_byte(0xfff8) << 8) | m_program->read_byte(0xfff9);
+ P = (m_program.read_byte(0xfff8) << 8) | m_program.read_byte(0xfff9);
}
}
diff --git a/src/devices/cpu/lh5801/lh5801.h b/src/devices/cpu/lh5801/lh5801.h
index 85ca6598f4d..68c028289af 100644
--- a/src/devices/cpu/lh5801/lh5801.h
+++ b/src/devices/cpu/lh5801/lh5801.h
@@ -2,7 +2,7 @@
// copyright-holders:Peter Trauner
/*****************************************************************************
*
- * cpustate->h
+ * lh6801.h
* portable lh5801 emulator interface
*
*
@@ -99,9 +99,9 @@ private:
devcb_read8 m_in_func;
- address_space *m_program; //ME0
- address_space *m_io; //ME1
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program; // ME0
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_io; // ME1
PAIR m_s;
PAIR m_p;
diff --git a/src/devices/cpu/m37710/m37710.cpp b/src/devices/cpu/m37710/m37710.cpp
index 5b199497ddd..ccbb60b1da4 100644
--- a/src/devices/cpu/m37710/m37710.cpp
+++ b/src/devices/cpu/m37710/m37710.cpp
@@ -1307,8 +1307,8 @@ void m37710_cpu_device::device_start()
m_watchdog_freq = 0;
std::fill(std::begin(m_int_control), std::end(m_int_control), 0);
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
m_port_in_cb.resolve_all_safe(0xff);
m_port_out_cb.resolve_all_safe();
diff --git a/src/devices/cpu/m37710/m37710.h b/src/devices/cpu/m37710/m37710.h
index 5ddac905305..1ff34d91336 100644
--- a/src/devices/cpu/m37710/m37710.h
+++ b/src/devices/cpu/m37710/m37710.h
@@ -270,8 +270,8 @@ private:
int m_ICount; /* cycle count */
uint32_t m_source; /* temp register */
uint32_t m_destination; /* temp register */
- address_space *m_program;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 1, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<24, 1, 0, ENDIANNESS_LITTLE>::specific m_program;
uint32_t m_stopped; /* Sets how the CPU is stopped */
// ports
diff --git a/src/devices/cpu/m37710/m37710cm.h b/src/devices/cpu/m37710/m37710cm.h
index 1fa3c45f14f..c29ab52bef5 100644
--- a/src/devices/cpu/m37710/m37710cm.h
+++ b/src/devices/cpu/m37710/m37710cm.h
@@ -21,12 +21,12 @@
#undef M37710_CALL_DEBUGGER
#define M37710_CALL_DEBUGGER(x) debugger_instruction_hook(x)
-#define m37710_read_8(addr) m_program->read_byte(addr)
-#define m37710_write_8(addr,data) m_program->write_byte(addr,data)
-#define m37710_read_8_immediate(A) m_cache->read_byte(A)
-#define m37710_read_16(addr) m_program->read_word_unaligned(addr)
-#define m37710_write_16(addr,data) m_program->write_word_unaligned(addr,data)
-#define m37710_read_16_immediate(A) m_cache->read_word(A)
+#define m37710_read_8(addr) m_program.read_byte(addr)
+#define m37710_write_8(addr,data) m_program.write_byte(addr,data)
+#define m37710_read_8_immediate(A) m_cache.read_byte(A)
+#define m37710_read_16(addr) m_program.read_word_unaligned(addr)
+#define m37710_write_16(addr,data) m_program.write_word_unaligned(addr,data)
+#define m37710_read_16_immediate(A) m_cache.read_word(A)
/* ======================================================================== */
diff --git a/src/devices/cpu/m6502/m4510.cpp b/src/devices/cpu/m6502/m4510.cpp
index 69dcd2a8f74..aa29a820dcd 100644
--- a/src/devices/cpu/m6502/m4510.cpp
+++ b/src/devices/cpu/m6502/m4510.cpp
@@ -74,22 +74,22 @@ m4510_device::mi_4510::mi_4510(m4510_device *_base)
uint8_t m4510_device::mi_4510::read(uint16_t adr)
{
- return program->read_byte(base->map(adr));
+ return program.read_byte(base->map(adr));
}
uint8_t m4510_device::mi_4510::read_sync(uint16_t adr)
{
- return scache->read_byte(base->map(adr));
+ return csprogram.read_byte(base->map(adr));
}
uint8_t m4510_device::mi_4510::read_arg(uint16_t adr)
{
- return cache->read_byte(base->map(adr));
+ return cprogram.read_byte(base->map(adr));
}
void m4510_device::mi_4510::write(uint16_t adr, uint8_t val)
{
- program->write_byte(base->map(adr), val);
+ program.write_byte(base->map(adr), val);
}
#include "cpu/m6502/m4510.hxx"
diff --git a/src/devices/cpu/m6502/m6502.cpp b/src/devices/cpu/m6502/m6502.cpp
index 2781d689dc1..f3b09d4de78 100644
--- a/src/devices/cpu/m6502/m6502.cpp
+++ b/src/devices/cpu/m6502/m6502.cpp
@@ -44,11 +44,9 @@ void m6502_device::device_start()
void m6502_device::init()
{
- mintf->program = &space(AS_PROGRAM);
- mintf->sprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : mintf->program;
-
- mintf->cache = mintf->program->cache<0, 0, ENDIANNESS_LITTLE>();
- mintf->scache = mintf->sprogram->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(mintf->cprogram);
+ space(AS_PROGRAM).specific(mintf->program);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(mintf->csprogram);
sync_w.resolve_safe();
@@ -528,22 +526,22 @@ void m6502_device::memory_interface::write_9(uint16_t adr, uint8_t val)
uint8_t m6502_device::mi_default::read(uint16_t adr)
{
- return program->read_byte(adr);
+ return program.read_byte(adr);
}
uint8_t m6502_device::mi_default::read_sync(uint16_t adr)
{
- return scache->read_byte(adr);
+ return csprogram.read_byte(adr);
}
uint8_t m6502_device::mi_default::read_arg(uint16_t adr)
{
- return cache->read_byte(adr);
+ return cprogram.read_byte(adr);
}
void m6502_device::mi_default::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
}
diff --git a/src/devices/cpu/m6502/m6502.h b/src/devices/cpu/m6502/m6502.h
index 3637b088eea..c7a0390971a 100644
--- a/src/devices/cpu/m6502/m6502.h
+++ b/src/devices/cpu/m6502/m6502.h
@@ -33,8 +33,8 @@ protected:
class memory_interface {
public:
- address_space *program, *sprogram;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *cache, *scache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache cprogram, csprogram;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific program;
virtual ~memory_interface() {}
virtual uint8_t read(uint16_t adr) = 0;
diff --git a/src/devices/cpu/m6502/m6504.cpp b/src/devices/cpu/m6502/m6504.cpp
index 4e342fdbd3a..98fba662e60 100644
--- a/src/devices/cpu/m6502/m6504.cpp
+++ b/src/devices/cpu/m6502/m6504.cpp
@@ -29,20 +29,20 @@ void m6504_device::device_start()
uint8_t m6504_device::mi_6504::read(uint16_t adr)
{
- return program->read_byte(adr & 0x1fff);
+ return program.read_byte(adr & 0x1fff);
}
uint8_t m6504_device::mi_6504::read_sync(uint16_t adr)
{
- return scache->read_byte(adr & 0x1fff);
+ return csprogram.read_byte(adr & 0x1fff);
}
uint8_t m6504_device::mi_6504::read_arg(uint16_t adr)
{
- return cache->read_byte(adr & 0x1fff);
+ return cprogram.read_byte(adr & 0x1fff);
}
void m6504_device::mi_6504::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr & 0x1fff, val);
+ program.write_byte(adr & 0x1fff, val);
}
diff --git a/src/devices/cpu/m6502/m6507.cpp b/src/devices/cpu/m6502/m6507.cpp
index aa4a0726aa8..a42aff44c2f 100644
--- a/src/devices/cpu/m6502/m6507.cpp
+++ b/src/devices/cpu/m6502/m6507.cpp
@@ -29,20 +29,20 @@ void m6507_device::device_start()
uint8_t m6507_device::mi_6507::read(uint16_t adr)
{
- return program->read_byte(adr & 0x1fff);
+ return program.read_byte(adr & 0x1fff);
}
uint8_t m6507_device::mi_6507::read_sync(uint16_t adr)
{
- return scache->read_byte(adr & 0x1fff);
+ return csprogram.read_byte(adr & 0x1fff);
}
uint8_t m6507_device::mi_6507::read_arg(uint16_t adr)
{
- return cache->read_byte(adr & 0x1fff);
+ return cprogram.read_byte(adr & 0x1fff);
}
void m6507_device::mi_6507::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr & 0x1fff, val);
+ program.write_byte(adr & 0x1fff, val);
}
diff --git a/src/devices/cpu/m6502/m6509.cpp b/src/devices/cpu/m6502/m6509.cpp
index 2f3d7ca0695..3ffbeda05fc 100644
--- a/src/devices/cpu/m6502/m6509.cpp
+++ b/src/devices/cpu/m6502/m6509.cpp
@@ -59,7 +59,7 @@ m6509_device::mi_6509::mi_6509(m6509_device *_base)
uint8_t m6509_device::mi_6509::read(uint16_t adr)
{
- uint8_t res = program->read_byte(base->adr_in_bank_i(adr));
+ uint8_t res = program.read_byte(base->adr_in_bank_i(adr));
if(adr == 0x0000)
res = base->bank_i_r();
else if(adr == 0x0001)
@@ -69,7 +69,7 @@ uint8_t m6509_device::mi_6509::read(uint16_t adr)
uint8_t m6509_device::mi_6509::read_sync(uint16_t adr)
{
- uint8_t res = scache->read_byte(base->adr_in_bank_i(adr));
+ uint8_t res = csprogram.read_byte(base->adr_in_bank_i(adr));
if(adr == 0x0000)
res = base->bank_i_r();
else if(adr == 0x0001)
@@ -79,7 +79,7 @@ uint8_t m6509_device::mi_6509::read_sync(uint16_t adr)
uint8_t m6509_device::mi_6509::read_arg(uint16_t adr)
{
- uint8_t res = cache->read_byte(base->adr_in_bank_i(adr));
+ uint8_t res = cprogram.read_byte(base->adr_in_bank_i(adr));
if(adr == 0x0000)
res = base->bank_i_r();
else if(adr == 0x0001)
@@ -89,7 +89,7 @@ uint8_t m6509_device::mi_6509::read_arg(uint16_t adr)
uint8_t m6509_device::mi_6509::read_9(uint16_t adr)
{
- uint8_t res = program->read_byte(base->adr_in_bank_y(adr));
+ uint8_t res = program.read_byte(base->adr_in_bank_y(adr));
if(adr == 0x0000)
res = base->bank_i_r();
else if(adr == 0x0001)
@@ -99,7 +99,7 @@ uint8_t m6509_device::mi_6509::read_9(uint16_t adr)
void m6509_device::mi_6509::write(uint16_t adr, uint8_t val)
{
- program->write_byte(base->adr_in_bank_i(adr), val);
+ program.write_byte(base->adr_in_bank_i(adr), val);
if(adr == 0x0000)
base->bank_i_w(val);
else if(adr == 0x0001)
@@ -108,7 +108,7 @@ void m6509_device::mi_6509::write(uint16_t adr, uint8_t val)
void m6509_device::mi_6509::write_9(uint16_t adr, uint8_t val)
{
- program->write_byte(base->adr_in_bank_y(adr), val);
+ program.write_byte(base->adr_in_bank_y(adr), val);
if(adr == 0x0000)
base->bank_i_w(val);
else if(adr == 0x0001)
diff --git a/src/devices/cpu/m6502/m6510.cpp b/src/devices/cpu/m6502/m6510.cpp
index 0bfa5a18395..706c1407fcb 100644
--- a/src/devices/cpu/m6502/m6510.cpp
+++ b/src/devices/cpu/m6502/m6510.cpp
@@ -113,7 +113,7 @@ m6510_device::mi_6510::mi_6510(m6510_device *_base)
uint8_t m6510_device::mi_6510::read(uint16_t adr)
{
- uint8_t res = program->read_byte(adr);
+ uint8_t res = program.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -123,7 +123,7 @@ uint8_t m6510_device::mi_6510::read(uint16_t adr)
uint8_t m6510_device::mi_6510::read_sync(uint16_t adr)
{
- uint8_t res = scache->read_byte(adr);
+ uint8_t res = csprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -133,7 +133,7 @@ uint8_t m6510_device::mi_6510::read_sync(uint16_t adr)
uint8_t m6510_device::mi_6510::read_arg(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -143,7 +143,7 @@ uint8_t m6510_device::mi_6510::read_arg(uint16_t adr)
void m6510_device::mi_6510::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
if(adr == 0x0000)
base->dir_w(val);
else if(adr == 0x0001)
@@ -175,7 +175,7 @@ m6508_device::mi_6508::mi_6508(m6508_device *_base)
uint8_t m6508_device::mi_6508::read(uint16_t adr)
{
- uint8_t res = program->read_byte(adr);
+ uint8_t res = program.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -187,7 +187,7 @@ uint8_t m6508_device::mi_6508::read(uint16_t adr)
uint8_t m6508_device::mi_6508::read_sync(uint16_t adr)
{
- uint8_t res = scache->read_byte(adr);
+ uint8_t res = csprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -199,7 +199,7 @@ uint8_t m6508_device::mi_6508::read_sync(uint16_t adr)
uint8_t m6508_device::mi_6508::read_arg(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(adr == 0x0000)
res = base->dir_r();
else if(adr == 0x0001)
@@ -211,7 +211,7 @@ uint8_t m6508_device::mi_6508::read_arg(uint16_t adr)
void m6508_device::mi_6508::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
if(adr == 0x0000)
base->dir_w(val);
else if(adr == 0x0001)
diff --git a/src/devices/cpu/m6502/n2a03.cpp b/src/devices/cpu/m6502/n2a03.cpp
index b7aa0778ed7..b4c05185441 100644
--- a/src/devices/cpu/m6502/n2a03.cpp
+++ b/src/devices/cpu/m6502/n2a03.cpp
@@ -72,7 +72,7 @@ WRITE_LINE_MEMBER(n2a03_device::apu_irq)
uint8_t n2a03_device::apu_read_mem(offs_t offset)
{
- return mintf->program->read_byte(offset);
+ return mintf->program.read_byte(offset);
}
void n2a03_device::device_add_mconfig(machine_config &config)
diff --git a/src/devices/cpu/m6502/r65c19.cpp b/src/devices/cpu/m6502/r65c19.cpp
index 4da7a547c79..0616a432504 100644
--- a/src/devices/cpu/m6502/r65c19.cpp
+++ b/src/devices/cpu/m6502/r65c19.cpp
@@ -108,9 +108,9 @@ device_memory_interface::space_config_vector c39_device::memory_space_config() c
void c39_device::device_start()
{
std::unique_ptr<mi_banked> intf = std::make_unique<mi_banked>();
- intf->exp = &space(AS_DATA);
- intf->escache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
- intf->es4 = &space(AS_IO);
+ space(AS_DATA).cache(intf->escache);
+ space(AS_DATA).specific(intf->exp);
+ space(AS_IO).specific(intf->es4);
save_item(NAME(intf->bsr));
save_item(NAME(intf->pbs));
@@ -186,38 +186,38 @@ void r65c19_device::cir_w(u8 data)
u8 c39_device::mi_banked::exp_read(u16 adr)
{
- return exp->read_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff));
+ return exp.read_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff));
}
u8 c39_device::mi_banked::exp_read_cached(u16 adr)
{
- return escache->read_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff));
+ return escache.read_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff));
}
void c39_device::mi_banked::exp_write(u16 adr, u8 val)
{
- exp->write_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff), val);
+ exp.write_byte(u32(bsr[(adr & 0xe000) >> 13]) << 13 | (adr & 0x1fff), val);
}
u8 c39_device::mi_banked::es4_read(u16 adr)
{
- return es4->read_byte(adr & 0x1ff);
+ return es4.read_byte(adr & 0x1ff);
}
void c39_device::mi_banked::es4_write(u16 adr, u8 val)
{
- es4->write_byte(adr & 0x1ff, val);
+ es4.write_byte(adr & 0x1ff, val);
}
u8 c39_device::mi_banked::read(u16 adr)
{
- return program->read_byte(adr);
+ return program.read_byte(adr);
}
u8 c39_device::mi_banked::read_sync(u16 adr)
{
if (adr < 0x0600)
- return cache->read_byte(adr);
+ return cprogram.read_byte(adr);
else if (adr >= 0x0800 || BIT(pbs, 1))
return exp_read_cached(adr);
else
@@ -227,7 +227,7 @@ u8 c39_device::mi_banked::read_sync(u16 adr)
u8 c39_device::mi_banked::read_arg(u16 adr)
{
if (adr < 0x0600)
- return cache->read_byte(adr);
+ return cprogram.read_byte(adr);
else if (adr >= 0x0800 || BIT(pbs, 1))
return exp_read_cached(adr);
else
@@ -236,7 +236,7 @@ u8 c39_device::mi_banked::read_arg(u16 adr)
void c39_device::mi_banked::write(u16 adr, u8 val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
}
u8 c39_device::pbs_r()
diff --git a/src/devices/cpu/m6502/r65c19.h b/src/devices/cpu/m6502/r65c19.h
index 6449b1833e2..6f018fb661b 100644
--- a/src/devices/cpu/m6502/r65c19.h
+++ b/src/devices/cpu/m6502/r65c19.h
@@ -138,9 +138,9 @@ private:
u8 es4_read(u16 adr);
void es4_write(u16 adr, u8 val);
- address_space *exp;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *escache;
- address_space *es4;
+ memory_access<21, 0, 0, ENDIANNESS_LITTLE>::cache escache;
+ memory_access<21, 0, 0, ENDIANNESS_LITTLE>::specific exp;
+ memory_access< 9, 0, 0, ENDIANNESS_LITTLE>::specific es4;
u8 bsr[8];
u8 pbs;
diff --git a/src/devices/cpu/m6502/st2204.cpp b/src/devices/cpu/m6502/st2204.cpp
index 829ff74ac08..467e60465a5 100644
--- a/src/devices/cpu/m6502/st2204.cpp
+++ b/src/devices/cpu/m6502/st2204.cpp
@@ -67,8 +67,9 @@ st2202_device::st2202_device(const machine_config &mconfig, const char *tag, dev
void st2204_device::device_start()
{
std::unique_ptr<mi_st2204> intf = std::make_unique<mi_st2204>();
- intf->data = &space(AS_DATA);
- intf->dcache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
+
+ space(AS_DATA).cache(intf->dcache);
+ space(AS_DATA).specific(intf->data);
intf->irr_enable = false;
intf->irr = 0;
intf->prr = 0;
@@ -178,55 +179,55 @@ const char *st2204_device::st2xxx_irq_name(int i) const
u8 st2204_device::mi_st2204::pread(u16 adr)
{
u16 bank = irq_service && irr_enable ? irr : prr;
- return data->read_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff));
+ return data.read_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff));
}
u8 st2204_device::mi_st2204::preadc(u16 adr)
{
u16 bank = irq_service && irr_enable ? irr : prr;
- return dcache->read_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff));
+ return dcache.read_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff));
}
void st2204_device::mi_st2204::pwrite(u16 adr, u8 val)
{
u16 bank = irq_service && irr_enable ? irr : prr;
- data->write_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff), val);
+ data.write_byte(u32(bank ^ 1) << 14 | (adr & 0x3fff), val);
}
u8 st2204_device::mi_st2204::dread(u16 adr)
{
- return data->read_byte(u32(drr) << 15 | (adr & 0x7fff));
+ return data.read_byte(u32(drr) << 15 | (adr & 0x7fff));
}
u8 st2204_device::mi_st2204::dreadc(u16 adr)
{
- return dcache->read_byte(u32(drr) << 15 | (adr & 0x7fff));
+ return dcache.read_byte(u32(drr) << 15 | (adr & 0x7fff));
}
void st2204_device::mi_st2204::dwrite(u16 adr, u8 val)
{
- data->write_byte(u32(drr) << 15 | (adr & 0x7fff), val);
+ data.write_byte(u32(drr) << 15 | (adr & 0x7fff), val);
}
u8 st2204_device::mi_st2204::read(u16 adr)
{
- return program->read_byte(adr);
+ return program.read_byte(adr);
}
u8 st2204_device::mi_st2204::read_sync(u16 adr)
{
- return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : cache->read_byte(adr);
+ return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : cprogram.read_byte(adr);
}
u8 st2204_device::mi_st2204::read_arg(u16 adr)
{
- return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : cache->read_byte(adr);
+ return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : cprogram.read_byte(adr);
}
u8 st2204_device::mi_st2204::read_dma(u16 adr)
{
if (BIT(adr, 15))
- return dcache->read_byte(u32(dmr) << 15 | (adr & 0x7fff));
+ return dcache.read_byte(u32(dmr) << 15 | (adr & 0x7fff));
else
return read(adr);
}
@@ -238,7 +239,7 @@ u8 st2204_device::mi_st2204::read_vector(u16 adr)
void st2204_device::mi_st2204::write(u16 adr, u8 val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
}
unsigned st2204_device::st2xxx_bt_divider(int n) const
diff --git a/src/devices/cpu/m6502/st2205u.cpp b/src/devices/cpu/m6502/st2205u.cpp
index c6036fbe21d..20436151600 100644
--- a/src/devices/cpu/m6502/st2205u.cpp
+++ b/src/devices/cpu/m6502/st2205u.cpp
@@ -51,8 +51,8 @@ st2205u_device::st2205u_device(const machine_config &mconfig, const char *tag, d
void st2205u_device::device_start()
{
std::unique_ptr<mi_st2205u> intf = std::make_unique<mi_st2205u>();
- intf->data = &space(AS_DATA);
- intf->dcache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_DATA).specific(intf->data);
+ space(AS_DATA).cache(intf->dcache);
intf->irr_enable = false;
intf->irr = 0;
intf->prr = 0;
@@ -164,7 +164,7 @@ u8 st2205u_device::mi_st2205u::pread(u16 adr)
if (BIT(bank, 15))
return ram[0x4000 | (adr & 0x3fff)];
else
- return data->read_byte(u32(bank) << 14 | (adr & 0x3fff));
+ return data.read_byte(u32(bank) << 14 | (adr & 0x3fff));
}
u8 st2205u_device::mi_st2205u::preadc(u16 adr)
@@ -173,7 +173,7 @@ u8 st2205u_device::mi_st2205u::preadc(u16 adr)
if (BIT(bank, 15))
return ram[0x4000 | (adr & 0x3fff)];
else
- return dcache->read_byte(u32(bank) << 14 | (adr & 0x3fff));
+ return dcache.read_byte(u32(bank) << 14 | (adr & 0x3fff));
}
void st2205u_device::mi_st2205u::pwrite(u16 adr, u8 val)
@@ -182,7 +182,7 @@ void st2205u_device::mi_st2205u::pwrite(u16 adr, u8 val)
if (BIT(bank, 15))
ram[0x4000 | (adr & 0x3fff)] = val;
else
- data->write_byte(u32(bank) << 14 | (adr & 0x3fff), val);
+ data.write_byte(u32(bank) << 14 | (adr & 0x3fff), val);
}
u8 st2205u_device::mi_st2205u::dread(u16 adr)
@@ -190,7 +190,7 @@ u8 st2205u_device::mi_st2205u::dread(u16 adr)
if (BIT(drr, 15))
return ram[adr & 0x7fff];
else
- return data->read_byte(u32(drr) << 15 | (adr & 0x7fff));
+ return data.read_byte(u32(drr) << 15 | (adr & 0x7fff));
}
u8 st2205u_device::mi_st2205u::dreadc(u16 adr)
@@ -198,7 +198,7 @@ u8 st2205u_device::mi_st2205u::dreadc(u16 adr)
if (BIT(drr, 15))
return ram[adr & 0x7fff];
else
- return dcache->read_byte(u32(drr) << 15 | (adr & 0x7fff));
+ return dcache.read_byte(u32(drr) << 15 | (adr & 0x7fff));
}
void st2205u_device::mi_st2205u::dwrite(u16 adr, u8 val)
@@ -206,7 +206,7 @@ void st2205u_device::mi_st2205u::dwrite(u16 adr, u8 val)
if (BIT(drr, 15))
ram[adr & 0x7fff] = val;
else
- data->write_byte(u32(drr) << 15 | (adr & 0x7fff), val);
+ data.write_byte(u32(drr) << 15 | (adr & 0x7fff), val);
}
u8 st2205u_device::mi_st2205u::bread(u16 adr)
@@ -214,7 +214,7 @@ u8 st2205u_device::mi_st2205u::bread(u16 adr)
if (BIT(brr, 15))
return ram[0x2000 | (adr & 0x1fff)];
else
- return data->read_byte(u32(brr) << 13 | (adr & 0x1fff));
+ return data.read_byte(u32(brr) << 13 | (adr & 0x1fff));
}
u8 st2205u_device::mi_st2205u::breadc(u16 adr)
@@ -222,7 +222,7 @@ u8 st2205u_device::mi_st2205u::breadc(u16 adr)
if (BIT(brr, 15))
return ram[0x2000 | (adr & 0x1fff)];
else
- return dcache->read_byte(u32(brr) << 13 | (adr & 0x1fff));
+ return dcache.read_byte(u32(brr) << 13 | (adr & 0x1fff));
}
void st2205u_device::mi_st2205u::bwrite(u16 adr, u8 val)
@@ -230,22 +230,22 @@ void st2205u_device::mi_st2205u::bwrite(u16 adr, u8 val)
if (BIT(brr, 15))
ram[0x2000 | (adr & 0x1fff)] = val;
else
- data->write_byte(u32(brr) << 13 | (adr & 0x1fff), val);
+ data.write_byte(u32(brr) << 13 | (adr & 0x1fff), val);
}
u8 st2205u_device::mi_st2205u::read(u16 adr)
{
- return program->read_byte(adr);
+ return program.read_byte(adr);
}
u8 st2205u_device::mi_st2205u::read_sync(u16 adr)
{
- return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : BIT(adr, 13) ? breadc(adr) : cache->read_byte(adr);
+ return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : BIT(adr, 13) ? breadc(adr) : cprogram.read_byte(adr);
}
u8 st2205u_device::mi_st2205u::read_arg(u16 adr)
{
- return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : BIT(adr, 13) ? breadc(adr) : cache->read_byte(adr);
+ return BIT(adr, 15) ? dreadc(adr) : BIT(adr, 14) ? preadc(adr) : BIT(adr, 13) ? breadc(adr) : cprogram.read_byte(adr);
}
u8 st2205u_device::mi_st2205u::read_vector(u16 adr)
@@ -255,7 +255,7 @@ u8 st2205u_device::mi_st2205u::read_vector(u16 adr)
void st2205u_device::mi_st2205u::write(u16 adr, u8 val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
}
u8 st2205u_device::brrl_r()
diff --git a/src/devices/cpu/m6502/st2xxx.h b/src/devices/cpu/m6502/st2xxx.h
index 3b188ba5dda..a895a95f24a 100644
--- a/src/devices/cpu/m6502/st2xxx.h
+++ b/src/devices/cpu/m6502/st2xxx.h
@@ -109,8 +109,8 @@ protected:
public:
virtual u8 read_vector(u16 adr) = 0;
- address_space *data;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *dcache;
+ memory_access<26, 0, 0, ENDIANNESS_LITTLE>::cache dcache;
+ memory_access<26, 0, 0, ENDIANNESS_LITTLE>::specific data;
bool irq_service;
bool irr_enable;
diff --git a/src/devices/cpu/m6502/xavix.cpp b/src/devices/cpu/m6502/xavix.cpp
index 841aa866e45..c8f98a0e8f7 100644
--- a/src/devices/cpu/m6502/xavix.cpp
+++ b/src/devices/cpu/m6502/xavix.cpp
@@ -171,13 +171,13 @@ inline uint8_t xavix_device::mi_xavix::read(uint16_t adr)
// opcode reads
uint8_t xavix_device::mi_xavix::read_sync(uint16_t adr)
{
- return scache->read_byte(base->adr_with_codebank(adr));
+ return csprogram.read_byte(base->adr_with_codebank(adr));
}
// oprand reads
uint8_t xavix_device::mi_xavix::read_arg(uint16_t adr)
{
- return cache->read_byte(base->adr_with_codebank(adr));
+ return cprogram.read_byte(base->adr_with_codebank(adr));
}
// data writes
diff --git a/src/devices/cpu/m6800/m6800.cpp b/src/devices/cpu/m6800/m6800.cpp
index e6549dd8d27..7eab9292599 100644
--- a/src/devices/cpu/m6800/m6800.cpp
+++ b/src/devices/cpu/m6800/m6800.cpp
@@ -122,26 +122,26 @@ TODO:
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
-#define RM(Addr) ((unsigned)m_program->read_byte(Addr))
+#define RM(Addr) (m_program.read_byte(Addr))
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
-#define WM(Addr,Value) (m_program->write_byte(Addr,Value))
+#define WM(Addr,Value) (m_program.write_byte(Addr,Value))
/****************************************************************************/
/* M6800_RDOP() is identical to M6800_RDMEM() except it is used for reading */
/* opcodes. In case of system with memory mapped I/O, this function can be */
/* used to greatly speed up emulation */
/****************************************************************************/
-#define M_RDOP(Addr) ((unsigned)m_opcodes_cache->read_byte(Addr))
+#define M_RDOP(Addr) (m_copcodes.read_byte(Addr))
/****************************************************************************/
/* M6800_RDOP_ARG() is identical to M6800_RDOP() but it's used for reading */
/* opcode arguments. This difference can be used to support systems that */
/* use different encoding mechanisms for opcodes and opcode arguments */
/****************************************************************************/
-#define M_RDOP_ARG(Addr) ((unsigned)m_cache->read_byte(Addr))
+#define M_RDOP_ARG(Addr) (m_cprogram.read_byte(Addr))
/* macros to access memory */
#define IMMBYTE(b) b = M_RDOP_ARG(PCD); PC++
@@ -546,10 +546,9 @@ void m6800_cpu_device::EAT_CYCLES()
void m6800_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_opcodes = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_opcodes_cache = m_opcodes->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cprogram);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_copcodes);
+ space(AS_PROGRAM).specific(m_program);
m_pc.d = 0;
m_s.d = 0;
diff --git a/src/devices/cpu/m6800/m6800.h b/src/devices/cpu/m6800/m6800.h
index 272b436a5f7..1601a62b798 100644
--- a/src/devices/cpu/m6800/m6800.h
+++ b/src/devices/cpu/m6800/m6800.h
@@ -82,8 +82,8 @@ protected:
uint8_t m_irq_state[3]; /* IRQ line state [IRQ1,TIN,SC1] */
/* Memory spaces */
- address_space *m_program, *m_opcodes;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache, *m_opcodes_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cprogram, m_copcodes;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
const op_func *m_insn;
const uint8_t *m_cycles; /* clock cycle of instruction table */
diff --git a/src/devices/cpu/m68000/m68000.h b/src/devices/cpu/m68000/m68000.h
index 58d6683d599..f9e5d2c2d26 100644
--- a/src/devices/cpu/m68000/m68000.h
+++ b/src/devices/cpu/m68000/m68000.h
@@ -260,6 +260,13 @@ protected:
or other side effects to be implemented */
address_space *m_program, *m_oprogram, *m_cpu_space;
+
+ memory_access<24, 0, 0, ENDIANNESS_BIG>::cache m_oprogram8;
+ memory_access<24, 1, 0, ENDIANNESS_BIG>::cache m_oprogram16;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_oprogram32;
+ memory_access<24, 0, 0, ENDIANNESS_BIG>::specific m_program8;
+ memory_access<24, 1, 0, ENDIANNESS_BIG>::specific m_program16;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_program32;
/* Redirect memory calls */
diff --git a/src/devices/cpu/m68000/m68kcpu.cpp b/src/devices/cpu/m68000/m68kcpu.cpp
index a95025507ca..5088f184e43 100644
--- a/src/devices/cpu/m68000/m68kcpu.cpp
+++ b/src/devices/cpu/m68000/m68kcpu.cpp
@@ -1305,16 +1305,16 @@ void m68000_base_device::init8(address_space &space, address_space &ospace)
{
m_space = &space;
m_ospace = &ospace;
- auto ocache = ospace.cache<0, 0, ENDIANNESS_BIG>();
- auto pspec = space.specific<0, 0, ENDIANNESS_BIG>();
+ ospace.cache(m_oprogram8);
+ space.specific(m_program8);
- m_readimm16 = [ocache](offs_t address) -> u16 { return ocache->read_word(address); };
- m_read8 = [pspec](offs_t address) -> u8 { return pspec->read_byte(address); };
- m_read16 = [pspec](offs_t address) -> u16 { return pspec->read_word(address); };
- m_read32 = [pspec](offs_t address) -> u32 { return pspec->read_dword(address); };
- m_write8 = [pspec](offs_t address, u8 data) { pspec->write_byte(address, data); };
- m_write16 = [pspec](offs_t address, u16 data) { pspec->write_word(address, data); };
- m_write32 = [pspec](offs_t address, u32 data) { pspec->write_dword(address, data); };
+ m_readimm16 = [this](offs_t address) -> u16 { return m_oprogram8.read_word(address); };
+ m_read8 = [this](offs_t address) -> u8 { return m_program8.read_byte(address); };
+ m_read16 = [this](offs_t address) -> u16 { return m_program8.read_word(address); };
+ m_read32 = [this](offs_t address) -> u32 { return m_program8.read_dword(address); };
+ m_write8 = [this](offs_t address, u8 data) { m_program8.write_byte(address, data); };
+ m_write16 = [this](offs_t address, u16 data) { m_program8.write_word(address, data); };
+ m_write32 = [this](offs_t address, u32 data) { m_program8.write_dword(address, data); };
}
/****************************************************************************
@@ -1325,16 +1325,16 @@ void m68000_base_device::init16(address_space &space, address_space &ospace)
{
m_space = &space;
m_ospace = &ospace;
- auto ocache = ospace.cache<1, 0, ENDIANNESS_BIG>();
- auto pspec = space.specific<1, 0, ENDIANNESS_BIG>();
+ ospace.cache(m_oprogram16);
+ space.specific(m_program16);
- m_readimm16 = [ocache](offs_t address) -> u16 { return ocache->read_word(address); };
- m_read8 = [pspec](offs_t address) -> u8 { return pspec->read_byte(address); };
- m_read16 = [pspec](offs_t address) -> u16 { return pspec->read_word(address); };
- m_read32 = [pspec](offs_t address) -> u32 { return pspec->read_dword(address); };
- m_write8 = [pspec](offs_t address, u8 data) { pspec->write_word(address & ~1, data | (data << 8), address & 1 ? 0x00ff : 0xff00); };
- m_write16 = [pspec](offs_t address, u16 data) { pspec->write_word(address, data); };
- m_write32 = [pspec](offs_t address, u32 data) { pspec->write_dword(address, data); };
+ m_readimm16 = [this](offs_t address) -> u16 { return m_oprogram16.read_word(address); };
+ m_read8 = [this](offs_t address) -> u8 { return m_program16.read_byte(address); };
+ m_read16 = [this](offs_t address) -> u16 { return m_program16.read_word(address); };
+ m_read32 = [this](offs_t address) -> u32 { return m_program16.read_dword(address); };
+ m_write8 = [this](offs_t address, u8 data) { m_program16.write_word(address & ~1, data | (data << 8), address & 1 ? 0x00ff : 0xff00); };
+ m_write16 = [this](offs_t address, u16 data) { m_program16.write_word(address, data); };
+ m_write32 = [this](offs_t address, u32 data) { m_program16.write_dword(address, data); };
}
/****************************************************************************
@@ -1350,55 +1350,55 @@ void m68000_base_device::init32(address_space &space, address_space &ospace)
{
m_space = &space;
m_ospace = &ospace;
- auto ocache = ospace.cache<2, 0, ENDIANNESS_BIG>();
- auto pspec = space.specific<2, 0, ENDIANNESS_BIG>();
-
- m_readimm16 = [ocache](offs_t address) -> u16 { return ocache->read_word(address); };
- m_read8 = [pspec](offs_t address) -> u8 { return pspec->read_byte(address); };
- m_read16 = [pspec](offs_t address) -> u16 { return pspec->read_word_unaligned(address); };
- m_read32 = [pspec](offs_t address) -> u32 { return pspec->read_dword_unaligned(address); };
- m_write8 = [pspec](offs_t address, u8 data) {
- pspec->write_dword(address & 0xfffffffcU, dword_from_byte(data), 0xff000000U >> 8 * (address & 3));
+ ospace.cache(m_oprogram32);
+ space.specific(m_program32);
+
+ m_readimm16 = [this](offs_t address) -> u16 { return m_oprogram32.read_word(address); };
+ m_read8 = [this](offs_t address) -> u8 { return m_program32.read_byte(address); };
+ m_read16 = [this](offs_t address) -> u16 { return m_program32.read_word_unaligned(address); };
+ m_read32 = [this](offs_t address) -> u32 { return m_program32.read_dword_unaligned(address); };
+ m_write8 = [this](offs_t address, u8 data) {
+ m_program32.write_dword(address & 0xfffffffcU, dword_from_byte(data), 0xff000000U >> 8 * (address & 3));
};
- m_write16 = [pspec](offs_t address, u16 data) {
+ m_write16 = [this](offs_t address, u16 data) {
switch (address & 3) {
case 0:
- pspec->write_dword(address, dword_from_word(data), 0xffff0000U);
+ m_program32.write_dword(address, dword_from_word(data), 0xffff0000U);
break;
case 1:
- pspec->write_dword(address - 1, dword_from_unaligned_word(data), 0x00ffff00);
+ m_program32.write_dword(address - 1, dword_from_unaligned_word(data), 0x00ffff00);
break;
case 2:
- pspec->write_dword(address - 2, dword_from_word(data), 0x0000ffff);
+ m_program32.write_dword(address - 2, dword_from_word(data), 0x0000ffff);
break;
case 3:
- pspec->write_dword(address - 3, dword_from_unaligned_word(data), 0x000000ff);
- pspec->write_dword(address + 1, dword_from_byte(data & 0x00ff), 0xff000000U);
+ m_program32.write_dword(address - 3, dword_from_unaligned_word(data), 0x000000ff);
+ m_program32.write_dword(address + 1, dword_from_byte(data & 0x00ff), 0xff000000U);
break;
}
};
- m_write32 = [pspec](offs_t address, u32 data) {
+ m_write32 = [this](offs_t address, u32 data) {
switch (address & 3) {
case 0:
- pspec->write_dword(address, data, 0xffffffffU);
+ m_program32.write_dword(address, data, 0xffffffffU);
break;
case 1:
- pspec->write_dword(address - 1, (data & 0xff000000U) | (data & 0xffffff00U) >> 8, 0x00ffffff);
- pspec->write_dword(address + 3, dword_from_byte(data & 0x000000ff), 0xff000000U);
+ m_program32.write_dword(address - 1, (data & 0xff000000U) | (data & 0xffffff00U) >> 8, 0x00ffffff);
+ m_program32.write_dword(address + 3, dword_from_byte(data & 0x000000ff), 0xff000000U);
break;
case 2:
- pspec->write_dword(address - 2, dword_from_word((data & 0xffff0000U) >> 16), 0x0000ffff);
- pspec->write_dword(address + 2, dword_from_word(data & 0x0000ffff), 0xffff0000U);
+ m_program32.write_dword(address - 2, dword_from_word((data & 0xffff0000U) >> 16), 0x0000ffff);
+ m_program32.write_dword(address + 2, dword_from_word(data & 0x0000ffff), 0xffff0000U);
break;
case 3:
- pspec->write_dword(address - 3, dword_from_unaligned_word((data & 0xffff0000U) >> 16), 0x000000ff);
- pspec->write_dword(address + 1, (data & 0x00ffffff) << 8 | (data & 0xff000000U) >> 24, 0xffffff00U);
+ m_program32.write_dword(address - 3, dword_from_unaligned_word((data & 0xffff0000U) >> 16), 0x000000ff);
+ m_program32.write_dword(address + 1, (data & 0x00ffffff) << 8 | (data & 0xff000000U) >> 24, 0xffffff00U);
break;
}
};
@@ -1409,45 +1409,45 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
{
m_space = &space;
m_ospace = &ospace;
- auto ocache = ospace.cache<2, 0, ENDIANNESS_BIG>();
- auto pspec = space.specific<2, 0, ENDIANNESS_BIG>();
+ ospace.cache(m_oprogram32);
+ space.specific(m_program32);
- m_readimm16 = [this, ocache](offs_t address) -> u16 {
+ m_readimm16 = [this](offs_t address) -> u16 {
if (m_pmmu_enabled) {
address = pmmu_translate_addr(address, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
}
- return ocache->read_word(address);
+ return m_oprogram32.read_word(address);
};
- m_read8 = [this, pspec](offs_t address) -> u8 {
+ m_read8 = [this](offs_t address) -> u8 {
if (m_pmmu_enabled) {
address = pmmu_translate_addr(address, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
}
- return pspec->read_byte(address);
+ return m_program32.read_byte(address);
};
- m_read16 = [this, pspec](offs_t address) -> u16 {
+ m_read16 = [this](offs_t address) -> u16 {
if (m_pmmu_enabled) {
u32 address0 = pmmu_translate_addr(address, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
if (WORD_ALIGNED(address))
- return pspec->read_word(address0);
+ return m_program32.read_word(address0);
u32 address1 = pmmu_translate_addr(address + 1, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
- u16 result = pspec->read_byte(address0) << 8;
- return result | pspec->read_byte(address1);
+ u16 result = m_program32.read_byte(address0) << 8;
+ return result | m_program32.read_byte(address1);
}
- return pspec->read_word_unaligned(address);
+ return m_program32.read_word_unaligned(address);
};
- m_read32 = [this, pspec](offs_t address) -> u32 {
+ m_read32 = [this](offs_t address) -> u32 {
if (m_pmmu_enabled) {
u32 address0 = pmmu_translate_addr(address, 1);
if (m_mmu_tmp_buserror_occurred)
@@ -1456,37 +1456,37 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
// not at page boundary; use default code
address = address0;
else if (DWORD_ALIGNED(address)) // 0
- return pspec->read_dword(address0);
+ return m_program32.read_dword(address0);
else {
u32 address2 = pmmu_translate_addr(address+2, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
if (WORD_ALIGNED(address)) { // 2
- u32 result = pspec->read_word(address0) << 16;
- return result | pspec->read_word(address2);
+ u32 result = m_program32.read_word(address0) << 16;
+ return result | m_program32.read_word(address2);
}
u32 address1 = pmmu_translate_addr(address+1, 1);
u32 address3 = pmmu_translate_addr(address+3, 1);
if (m_mmu_tmp_buserror_occurred)
return ~0;
- u32 result = pspec->read_byte(address0) << 24;
- result |= pspec->read_word(address1) << 8;
- return result | pspec->read_byte(address3);
+ u32 result = m_program32.read_byte(address0) << 24;
+ result |= m_program32.read_word(address1) << 8;
+ return result | m_program32.read_byte(address3);
}
}
- return pspec->read_dword_unaligned(address);
+ return m_program32.read_dword_unaligned(address);
};
- m_write8 = [this, pspec](offs_t address, u8 data) {
+ m_write8 = [this](offs_t address, u8 data) {
if (m_pmmu_enabled) {
address = pmmu_translate_addr(address, 0);
if (m_mmu_tmp_buserror_occurred)
return;
}
- pspec->write_dword(address & 0xfffffffcU, dword_from_byte(data), 0xff000000U >> 8 * (address & 3));
+ m_program32.write_dword(address & 0xfffffffcU, dword_from_byte(data), 0xff000000U >> 8 * (address & 3));
};
- m_write16 = [this, pspec](offs_t address, u16 data) {
+ m_write16 = [this](offs_t address, u16 data) {
u32 address0 = address;
if (m_pmmu_enabled) {
address0 = pmmu_translate_addr(address0, 0);
@@ -1495,15 +1495,15 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
}
switch (address & 3) {
case 0:
- pspec->write_dword(address0, dword_from_word(data), 0xffff0000U);
+ m_program32.write_dword(address0, dword_from_word(data), 0xffff0000U);
break;
case 1:
- pspec->write_dword(address0 - 1, dword_from_unaligned_word(data), 0x00ffff00);
+ m_program32.write_dword(address0 - 1, dword_from_unaligned_word(data), 0x00ffff00);
break;
case 2:
- pspec->write_dword(address0 - 2, dword_from_word(data), 0x0000ffff);
+ m_program32.write_dword(address0 - 2, dword_from_word(data), 0x0000ffff);
break;
case 3:
@@ -1514,14 +1514,14 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
if (m_mmu_tmp_buserror_occurred)
return;
}
- pspec->write_dword(address0 - 3, dword_from_unaligned_word(data), 0x000000ff);
- pspec->write_dword(address1, dword_from_byte(data & 0x00ff), 0xff000000U);
+ m_program32.write_dword(address0 - 3, dword_from_unaligned_word(data), 0x000000ff);
+ m_program32.write_dword(address1, dword_from_byte(data & 0x00ff), 0xff000000U);
break;
}
}
};
- m_write32 = [this, pspec](offs_t address, u32 data) {
+ m_write32 = [this](offs_t address, u32 data) {
u32 address0 = address;
if (m_pmmu_enabled) {
address0 = pmmu_translate_addr(address0, 0);
@@ -1530,7 +1530,7 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
}
switch (address & 3) {
case 0:
- pspec->write_dword(address0, data, 0xffffffffU);
+ m_program32.write_dword(address0, data, 0xffffffffU);
break;
case 1:
@@ -1541,8 +1541,8 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
if (m_mmu_tmp_buserror_occurred)
return;
}
- pspec->write_dword(address0 - 1, (data & 0xff000000U) | (data & 0xffffff00U) >> 8, 0x00ffffff);
- pspec->write_dword(address3, dword_from_byte(data & 0x000000ff), 0xff000000U);
+ m_program32.write_dword(address0 - 1, (data & 0xff000000U) | (data & 0xffffff00U) >> 8, 0x00ffffff);
+ m_program32.write_dword(address3, dword_from_byte(data & 0x000000ff), 0xff000000U);
break;
}
@@ -1554,8 +1554,8 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
if (m_mmu_tmp_buserror_occurred)
return;
}
- pspec->write_dword(address0 - 2, dword_from_word((data & 0xffff0000U) >> 16), 0x0000ffff);
- pspec->write_dword(address2, dword_from_word(data & 0x0000ffff), 0xffff0000U);
+ m_program32.write_dword(address0 - 2, dword_from_word((data & 0xffff0000U) >> 16), 0x0000ffff);
+ m_program32.write_dword(address2, dword_from_word(data & 0x0000ffff), 0xffff0000U);
break;
}
@@ -1567,8 +1567,8 @@ void m68000_base_device::init32mmu(address_space &space, address_space &ospace)
if (m_mmu_tmp_buserror_occurred)
return;
}
- pspec->write_dword(address0 - 3, dword_from_unaligned_word((data & 0xffff0000U) >> 16), 0x000000ff);
- pspec->write_dword(address1, (data & 0x00ffffff) << 8 | (data & 0xff000000U) >> 24, 0xffffff00U);
+ m_program32.write_dword(address0 - 3, dword_from_unaligned_word((data & 0xffff0000U) >> 16), 0x000000ff);
+ m_program32.write_dword(address1, (data & 0x00ffffff) << 8 | (data & 0xff000000U) >> 24, 0xffffff00U);
break;
}
}
@@ -1579,78 +1579,78 @@ void m68000_base_device::init32hmmu(address_space &space, address_space &ospace)
{
m_space = &space;
m_ospace = &ospace;
- auto ocache = ospace.cache<2, 0, ENDIANNESS_BIG>();
- auto pspec = space.specific<2, 0, ENDIANNESS_BIG>();
+ ospace.cache(m_oprogram32);
+ space.specific(m_program32);
- m_readimm16 = [this, ocache](offs_t address) -> u16 {
+ m_readimm16 = [this](offs_t address) -> u16 {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
- return ocache->read_word(address);
+ return m_oprogram32.read_word(address);
};
- m_read8 = [this, pspec](offs_t address) -> u8 {
+ m_read8 = [this](offs_t address) -> u8 {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
- return pspec->read_byte(address);
+ return m_program32.read_byte(address);
};
- m_read16 = [this, pspec](offs_t address) -> u16 {
+ m_read16 = [this](offs_t address) -> u16 {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
if (WORD_ALIGNED(address))
- return pspec->read_word(address);
- u16 result = pspec->read_byte(address) << 8;
- return result | pspec->read_byte(address + 1);
+ return m_program32.read_word(address);
+ u16 result = m_program32.read_byte(address) << 8;
+ return result | m_program32.read_byte(address + 1);
};
- m_read32 = [this, pspec](offs_t address) -> u32 {
+ m_read32 = [this](offs_t address) -> u32 {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
if (DWORD_ALIGNED(address))
- return pspec->read_dword(address);
+ return m_program32.read_dword(address);
if (WORD_ALIGNED(address)) {
- u32 result = pspec->read_word(address) << 16;
- return result | pspec->read_word(address + 2);
+ u32 result = m_program32.read_word(address) << 16;
+ return result | m_program32.read_word(address + 2);
}
- u32 result = pspec->read_byte(address) << 24;
- result |= pspec->read_word(address + 1) << 8;
- return result | pspec->read_byte(address + 3);
+ u32 result = m_program32.read_byte(address) << 24;
+ result |= m_program32.read_word(address + 1) << 8;
+ return result | m_program32.read_byte(address + 3);
};
- m_write8 = [this, pspec](offs_t address, u8 data) {
+ m_write8 = [this](offs_t address, u8 data) {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
- pspec->write_byte(address, data);
+ m_program32.write_byte(address, data);
};
- m_write16 = [this, pspec](offs_t address, u16 data) {
+ m_write16 = [this](offs_t address, u16 data) {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
if (WORD_ALIGNED(address)) {
- pspec->write_word(address, data);
+ m_program32.write_word(address, data);
return;
}
- pspec->write_byte(address, data >> 8);
- pspec->write_byte(address + 1, data);
+ m_program32.write_byte(address, data >> 8);
+ m_program32.write_byte(address + 1, data);
};
- m_write32 = [this, pspec](offs_t address, u32 data) {
+ m_write32 = [this](offs_t address, u32 data) {
if (m_hmmu_enabled)
address = hmmu_translate_addr(address);
if (DWORD_ALIGNED(address)) {
- pspec->write_dword(address, data);
+ m_program32.write_dword(address, data);
return;
}
if (WORD_ALIGNED(address)) {
- pspec->write_word(address, data >> 16);
- pspec->write_word(address + 2, data);
+ m_program32.write_word(address, data >> 16);
+ m_program32.write_word(address + 2, data);
return;
}
- pspec->write_byte(address, data >> 24);
- pspec->write_word(address + 1, data >> 8);
- pspec->write_byte(address + 3, data);
+ m_program32.write_byte(address, data >> 24);
+ m_program32.write_word(address + 1, data >> 8);
+ m_program32.write_byte(address + 3, data);
};
}
diff --git a/src/devices/cpu/m6805/6805ops.hxx b/src/devices/cpu/m6805/6805ops.hxx
index c0ff90eb32d..969be4e51e6 100644
--- a/src/devices/cpu/m6805/6805ops.hxx
+++ b/src/devices/cpu/m6805/6805ops.hxx
@@ -14,10 +14,10 @@ HNZC
*/
-#define OP_HANDLER(name) void m6805_base_device::name()
-#define OP_HANDLER_BIT(name) template <unsigned B> void m6805_base_device::name()
-#define OP_HANDLER_BRA(name) template <bool C> void m6805_base_device::name()
-#define OP_HANDLER_MODE(name) template <m6805_base_device::addr_mode M> void m6805_base_device::name()
+#define OP_HANDLER(name) template<bool big> void m6805_base_device::name()
+#define OP_HANDLER_BIT(name) template <bool big, unsigned B> void m6805_base_device::name()
+#define OP_HANDLER_BRA(name) template <bool big, bool C> void m6805_base_device::name()
+#define OP_HANDLER_MODE(name) template <bool big, m6805_base_device::addr_mode M> void m6805_base_device::name()
OP_HANDLER( illegal )
@@ -30,7 +30,7 @@ OP_HANDLER_BIT( brset )
{
u8 t, r;
DIRBYTE(r);
- immbyte(t);
+ immbyte<big>(t);
CLC;
if (BIT(r, B)) { SEC; PC += SIGNED(t); }
}
@@ -40,7 +40,7 @@ OP_HANDLER_BIT( brclr )
{
u8 t, r;
DIRBYTE(r);
- immbyte(t);
+ immbyte<big>(t);
SEC;
if (!BIT(r, B)) { CLC; PC += SIGNED(t); }
}
@@ -50,7 +50,7 @@ OP_HANDLER_BIT( bset )
{
u8 t;
DIRBYTE(t);
- wm(EAD, t | (u8(1) << B));
+ wm<big>(EAD, t | (u8(1) << B));
}
// $11/$13/$15/$17/$19/$1B/$1D/$1F BCLR direct ----
@@ -58,7 +58,7 @@ OP_HANDLER_BIT( bclr )
{
u8 t;
DIRBYTE(t);
- wm(EAD, t & ~(u8(1) << B));
+ wm<big>(EAD, t & ~(u8(1) << B));
}
// $20 BRA relative ----
@@ -103,7 +103,7 @@ OP_HANDLER_MODE( neg )
u16 const r = -t;
clr_nzc();
set_nzc8(r);
- wm(EAD, r);
+ wm<big>(EAD, r);
}
// $31 ILLEGAL
@@ -125,7 +125,7 @@ OP_HANDLER_MODE( com )
clr_nz();
set_nz8(t);
SEC;
- wm(EAD, t);
+ wm<big>(EAD, t);
}
// $34 LSR direct -0**
@@ -139,7 +139,7 @@ OP_HANDLER_MODE( lsr )
CC |= BIT(t, 0);
t >>= 1;
set_z8(t);
- wm(EAD, t);
+ wm<big>(EAD, t);
}
// $35 ILLEGAL
@@ -158,7 +158,7 @@ OP_HANDLER_MODE( ror )
CC |= BIT(t, 0);
r |= t >> 1;
set_nz8(r);
- wm(EAD, r);
+ wm<big>(EAD, r);
}
// $37 ASR direct -***
@@ -172,7 +172,7 @@ OP_HANDLER_MODE( asr )
CC |= BIT(t, 0);
t = (t >> 1) | (t & 0x80);
set_nz8(t);
- wm(EAD, t);
+ wm<big>(EAD, t);
}
// $38 LSL direct -***
@@ -185,7 +185,7 @@ OP_HANDLER_MODE( lsl )
u16 const r = u16(t) << 1;
clr_nzc();
set_nzc8(r);
- wm(EAD, r);
+ wm<big>(EAD, r);
}
// $39 ROL direct -***
@@ -198,7 +198,7 @@ OP_HANDLER_MODE( rol )
u16 const r = BIT(CC, 0) | (t << 1);
clr_nzc();
set_nzc8(r);
- wm(EAD, r);
+ wm<big>(EAD, r);
}
// $3a DEC direct -**-
@@ -210,7 +210,7 @@ OP_HANDLER_MODE( dec )
--t;
clr_nz();
set_nz8(t);
- wm(EAD, t);
+ wm<big>(EAD, t);
}
// $3b ILLEGAL
@@ -227,7 +227,7 @@ OP_HANDLER_MODE( inc )
++t;
clr_nz();
set_nz8(t);
- wm(EAD, t);
+ wm<big>(EAD, t);
}
// $3d TST direct -**-
@@ -253,7 +253,7 @@ OP_HANDLER_MODE( clr )
ARGADDR;
clr_nz();
SEZ;
- wm(EAD, 0);
+ wm<big>(EAD, 0);
}
// $40 NEGA inherent -***
@@ -480,16 +480,16 @@ OP_HANDLER( clrx )
// $80 RTI inherent ####
OP_HANDLER( rti )
{
- pullbyte(CC);
- pullbyte(A);
- pullbyte(X);
- pullword(m_pc);
+ pullbyte<big>(CC);
+ pullbyte<big>(A);
+ pullbyte<big>(X);
+ pullword<big>(m_pc);
}
// $81 RTS inherent ----
OP_HANDLER( rts )
{
- pullword(m_pc);
+ pullword<big>(m_pc);
}
// $82 ILLEGAL
@@ -497,12 +497,12 @@ OP_HANDLER( rts )
// $83 SWI absolute indirect ----
OP_HANDLER( swi )
{
- pushword(m_pc);
- pushbyte(m_x);
- pushbyte(m_a);
- pushbyte(m_cc);
+ pushword<big>(m_pc);
+ pushbyte<big>(m_x);
+ pushbyte<big>(m_a);
+ pushbyte<big>(m_cc);
SEI;
- rm16(m_params.m_swi_vector & m_params.m_vector_mask, m_pc);
+ rm16<big>(m_params.m_swi_vector & m_params.m_vector_mask, m_pc);
}
// $84 ILLEGAL
@@ -697,7 +697,7 @@ OP_HANDLER_MODE( sta )
clr_nz();
set_nz8(A);
ARGADDR;
- wm(EAD, A);
+ wm<big>(EAD, A);
}
// $a8 EORA immediate -**-
@@ -778,8 +778,8 @@ OP_HANDLER_MODE( jmp )
OP_HANDLER( bsr )
{
u8 t;
- immbyte(t);
- pushword(m_pc);
+ immbyte<big>(t);
+ pushword<big>(m_pc);
PC += SIGNED(t);
}
@@ -791,7 +791,7 @@ OP_HANDLER( bsr )
OP_HANDLER_MODE( jsr )
{
ARGADDR;
- pushword(m_pc);
+ pushword<big>(m_pc);
PC = EA;
}
@@ -819,5 +819,5 @@ OP_HANDLER_MODE( stx )
clr_nz();
set_nz8(X);
ARGADDR;
- wm(EAD, X);
+ wm<big>(EAD, X);
}
diff --git a/src/devices/cpu/m6805/m6805.cpp b/src/devices/cpu/m6805/m6805.cpp
index e0933a1af54..4e52a5631ec 100644
--- a/src/devices/cpu/m6805/m6805.cpp
+++ b/src/devices/cpu/m6805/m6805.cpp
@@ -41,23 +41,26 @@
#include <algorithm>
-#define OP(name) (&m6805_base_device::name)
-#define OP_T(name) (&m6805_base_device::name<true>)
-#define OP_F(name) (&m6805_base_device::name<false>)
-#define OP_IM(name) (&m6805_base_device::name<addr_mode::IM>)
-#define OP_DI(name) (&m6805_base_device::name<addr_mode::DI>)
-#define OP_EX(name) (&m6805_base_device::name<addr_mode::EX>)
-#define OP_IX(name) (&m6805_base_device::name<addr_mode::IX>)
-#define OP_IX1(name) (&m6805_base_device::name<addr_mode::IX1>)
-#define OP_IX2(name) (&m6805_base_device::name<addr_mode::IX2>)
-
-const m6805_base_device::op_handler_table m6805_base_device::s_hmos_ops =
+#define OP(name) (&m6805_base_device::name<big>)
+#define OPN(name,n) (&m6805_base_device::name<big, n>)
+#define OP_T(name) (&m6805_base_device::name<big, true>)
+#define OP_F(name) (&m6805_base_device::name<big, false>)
+#define OP_IM(name) (&m6805_base_device::name<big, addr_mode::IM>)
+#define OP_DI(name) (&m6805_base_device::name<big, addr_mode::DI>)
+#define OP_EX(name) (&m6805_base_device::name<big, addr_mode::EX>)
+#define OP_IX(name) (&m6805_base_device::name<big, addr_mode::IX>)
+#define OP_IX1(name) (&m6805_base_device::name<big, addr_mode::IX1>)
+#define OP_IX2(name) (&m6805_base_device::name<big, addr_mode::IX2>)
+
+#define big false
+
+const m6805_base_device::op_handler_table m6805_base_device::s_hmos_s_ops =
{
/* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */
- /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>),
- OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>),
- /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>),
- OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>),
+ /* 0 */ OPN(brset,0),OPN(brclr,0),OPN(brset,1),OPN(brclr,1),OPN(brset,2),OPN(brclr,2),OPN(brset,3),OPN(brclr,3),
+ OPN(brset,4),OPN(brclr,4),OPN(brset,5),OPN(brclr,5),OPN(brset,6),OPN(brclr,6),OPN(brset,7),OPN(brclr,7),
+ /* 1 */ OPN(bset,0), OPN(bclr,0), OPN(bset,1), OPN(bclr,1), OPN(bset,2), OPN(bclr,2), OPN(bset,3), OPN(bclr,3),
+ OPN(bset,4), OPN(bclr,4), OPN(bset,5), OPN(bclr,5), OPN(bset,6), OPN(bclr,6), OPN(bset,7), OPN(bclr,7),
/* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne),
OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP_T(bil), OP_F(bil),
/* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr),
@@ -88,13 +91,90 @@ const m6805_base_device::op_handler_table m6805_base_device::s_hmos_ops =
OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx)
};
-const m6805_base_device::op_handler_table m6805_base_device::s_cmos_ops =
+const m6805_base_device::op_handler_table m6805_base_device::s_hc_s_ops =
{
/* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */
- /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>),
- OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>),
- /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>),
- OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>),
+ /* 0 */ OPN(brset,0),OPN(brclr,0),OPN(brset,1),OPN(brclr,1),OPN(brset,2),OPN(brclr,2),OPN(brset,3),OPN(brclr,3),
+ OPN(brset,4),OPN(brclr,4),OPN(brset,5),OPN(brclr,5),OPN(brset,6),OPN(brclr,6),OPN(brset,7),OPN(brclr,7),
+ /* 1 */ OPN(bset,0), OPN(bclr,0), OPN(bset,1), OPN(bclr,1), OPN(bset,2), OPN(bclr,2), OPN(bset,3), OPN(bclr,3),
+ OPN(bset,4), OPN(bclr,4), OPN(bset,5), OPN(bclr,5), OPN(bset,6), OPN(bclr,6), OPN(bset,7), OPN(bclr,7),
+ /* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne),
+ OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP_T(bil), OP_F(bil),
+ /* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr),
+ OP_DI(lsl), OP_DI(rol), OP_DI(dec), OP(illegal), OP_DI(inc), OP_DI(tst), OP(illegal), OP_DI(clr),
+ /* 4 */ OP(nega), OP(illegal), OP(mul), OP(coma), OP(lsra), OP(illegal), OP(rora), OP(asra),
+ OP(lsla), OP(rola), OP(deca), OP(illegal), OP(inca), OP(tsta), OP(illegal), OP(clra),
+ /* 5 */ OP(negx), OP(illegal), OP(illegal), OP(comx), OP(lsrx), OP(illegal), OP(rorx), OP(asrx),
+ OP(lslx), OP(rolx), OP(decx), OP(illegal), OP(incx), OP(tstx), OP(illegal), OP(clrx),
+ /* 6 */ OP_IX1(neg), OP(illegal), OP(illegal), OP_IX1(com), OP_IX1(lsr), OP(illegal), OP_IX1(ror), OP_IX1(asr),
+ OP_IX1(lsl), OP_IX1(rol), OP_IX1(dec), OP(illegal), OP_IX1(inc), OP_IX1(tst), OP(illegal), OP_IX1(clr),
+ /* 7 */ OP_IX(neg), OP(illegal), OP(illegal), OP_IX(com), OP_IX(lsr), OP(illegal), OP_IX(ror), OP_IX(asr),
+ OP_IX(lsl), OP_IX(rol), OP_IX(dec), OP(illegal), OP_IX(inc), OP_IX(tst), OP(illegal), OP_IX(clr),
+ /* 8 */ OP(rti), OP(rts), OP(illegal), OP(swi), OP(illegal), OP(illegal), OP(illegal), OP(illegal),
+ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(stop), OP(wait),
+ /* 9 */ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(tax),
+ OP(clc), OP(sec), OP(cli), OP(sei), OP(rsp), OP(nop), OP(illegal), OP(txa),
+ /* A */ OP_IM(suba), OP_IM(cmpa), OP_IM(sbca), OP_IM(cpx), OP_IM(anda), OP_IM(bita), OP_IM(lda), OP(illegal),
+ OP_IM(eora), OP_IM(adca), OP_IM(ora), OP_IM(adda), OP(illegal), OP(bsr), OP_IM(ldx), OP(illegal),
+ /* B */ OP_DI(suba), OP_DI(cmpa), OP_DI(sbca), OP_DI(cpx), OP_DI(anda), OP_DI(bita), OP_DI(lda), OP_DI(sta),
+ OP_DI(eora), OP_DI(adca), OP_DI(ora), OP_DI(adda), OP_DI(jmp), OP_DI(jsr), OP_DI(ldx), OP_DI(stx),
+ /* C */ OP_EX(suba), OP_EX(cmpa), OP_EX(sbca), OP_EX(cpx), OP_EX(anda), OP_EX(bita), OP_EX(lda), OP_EX(sta),
+ OP_EX(eora), OP_EX(adca), OP_EX(ora), OP_EX(adda), OP_EX(jmp), OP_EX(jsr), OP_EX(ldx), OP_EX(stx),
+ /* D */ OP_IX2(suba),OP_IX2(cmpa),OP_IX2(sbca),OP_IX2(cpx), OP_IX2(anda),OP_IX2(bita),OP_IX2(lda), OP_IX2(sta),
+ OP_IX2(eora),OP_IX2(adca),OP_IX2(ora), OP_IX2(adda),OP_IX2(jmp), OP_IX2(jsr), OP_IX2(ldx), OP_IX2(stx),
+ /* E */ OP_IX1(suba),OP_IX1(cmpa),OP_IX1(sbca),OP_IX1(cpx), OP_IX1(anda),OP_IX1(bita),OP_IX1(lda), OP_IX1(sta),
+ OP_IX1(eora),OP_IX1(adca),OP_IX1(ora), OP_IX1(adda),OP_IX1(jmp), OP_IX1(jsr), OP_IX1(ldx), OP_IX1(stx),
+ /* F */ OP_IX(suba), OP_IX(cmpa), OP_IX(sbca), OP_IX(cpx), OP_IX(anda), OP_IX(bita), OP_IX(lda), OP_IX(sta),
+ OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx)
+};
+
+#undef big
+#define big true
+
+const m6805_base_device::op_handler_table m6805_base_device::s_hmos_b_ops =
+{
+ /* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */
+ /* 0 */ OPN(brset,0),OPN(brclr,0),OPN(brset,1),OPN(brclr,1),OPN(brset,2),OPN(brclr,2),OPN(brset,3),OPN(brclr,3),
+ OPN(brset,4),OPN(brclr,4),OPN(brset,5),OPN(brclr,5),OPN(brset,6),OPN(brclr,6),OPN(brset,7),OPN(brclr,7),
+ /* 1 */ OPN(bset,0), OPN(bclr,0), OPN(bset,1), OPN(bclr,1), OPN(bset,2), OPN(bclr,2), OPN(bset,3), OPN(bclr,3),
+ OPN(bset,4), OPN(bclr,4), OPN(bset,5), OPN(bclr,5), OPN(bset,6), OPN(bclr,6), OPN(bset,7), OPN(bclr,7),
+ /* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne),
+ OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP_T(bil), OP_F(bil),
+ /* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr),
+ OP_DI(lsl), OP_DI(rol), OP_DI(dec), OP(illegal), OP_DI(inc), OP_DI(tst), OP(illegal), OP_DI(clr),
+ /* 4 */ OP(nega), OP(illegal), OP(illegal), OP(coma), OP(lsra), OP(illegal), OP(rora), OP(asra),
+ OP(lsla), OP(rola), OP(deca), OP(illegal), OP(inca), OP(tsta), OP(illegal), OP(clra),
+ /* 5 */ OP(negx), OP(illegal), OP(illegal), OP(comx), OP(lsrx), OP(illegal), OP(rorx), OP(asrx),
+ OP(lslx), OP(rolx), OP(decx), OP(illegal), OP(incx), OP(tstx), OP(illegal), OP(clrx),
+ /* 6 */ OP_IX1(neg), OP(illegal), OP(illegal), OP_IX1(com), OP_IX1(lsr), OP(illegal), OP_IX1(ror), OP_IX1(asr),
+ OP_IX1(lsl), OP_IX1(rol), OP_IX1(dec), OP(illegal), OP_IX1(inc), OP_IX1(tst), OP(illegal), OP_IX1(clr),
+ /* 7 */ OP_IX(neg), OP(illegal), OP(illegal), OP_IX(com), OP_IX(lsr), OP(illegal), OP_IX(ror), OP_IX(asr),
+ OP_IX(lsl), OP_IX(rol), OP_IX(dec), OP(illegal), OP_IX(inc), OP_IX(tst), OP(illegal), OP_IX(clr),
+ /* 8 */ OP(rti), OP(rts), OP(illegal), OP(swi), OP(illegal), OP(illegal), OP(illegal), OP(illegal),
+ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal),
+ /* 9 */ OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(illegal), OP(tax),
+ OP(clc), OP(sec), OP(cli), OP(sei), OP(rsp), OP(nop), OP(illegal), OP(txa),
+ /* A */ OP_IM(suba), OP_IM(cmpa), OP_IM(sbca), OP_IM(cpx), OP_IM(anda), OP_IM(bita), OP_IM(lda), OP(illegal),
+ OP_IM(eora), OP_IM(adca), OP_IM(ora), OP_IM(adda), OP(illegal), OP(bsr), OP_IM(ldx), OP(illegal),
+ /* B */ OP_DI(suba), OP_DI(cmpa), OP_DI(sbca), OP_DI(cpx), OP_DI(anda), OP_DI(bita), OP_DI(lda), OP_DI(sta),
+ OP_DI(eora), OP_DI(adca), OP_DI(ora), OP_DI(adda), OP_DI(jmp), OP_DI(jsr), OP_DI(ldx), OP_DI(stx),
+ /* C */ OP_EX(suba), OP_EX(cmpa), OP_EX(sbca), OP_EX(cpx), OP_EX(anda), OP_EX(bita), OP_EX(lda), OP_EX(sta),
+ OP_EX(eora), OP_EX(adca), OP_EX(ora), OP_EX(adda), OP_EX(jmp), OP_EX(jsr), OP_EX(ldx), OP_EX(stx),
+ /* D */ OP_IX2(suba),OP_IX2(cmpa),OP_IX2(sbca),OP_IX2(cpx), OP_IX2(anda),OP_IX2(bita),OP_IX2(lda), OP_IX2(sta),
+ OP_IX2(eora),OP_IX2(adca),OP_IX2(ora), OP_IX2(adda),OP_IX2(jmp), OP_IX2(jsr), OP_IX2(ldx), OP_IX2(stx),
+ /* E */ OP_IX1(suba),OP_IX1(cmpa),OP_IX1(sbca),OP_IX1(cpx), OP_IX1(anda),OP_IX1(bita),OP_IX1(lda), OP_IX1(sta),
+ OP_IX1(eora),OP_IX1(adca),OP_IX1(ora), OP_IX1(adda),OP_IX1(jmp), OP_IX1(jsr), OP_IX1(ldx), OP_IX1(stx),
+ /* F */ OP_IX(suba), OP_IX(cmpa), OP_IX(sbca), OP_IX(cpx), OP_IX(anda), OP_IX(bita), OP_IX(lda), OP_IX(sta),
+ OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx)
+};
+
+const m6805_base_device::op_handler_table m6805_base_device::s_cmos_b_ops =
+{
+ /* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */
+ /* 0 */ OPN(brset,0),OPN(brclr,0),OPN(brset,1),OPN(brclr,1),OPN(brset,2),OPN(brclr,2),OPN(brset,3),OPN(brclr,3),
+ OPN(brset,4),OPN(brclr,4),OPN(brset,5),OPN(brclr,5),OPN(brset,6),OPN(brclr,6),OPN(brset,7),OPN(brclr,7),
+ /* 1 */ OPN(bset,0), OPN(bclr,0), OPN(bset,1), OPN(bclr,1), OPN(bset,2), OPN(bclr,2), OPN(bset,3), OPN(bclr,3),
+ OPN(bset,4), OPN(bclr,4), OPN(bset,5), OPN(bclr,5), OPN(bset,6), OPN(bclr,6), OPN(bset,7), OPN(bclr,7),
/* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne),
OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP_T(bil), OP_F(bil),
/* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr),
@@ -125,13 +205,13 @@ const m6805_base_device::op_handler_table m6805_base_device::s_cmos_ops =
OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx)
};
-const m6805_base_device::op_handler_table m6805_base_device::s_hc_ops =
+const m6805_base_device::op_handler_table m6805_base_device::s_hc_b_ops =
{
/* 0/8 1/9 2/A 3/B 4/C 5/D 6/E 7/F */
- /* 0 */ OP(brset<0>),OP(brclr<0>),OP(brset<1>),OP(brclr<1>),OP(brset<2>),OP(brclr<2>),OP(brset<3>),OP(brclr<3>),
- OP(brset<4>),OP(brclr<4>),OP(brset<5>),OP(brclr<5>),OP(brset<6>),OP(brclr<6>),OP(brset<7>),OP(brclr<7>),
- /* 1 */ OP(bset<0>), OP(bclr<0>), OP(bset<1>), OP(bclr<1>), OP(bset<2>), OP(bclr<2>), OP(bset<3>), OP(bclr<3>),
- OP(bset<4>), OP(bclr<4>), OP(bset<5>), OP(bclr<5>), OP(bset<6>), OP(bclr<6>), OP(bset<7>), OP(bclr<7>),
+ /* 0 */ OPN(brset,0),OPN(brclr,0),OPN(brset,1),OPN(brclr,1),OPN(brset,2),OPN(brclr,2),OPN(brset,3),OPN(brclr,3),
+ OPN(brset,4),OPN(brclr,4),OPN(brset,5),OPN(brclr,5),OPN(brset,6),OPN(brclr,6),OPN(brset,7),OPN(brclr,7),
+ /* 1 */ OPN(bset,0), OPN(bclr,0), OPN(bset,1), OPN(bclr,1), OPN(bset,2), OPN(bclr,2), OPN(bset,3), OPN(bclr,3),
+ OPN(bset,4), OPN(bclr,4), OPN(bset,5), OPN(bclr,5), OPN(bset,6), OPN(bclr,6), OPN(bset,7), OPN(bclr,7),
/* 2 */ OP_T(bra), OP_F(bra), OP_T(bhi), OP_F(bhi), OP_T(bcc), OP_F(bcc), OP_T(bne), OP_F(bne),
OP_T(bhcc), OP_F(bhcc), OP_T(bpl), OP_F(bpl), OP_T(bmc), OP_F(bmc), OP_T(bil), OP_F(bil),
/* 3 */ OP_DI(neg), OP(illegal), OP(illegal), OP_DI(com), OP_DI(lsr), OP(illegal), OP_DI(ror), OP_DI(asr),
@@ -162,6 +242,7 @@ const m6805_base_device::op_handler_table m6805_base_device::s_hc_ops =
OP_IX(eora), OP_IX(adca), OP_IX(ora), OP_IX(adda), OP_IX(jmp), OP_IX(jsr), OP_IX(ldx), OP_IX(stx)
};
+#undef big
const m6805_base_device::cycle_count_table m6805_base_device::s_hmos_cycles =
{
@@ -262,8 +343,13 @@ m6805_base_device::m6805_base_device(
void m6805_base_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
+ if (m_params.m_addr_width > 13) {
+ space(AS_PROGRAM).cache(m_cprogram16);
+ space(AS_PROGRAM).specific(m_program16);
+ } else {
+ space(AS_PROGRAM).cache(m_cprogram13);
+ space(AS_PROGRAM).specific(m_program13);
+ }
// get the minimum not including the zero placeholders for illegal instructions
m_min_cycles = *std::min_element(
@@ -314,7 +400,10 @@ void m6805_base_device::device_reset()
/* IRQ disabled */
SEI;
- rm16(0xfffe & m_params.m_vector_mask, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(0xfffe & m_params.m_vector_mask, m_pc);
+ else
+ rm16<false>(0xfffe & m_params.m_vector_mask, m_pc);
}
@@ -363,7 +452,10 @@ bool m6805_base_device::test_il()
void m6805_base_device::interrupt_vector()
{
- rm16(0xfffa & m_params.m_vector_mask, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(0xfffa & m_params.m_vector_mask, m_pc);
+ else
+ rm16<false>(0xfffa & m_params.m_vector_mask, m_pc);
}
/* Generate interrupts */
@@ -375,15 +467,27 @@ void m6805_base_device::interrupt()
if (BIT(m_pending_interrupts, HD63705_INT_NMI))
{
- pushword(m_pc);
- pushbyte(m_x);
- pushbyte(m_a);
- pushbyte(m_cc);
+ if (m_params.m_addr_width > 13) {
+ pushword<true>(m_pc);
+ pushbyte<true>(m_x);
+ pushbyte<true>(m_a);
+ pushbyte<true>(m_cc);
+ }
+ else
+ {
+ pushword<false>(m_pc);
+ pushbyte<false>(m_x);
+ pushbyte<false>(m_a);
+ pushbyte<false>(m_cc);
+ }
SEI;
/* no vectors supported, just do the callback to clear irq_state if needed */
standard_irq_callback(0);
- rm16(0x1ffc, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(0x1ffc, m_pc);
+ else
+ rm16<false>(0x1ffc, m_pc);
m_pending_interrupts &= ~(1 << HD63705_INT_NMI);
m_icount -= 11;
@@ -394,10 +498,19 @@ void m6805_base_device::interrupt()
if ((CC & IFLAG) == 0)
{
/* standard IRQ */
- pushword(m_pc);
- pushbyte(m_x);
- pushbyte(m_a);
- pushbyte(m_cc);
+ if (m_params.m_addr_width > 13) {
+ pushword<true>(m_pc);
+ pushbyte<true>(m_x);
+ pushbyte<true>(m_a);
+ pushbyte<true>(m_cc);
+ }
+ else
+ {
+ pushword<false>(m_pc);
+ pushbyte<false>(m_x);
+ pushbyte<false>(m_a);
+ pushbyte<false>(m_cc);
+ }
SEI;
/* no vectors supported, just do the callback to clear irq_state if needed */
standard_irq_callback(0);
@@ -495,7 +608,7 @@ void m6805_base_device::execute_run()
debugger_instruction_hook(PC);
- u8 const ireg = rdop(PC++);
+ u8 const ireg = m_params.m_addr_width > 13 ? rdop<true>(PC++) : rdop<false>(PC++);
(this->*m_params.m_ops[ireg])();
m_icount -= m_params.m_cycles[ireg];
@@ -528,7 +641,7 @@ m68hc05eg_device::m68hc05eg_device(const machine_config &mconfig, const char *ta
owner,
clock,
M68HC05EG,
- { s_hmos_ops, s_hmos_cycles, 13, 0x00ff, 0x00c0, 0xfffc }) // completely wrong, but it preserves existing behaviour
+ { s_hmos_s_ops, s_hmos_cycles, 13, 0x00ff, 0x00c0, 0xfffc }) // completely wrong, but it preserves existing behaviour
{
}
@@ -536,7 +649,7 @@ void m68hc05eg_device::device_reset()
{
m6805_base_device::device_reset();
- rm16(0x1ffe, m_pc);
+ rm16<false>(0x1ffe, m_pc);
}
void m68hc05eg_device::interrupt_vector()
@@ -544,17 +657,17 @@ void m68hc05eg_device::interrupt_vector()
if (BIT(m_pending_interrupts, M68HC05EG_INT_IRQ))
{
m_pending_interrupts &= ~(1 << M68HC05EG_INT_IRQ);
- rm16(0x1ffa, m_pc);
+ rm16<false>(0x1ffa, m_pc);
}
else if (BIT(m_pending_interrupts, M68HC05EG_INT_TIMER))
{
m_pending_interrupts &= ~(1 << M68HC05EG_INT_TIMER);
- rm16(0x1ff8, m_pc);
+ rm16<false>(0x1ff8, m_pc);
}
else if (BIT(m_pending_interrupts, M68HC05EG_INT_CPI))
{
m_pending_interrupts &= ~(1 << M68HC05EG_INT_CPI);
- rm16(0x1ff6, m_pc);
+ rm16<false>(0x1ff6, m_pc);
}
}
@@ -568,7 +681,7 @@ hd63705_device::hd63705_device(const machine_config &mconfig, const char *tag, d
owner,
clock,
HD63705,
- { s_hmos_ops, s_hmos_cycles, 16, 0x017f, 0x0100, 0x1ffa })
+ { s_hmos_b_ops, s_hmos_cycles, 16, 0x017f, 0x0100, 0x1ffa })
{
}
@@ -578,7 +691,7 @@ void hd63705_device::device_reset()
m_s.w.l = SP_MASK;
- rm16(0x1ffe, m_pc);
+ rm16<true>(0x1ffe, m_pc);
}
void hd63705_device::execute_set_input(int inputnum, int state)
@@ -617,42 +730,42 @@ void hd63705_device::interrupt_vector()
if ((m_pending_interrupts & (1 << HD63705_INT_IRQ1)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_IRQ1);
- rm16(0x1ff8, m_pc);
+ rm16<true>(0x1ff8, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_IRQ2)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_IRQ2);
- rm16(0x1fec, m_pc);
+ rm16<true>(0x1fec, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_ADCONV)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_ADCONV);
- rm16(0x1fea, m_pc);
+ rm16<true>(0x1fea, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER1)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_TIMER1);
- rm16(0x1ff6, m_pc);
+ rm16<true>(0x1ff6, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER2)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_TIMER2);
- rm16(0x1ff4, m_pc);
+ rm16<true>(0x1ff4, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_TIMER3)) != 0)
{
m_pending_interrupts &= ~(1<<HD63705_INT_TIMER3);
- rm16(0x1ff2, m_pc);
+ rm16<true>(0x1ff2, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_PCI)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_PCI);
- rm16(0x1ff0, m_pc);
+ rm16<true>(0x1ff0, m_pc);
}
else if ((m_pending_interrupts & (1 << HD63705_INT_SCI)) != 0)
{
m_pending_interrupts &= ~(1 << HD63705_INT_SCI);
- rm16(0x1fee, m_pc);
+ rm16<true>(0x1fee, m_pc);
}
}
diff --git a/src/devices/cpu/m6805/m6805.h b/src/devices/cpu/m6805/m6805.h
index 1d08e0e8eaf..8aaf1a2a1f0 100644
--- a/src/devices/cpu/m6805/m6805.h
+++ b/src/devices/cpu/m6805/m6805.h
@@ -97,9 +97,11 @@ protected:
};
// opcode tables
- static op_handler_table s_hmos_ops;
- static op_handler_table s_cmos_ops;
- static op_handler_table s_hc_ops;
+ static op_handler_table s_hmos_s_ops;
+ static op_handler_table s_hmos_b_ops;
+ static op_handler_table s_cmos_b_ops;
+ static op_handler_table s_hc_s_ops;
+ static op_handler_table s_hc_b_ops;
static cycle_count_table s_hmos_cycles;
static cycle_count_table s_cmos_cycles;
static cycle_count_table s_hc_cycles;
@@ -163,111 +165,111 @@ protected:
void set_nzc8(u16 a) { set_nz8(a); set_c8(a); }
void set_hnzc8(u8 a, u8 b, u16 r) { set_h(a, b, r); set_nzc8(r); }
- unsigned rdmem(u32 addr) { return unsigned(m_program->read_byte(addr)); }
- void wrmem(u32 addr, u8 value) { m_program->write_byte(addr, value); }
- unsigned rdop(u32 addr) { return unsigned(m_cache->read_byte(addr)); }
- unsigned rdop_arg(u32 addr) { return unsigned(m_cache->read_byte(addr)); }
-
- unsigned rm(u32 addr) { return rdmem(addr); }
- void rm16(u32 addr, PAIR &p);
- void wm(u32 addr, u8 value) { wrmem(addr, value); }
-
- void pushbyte(u8 b);
- void pushword(PAIR const &p);
- void pullbyte(u8 &b);
- void pullword(PAIR &p);
-
- template <typename T> void immbyte(T &b);
- void immword(PAIR &w);
- void skipbyte();
-
- template <unsigned B> void brset();
- template <unsigned B> void brclr();
- template <unsigned B> void bset();
- template <unsigned B> void bclr();
-
- template <bool C> void bra();
- template <bool C> void bhi();
- template <bool C> void bcc();
- template <bool C> void bne();
- template <bool C> void bhcc();
- template <bool C> void bpl();
- template <bool C> void bmc();
- template <bool C> void bil();
- void bsr();
-
- template <addr_mode M> void neg();
- template <addr_mode M> void com();
- template <addr_mode M> void lsr();
- template <addr_mode M> void ror();
- template <addr_mode M> void asr();
- template <addr_mode M> void lsl();
- template <addr_mode M> void rol();
- template <addr_mode M> void dec();
- template <addr_mode M> void inc();
- template <addr_mode M> void tst();
- template <addr_mode M> void clr();
-
- void nega();
- void mul();
- void coma();
- void lsra();
- void rora();
- void asra();
- void lsla();
- void rola();
- void deca();
- void inca();
- void tsta();
- void clra();
-
- void negx();
- void comx();
- void lsrx();
- void rorx();
- void asrx();
- void lslx();
- void rolx();
- void decx();
- void incx();
- void tstx();
- void clrx();
-
- void rti();
- void rts();
- void swi();
- void stop();
- void wait();
-
- void tax();
- void txa();
-
- void clc();
- void sec();
- void cli();
- void sei();
-
- void rsp();
- void nop();
-
- template <addr_mode M> void suba();
- template <addr_mode M> void cmpa();
- template <addr_mode M> void sbca();
- template <addr_mode M> void cpx();
- template <addr_mode M> void anda();
- template <addr_mode M> void bita();
- template <addr_mode M> void lda();
- template <addr_mode M> void sta();
- template <addr_mode M> void eora();
- template <addr_mode M> void adca();
- template <addr_mode M> void ora();
- template <addr_mode M> void adda();
- template <addr_mode M> void jmp();
- template <addr_mode M> void jsr();
- template <addr_mode M> void ldx();
- template <addr_mode M> void stx();
-
- void illegal();
+ template <bool big> unsigned rdmem(u32 addr) { return big ? m_program16.read_byte(addr) : m_program13.read_byte(addr); }
+ template <bool big> void wrmem(u32 addr, u8 value) { if(big) m_program16.write_byte(addr, value); else m_program13.write_byte(addr, value); }
+ template <bool big> unsigned rdop(u32 addr) { return big ? m_cprogram16.read_byte(addr) : m_cprogram13.read_byte(addr); }
+ template <bool big> unsigned rdop_arg(u32 addr) { return big ? m_cprogram16.read_byte(addr) : m_cprogram13.read_byte(addr); }
+
+ template <bool big> unsigned rm(u32 addr) { return rdmem<big>(addr); }
+ template <bool big> void rm16(u32 addr, PAIR &p);
+ template <bool big> void wm(u32 addr, u8 value) { wrmem<big>(addr, value); }
+
+ template <bool big> void pushbyte(u8 b);
+ template <bool big> void pushword(PAIR const &p);
+ template <bool big> void pullbyte(u8 &b);
+ template <bool big> void pullword(PAIR &p);
+
+ template <bool big, typename T> void immbyte(T &b);
+ template <bool big> void immword(PAIR &w);
+ template <bool big> void skipbyte();
+
+ template <bool big, unsigned B> void brset();
+ template <bool big, unsigned B> void brclr();
+ template <bool big, unsigned B> void bset();
+ template <bool big, unsigned B> void bclr();
+
+ template <bool big, bool C> void bra();
+ template <bool big, bool C> void bhi();
+ template <bool big, bool C> void bcc();
+ template <bool big, bool C> void bne();
+ template <bool big, bool C> void bhcc();
+ template <bool big, bool C> void bpl();
+ template <bool big, bool C> void bmc();
+ template <bool big, bool C> void bil();
+ template <bool big> void bsr();
+
+ template <bool big, addr_mode M> void neg();
+ template <bool big, addr_mode M> void com();
+ template <bool big, addr_mode M> void lsr();
+ template <bool big, addr_mode M> void ror();
+ template <bool big, addr_mode M> void asr();
+ template <bool big, addr_mode M> void lsl();
+ template <bool big, addr_mode M> void rol();
+ template <bool big, addr_mode M> void dec();
+ template <bool big, addr_mode M> void inc();
+ template <bool big, addr_mode M> void tst();
+ template <bool big, addr_mode M> void clr();
+
+ template <bool big> void nega();
+ template <bool big> void mul();
+ template <bool big> void coma();
+ template <bool big> void lsra();
+ template <bool big> void rora();
+ template <bool big> void asra();
+ template <bool big> void lsla();
+ template <bool big> void rola();
+ template <bool big> void deca();
+ template <bool big> void inca();
+ template <bool big> void tsta();
+ template <bool big> void clra();
+
+ template <bool big> void negx();
+ template <bool big> void comx();
+ template <bool big> void lsrx();
+ template <bool big> void rorx();
+ template <bool big> void asrx();
+ template <bool big> void lslx();
+ template <bool big> void rolx();
+ template <bool big> void decx();
+ template <bool big> void incx();
+ template <bool big> void tstx();
+ template <bool big> void clrx();
+
+ template <bool big> void rti();
+ template <bool big> void rts();
+ template <bool big> void swi();
+ template <bool big> void stop();
+ template <bool big> void wait();
+
+ template <bool big> void tax();
+ template <bool big> void txa();
+
+ template <bool big> void clc();
+ template <bool big> void sec();
+ template <bool big> void cli();
+ template <bool big> void sei();
+
+ template <bool big> void rsp();
+ template <bool big> void nop();
+
+ template <bool big, addr_mode M> void suba();
+ template <bool big, addr_mode M> void cmpa();
+ template <bool big, addr_mode M> void sbca();
+ template <bool big, addr_mode M> void cpx();
+ template <bool big, addr_mode M> void anda();
+ template <bool big, addr_mode M> void bita();
+ template <bool big, addr_mode M> void lda();
+ template <bool big, addr_mode M> void sta();
+ template <bool big, addr_mode M> void eora();
+ template <bool big, addr_mode M> void adca();
+ template <bool big, addr_mode M> void ora();
+ template <bool big, addr_mode M> void adda();
+ template <bool big, addr_mode M> void jmp();
+ template <bool big, addr_mode M> void jsr();
+ template <bool big, addr_mode M> void ldx();
+ template <bool big, addr_mode M> void stx();
+
+ template <bool big> void illegal();
virtual void interrupt();
virtual void interrupt_vector();
@@ -298,8 +300,10 @@ protected:
int m_icount;
// address spaces
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cprogram16;
+ memory_access<13, 0, 0, ENDIANNESS_BIG>::cache m_cprogram13;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program16;
+ memory_access<13, 0, 0, ENDIANNESS_BIG>::specific m_program13;
};
diff --git a/src/devices/cpu/m6805/m6805defs.h b/src/devices/cpu/m6805/m6805defs.h
index 1e5d8c6e7fb..084fee004f4 100644
--- a/src/devices/cpu/m6805/m6805defs.h
+++ b/src/devices/cpu/m6805/m6805defs.h
@@ -24,53 +24,53 @@ inline void clear_pair(PAIR &p) { p.d = 0; }
#define SP_DEC if (--S < SP_LOW) S = SP_MASK
#define SP_ADJUST(s) (((s) & SP_MASK) | SP_LOW)
-inline void m6805_base_device::rm16(u32 addr, PAIR &p)
+template<bool big> inline void m6805_base_device::rm16(u32 addr, PAIR &p)
{
clear_pair(p);
- p.b.h = rm(addr);
- p.b.l = rm(addr + 1);
+ p.b.h = rm<big>(addr);
+ p.b.l = rm<big>(addr + 1);
}
-inline void m6805_base_device::pushbyte(u8 b)
+template<bool big> inline void m6805_base_device::pushbyte(u8 b)
{
- wm(S, b);
+ wm<big>(S, b);
SP_DEC;
}
-inline void m6805_base_device::pushword(PAIR const &p)
+template<bool big> inline void m6805_base_device::pushword(PAIR const &p)
{
- pushbyte(p.b.l);
- pushbyte(p.b.h);
+ pushbyte<big>(p.b.l);
+ pushbyte<big>(p.b.h);
}
-inline void m6805_base_device::pullbyte(u8 &b)
+template<bool big> inline void m6805_base_device::pullbyte(u8 &b)
{
SP_INC;
- b = rm(S);
+ b = rm<big>(S);
}
-inline void m6805_base_device::pullword(PAIR &p)
+template<bool big> inline void m6805_base_device::pullword(PAIR &p)
{
clear_pair(p);
- pullbyte(p.b.h);
- pullbyte(p.b.l);
+ pullbyte<big>(p.b.h);
+ pullbyte<big>(p.b.l);
}
/* macros to access memory */
-template <typename T> inline void m6805_base_device::immbyte(T &b) { b = rdop_arg(PC++); }
-inline void m6805_base_device::immword(PAIR &w) { w.d = 0; immbyte(w.b.h); immbyte(w.b.l); }
-inline void m6805_base_device::skipbyte() { rdop_arg(PC++); }
+template <bool big, typename T> inline void m6805_base_device::immbyte(T &b) { b = rdop_arg<big>(PC++); }
+template<bool big> inline void m6805_base_device::immword(PAIR &w) { w.d = 0; immbyte<big>(w.b.h); immbyte<big>(w.b.l); }
+template<bool big> inline void m6805_base_device::skipbyte() { rdop_arg<big>(PC++); }
/* for treating an unsigned uint8_t as a signed int16_t */
#define SIGNED(b) (int16_t(b & 0x80 ? b | 0xff00 : b))
/* Macros for addressing modes */
-#define DIRECT do { EAD=0; immbyte(m_ea.b.l); } while (false)
+#define DIRECT do { EAD=0; immbyte<big>(m_ea.b.l); } while (false)
#define IMM8 do { EA = PC++; } while (false)
-#define EXTENDED immword(m_ea)
+#define EXTENDED immword<big>(m_ea)
#define INDEXED do { EA = X; } while (false)
-#define INDEXED1 do { EAD = 0; immbyte(m_ea.b.l); EA += X; } while (false)
-#define INDEXED2 do { immword(m_ea); EA += X;} while (false)
+#define INDEXED1 do { EAD = 0; immbyte<big>(m_ea.b.l); EA += X; } while (false)
+#define INDEXED2 do { immword<big>(m_ea); EA += X;} while (false)
/* macros to set status flags */
#if defined(SEC)
@@ -97,14 +97,14 @@ inline void m6805_base_device::skipbyte() { rdop_arg(PC++); }
case addr_mode::IX1: INDEXED1; break; \
case addr_mode::IX2: INDEXED2; break; \
} } while (false)
-#define DIRBYTE(b) do { DIRECT; b = rm(EAD); } while (false)
-#define EXTBYTE(b) do { EXTENDED; b = rm(EAD); } while (false)
-#define IDXBYTE(b) do { INDEXED; b = rm(EAD); } while (false)
-#define IDX1BYTE(b) do { INDEXED1; b = rm(EAD); } while (false)
-#define IDX2BYTE(b) do { INDEXED2; b = rm(EAD); } while (false)
+#define DIRBYTE(b) do { DIRECT; b = rm<big>(EAD); } while (false)
+#define EXTBYTE(b) do { EXTENDED; b = rm<big>(EAD); } while (false)
+#define IDXBYTE(b) do { INDEXED; b = rm<big>(EAD); } while (false)
+#define IDX1BYTE(b) do { INDEXED1; b = rm<big>(EAD); } while (false)
+#define IDX2BYTE(b) do { INDEXED2; b = rm<big>(EAD); } while (false)
#define ARGBYTE(b) \
do { switch (M) { \
- case addr_mode::IM: immbyte(b); break; \
+ case addr_mode::IM: immbyte<big>(b); break; \
case addr_mode::DI: DIRBYTE(b); break; \
case addr_mode::EX: EXTBYTE(b); break; \
case addr_mode::IX: IDXBYTE(b); break; \
@@ -114,6 +114,6 @@ inline void m6805_base_device::skipbyte() { rdop_arg(PC++); }
} } while (false)
/* Macros for branch instructions */
-#define BRANCH(f) do { u8 t; immbyte(t); if (bool(f) == bool(C)) PC += SIGNED(t); } while (false)
+#define BRANCH(f) do { u8 t; immbyte<big>(t); if (bool(f) == bool(C)) PC += SIGNED(t); } while (false)
#endif // MAME_CPU_M6805_M6805DEFS_H
diff --git a/src/devices/cpu/m6805/m68705.cpp b/src/devices/cpu/m6805/m68705.cpp
index d121201d6d8..12e3b8d1384 100644
--- a/src/devices/cpu/m6805/m68705.cpp
+++ b/src/devices/cpu/m6805/m68705.cpp
@@ -215,7 +215,7 @@ Ux Parts:
*/
m6805_hmos_device::m6805_hmos_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock, device_type type, u32 addr_width, unsigned ram_size)
- : m6805_base_device(mconfig, tag, owner, clock, type, { s_hmos_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, M6805_VECTOR_SWI }, address_map_constructor(FUNC(m6805_hmos_device::map), this))
+ : m6805_base_device(mconfig, tag, owner, clock, type, { addr_width > 13 ? s_hmos_b_ops : s_hmos_s_ops, s_hmos_cycles, addr_width, 0x007f, 0x0060, M6805_VECTOR_SWI }, address_map_constructor(FUNC(m6805_hmos_device::map), this))
, m_timer(*this)
, m_port_open_drain{ false, false, false, false }
, m_port_mask{ 0x00, 0x00, 0x00, 0x00 }
@@ -471,7 +471,10 @@ void m6805_hmos_device::device_reset()
// reset timer/counter
m_timer.reset();
- rm16(M6805_VECTOR_RESET, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M6805_VECTOR_RESET, m_pc);
+ else
+ rm16<false>(M6805_VECTOR_RESET, m_pc);
}
void m68705_device::device_reset()
@@ -484,12 +487,18 @@ void m68705_device::device_reset()
if (CLEAR_LINE != m_vihtp)
{
LOG("loading bootstrap vector\n");
- rm16(M68705_VECTOR_BOOTSTRAP, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M68705_VECTOR_BOOTSTRAP, m_pc);
+ else
+ rm16<false>(M68705_VECTOR_BOOTSTRAP, m_pc);
}
else
{
LOG("loading reset vector\n");
- rm16(M6805_VECTOR_RESET, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M6805_VECTOR_RESET, m_pc);
+ else
+ rm16<false>(M6805_VECTOR_RESET, m_pc);
}
}
@@ -543,10 +552,19 @@ void m6805_hmos_device::interrupt()
{
if ((CC & IFLAG) == 0)
{
- pushword(m_pc);
- pushbyte(m_x);
- pushbyte(m_a);
- pushbyte(m_cc);
+ if (m_params.m_addr_width > 13) {
+ pushword<true>(m_pc);
+ pushbyte<true>(m_x);
+ pushbyte<true>(m_a);
+ pushbyte<true>(m_cc);
+ }
+ else
+ {
+ pushword<false>(m_pc);
+ pushbyte<false>(m_x);
+ pushbyte<false>(m_a);
+ pushbyte<false>(m_cc);
+ }
SEI;
standard_irq_callback(0);
@@ -554,12 +572,18 @@ void m6805_hmos_device::interrupt()
{
LOGINT("servicing /INT interrupt\n");
m_pending_interrupts &= ~(1 << M6805_IRQ_LINE);
- rm16(M6805_VECTOR_INT, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M6805_VECTOR_INT, m_pc);
+ else
+ rm16<false>(M6805_VECTOR_INT, m_pc);
}
else if (BIT(m_pending_interrupts, M6805_INT_TIMER))
{
LOGINT("servicing timer/counter interrupt\n");
- rm16(M6805_VECTOR_TIMER, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M6805_VECTOR_TIMER, m_pc);
+ else
+ rm16<false>(M6805_VECTOR_TIMER, m_pc);
}
else
{
diff --git a/src/devices/cpu/m6805/m68hc05.cpp b/src/devices/cpu/m6805/m68hc05.cpp
index d3843cbca56..ee76081e422 100644
--- a/src/devices/cpu/m6805/m68hc05.cpp
+++ b/src/devices/cpu/m6805/m68hc05.cpp
@@ -143,7 +143,7 @@ m68hc05_device::m68hc05_device(
owner,
clock,
type,
- { s_hc_ops, s_hc_cycles, addr_width, 0x00ff, 0x00c0, vector_mask, M68HC05_VECTOR_SWI },
+ { addr_width > 13 ? s_hc_b_ops : s_hc_s_ops, s_hc_cycles, addr_width, 0x00ff, 0x00c0, vector_mask, M68HC05_VECTOR_SWI },
internal_map)
, m_port_cb_r(*this)
, m_port_cb_w(*this)
@@ -582,10 +582,19 @@ void m68hc05_device::interrupt()
{
if ((m_pending_interrupts & M68HC05_INT_MASK) && !(CC & IFLAG))
{
- pushword(m_pc);
- pushbyte(m_x);
- pushbyte(m_a);
- pushbyte(m_cc);
+ if (m_params.m_addr_width > 13) {
+ pushword<true>(m_pc);
+ pushbyte<true>(m_x);
+ pushbyte<true>(m_a);
+ pushbyte<true>(m_cc);
+ }
+ else
+ {
+ pushword<false>(m_pc);
+ pushbyte<false>(m_x);
+ pushbyte<false>(m_a);
+ pushbyte<false>(m_cc);
+ }
SEI;
standard_irq_callback(0);
@@ -594,12 +603,18 @@ void m68hc05_device::interrupt()
LOGINT("servicing external interrupt\n");
m_irq_latch = 0;
m_pending_interrupts &= ~M68HC05_INT_IRQ;
- rm16(M68HC05_VECTOR_IRQ & m_params.m_vector_mask, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M68HC05_VECTOR_IRQ & m_params.m_vector_mask, m_pc);
+ else
+ rm16<false>(M68HC05_VECTOR_IRQ & m_params.m_vector_mask, m_pc);
}
else if (m_pending_interrupts & M68HC05_INT_TIMER)
{
LOGINT("servicing timer interrupt\n");
- rm16(M68HC05_VECTOR_TIMER & m_params.m_vector_mask, m_pc);
+ if (m_params.m_addr_width > 13)
+ rm16<true>(M68HC05_VECTOR_TIMER & m_params.m_vector_mask, m_pc);
+ else
+ rm16<false>(M68HC05_VECTOR_TIMER & m_params.m_vector_mask, m_pc);
}
else
{
@@ -965,8 +980,8 @@ void m68hc705c8a_device::device_reset()
m68hc705_device::device_reset();
// latch MOR registers on reset
- set_port_interrupt(std::array<u8, PORT_COUNT>{{ 0x00, u8(rdmem(0xfff0)), 0x00, 0x00 }});
- set_ncope(BIT(rdmem(0xfff1), 0));
+ set_port_interrupt(std::array<u8, PORT_COUNT>{{ 0x00, u8(rdmem<false>(0xfff0)), 0x00, 0x00 }});
+ set_ncope(BIT(rdmem<false>(0xfff1), 0));
// RAM disabled, IRQ negative edge and level sensitive
m_option = 0x02;
@@ -1064,7 +1079,7 @@ void m68hc705j1a_device::device_reset()
m68hc705_device::device_reset();
// latch MOR register on reset
- set_ncope(BIT(rdmem(0x07f1), 0)); // FIXME: this is more like C8A's PCOP
+ set_ncope(BIT(rdmem<false>(0x07f1), 0)); // FIXME: this is more like C8A's PCOP
}
diff --git a/src/devices/cpu/m6809/m6809.cpp b/src/devices/cpu/m6809/m6809.cpp
index 5143676fa05..e2a83a17e00 100644
--- a/src/devices/cpu/m6809/m6809.cpp
+++ b/src/devices/cpu/m6809/m6809.cpp
@@ -156,11 +156,9 @@ void m6809_base_device::device_start()
if (!m_mintf)
m_mintf = std::make_unique<mi_default>();
- m_mintf->m_program = &space(AS_PROGRAM);
- m_mintf->m_sprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_mintf->m_program;
-
- m_mintf->m_cache = m_mintf->m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_mintf->m_scache = m_mintf->m_sprogram->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_mintf->cprogram);
+ space(AS_PROGRAM).specific(m_mintf->program);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_mintf->csprogram);
m_lic_func.resolve_safe();
@@ -581,23 +579,23 @@ void m6809_base_device::execute_run()
uint8_t m6809_base_device::mi_default::read(uint16_t adr)
{
- return m_program->read_byte(adr);
+ return program.read_byte(adr);
}
uint8_t m6809_base_device::mi_default::read_opcode(uint16_t adr)
{
- return m_scache->read_byte(adr);
+ return csprogram.read_byte(adr);
}
uint8_t m6809_base_device::mi_default::read_opcode_arg(uint16_t adr)
{
- return m_cache->read_byte(adr);
+ return cprogram.read_byte(adr);
}
void m6809_base_device::mi_default::write(uint16_t adr, uint8_t val)
{
- m_program->write_byte(adr, val);
+ program.write_byte(adr, val);
}
diff --git a/src/devices/cpu/m6809/m6809.h b/src/devices/cpu/m6809/m6809.h
index daa1b82913a..0af03cfd47b 100644
--- a/src/devices/cpu/m6809/m6809.h
+++ b/src/devices/cpu/m6809/m6809.h
@@ -34,8 +34,8 @@ protected:
class memory_interface {
public:
- address_space *m_program, *m_sprogram;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache, *m_scache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache cprogram, csprogram;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific program;
virtual ~memory_interface() {}
virtual uint8_t read(uint16_t adr) = 0;
diff --git a/src/devices/cpu/m88000/m88000.cpp b/src/devices/cpu/m88000/m88000.cpp
index cb25ff35a38..7498d02591d 100644
--- a/src/devices/cpu/m88000/m88000.cpp
+++ b/src/devices/cpu/m88000/m88000.cpp
@@ -19,8 +19,6 @@ mc88100_device::mc88100_device(const machine_config &mconfig, const char *tag, d
: cpu_device(mconfig, MC88100, tag, owner, clock)
, m_code_config("code", ENDIANNESS_BIG, 32, 32, 0)
, m_data_config("data", ENDIANNESS_BIG, 32, 32, 0)
- , m_inst_cache(nullptr)
- , m_data_space(nullptr)
, m_pc(0)
, m_r{0}
, m_cr{0}
@@ -45,8 +43,8 @@ device_memory_interface::space_config_vector mc88100_device::memory_space_config
void mc88100_device::device_start()
{
- m_inst_cache = space(AS_PROGRAM).cache<2, 0, ENDIANNESS_BIG>();
- m_data_space = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_inst_cache);
+ space(AS_DATA).specific(m_data_space);
set_icountptr(m_icount);
diff --git a/src/devices/cpu/m88000/m88000.h b/src/devices/cpu/m88000/m88000.h
index 1e277099718..c4e0c888475 100644
--- a/src/devices/cpu/m88000/m88000.h
+++ b/src/devices/cpu/m88000/m88000.h
@@ -49,8 +49,8 @@ private:
// address spaces
address_space_config m_code_config;
address_space_config m_data_config;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_inst_cache;
- address_space *m_data_space;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_inst_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_data_space;
// register storage
u32 m_pc;
diff --git a/src/devices/cpu/mb86233/mb86233.cpp b/src/devices/cpu/mb86233/mb86233.cpp
index 7a67599408a..b69cad9639c 100644
--- a/src/devices/cpu/mb86233/mb86233.cpp
+++ b/src/devices/cpu/mb86233/mb86233.cpp
@@ -88,12 +88,11 @@ std::unique_ptr<util::disasm_interface> mb86233_device::create_disassembler()
void mb86233_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, -2, ENDIANNESS_LITTLE>();
-
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
- m_rf = &space(AS_RF);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
+ space(AS_RF).specific(m_rf);
state_add(STATE_GENPC, "GENPC", m_pc);
state_add(STATE_GENPCBASE, "PC", m_ppc).noshow();
@@ -606,7 +605,7 @@ u32 mb86233_device::read_reg(u32 r)
{
r &= 0x3f;
if(r >= 0x20 && r < 0x30)
- return m_rf->read_dword(r & 0x1f);
+ return m_rf.read_dword(r & 0x1f);
switch(r) {
case 0x00: return m_b0;
case 0x01: return m_b1;
@@ -643,7 +642,7 @@ void mb86233_device::write_reg(u32 r, u32 v)
{
r &= 0x3f;
if(r >= 0x20 && r < 0x30) {
- m_rf->write_dword(r & 0x1f, v);
+ m_rf.write_dword(r & 0x1f, v);
return;
}
switch(r) {
@@ -706,14 +705,14 @@ void mb86233_device::write_mem_internal_1(u32 r, u32 v, bool bank)
u16 ea = ea_pre_1(r);
if(bank)
ea += 0x200;
- m_data->write_dword(ea, v);
+ m_data.write_dword(ea, v);
ea_post_1(r);
}
void mb86233_device::write_mem_io_1(u32 r, u32 v)
{
u16 ea = ea_pre_1(r);
- m_io->write_dword(ea, v);
+ m_io.write_dword(ea, v);
ea_post_1(r);
}
@@ -722,7 +721,7 @@ void mb86233_device::execute_run()
while(m_icount > 0) {
m_ppc = m_pc;
debugger_instruction_hook(m_ppc);
- u32 opcode = m_cache->read_dword(m_pc++);
+ u32 opcode = m_cache.read_dword(m_pc++);
switch((opcode >> 26) & 0x3f) {
case 0x00: {
@@ -739,11 +738,11 @@ void mb86233_device::execute_run()
// lab mem, mem (e)
u32 ea1 = ea_pre_0(r1);
- u32 v1 = m_data->read_dword(ea1);
+ u32 v1 = m_data.read_dword(ea1);
if(m_stall) goto do_stall;
u32 ea2 = ea_pre_1(r2);
- u32 v2 = m_io->read_dword(ea2);
+ u32 v2 = m_io.read_dword(ea2);
if(m_stall) goto do_stall;
ea_post_0(r1);
@@ -758,11 +757,11 @@ void mb86233_device::execute_run()
// lab mem, mem + 0x200
u32 ea1 = ea_pre_0(r1);
- u32 v1 = m_data->read_dword(ea1);
+ u32 v1 = m_data.read_dword(ea1);
if(m_stall) goto do_stall;
u32 ea2 = ea_pre_1(r2) + 0x200;
- u32 v2 = m_data->read_dword(ea2);
+ u32 v2 = m_data.read_dword(ea2);
if(m_stall) goto do_stall;
ea_post_0(r1);
@@ -777,11 +776,11 @@ void mb86233_device::execute_run()
// lab mem + 0x200, mem
u32 ea1 = ea_pre_0(r1) + 0x200;
- u32 v1 = m_data->read_dword(ea1);
+ u32 v1 = m_data.read_dword(ea1);
if(m_stall) goto do_stall;
u32 ea2 = ea_pre_1(r2);
- u32 v2 = m_data->read_dword(ea2);
+ u32 v2 = m_data.read_dword(ea2);
if(m_stall) goto do_stall;
ea_post_0(r1);
@@ -817,7 +816,7 @@ void mb86233_device::execute_run()
case 0: {
// mov mem, mem (e)
u32 ea = ea_pre_0(r1);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_io_1(r2, v);
@@ -827,7 +826,7 @@ void mb86233_device::execute_run()
case 1: {
// mov mem, mem (e)
u32 ea = ea_pre_0(r1);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_io_1(r2, v);
@@ -837,7 +836,7 @@ void mb86233_device::execute_run()
case 2: {
// mov mem (e), mem
u32 ea = ea_pre_0(r1);
- u32 v = m_io->read_dword(ea);
+ u32 v = m_io.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_internal_1(r2, v, false);
@@ -847,7 +846,7 @@ void mb86233_device::execute_run()
case 3: {
// mov mem, mem + 0x200
u32 ea = ea_pre_0(r1);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_internal_1(r2, v, true);
@@ -857,7 +856,7 @@ void mb86233_device::execute_run()
case 4: {
// mov mem + 0x200, mem
u32 ea = ea_pre_0(r1) + 0x200;
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_internal_1(r2, v, false);
@@ -867,7 +866,7 @@ void mb86233_device::execute_run()
case 5: {
// mov mem (o), mem
u32 ea = ea_pre_0(r1);
- u32 v = m_program->read_dword(ea);
+ u32 v = m_program.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_mem_internal_1(r2, v, false);
@@ -895,7 +894,7 @@ void mb86233_device::execute_run()
case 2: {
// mov mem + 0x200, reg
u32 ea = ea_pre_1(r1) + 0x200;
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_1(r1);
write_reg(r2, v);
@@ -905,7 +904,7 @@ void mb86233_device::execute_run()
case 3: {
// mov mem, reg
u32 ea = ea_pre_1(r1);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_1(r1);
write_reg(r2, v);
@@ -915,7 +914,7 @@ void mb86233_device::execute_run()
case 4: {
// mov mem (e), reg
u32 ea = ea_pre_1(r1);
- u32 v = m_io->read_dword(ea);
+ u32 v = m_io.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_1(r1);
write_reg(r2, v);
@@ -925,7 +924,7 @@ void mb86233_device::execute_run()
case 5: {
// mov mem (o), reg
u32 ea = ea_pre_0(r1);
- u32 v = m_program->read_dword(ea);
+ u32 v = m_program.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(r1);
write_reg(r2, v);
@@ -1117,7 +1116,7 @@ void mb86233_device::execute_run()
} else {
// brul adr
u32 ea = ea_pre_0(opcode);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(opcode);
m_pc = v;
@@ -1139,7 +1138,7 @@ void mb86233_device::execute_run()
} else {
// bsul adr
u32 ea = ea_pre_0(opcode);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(opcode);
pcs_push();
@@ -1153,7 +1152,7 @@ void mb86233_device::execute_run()
case 6: { // ldif adr, rn
u32 ea = ea_pre_0(opcode);
- u32 v = m_data->read_dword(ea);
+ u32 v = m_data.read_dword(ea);
if(m_stall) goto do_stall;
ea_post_0(opcode);
write_reg(opcode >> 9, v);
diff --git a/src/devices/cpu/mb86233/mb86233.h b/src/devices/cpu/mb86233/mb86233.h
index 2f02a4c0d46..611eb1e5b33 100644
--- a/src/devices/cpu/mb86233/mb86233.h
+++ b/src/devices/cpu/mb86233/mb86233.h
@@ -88,8 +88,12 @@ private:
address_space_config m_io_config;
address_space_config m_rf_config;
- address_space *m_program, *m_data, *m_io, *m_rf;
- memory_access_cache<2, -2, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 2, -2, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 2, -2, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<16, 2, -2, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<16, 2, -2, ENDIANNESS_LITTLE>::specific m_io;
+ memory_access< 4, 2, -2, ENDIANNESS_LITTLE>::specific m_rf;
+
int m_icount;
u32 m_st, m_a, m_b, m_d, m_p;
diff --git a/src/devices/cpu/mb86235/mb86235.cpp b/src/devices/cpu/mb86235/mb86235.cpp
index fc56ce12390..45eb318704c 100644
--- a/src/devices/cpu/mb86235/mb86235.cpp
+++ b/src/devices/cpu/mb86235/mb86235.cpp
@@ -68,7 +68,7 @@ void mb86235_device::execute_run()
curpc = check_previous_op_stall() ? m_core->cur_fifo_state.pc : m_core->pc;
debugger_instruction_hook(curpc);
- opcode = m_pcache->read_qword(curpc);
+ opcode = m_pcache.read_qword(curpc);
m_core->ppc = curpc;
@@ -91,10 +91,10 @@ void mb86235_device::execute_run()
void mb86235_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_pcache = m_program->cache<3, -3, ENDIANNESS_LITTLE>();
- m_dataa = &space(AS_DATA);
- m_datab = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_pcache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_dataa);
+ space(AS_IO).specific(m_datab);
m_core = (mb86235_internal_state *)m_cache.alloc_near(sizeof(mb86235_internal_state));
memset(m_core, 0, sizeof(mb86235_internal_state));
diff --git a/src/devices/cpu/mb86235/mb86235.h b/src/devices/cpu/mb86235/mb86235.h
index 9edfd828749..c859807bf56 100644
--- a/src/devices/cpu/mb86235/mb86235.h
+++ b/src/devices/cpu/mb86235/mb86235.h
@@ -74,8 +74,6 @@ protected:
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
- memory_access_cache<3, -3, ENDIANNESS_LITTLE> *m_pcache;
-
private:
struct mb86235_flags
@@ -174,9 +172,10 @@ private:
std::unique_ptr<drcuml_state> m_drcuml;
std::unique_ptr<mb86235_frontend> m_drcfe;
- address_space *m_program;
- address_space *m_dataa;
- address_space *m_datab;
+ memory_access<32, 3, -3, ENDIANNESS_LITTLE>::cache m_pcache;
+ memory_access<32, 3, -3, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<24, 2, -2, ENDIANNESS_LITTLE>::specific m_dataa;
+ memory_access<10, 2, -2, ENDIANNESS_LITTLE>::specific m_datab;
/* internal compiler state */
struct compiler_state
diff --git a/src/devices/cpu/mb86235/mb86235fe.cpp b/src/devices/cpu/mb86235/mb86235fe.cpp
index 41ad97ebb87..94a8d986869 100644
--- a/src/devices/cpu/mb86235/mb86235fe.cpp
+++ b/src/devices/cpu/mb86235/mb86235fe.cpp
@@ -63,7 +63,7 @@ mb86235_frontend::mb86235_frontend(mb86235_device *core, uint32_t window_start,
bool mb86235_frontend::describe(opcode_desc &desc, const opcode_desc *prev)
{
- uint64_t opcode = desc.opptr.q[0] = m_core->m_pcache->read_qword(desc.pc, 0);
+ uint64_t opcode = desc.opptr.q[0] = m_core->m_pcache.read_qword(desc.pc, 0);
desc.length = 1;
desc.cycles = 1;
diff --git a/src/devices/cpu/mb86235/mb86235ops.cpp b/src/devices/cpu/mb86235/mb86235ops.cpp
index c21b6c8836f..e79b9240cce 100644
--- a/src/devices/cpu/mb86235/mb86235ops.cpp
+++ b/src/devices/cpu/mb86235/mb86235ops.cpp
@@ -144,15 +144,15 @@ inline uint32_t mb86235_device::decode_ea(uint8_t mode, uint8_t rx, uint8_t ry,
inline uint32_t mb86235_device::read_bus(bool isbbus, uint32_t addr)
{
- return isbbus == true ? m_datab->read_dword(addr & 0x3ff) : m_dataa->read_dword(addr & 0x3ff);
+ return isbbus == true ? m_datab.read_dword(addr & 0x3ff) : m_dataa.read_dword(addr & 0x3ff);
}
inline void mb86235_device::write_bus(bool isbbus, uint32_t addr, uint32_t data)
{
if(isbbus == true)
- m_datab->write_dword(addr & 0x3ff,data);
+ m_datab.write_dword(addr & 0x3ff,data);
else
- m_dataa->write_dword(addr & 0x3ff,data);
+ m_dataa.write_dword(addr & 0x3ff,data);
}
@@ -885,7 +885,7 @@ void mb86235_device::do_trans1_1(uint32_t h, uint32_t l)
uint32_t addr = m_core->eb+m_core->eo;
uint8_t disp_offs = (l >> 19) & 0x3f;
- res = m_dataa->read_dword(addr);
+ res = m_dataa.read_dword(addr);
if(dr & 0x40)
{
bool isbbus = (dr & 0x20) == 0x20;
@@ -998,7 +998,7 @@ void mb86235_device::do_trans1_2(uint32_t h, uint32_t l)
if(l&0x80000000)
disp_offs |= 1;
- res = m_dataa->read_dword(addr);
+ res = m_dataa.read_dword(addr);
if(dr & 0x40)
{
bool isbbus = (dr & 0x20) == 0x20;
@@ -1035,7 +1035,7 @@ void mb86235_device::do_trans1_2(uint32_t h, uint32_t l)
else
res = get_transfer_reg(sr);
- m_dataa->write_dword(addr,res);
+ m_dataa.write_dword(addr,res);
if(disp_offs & 0x20)
m_core->eo -= disp_offs & 0x1f;
else
@@ -1206,10 +1206,10 @@ void mb86235_device::do_control(uint32_t h, uint32_t l)
case 0x04: // PUSH
m_core->sp --;
m_core->sp &= 0x3ff;
- m_datab->write_dword(m_core->sp,get_transfer_reg((ef2>>6) & 0x3f));
+ m_datab.write_dword(m_core->sp,get_transfer_reg((ef2>>6) & 0x3f));
break;
case 0x05: // POP
- set_transfer_reg((ef2>>6) & 0x3f, m_datab->read_dword(m_core->sp));
+ set_transfer_reg((ef2>>6) & 0x3f, m_datab.read_dword(m_core->sp));
m_core->sp ++;
m_core->sp &= 0x3ff;
break;
diff --git a/src/devices/cpu/mb88xx/mb88xx.cpp b/src/devices/cpu/mb88xx/mb88xx.cpp
index b02d8b50304..56f990cd599 100644
--- a/src/devices/cpu/mb88xx/mb88xx.cpp
+++ b/src/devices/cpu/mb88xx/mb88xx.cpp
@@ -47,10 +47,10 @@ DEFINE_DEVICE_TYPE(MB8844, mb8844_cpu_device, "mb8844", "Fujitsu MB8844")
MACROS
***************************************************************************/
-#define READOP(a) (m_cache->read_byte(a))
+#define READOP(a) (m_cache.read_byte(a))
-#define RDMEM(a) (m_data->read_byte(a))
-#define WRMEM(a,v) (m_data->write_byte((a), (v)))
+#define RDMEM(a) (m_data.read_byte(a))
+#define WRMEM(a,v) (m_data.write_byte((a), (v)))
#define TEST_ST() (m_st & 1)
#define TEST_ZF() (m_zf & 1)
@@ -182,9 +182,9 @@ std::unique_ptr<util::disasm_interface> mb88_cpu_device::create_disassembler()
void mb88_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
m_read_k.resolve_safe(0);
m_write_o.resolve_safe();
diff --git a/src/devices/cpu/mb88xx/mb88xx.h b/src/devices/cpu/mb88xx/mb88xx.h
index 2dbd4b63f86..df9c3dc283c 100644
--- a/src/devices/cpu/mb88xx/mb88xx.h
+++ b/src/devices/cpu/mb88xx/mb88xx.h
@@ -177,9 +177,10 @@ private:
/* IRQ handling */
uint8_t m_pending_interrupt;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
+ memory_access<11, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<11, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 7, 0, 0, ENDIANNESS_BIG>::specific m_data;
+
int m_icount;
// For the debugger
diff --git a/src/devices/cpu/mc68hc11/mc68hc11.cpp b/src/devices/cpu/mc68hc11/mc68hc11.cpp
index 453c048231f..3aa83784ca7 100644
--- a/src/devices/cpu/mc68hc11/mc68hc11.cpp
+++ b/src/devices/cpu/mc68hc11/mc68hc11.cpp
@@ -552,13 +552,13 @@ void mc68hc11m0_device::io_map(address_map &map)
uint8_t mc68hc11_cpu_device::FETCH()
{
- return m_cache->read_byte(m_pc++);
+ return m_cache.read_byte(m_pc++);
}
uint16_t mc68hc11_cpu_device::FETCH16()
{
uint16_t w;
- w = m_cache->read_word(m_pc);
+ w = m_cache.read_word(m_pc);
m_pc += 2;
return w;
}
@@ -567,28 +567,28 @@ uint8_t mc68hc11_cpu_device::READ8(uint32_t address)
{
if(address >= m_reg_position && (address - m_reg_position) < m_reg_block_size)
{
- return m_io->read_byte(address-m_reg_position);
+ return m_io.read_byte(address-m_reg_position);
}
else if(address >= m_ram_position && address < m_ram_position+m_internal_ram_size)
{
- return m_data->read_byte(address-m_ram_position);
+ return m_data.read_byte(address-m_ram_position);
}
- return m_program->read_byte(address);
+ return m_program.read_byte(address);
}
void mc68hc11_cpu_device::WRITE8(uint32_t address, uint8_t value)
{
if(address >= m_reg_position && (address - m_reg_position) < m_reg_block_size)
{
- m_io->write_byte(address-m_reg_position, value);
+ m_io.write_byte(address-m_reg_position, value);
return;
}
else if(address >= m_ram_position && address < m_ram_position+m_internal_ram_size)
{
- m_data->write_byte(address-m_ram_position, value);
+ m_data.write_byte(address-m_ram_position, value);
return;
}
- m_program->write_byte(address, value);
+ m_program.write_byte(address, value);
}
uint16_t mc68hc11_cpu_device::READ16(uint32_t address)
@@ -639,10 +639,10 @@ void mc68hc11_cpu_device::device_start()
}
}
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_pc));
save_item(NAME(m_ix));
diff --git a/src/devices/cpu/mc68hc11/mc68hc11.h b/src/devices/cpu/mc68hc11/mc68hc11.h
index c6b55d88279..33b6ab4be33 100644
--- a/src/devices/cpu/mc68hc11/mc68hc11.h
+++ b/src/devices/cpu/mc68hc11/mc68hc11.h
@@ -141,10 +141,10 @@ private:
int m_ad_channel;
uint8_t m_irq_state[2];
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_program;
- address_space *m_data;
- address_space *m_io;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access<11, 0, 0, ENDIANNESS_BIG>::specific m_data;
+ memory_access< 8, 0, 0, ENDIANNESS_BIG>::specific m_io;
devcb_read8::array<8> m_port_input_cb;
devcb_write8::array<8> m_port_output_cb;
devcb_read8::array<8> m_analog_cb;
diff --git a/src/devices/cpu/mcs40/mcs40.cpp b/src/devices/cpu/mcs40/mcs40.cpp
index e973d1ab549..969f08c4197 100644
--- a/src/devices/cpu/mcs40/mcs40.cpp
+++ b/src/devices/cpu/mcs40/mcs40.cpp
@@ -102,7 +102,6 @@ mcs40_cpu_device_base::mcs40_cpu_device_base(
{ "ramport", ENDIANNESS_LITTLE, 8, u8(5), 0 },
{ "program", ENDIANNESS_LITTLE, 8, u8(rom_width - 3), 0 }, }
, m_spaces{ nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }
- , m_cache(nullptr)
, m_bus_cycle_cb(*this)
, m_sync_cb(*this)
, m_cm_rom_cb(*this)
@@ -142,7 +141,7 @@ void mcs40_cpu_device_base::device_start()
m_spaces[AS_RAM_STATUS] = &space(AS_RAM_STATUS);
m_spaces[AS_RAM_PORTS] = &space(AS_RAM_PORTS);
m_spaces[AS_PROGRAM_MEMORY] = &space(AS_PROGRAM_MEMORY);
- m_cache = m_spaces[AS_ROM]->cache<0, 0, ENDIANNESS_LITTLE>();
+ m_spaces[AS_ROM]->cache(m_cache);
m_bus_cycle_cb.resolve();
m_sync_cb.resolve_safe();
@@ -633,7 +632,7 @@ inline void mcs40_cpu_device_base::do_m1()
update_cm_rom(0x0fU);
}
// TODO: just read the high nybble here - MAME doesn't support this
- u8 const read = m_cache->read_byte(rom_bank() | m_rom_addr);
+ u8 const read = m_cache.read_byte(rom_bank() | m_rom_addr);
if (cycle::OP == m_cycle)
{
m_opr = (m_stop_ff) ? 0x0U : (read >> 4);
@@ -651,7 +650,7 @@ inline void mcs40_cpu_device_base::do_m1()
inline void mcs40_cpu_device_base::do_m2()
{
// TODO: just read the low nybble here - MAME doesn't support this
- u8 const read = m_cache->read_byte(rom_bank() | m_rom_addr);
+ u8 const read = m_cache.read_byte(rom_bank() | m_rom_addr);
if (cycle::OP == m_cycle)
m_opa = (m_stop_ff) ? 0x0U : (read & 0x0fU);
else
diff --git a/src/devices/cpu/mcs40/mcs40.h b/src/devices/cpu/mcs40/mcs40.h
index 7bd595dba34..68a8dca161f 100644
--- a/src/devices/cpu/mcs40/mcs40.h
+++ b/src/devices/cpu/mcs40/mcs40.h
@@ -182,7 +182,7 @@ private:
// address spaces
address_space_config const m_space_config[7];
address_space *m_spaces[7];
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
// bus snooping callback
bus_cycle_delegate m_bus_cycle_cb;
diff --git a/src/devices/cpu/mcs48/mcs48.cpp b/src/devices/cpu/mcs48/mcs48.cpp
index a2a3fbf0bb1..c85a3a2e79b 100644
--- a/src/devices/cpu/mcs48/mcs48.cpp
+++ b/src/devices/cpu/mcs48/mcs48.cpp
@@ -391,7 +391,7 @@ uint8_t mcs48_cpu_device::opcode_fetch()
{
uint16_t address = m_pc;
m_pc = ((m_pc + 1) & 0x7ff) | (m_pc & 0x800);
- return m_cache->read_byte(address);
+ return m_program.read_byte(address);
}
@@ -404,7 +404,7 @@ uint8_t mcs48_cpu_device::argument_fetch()
{
uint16_t address = m_pc;
m_pc = ((m_pc + 1) & 0x7ff) | (m_pc & 0x800);
- return m_cache->read_byte(address);
+ return m_program.read_byte(address);
}
@@ -1114,10 +1114,10 @@ void mcs48_cpu_device::device_start()
/* FIXME: Current implementation suboptimal */
m_ea = (m_int_rom_size ? 0 : 1);
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = (m_feature_mask & EXT_BUS_FEATURE) != 0 ? &space(AS_IO) : nullptr;
+ space(AS_PROGRAM).cache(m_program);
+ space(AS_DATA).specific(m_data);
+ if(m_feature_mask & EXT_BUS_FEATURE)
+ space(AS_IO).specific(m_io);
// resolve callbacks
m_port_in_cb.resolve_all_safe(0xff);
@@ -1243,7 +1243,7 @@ int mcs48_cpu_device::check_irqs()
// force JNI to be taken (hack)
if (m_irq_polled)
- m_pc = ((m_pc - 1) & 0xf00) | m_cache->read_byte(m_pc - 1);
+ m_pc = ((m_pc - 1) & 0xf00) | m_program.read_byte(m_pc - 1);
/* transfer to location 0x03 */
push_pc_psw();
diff --git a/src/devices/cpu/mcs48/mcs48.h b/src/devices/cpu/mcs48/mcs48.h
index 8041d11a89d..572c09b6bec 100644
--- a/src/devices/cpu/mcs48/mcs48.h
+++ b/src/devices/cpu/mcs48/mcs48.h
@@ -216,10 +216,9 @@ protected:
int m_icount;
/* Memory spaces */
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::cache m_program;
+ memory_access<8, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
required_shared_ptr<uint8_t> m_dataptr;
@@ -235,15 +234,15 @@ protected:
const mcs48_ophandler *const m_opcode_table;
/* ROM is mapped to AS_PROGRAM */
- uint8_t program_r(offs_t a) { return m_program->read_byte(a); }
+ uint8_t program_r(offs_t a) { return m_program.read_byte(a); }
/* RAM is mapped to AS_DATA */
- uint8_t ram_r(offs_t a) { return m_data->read_byte(a); }
- void ram_w(offs_t a, uint8_t v) { m_data->write_byte(a, v); }
+ uint8_t ram_r(offs_t a) { return m_data.read_byte(a); }
+ void ram_w(offs_t a, uint8_t v) { m_data.write_byte(a, v); }
/* ports are mapped to AS_IO and callbacks */
- uint8_t ext_r(offs_t a) { return m_io->read_byte(a); }
- void ext_w(offs_t a, uint8_t v) { m_io->write_byte(a, v); }
+ uint8_t ext_r(offs_t a) { return m_io.read_byte(a); }
+ void ext_w(offs_t a, uint8_t v) { m_io.write_byte(a, v); }
uint8_t port_r(offs_t a) { return m_port_in_cb[a - 1](); }
void port_w(offs_t a, uint8_t v) { m_port_out_cb[a - 1](v); }
int test_r(offs_t a) { return m_test_in_cb[a](); }
diff --git a/src/devices/cpu/mcs51/mcs51.cpp b/src/devices/cpu/mcs51/mcs51.cpp
index a76e2bb5ea4..66eb3f50316 100644
--- a/src/devices/cpu/mcs51/mcs51.cpp
+++ b/src/devices/cpu/mcs51/mcs51.cpp
@@ -418,15 +418,15 @@ device_memory_interface::space_config_vector mcs51_cpu_device::memory_space_conf
***************************************************************************/
/* Read Opcode/Opcode Arguments from Program Code */
-#define ROP(pc) m_cache->read_byte(pc)
-#define ROP_ARG(pc) m_cache->read_byte(pc)
+#define ROP(pc) m_program.read_byte(pc)
+#define ROP_ARG(pc) m_program.read_byte(pc)
/* Read a byte from External Code Memory (Usually Program Rom(s) Space) */
-#define CODEMEM_R(a) (uint8_t)m_program->read_byte(a)
+#define CODEMEM_R(a) (uint8_t)m_program.read_byte(a)
/* Read/Write a byte from/to External Data Memory (Usually RAM or other I/O) */
-#define DATAMEM_R(a) (uint8_t)m_io->read_byte(a)
-#define DATAMEM_W(a,v) m_io->write_byte(a, v)
+#define DATAMEM_R(a) (uint8_t)m_io.read_byte(a)
+#define DATAMEM_W(a,v) m_io.write_byte(a, v)
/* Read/Write a byte from/to the Internal RAM */
@@ -435,8 +435,8 @@ device_memory_interface::space_config_vector mcs51_cpu_device::memory_space_conf
/* Read/Write a byte from/to the Internal RAM indirectly */
/* (called from indirect addressing) */
-uint8_t mcs51_cpu_device::iram_iread(offs_t a) { return (a <= m_ram_mask) ? m_data->read_byte(a) : 0xff; }
-void mcs51_cpu_device::iram_iwrite(offs_t a, uint8_t d) { if (a <= m_ram_mask) m_data->write_byte(a, d); }
+uint8_t mcs51_cpu_device::iram_iread(offs_t a) { return (a <= m_ram_mask) ? m_data.read_byte(a) : 0xff; }
+void mcs51_cpu_device::iram_iwrite(offs_t a, uint8_t d) { if (a <= m_ram_mask) m_data.write_byte(a, d); }
#define IRAM_IR(a) iram_iread(a)
#define IRAM_IW(a, d) iram_iwrite(a, d)
@@ -829,13 +829,13 @@ offs_t mcs51_cpu_device::external_ram_iaddr(offs_t offset, offs_t mem_mask)
uint8_t mcs51_cpu_device::iram_read(size_t offset)
{
- return (((offset) < 0x80) ? m_data->read_byte(offset) : sfr_read(offset));
+ return (((offset) < 0x80) ? m_data.read_byte(offset) : sfr_read(offset));
}
void mcs51_cpu_device::iram_write(size_t offset, uint8_t data)
{
if ((offset) < 0x80)
- m_data->write_byte(offset, data);
+ m_data.write_byte(offset, data);
else
sfr_write(offset, data);
}
@@ -2012,7 +2012,7 @@ void mcs51_cpu_device::execute_run()
/* Read next opcode */
PPC = PC;
debugger_instruction_hook(PC);
- op = m_cache->read_byte(PC++);
+ op = m_program.read_byte(PC++);
/* process opcode and count cycles */
m_inst_cycles = mcs51_cycles[op];
@@ -2079,7 +2079,7 @@ void mcs51_cpu_device::sfr_write(size_t offset, uint8_t data)
/* no write in this case according to manual */
return;
}
- m_data->write_byte((size_t)offset | 0x100, data);
+ m_data.write_byte((size_t)offset | 0x100, data);
}
uint8_t mcs51_cpu_device::sfr_read(size_t offset)
@@ -2114,7 +2114,7 @@ uint8_t mcs51_cpu_device::sfr_read(size_t offset)
case ADDR_SBUF:
case ADDR_IE:
case ADDR_IP:
- return m_data->read_byte((size_t) offset | 0x100);
+ return m_data.read_byte((size_t) offset | 0x100);
/* Illegal or non-implemented sfr */
default:
LOG(("mcs51 '%s': attemping to read an invalid/non-implemented SFR address: %x at 0x%04x\n", tag(), (uint32_t)offset,PC));
@@ -2126,10 +2126,9 @@ uint8_t mcs51_cpu_device::sfr_read(size_t offset)
void mcs51_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
m_port_in_cb.resolve_all_safe(0xff);
m_port_out_cb.resolve_all_safe();
@@ -2321,7 +2320,7 @@ void i8052_device::sfr_write(size_t offset, uint8_t data)
case ADDR_RCAP2H:
case ADDR_TL2:
case ADDR_TH2:
- m_data->write_byte((size_t) offset | 0x100, data);
+ m_data.write_byte((size_t) offset | 0x100, data);
break;
default:
@@ -2339,7 +2338,7 @@ uint8_t i8052_device::sfr_read(size_t offset)
case ADDR_RCAP2H:
case ADDR_TL2:
case ADDR_TH2:
- return m_data->read_byte((size_t) offset | 0x100);
+ return m_data.read_byte((size_t) offset | 0x100);
default:
return mcs51_cpu_device::sfr_read(offset);
}
@@ -2369,7 +2368,7 @@ void i80c52_device::sfr_write(size_t offset, uint8_t data)
i8052_device::sfr_write(offset, data);
return;
}
- m_data->write_byte((size_t) offset | 0x100, data);
+ m_data.write_byte((size_t) offset | 0x100, data);
}
uint8_t i80c52_device::sfr_read(size_t offset)
@@ -2380,7 +2379,7 @@ uint8_t i80c52_device::sfr_read(size_t offset)
case ADDR_IPH:
case ADDR_SADDR:
case ADDR_SADEN:
- return m_data->read_byte((size_t) offset | 0x100);
+ return m_data.read_byte((size_t) offset | 0x100);
default:
return i8052_device::sfr_read(offset);
}
@@ -2434,7 +2433,7 @@ void ds5002fp_device::sfr_write(size_t offset, uint8_t data)
mcs51_cpu_device::sfr_write(offset, data);
return;
}
- m_data->write_byte((size_t) offset | 0x100, data);
+ m_data.write_byte((size_t) offset | 0x100, data);
}
uint8_t ds5002fp_device::sfr_read(size_t offset)
@@ -2455,7 +2454,7 @@ uint8_t ds5002fp_device::sfr_read(size_t offset)
default:
return mcs51_cpu_device::sfr_read(offset);
}
- return m_data->read_byte((size_t) offset | 0x100);
+ return m_data.read_byte((size_t) offset | 0x100);
}
/*
diff --git a/src/devices/cpu/mcs51/mcs51.h b/src/devices/cpu/mcs51/mcs51.h
index 169cf77c11a..b273903bf00 100644
--- a/src/devices/cpu/mcs51/mcs51.h
+++ b/src/devices/cpu/mcs51/mcs51.h
@@ -148,10 +148,9 @@ protected:
virtual uint8_t sfr_read(size_t offset);
/* Memory spaces */
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_program;
+ memory_access< 9, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<17, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
devcb_read8::array<4> m_port_in_cb;
devcb_write8::array<4> m_port_out_cb;
diff --git a/src/devices/cpu/mcs96/mcs96.cpp b/src/devices/cpu/mcs96/mcs96.cpp
index 7070645bb52..e1524462f13 100644
--- a/src/devices/cpu/mcs96/mcs96.cpp
+++ b/src/devices/cpu/mcs96/mcs96.cpp
@@ -26,11 +26,11 @@ void mcs96_device::device_start()
{
program = &space(AS_PROGRAM);
if(program->data_width() == 8) {
- auto cache = program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ program->cache(m_cache8);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache8.read_byte(address); };
} else {
- auto cache = program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ program->cache(m_cache16);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
regs = &space(AS_DATA);
diff --git a/src/devices/cpu/mcs96/mcs96.h b/src/devices/cpu/mcs96/mcs96.h
index f24ad31a53b..b27d13044c7 100644
--- a/src/devices/cpu/mcs96/mcs96.h
+++ b/src/devices/cpu/mcs96/mcs96.h
@@ -65,6 +65,8 @@ protected:
address_space_config program_config, regs_config;
address_space *program, *regs;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache8;
+ memory_access<16, 1, 0, ENDIANNESS_LITTLE>::cache m_cache16;
std::function<u8 (offs_t address)> m_pr8;
required_shared_ptr<u16> register_file;
diff --git a/src/devices/cpu/mips/mips3.cpp b/src/devices/cpu/mips/mips3.cpp
index 62fa0c4b77f..56d25c5f73a 100644
--- a/src/devices/cpu/mips/mips3.cpp
+++ b/src/devices/cpu/mips/mips3.cpp
@@ -401,30 +401,30 @@ void mips3_device::device_start()
{
if (m_data_bits == 32)
{
- auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache32le);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache32le.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache32le.read_ptr(address); };
}
else
{
- auto cache = m_program->cache<3, 0, ENDIANNESS_LITTLE>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache64le);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache64le.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache64le.read_ptr(address); };
}
}
else
{
if (m_data_bits == 32)
{
- auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache32be);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache32be.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache32be.read_ptr(address); };
}
else
{
- auto cache = m_program->cache<3, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache64be);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache64be.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache64be.read_ptr(address); };
}
}
diff --git a/src/devices/cpu/mips/mips3.h b/src/devices/cpu/mips/mips3.h
index 6f4081bcb61..9a6be2c98f6 100644
--- a/src/devices/cpu/mips/mips3.h
+++ b/src/devices/cpu/mips/mips3.h
@@ -401,6 +401,11 @@ protected:
uint8_t *m_icache;
address_space_config m_program_config;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache32le;
+ memory_access<32, 3, 0, ENDIANNESS_LITTLE>::cache m_cache64le;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache32be;
+ memory_access<32, 3, 0, ENDIANNESS_BIG>::cache m_cache64be;
+
mips3_flavor m_flavor;
/* internal stuff */
diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
index 8152f8f97c7..198ce26b619 100644
--- a/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
+++ b/src/devices/cpu/nanoprocessor/nanoprocessor.cpp
@@ -80,9 +80,9 @@ void hp_nanoprocessor_device::device_start()
state_add(NANO_REG_ISR, "ISR", m_reg_ISR).formatstr("%03X");
state_add(STATE_GENFLAGS, "GENFLAGS", m_flags).noshow().formatstr("%10s");
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_reg_A));
save_item(NAME(m_reg_R));
@@ -457,12 +457,12 @@ void hp_nanoprocessor_device::execute_one(uint8_t opcode)
switch (opcode & 0xf0) {
case 0x40:
// INA
- m_reg_A = m_io->read_byte(opcode & 0xf);
+ m_reg_A = m_io.read_byte(opcode & 0xf);
break;
case 0x50:
// OTA
- m_io->write_byte(opcode & 0xf, m_reg_A);
+ m_io.write_byte(opcode & 0xf, m_reg_A);
break;
case 0x60:
@@ -477,7 +477,7 @@ void hp_nanoprocessor_device::execute_one(uint8_t opcode)
case 0xc0:
// OTR
- m_io->write_byte(opcode & 0xf, fetch());
+ m_io.write_byte(opcode & 0xf, fetch());
break;
case 0xd0:
@@ -510,7 +510,7 @@ uint16_t hp_nanoprocessor_device::pa_offset(unsigned off) const
uint8_t hp_nanoprocessor_device::fetch(void)
{
- uint8_t res = m_cache->read_byte(m_reg_PA);
+ uint8_t res = m_cache.read_byte(m_reg_PA);
m_reg_PA = pa_offset(1);
return res;
}
diff --git a/src/devices/cpu/nanoprocessor/nanoprocessor.h b/src/devices/cpu/nanoprocessor/nanoprocessor.h
index b172d3e1b6d..e5260a950e6 100644
--- a/src/devices/cpu/nanoprocessor/nanoprocessor.h
+++ b/src/devices/cpu/nanoprocessor/nanoprocessor.h
@@ -113,9 +113,9 @@ private:
address_space_config m_program_config;
address_space_config m_io_config;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_io;
+ memory_access<11, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<11, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 4, 0, 0, ENDIANNESS_BIG>::specific m_io;
// device_t overrides
virtual void device_start() override;
diff --git a/src/devices/cpu/nec/nec.cpp b/src/devices/cpu/nec/nec.cpp
index 09469dcad16..2a9546977c2 100644
--- a/src/devices/cpu/nec/nec.cpp
+++ b/src/devices/cpu/nec/nec.cpp
@@ -497,19 +497,19 @@ void nec_common_device::device_start()
m_program = &space(AS_PROGRAM);
if (m_program->data_width() == 8)
{
- auto cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_dr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_program->cache(m_cache8);
+ m_dr8 = [this](offs_t address) -> u8 { return m_cache8.read_byte(address); };
}
else if (m_chip_type == V33_TYPE)
{
save_item(NAME(m_xa));
- auto cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_dr8 = [cache, this](offs_t address) -> u8 { return cache->read_byte(v33_translate(address)); };
+ m_program->cache(m_cache16);
+ m_dr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(v33_translate(address)); };
}
else
{
- auto cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_dr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_program->cache(m_cache16);
+ m_dr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/nec/nec.h b/src/devices/cpu/nec/nec.h
index 7734c1dd40c..025aecc17fc 100644
--- a/src/devices/cpu/nec/nec.h
+++ b/src/devices/cpu/nec/nec.h
@@ -102,6 +102,9 @@ private:
uint8_t m_halted;
address_space *m_program;
+ memory_access<24, 0, 0, ENDIANNESS_LITTLE>::cache m_cache8;
+ memory_access<24, 1, 0, ENDIANNESS_LITTLE>::cache m_cache16;
+
std::function<u8 (offs_t address)> m_dr8;
address_space *m_io;
int m_icount;
diff --git a/src/devices/cpu/nec/v25.cpp b/src/devices/cpu/nec/v25.cpp
index 9d57b0f2733..f4785ba9af0 100644
--- a/src/devices/cpu/nec/v25.cpp
+++ b/src/devices/cpu/nec/v25.cpp
@@ -621,11 +621,11 @@ void v25_common_device::device_start()
m_program = &space(AS_PROGRAM);
if(m_program->data_width() == 8) {
- auto cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_dr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_program->cache(m_cache8);
+ m_dr8 = [this](offs_t address) -> u8 { return m_cache8.read_byte(address); };
} else {
- auto cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_dr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
+ m_program->cache(m_cache16);
+ m_dr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
}
m_data = &space(AS_DATA);
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/nec/v25.h b/src/devices/cpu/nec/v25.h
index 8d37752c85d..e3cf7e9a80b 100644
--- a/src/devices/cpu/nec/v25.h
+++ b/src/devices/cpu/nec/v25.h
@@ -78,6 +78,9 @@ private:
address_space_config m_data_config;
address_space_config m_io_config;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_cache8;
+ memory_access<20, 1, 0, ENDIANNESS_LITTLE>::cache m_cache16;
+
/* internal RAM and register banks */
required_shared_ptr<uint16_t> m_internal_ram;
diff --git a/src/devices/cpu/pace/pace.cpp b/src/devices/cpu/pace/pace.cpp
index b971edc41fa..2bfba2cc338 100644
--- a/src/devices/cpu/pace/pace.cpp
+++ b/src/devices/cpu/pace/pace.cpp
@@ -65,8 +65,6 @@ ALLOW_SAVE_TYPE(pace_device::cycle);
pace_device::pace_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: cpu_device(mconfig, type, tag, owner, clock)
, m_space_config("program", ENDIANNESS_LITTLE, 16, 16, -1)
- , m_space(nullptr)
- , m_cache(nullptr)
, m_bps_callback(*this)
, m_jc_callback(*this)
, m_flag_callback(*this)
@@ -132,8 +130,8 @@ void pace_device::device_resolve_objects()
void pace_device::device_start()
{
// get memory spaces
- m_space = &space(AS_PROGRAM);
- m_cache = m_space->cache<1, -1, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_space);
set_icountptr(m_icount);
@@ -542,7 +540,7 @@ void pace_device::read_instruction()
// TODO: interrupt check
m_ppc = m_pc;
debugger_instruction_hook(m_pc);
- m_mdr = m_cache->read_word(m_pc++);
+ m_mdr = m_cache.read_word(m_pc++);
m_cir = m_mdr >> 6;
sign_extend(m_mdr);
}
@@ -583,12 +581,7 @@ void pace_device::read_effective_address()
{
// All opcodes with bit 15 set read from an EA except RTS and non-indirect ST
if (m_cir > 0x200 && (m_cir & 0x3c0) != 0x340)
- {
- if ((m_cir & 0x00c) == 0x004)
- m_mdr = m_cache->read_word(m_mar);
- else
- m_mdr = m_space->read_word(m_mar);
- }
+ m_mdr = m_space.read_word(m_mar);
}
@@ -599,10 +592,7 @@ void pace_device::read_effective_address()
void pace_device::write_effective_address(u16 r)
{
- if ((m_cir & 0x00c) == 0x004)
- m_cache->write_word(m_mar, r);
- else
- m_space->write_word(m_mar, r);
+ m_space.write_word(m_mar, r);
}
@@ -733,7 +723,7 @@ pace_device::cycle pace_device::execute_one()
return cycle::IFETCH_M1;
case cycle::LD_IND_M4:
- m_mdr = m_space->read_word(m_mdr);
+ m_mdr = m_space.read_word(m_mdr);
return cycle::LD_IND_M5;
case cycle::LD_IND_M5:
@@ -745,11 +735,11 @@ pace_device::cycle pace_device::execute_one()
return cycle::IFETCH_M1;
case cycle::ST_IND_M4:
- m_space->write_word(m_mdr, m_ac[0]);
+ m_space.write_word(m_mdr, m_ac[0]);
return cycle::IFETCH_M1;
case cycle::LSEX_M4:
- m_mdr = m_space->read_word(m_mdr);
+ m_mdr = m_space.read_word(m_mdr);
sign_extend(m_mdr);
return cycle::IFETCH_M1;
diff --git a/src/devices/cpu/pace/pace.h b/src/devices/cpu/pace/pace.h
index 5af18e3dbe8..c96c38e5c02 100644
--- a/src/devices/cpu/pace/pace.h
+++ b/src/devices/cpu/pace/pace.h
@@ -182,8 +182,8 @@ private:
// address space and cache
address_space_config m_space_config;
- address_space *m_space;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific m_space;
// callback objects
devcb_read_line m_bps_callback;
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.cpp b/src/devices/cpu/pic16c5x/pic16c5x.cpp
index 21907b7d369..715cf574ee1 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.cpp
+++ b/src/devices/cpu/pic16c5x/pic16c5x.cpp
@@ -197,14 +197,14 @@ std::unique_ptr<util::disasm_interface> pic16c5x_device::create_disassembler()
void pic16c5x_device::update_internalram_ptr()
{
- m_internalram = (uint8_t *)m_data->get_write_ptr(0x00);
+ m_internalram = (uint8_t *)space(AS_DATA).get_write_ptr(0x00);
}
-#define PIC16C5x_RDOP(A) (m_cache->read_word(A))
-#define PIC16C5x_RAM_RDMEM(A) ((uint8_t)m_data->read_byte(A))
-#define PIC16C5x_RAM_WRMEM(A,V) (m_data->write_byte(A,V))
+#define PIC16C5x_RDOP(A) (m_program.read_word(A))
+#define PIC16C5x_RAM_RDMEM(A) ((uint8_t)m_data.read_byte(A))
+#define PIC16C5x_RAM_WRMEM(A,V) (m_data.write_byte(A,V))
#define M_RDRAM(A) (((A) < 9) ? m_internalram[A] : PIC16C5x_RAM_RDMEM(A))
#define M_WRTRAM(A,V) do { if ((A) < 9) m_internalram[A] = (V); else PIC16C5x_RAM_WRMEM(A,V); } while (0)
@@ -887,9 +887,8 @@ enum
void pic16c5x_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
+ space(AS_PROGRAM).cache(m_program);
+ space(AS_DATA).specific(m_data);
m_read_a.resolve_safe(0);
m_read_b.resolve_safe(0);
diff --git a/src/devices/cpu/pic16c5x/pic16c5x.h b/src/devices/cpu/pic16c5x/pic16c5x.h
index e9e11b85778..8936a22d3a3 100644
--- a/src/devices/cpu/pic16c5x/pic16c5x.h
+++ b/src/devices/cpu/pic16c5x/pic16c5x.h
@@ -143,9 +143,8 @@ private:
uint8_t m_picRAMmask;
int m_inst_cycles;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
+ memory_access<11, 1, -1, ENDIANNESS_LITTLE>::cache m_program;
+ memory_access< 7, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
// i/o handlers
devcb_read8 m_read_a;
diff --git a/src/devices/cpu/pic16c62x/pic16c62x.cpp b/src/devices/cpu/pic16c62x/pic16c62x.cpp
index 6263fd04f42..166b26b731e 100644
--- a/src/devices/cpu/pic16c62x/pic16c62x.cpp
+++ b/src/devices/cpu/pic16c62x/pic16c62x.cpp
@@ -187,16 +187,16 @@ std::unique_ptr<util::disasm_interface> pic16c62x_device::create_disassembler()
void pic16c62x_device::update_internalram_ptr()
{
- m_internalram = (uint8_t *)m_data->get_write_ptr(0x00);
+ m_internalram = (uint8_t *)m_data.space().get_write_ptr(0x00);
}
-#define PIC16C62x_RDOP(A) (m_cache->read_word(A))
-#define PIC16C62x_RAM_RDMEM(A) ((uint8_t)m_data->read_byte(A))
-#define PIC16C62x_RAM_WRMEM(A,V) (m_data->write_byte(A,V))
-#define PIC16C62x_In(Port) ((uint8_t)m_io->read_byte((Port)))
-#define PIC16C62x_Out(Port,Value) (m_io->write_byte((Port),Value))
+#define PIC16C62x_RDOP(A) (m_cache.read_word(A))
+#define PIC16C62x_RAM_RDMEM(A) ((uint8_t)m_data.read_byte(A))
+#define PIC16C62x_RAM_WRMEM(A,V) (m_data.write_byte(A,V))
+#define PIC16C62x_In(Port) ((uint8_t)m_io.read_byte((Port)))
+#define PIC16C62x_Out(Port,Value) (m_io.write_byte((Port),Value))
/************ Read the state of the T0 Clock input signal ************/
-#define PIC16C62x_T0_In (m_io->read_byte(PIC16C62x_T0) >> 4)
+#define PIC16C62x_T0_In (m_io.read_byte(PIC16C62x_T0) >> 4)
#define M_RDRAM(A) (((A) == 0) ? m_internalram[0] : PIC16C62x_RAM_RDMEM(A))
#define M_WRTRAM(A,V) do { if ((A) == 0) m_internalram[0] = (V); else PIC16C62x_RAM_WRMEM(A,V); } while (0)
@@ -887,10 +887,10 @@ void pic16c62x_device::build_opcode_table(void)
void pic16c62x_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
/* ensure the internal ram pointers are set before get_info is called */
update_internalram_ptr();
diff --git a/src/devices/cpu/pic16c62x/pic16c62x.h b/src/devices/cpu/pic16c62x/pic16c62x.h
index 517191f7f37..d0b9390078f 100644
--- a/src/devices/cpu/pic16c62x/pic16c62x.h
+++ b/src/devices/cpu/pic16c62x/pic16c62x.h
@@ -114,10 +114,10 @@ private:
uint8_t m_picRAMmask;
int m_inst_cycles;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<11, 1, -1, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<11, 1, -1, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access< 5, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
// For debugger
int m_debugger_temp;
diff --git a/src/devices/cpu/powerpc/ppc.h b/src/devices/cpu/powerpc/ppc.h
index 8714fb570aa..8b935f4e58f 100644
--- a/src/devices/cpu/powerpc/ppc.h
+++ b/src/devices/cpu/powerpc/ppc.h
@@ -292,6 +292,8 @@ protected:
address_space_config m_program_config;
address_space *m_program;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache32;
+ memory_access<32, 3, 0, ENDIANNESS_BIG>::cache m_cache64;
uint32_t c_bus_frequency;
struct internal_ppc_state
diff --git a/src/devices/cpu/powerpc/ppccom.cpp b/src/devices/cpu/powerpc/ppccom.cpp
index aaf40f8acac..9624afe4c23 100644
--- a/src/devices/cpu/powerpc/ppccom.cpp
+++ b/src/devices/cpu/powerpc/ppccom.cpp
@@ -722,24 +722,24 @@ void ppc_device::device_start()
m_program = &space(AS_PROGRAM);
if(m_cap & PPCCAP_4XX)
{
- auto cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ m_program->cache(m_cache32);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache32.read_dword(address); };
+ m_prptr = [this](offs_t address) -> const void * { return m_cache32.read_ptr(address); };
}
else
{
- auto cache = m_program->cache<3, 0, ENDIANNESS_BIG>();
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword(address); };
+ m_program->cache(m_cache64);
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache64.read_dword(address); };
if(space_config()->m_endianness != ENDIANNESS_NATIVE)
- m_prptr = [cache](offs_t address) -> const void * {
- const u32 *ptr = static_cast<u32 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u32 *ptr = static_cast<u32 *>(m_cache64.read_ptr(address & ~7));
if(!(address & 4))
ptr++;
return ptr;
};
else
- m_prptr = [cache](offs_t address) -> const void * {
- const u32 *ptr = static_cast<u32 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u32 *ptr = static_cast<u32 *>(m_cache64.read_ptr(address & ~7));
if(address & 4)
ptr++;
return ptr;
diff --git a/src/devices/cpu/pps4/pps4.cpp b/src/devices/cpu/pps4/pps4.cpp
index f17b420a004..7f0b9ba70dd 100644
--- a/src/devices/cpu/pps4/pps4.cpp
+++ b/src/devices/cpu/pps4/pps4.cpp
@@ -123,7 +123,7 @@ device_memory_interface::space_config_vector pps4_device::memory_space_config()
*/
u8 pps4_device::M()
{
- u8 ret = m_data->read_byte(m_B & ~m_SAG);
+ u8 ret = m_data.read_byte(m_B & ~m_SAG);
m_SAG = 0;
return ret;
}
@@ -135,7 +135,7 @@ u8 pps4_device::M()
*/
void pps4_device::W(u8 data)
{
- m_data->write_byte(m_B & ~m_SAG, data);
+ m_data.write_byte(m_B & ~m_SAG, data);
m_SAG = 0;
}
@@ -153,7 +153,7 @@ std::unique_ptr<util::disasm_interface> pps4_device::create_disassembler()
*/
inline u8 pps4_device::ROP()
{
- const u8 op = m_cache->read_byte(m_P & 0xFFF);
+ const u8 op = m_cache.read_byte(m_P & 0xFFF);
m_Ip = m_I1; // save previous opcode
m_P = (m_P + 1) & 0xFFF;
m_icount -= 1;
@@ -169,7 +169,7 @@ inline u8 pps4_device::ROP()
*/
inline u8 pps4_device::ARG()
{
- const u8 arg = m_cache->read_byte(m_P & 0xFFF);
+ const u8 arg = m_cache.read_byte(m_P & 0xFFF);
m_P = (m_P + 1) & 0xFFF;
m_icount -= 1;
return arg;
@@ -1237,9 +1237,9 @@ void pps4_device::iIOL()
{
u8 ac = (~m_A & 15);
m_I2 = ARG();
- m_io->write_byte(m_I2, ac);
+ m_io.write_byte(m_I2, ac);
LOG("%s: port:%02x <- %x\n", __FUNCTION__, m_I2, ac);
- ac = m_io->read_byte(m_I2) & 15;
+ ac = m_io.read_byte(m_I2) & 15;
LOG("%s: port:%02x -> %x\n", __FUNCTION__, m_I2, ac);
m_A = ~ac & 15;
}
@@ -1568,10 +1568,10 @@ void pps4_device::execute_run()
void pps4_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_A));
save_item(NAME(m_X));
@@ -1658,9 +1658,10 @@ void pps4_2_device::device_reset()
READ16_MEMBER(pps4_device::address_bus_r)
{
- if (&space == m_io || &space == m_data)
+ int id = space.spacenum();
+ if (id == AS_IO || id == AS_DATA)
return m_B;
- else if (&space == m_program)
+ else if (id == AS_PROGRAM)
return m_P;
else
return 0;
diff --git a/src/devices/cpu/pps4/pps4.h b/src/devices/cpu/pps4/pps4.h
index e3ca3b012bb..f4047e68e99 100644
--- a/src/devices/cpu/pps4/pps4.h
+++ b/src/devices/cpu/pps4/pps4.h
@@ -79,10 +79,10 @@ protected:
devcb_read8 m_dib_cb;
devcb_write8 m_do_cb;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access< 8, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
u8 m_A; //!< Accumulator A(4:1)
diff --git a/src/devices/cpu/psx/psx.cpp b/src/devices/cpu/psx/psx.cpp
index 58e8997f99b..36f390df5d4 100644
--- a/src/devices/cpu/psx/psx.cpp
+++ b/src/devices/cpu/psx/psx.cpp
@@ -386,7 +386,7 @@ uint8_t psxcpu_device::readbyte( uint32_t address )
{
if( m_bus_attached )
{
- return m_data->read_byte( address );
+ return m_data.read_byte( address );
}
return cache_readword( address ) >> ( ( address & 3 ) * 8 );
@@ -396,7 +396,7 @@ uint16_t psxcpu_device::readhalf( uint32_t address )
{
if( m_bus_attached )
{
- return m_data->read_word( address );
+ return m_data.read_word( address );
}
return cache_readword( address ) >> ( ( address & 2 ) * 8 );
@@ -406,7 +406,7 @@ uint32_t psxcpu_device::readword( uint32_t address )
{
if( m_bus_attached )
{
- return m_data->read_dword( address );
+ return m_data.read_dword( address );
}
return cache_readword( address );
@@ -416,7 +416,7 @@ uint32_t psxcpu_device::readword_masked( uint32_t address, uint32_t mask )
{
if( m_bus_attached )
{
- return m_data->read_dword( address, mask );
+ return m_data.read_dword( address, mask );
}
return cache_readword( address );
@@ -426,7 +426,7 @@ void psxcpu_device::writeword( uint32_t address, uint32_t data )
{
if( m_bus_attached )
{
- m_data->write_dword( address, data );
+ m_data.write_dword( address, data );
}
else
{
@@ -438,7 +438,7 @@ void psxcpu_device::writeword_masked( uint32_t address, uint32_t data, uint32_t
{
if( m_bus_attached )
{
- m_data->write_dword( address, data, mask );
+ m_data.write_dword( address, data, mask );
}
else
{
@@ -1462,7 +1462,7 @@ void psxcpu_device::update_cop0(int reg)
//if (ip & CAUSE_IP5) debugger_interrupt_hook(PSXCPU_IRQ3);
//if (ip & CAUSE_IP6) debugger_interrupt_hook(PSXCPU_IRQ4);
//if (ip & CAUSE_IP7) debugger_interrupt_hook(PSXCPU_IRQ5);
- m_op = m_instruction->read_dword(m_pc);
+ m_op = m_instruction.read_dword(m_pc);
execute_unstoppable_instructions(1);
exception(EXC_INT);
}
@@ -1490,11 +1490,11 @@ void psxcpu_device::fetch_next_op()
{
uint32_t safepc = m_delayv & ~m_bad_word_address_mask;
- m_op = m_instruction->read_dword( safepc );
+ m_op = m_instruction.read_dword( safepc );
}
else
{
- m_op = m_instruction->read_dword( m_pc + 4 );
+ m_op = m_instruction.read_dword( m_pc + 4 );
}
}
@@ -1837,8 +1837,8 @@ void psxcpu_device::device_start()
{
// get our address spaces
m_program = &space( AS_PROGRAM );
- m_instruction = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_data = m_program->specific<2, 0, ENDIANNESS_LITTLE>();
+ m_program->cache(m_instruction);
+ m_program->specific(m_data);
save_item( NAME( m_op ) );
save_item( NAME( m_pc ) );
@@ -2350,7 +2350,7 @@ void psxcpu_device::execute_run()
}
else
{
- m_op = m_instruction->read_dword(m_pc);
+ m_op = m_instruction.read_dword(m_pc);
if( m_berr )
{
diff --git a/src/devices/cpu/psx/psx.h b/src/devices/cpu/psx/psx.h
index 5b57acc4859..57be9a19de9 100644
--- a/src/devices/cpu/psx/psx.h
+++ b/src/devices/cpu/psx/psx.h
@@ -208,8 +208,8 @@ protected:
// address spaces
const address_space_config m_program_config;
address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE>* m_instruction;
- memory_access_specific<2, 0, ENDIANNESS_LITTLE> *m_data;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_instruction;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_data;
// other internal states
int m_icount;
diff --git a/src/devices/cpu/rii/riscii.cpp b/src/devices/cpu/rii/riscii.cpp
index 7e05eb18055..6351cd60073 100644
--- a/src/devices/cpu/rii/riscii.cpp
+++ b/src/devices/cpu/rii/riscii.cpp
@@ -64,9 +64,6 @@ riscii_series_device::riscii_series_device(const machine_config &mconfig, device
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 16, addrbits, -1)
, m_regs_config("register", ENDIANNESS_LITTLE, 8, 8 + bankbits, 0, regs)
- , m_program(nullptr)
- , m_regs(nullptr)
- , m_cache(nullptr)
, m_porta_in_cb(*this)
, m_port_in_cb(*this)
, m_port_out_cb(*this)
@@ -199,9 +196,9 @@ void riscii_series_device::device_resolve_objects()
void riscii_series_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_regs = &space(AS_DATA);
- m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_regs);
if (m_pcmask > 0xffff)
m_pchstack = make_unique_clear<u8[]>(128);
@@ -1022,7 +1019,7 @@ void riscii_series_device::vocon_w(u8 data)
u16 riscii_series_device::fetch_program_word()
{
- return m_cache->read_word(std::exchange(m_pc, (m_pc + 1) & m_pcmask));
+ return m_cache.read_word(std::exchange(m_pc, (m_pc + 1) & m_pcmask));
}
u16 riscii_series_device::get_banked_address(u8 reg)
@@ -1135,14 +1132,14 @@ void riscii_series_device::multi_byte_borrow(u16 addr, bool cy)
void riscii_series_device::execute_move(u8 dstreg, u8 srcreg)
{
- u8 tmp = m_regs->read_byte(get_banked_address(srcreg));
- m_regs->write_byte(get_banked_address(dstreg), tmp);
+ u8 tmp = m_regs.read_byte(get_banked_address(srcreg));
+ m_regs.write_byte(get_banked_address(dstreg), tmp);
}
void riscii_series_device::execute_add(u8 reg, bool a, bool c)
{
u16 addr = get_banked_address(reg);
- u8 data = m_regs->read_byte(addr);
+ u8 data = m_regs.read_byte(addr);
s16 tmp = s16(s8(data)) + s8(m_acc) + (c ? m_status & 0x01 : 0);
bool cy = u16(data) + m_acc + (c ? m_status & 0x01 : 0) >= 0x100;
bool dc = (data & 0x0f) + (m_acc & 0x0f) + (c ? m_status & 0x01 : 0) >= 0x10;
@@ -1150,7 +1147,7 @@ void riscii_series_device::execute_add(u8 reg, bool a, bool c)
acc_w(tmp & 0xff);
else
{
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
multi_byte_carry(addr, cy);
}
m_status = (m_status & 0xc0)
@@ -1165,7 +1162,7 @@ void riscii_series_device::execute_add(u8 reg, bool a, bool c)
void riscii_series_device::execute_sub(u8 reg, bool a, bool c)
{
u16 addr = get_banked_address(reg);
- u8 data = m_regs->read_byte(addr);
+ u8 data = m_regs.read_byte(addr);
s16 tmp = s16(s8(data)) - s8(m_acc) - (c ? ~m_status & 0x01 : 0);
bool cy = u16(data) >= m_acc + (c ? m_status & 0x01 : 0); // borrow is inverted
bool dc = (data & 0x0f) >= (m_acc & 0x0f) + (c ? ~m_status & 0x01 : 0);
@@ -1173,7 +1170,7 @@ void riscii_series_device::execute_sub(u8 reg, bool a, bool c)
acc_w(tmp & 0xff);
else
{
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
multi_byte_borrow(addr, cy);
}
m_status = (m_status & 0xc0)
@@ -1218,7 +1215,7 @@ void riscii_series_device::execute_sub_imm(u8 data, bool c)
void riscii_series_device::execute_adddc(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 data = m_regs->read_byte(addr);
+ u8 data = m_regs.read_byte(addr);
u16 tmp = u16(data) + m_acc + (m_status & 0x01);
bool dc = (data & 0x0f) + (m_acc & 0x0f) + (m_status & 0x01) >= 0x0a;
if (dc)
@@ -1228,7 +1225,7 @@ void riscii_series_device::execute_adddc(u8 reg, bool a)
if (a)
acc_w(tmp & 0xff);
else
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
m_status = (m_status & 0xf8)
| (BIT(tmp, 8) ? 0x01 : 0x00)
| (dc ? 0x02 : 0x00)
@@ -1238,7 +1235,7 @@ void riscii_series_device::execute_adddc(u8 reg, bool a)
void riscii_series_device::execute_subdb(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 data = m_regs->read_byte(addr);
+ u8 data = m_regs.read_byte(addr);
u16 tmp = u16(data) - m_acc - (~m_status & 0x01);
bool dc = (data & 0x0f) + (~m_acc & 0x0f) + (m_status & 0x01) >= 0x0a;
if (dc)
@@ -1248,7 +1245,7 @@ void riscii_series_device::execute_subdb(u8 reg, bool a)
if (a)
acc_w(tmp & 0xff);
else
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
m_status = (m_status & 0xf8)
| (BIT(tmp, 8) ? 0x00 : 0x01) // borrow is inverted
| (dc ? 0x02 : 0x00)
@@ -1257,7 +1254,7 @@ void riscii_series_device::execute_subdb(u8 reg, bool a)
void riscii_series_device::execute_mul(u8 reg)
{
- execute_mul_imm(m_regs->read_byte(get_banked_address(reg)));
+ execute_mul_imm(m_regs.read_byte(get_banked_address(reg)));
}
void riscii_series_device::execute_mul_imm(u8 data)
@@ -1270,11 +1267,11 @@ void riscii_series_device::execute_mul_imm(u8 data)
void riscii_series_device::execute_or(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_acc | m_regs->read_byte(addr);
+ u8 tmp = m_acc | m_regs.read_byte(addr);
if (a)
acc_w(tmp);
else
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
if (tmp == 0)
m_status |= 0x04;
else
@@ -1284,11 +1281,11 @@ void riscii_series_device::execute_or(u8 reg, bool a)
void riscii_series_device::execute_and(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_acc & m_regs->read_byte(addr);
+ u8 tmp = m_acc & m_regs.read_byte(addr);
if (a)
acc_w(tmp);
else
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
if (tmp == 0)
m_status |= 0x04;
else
@@ -1298,11 +1295,11 @@ void riscii_series_device::execute_and(u8 reg, bool a)
void riscii_series_device::execute_xor(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_acc ^ m_regs->read_byte(addr);
+ u8 tmp = m_acc ^ m_regs.read_byte(addr);
if (a)
acc_w(tmp);
else
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
if (tmp == 0)
m_status |= 0x04;
else
@@ -1312,11 +1309,11 @@ void riscii_series_device::execute_xor(u8 reg, bool a)
void riscii_series_device::execute_com(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = ~m_regs->read_byte(addr);
+ u8 tmp = ~m_regs.read_byte(addr);
if (a)
acc_w(tmp);
else
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
if (tmp == 0)
m_status |= 0x04;
else
@@ -1325,41 +1322,41 @@ void riscii_series_device::execute_com(u8 reg, bool a)
void riscii_series_device::execute_clr(u8 reg)
{
- m_regs->write_byte(get_banked_address(reg), 0);
+ m_regs.write_byte(get_banked_address(reg), 0);
m_status |= 0x04;
}
void riscii_series_device::execute_rrc(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u16 tmp = m_regs->read_byte(addr) | u16(m_status & 0x01) << 8;
+ u16 tmp = m_regs.read_byte(addr) | u16(m_status & 0x01) << 8;
if (a)
acc_w(tmp >> 1);
else
- m_regs->write_byte(addr, tmp >> 1);
+ m_regs.write_byte(addr, tmp >> 1);
m_status = (m_status & 0xfe) | (tmp & 0x01);
}
void riscii_series_device::execute_rlc(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u16 tmp = u16(m_regs->read_byte(addr)) << 1 | (m_status & 0x01);
+ u16 tmp = u16(m_regs.read_byte(addr)) << 1 | (m_status & 0x01);
if (a)
acc_w(tmp & 0xff);
else
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
m_status = (m_status & 0xfe) | (tmp >> 8);
}
void riscii_series_device::execute_shra(u8 reg)
{
- u8 tmp = m_regs->read_byte(get_banked_address(reg));
+ u8 tmp = m_regs.read_byte(get_banked_address(reg));
acc_w((tmp >> 1) | (m_status & 0x01) << 7);
}
void riscii_series_device::execute_shla(u8 reg)
{
- u8 tmp = m_regs->read_byte(get_banked_address(reg));
+ u8 tmp = m_regs.read_byte(get_banked_address(reg));
acc_w((tmp << 1) | (m_status & 0x01));
}
@@ -1373,7 +1370,7 @@ void riscii_series_device::execute_call(u32 addr)
// Push PC to the stack region at the end of banked RAM
m_stkptr -= 2;
u16 stkaddr = u16(m_maxbank - (BIT(m_stkptr, 7) ? 0 : 1)) << 8 | 0x80 | (m_stkptr & 0x7e);
- m_regs->write_word(stkaddr, swapendian_int16(m_pc & 0xffff));
+ m_regs.write_word(stkaddr, swapendian_int16(m_pc & 0xffff));
// PCH (on relevant models) must be saved somewhere. This implementation assumes a private buffer is used.
if (m_pcmask > 0xffff)
@@ -1393,12 +1390,12 @@ void riscii_series_device::execute_jcc(bool condition)
void riscii_series_device::execute_jdnz(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr) - 1;
+ u8 tmp = m_regs.read_byte(addr) - 1;
if (a)
acc_w(tmp);
else
{
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
multi_byte_borrow(addr, tmp != 0xff);
}
execute_jcc(tmp != 0);
@@ -1407,12 +1404,12 @@ void riscii_series_device::execute_jdnz(u8 reg, bool a)
void riscii_series_device::execute_jinz(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr) + 1;
+ u8 tmp = m_regs.read_byte(addr) + 1;
if (a)
acc_w(tmp);
else
{
- m_regs->write_byte(addr, tmp);
+ m_regs.write_byte(addr, tmp);
multi_byte_carry(addr, tmp == 0);
}
execute_jcc(tmp != 0);
@@ -1429,17 +1426,17 @@ void riscii_series_device::set_z_acc(u8 tmp)
void riscii_series_device::execute_load(u8 reg)
{
- set_z_acc(m_regs->read_byte(get_banked_address(reg)));
+ set_z_acc(m_regs.read_byte(get_banked_address(reg)));
}
void riscii_series_device::execute_store(u8 reg)
{
- m_regs->write_byte(get_banked_address(reg), m_acc);
+ m_regs.write_byte(get_banked_address(reg), m_acc);
}
void riscii_series_device::execute_test(u8 reg)
{
- u8 tmp = m_regs->read_byte(get_banked_address(reg));
+ u8 tmp = m_regs.read_byte(get_banked_address(reg));
if (tmp == 0)
m_status |= 0x04;
else
@@ -1449,53 +1446,53 @@ void riscii_series_device::execute_test(u8 reg)
void riscii_series_device::execute_swap(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr);
+ u8 tmp = m_regs.read_byte(addr);
if (a)
acc_w((tmp >> 4) | (tmp << 4));
else
- m_regs->write_byte(addr, (tmp >> 4) | (tmp << 4));
+ m_regs.write_byte(addr, (tmp >> 4) | (tmp << 4));
}
void riscii_series_device::execute_jbc(u8 reg, int b)
{
- execute_jcc(!BIT(m_regs->read_byte(get_banked_address(reg)), b));
+ execute_jcc(!BIT(m_regs.read_byte(get_banked_address(reg)), b));
}
void riscii_series_device::execute_jbs(u8 reg, int b)
{
- execute_jcc(BIT(m_regs->read_byte(get_banked_address(reg)), b));
+ execute_jcc(BIT(m_regs.read_byte(get_banked_address(reg)), b));
}
void riscii_series_device::execute_bc(u8 reg, int b)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr) & ~(1 << b);
- m_regs->write_byte(addr, tmp);
+ u8 tmp = m_regs.read_byte(addr) & ~(1 << b);
+ m_regs.write_byte(addr, tmp);
}
void riscii_series_device::execute_bs(u8 reg, int b)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr) | (1 << b);
- m_regs->write_byte(addr, tmp);
+ u8 tmp = m_regs.read_byte(addr) | (1 << b);
+ m_regs.write_byte(addr, tmp);
}
void riscii_series_device::execute_btg(u8 reg, int b)
{
u16 addr = get_banked_address(reg);
- u8 tmp = m_regs->read_byte(addr) ^ (1 << b);
- m_regs->write_byte(addr, tmp);
+ u8 tmp = m_regs.read_byte(addr) ^ (1 << b);
+ m_regs.write_byte(addr, tmp);
}
void riscii_series_device::execute_inc(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u16 tmp = u16(m_regs->read_byte(addr)) + 1;
+ u16 tmp = u16(m_regs.read_byte(addr)) + 1;
if (a)
acc_w(tmp & 0xff);
else
{
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
multi_byte_carry(addr, (tmp >> 8) != 0);
}
m_status = (m_status & 0xfa) | ((tmp & 0xff) == 0 ? 0x04 : 0x00) | (tmp >> 8);
@@ -1504,12 +1501,12 @@ void riscii_series_device::execute_inc(u8 reg, bool a)
void riscii_series_device::execute_dec(u8 reg, bool a)
{
u16 addr = get_banked_address(reg);
- u16 tmp = u16(m_regs->read_byte(addr)) + 0xff;
+ u16 tmp = u16(m_regs.read_byte(addr)) + 0xff;
if (a)
acc_w(tmp & 0xff);
else
{
- m_regs->write_byte(addr, tmp & 0xff);
+ m_regs.write_byte(addr, tmp & 0xff);
multi_byte_borrow(addr, (tmp >> 8) != 0);
}
m_status = (m_status & 0xfa) | ((tmp & 0xff) == 0 ? 0x04 : 0x00) | (tmp >> 8);
@@ -1517,14 +1514,14 @@ void riscii_series_device::execute_dec(u8 reg, bool a)
void riscii_series_device::execute_rpt(u8 reg)
{
- m_repeat = m_regs->read_byte(get_banked_address(reg)) - 1;
+ m_repeat = m_regs.read_byte(get_banked_address(reg)) - 1;
}
void riscii_series_device::execute_ret(bool inte)
{
// Pop PC from the stack region at the end of banked RAM
u16 stkaddr = u16(m_maxbank - (BIT(m_stkptr, 7) ? 0 : 1)) << 8 | 0x80 | (m_stkptr & 0x7e);
- u32 dest = swapendian_int16(m_regs->read_word(stkaddr));
+ u32 dest = swapendian_int16(m_regs.read_word(stkaddr));
if (m_pcmask > 0xffff)
dest |= u32(m_pchstack[m_stkptr >> 1]) << 16;
execute_jump(dest);
@@ -1789,15 +1786,15 @@ void riscii_series_device::execute_cycle1(u16 opcode)
break;
case 0x5500:
- execute_jcc(m_acc >= m_regs->read_byte(get_banked_address(opcode & 0x00ff)));
+ execute_jcc(m_acc >= m_regs.read_byte(get_banked_address(opcode & 0x00ff)));
break;
case 0x5600:
- execute_jcc(m_acc <= m_regs->read_byte(get_banked_address(opcode & 0x00ff)));
+ execute_jcc(m_acc <= m_regs.read_byte(get_banked_address(opcode & 0x00ff)));
break;
case 0x5700:
- execute_jcc(m_acc == m_regs->read_byte(get_banked_address(opcode & 0x00ff)));
+ execute_jcc(m_acc == m_regs.read_byte(get_banked_address(opcode & 0x00ff)));
break;
case 0x5800: case 0x5900: case 0x5a00: case 0x5b00:
@@ -1837,13 +1834,13 @@ void riscii_series_device::execute_tbrd(u32 ptr)
u32 memaddr = (ptr & 0x7ffffe) >> 1;
if (!BIT(ptr, 23))
memaddr &= m_pcmask;
- u16 data = m_program->read_word(memaddr);
+ u16 data = m_program.read_word(memaddr);
if (BIT(ptr, 0))
data >>= 8;
else
data &= 0x00ff;
LOGMASKED(LOG_TBRD, "%05X: TBRD(%06Xh) = %02Xh -> %02X:%02Xh\n", m_ppc, ptr, data, addr >> 8, addr & 0x00ff);
- m_regs->write_byte(addr, data);
+ m_regs.write_byte(addr, data);
if (m_repeat != 0)
--m_repeat;
diff --git a/src/devices/cpu/rii/riscii.h b/src/devices/cpu/rii/riscii.h
index 48725211e94..1acc09e4862 100644
--- a/src/devices/cpu/rii/riscii.h
+++ b/src/devices/cpu/rii/riscii.h
@@ -287,9 +287,9 @@ private:
// address spaces
address_space_config m_program_config;
address_space_config m_regs_config;
- address_space *m_program;
- address_space *m_regs;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<22, 1, -1, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<22, 1, -1, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<13, 0, 0, ENDIANNESS_LITTLE>::specific m_regs;
// device callbacks
devcb_read8 m_porta_in_cb;
diff --git a/src/devices/cpu/rsp/rsp.cpp b/src/devices/cpu/rsp/rsp.cpp
index 17b1682b8bd..07deffc6e10 100644
--- a/src/devices/cpu/rsp/rsp.cpp
+++ b/src/devices/cpu/rsp/rsp.cpp
@@ -78,7 +78,7 @@ DEFINE_DEVICE_TYPE(RSP, rsp_device, "rsp", "Nintendo & SGI Reality Signal Proces
#define CLEAR_ZERO_FLAG(x) { m_vflag[ZERO][x & 7] = 0; }
#define CLEAR_CLIP2_FLAG(x) { m_vflag[CLIP2][x & 7] = 0; }
-#define ROPCODE(pc) m_program->read_dword(pc)
+#define ROPCODE(pc) m_pcache.read_dword(pc)
/***************************************************************************
@@ -232,7 +232,7 @@ uint8_t rsp_device::READ8(uint32_t address)
{
uint8_t ret;
address &= 0xfff;
- ret = m_program->read_byte(address);
+ ret = m_program.read_byte(address);
//printf("R8:%08x=%02x\n", address, ret);
return ret;
}
@@ -242,7 +242,7 @@ uint16_t rsp_device::READ16(uint32_t address)
uint16_t ret;
address &= 0xfff;
- ret = (m_program->read_byte(address) << 8) | (m_program->read_byte(address + 1) & 0xff);
+ ret = (m_program.read_byte(address) << 8) | (m_program.read_byte(address + 1) & 0xff);
//printf("R16:%08x=%04x\n", address, ret);
return ret;
@@ -253,10 +253,10 @@ uint32_t rsp_device::READ32(uint32_t address)
uint32_t ret;
address &= 0xfff;
- ret = (m_program->read_byte(address) << 24) |
- (m_program->read_byte(address + 1) << 16) |
- (m_program->read_byte(address + 2) << 8) |
- (m_program->read_byte(address + 3) << 0);
+ ret = (m_program.read_byte(address) << 24) |
+ (m_program.read_byte(address + 1) << 16) |
+ (m_program.read_byte(address + 2) << 8) |
+ (m_program.read_byte(address + 3) << 0);
//printf("R32:%08x=%08x\n", address, ret);
return ret;
@@ -265,7 +265,7 @@ uint32_t rsp_device::READ32(uint32_t address)
void rsp_device::WRITE8(uint32_t address, uint8_t data)
{
address &= 0xfff;
- m_program->write_byte(address, data);
+ m_program.write_byte(address, data);
//printf("W8:%08x=%02x\n", address, data);
}
@@ -273,8 +273,8 @@ void rsp_device::WRITE16(uint32_t address, uint16_t data)
{
address &= 0xfff;
- m_program->write_byte(address, data >> 8);
- m_program->write_byte(address + 1, data & 0xff);
+ m_program.write_byte(address, data >> 8);
+ m_program.write_byte(address + 1, data & 0xff);
//printf("W16:%08x=%04x\n", address, data);
}
@@ -282,10 +282,10 @@ void rsp_device::WRITE32(uint32_t address, uint32_t data)
{
address &= 0xfff;
- m_program->write_byte(address, data >> 24);
- m_program->write_byte(address + 1, (data >> 16) & 0xff);
- m_program->write_byte(address + 2, (data >> 8) & 0xff);
- m_program->write_byte(address + 3, data & 0xff);
+ m_program.write_byte(address, data >> 24);
+ m_program.write_byte(address + 1, (data >> 16) & 0xff);
+ m_program.write_byte(address + 2, (data >> 8) & 0xff);
+ m_program.write_byte(address + 3, data & 0xff);
//printf("W32:%08x=%08x\n", address, data);
}
@@ -381,8 +381,8 @@ void rsp_device::device_start()
if (LOG_INSTRUCTION_EXECUTION)
m_exec_output = fopen("rsp_execute.txt", "wt");
- m_program = &space(AS_PROGRAM);
- m_pcache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_pcache);
+ space(AS_PROGRAM).specific(m_program);
resolve_cb();
if (m_isdrc)
diff --git a/src/devices/cpu/rsp/rsp.h b/src/devices/cpu/rsp/rsp.h
index 10fa70801ce..5383889cdd3 100644
--- a/src/devices/cpu/rsp/rsp.h
+++ b/src/devices/cpu/rsp/rsp.h
@@ -218,9 +218,9 @@ private:
uint32_t m_ppc;
uint32_t m_nextpc;
- address_space *m_program;
protected:
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_pcache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_pcache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_program;
private:
std::unique_ptr<cop2> m_cop2;
diff --git a/src/devices/cpu/rsp/rspdrc.cpp b/src/devices/cpu/rsp/rspdrc.cpp
index a91db94ceeb..c9ec2bcb4b3 100644
--- a/src/devices/cpu/rsp/rspdrc.cpp
+++ b/src/devices/cpu/rsp/rspdrc.cpp
@@ -405,7 +405,7 @@ void rsp_device::code_compile_block(offs_t pc)
}
/* validate this code block if we're not pointing into ROM */
- if (m_program->get_write_ptr(seqhead->physpc) != nullptr)
+ if (m_program.space().get_write_ptr(seqhead->physpc) != nullptr)
generate_checksum_block(block, compiler, seqhead, seqlast);
/* label this instruction, if it may be jumped to locally */
@@ -654,12 +654,12 @@ void rsp_device::generate_checksum_block(drcuml_block &block, compiler_state &co
if (!(seqhead->flags & OPFLAG_VIRTUAL_NOOP))
{
uint32_t sum = seqhead->opptr.l[0];
- void *base = m_pcache->read_ptr(seqhead->physpc | 0x1000);
+ void *base = m_pcache.read_ptr(seqhead->physpc | 0x1000);
UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
if (seqhead->delay.first() != nullptr && seqhead->physpc != seqhead->delay.first()->physpc)
{
- base = m_pcache->read_ptr((seqhead->delay.first()->physpc & 0x00000fff) | 0x1000);
+ base = m_pcache.read_ptr((seqhead->delay.first()->physpc & 0x00000fff) | 0x1000);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@@ -676,13 +676,13 @@ void rsp_device::generate_checksum_block(drcuml_block &block, compiler_state &co
else
{
uint32_t sum = 0;
- void *base = m_pcache->read_ptr(seqhead->physpc | 0x1000);
+ void *base = m_pcache.read_ptr(seqhead->physpc | 0x1000);
UML_LOAD(block, I0, base, 0, SIZE_DWORD, SCALE_x4); // load i0,base,0,dword
sum += seqhead->opptr.l[0];
for (curdesc = seqhead->next(); curdesc != seqlast->next(); curdesc = curdesc->next())
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
- base = m_pcache->read_ptr(curdesc->physpc | 0x1000);
+ base = m_pcache.read_ptr(curdesc->physpc | 0x1000);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
@@ -690,7 +690,7 @@ void rsp_device::generate_checksum_block(drcuml_block &block, compiler_state &co
if (curdesc->delay.first() != nullptr && (curdesc == seqlast || (curdesc->next() != nullptr && curdesc->next()->physpc != curdesc->delay.first()->physpc)))
{
- base = m_pcache->read_ptr((curdesc->delay.first()->physpc & 0x00000fff) | 0x1000);
+ base = m_pcache.read_ptr((curdesc->delay.first()->physpc & 0x00000fff) | 0x1000);
assert(base != nullptr);
UML_LOAD(block, I1, base, 0, SIZE_DWORD, SCALE_x4); // load i1,base,dword
UML_ADD(block, I0, I0, I1); // add i0,i0,i1
diff --git a/src/devices/cpu/rsp/rspfe.cpp b/src/devices/cpu/rsp/rspfe.cpp
index bb7fbfebd47..83778386a0e 100644
--- a/src/devices/cpu/rsp/rspfe.cpp
+++ b/src/devices/cpu/rsp/rspfe.cpp
@@ -38,7 +38,7 @@ bool rsp_device::frontend::describe(opcode_desc &desc, const opcode_desc *prev)
uint32_t op, opswitch;
// fetch the opcode
- op = desc.opptr.l[0] = m_rsp.m_pcache->read_dword((desc.physpc & 0x00000fff) | 0x1000);
+ op = desc.opptr.l[0] = m_rsp.m_pcache.read_dword((desc.physpc & 0x00000fff) | 0x1000);
// all instructions are 4 bytes and default to a single cycle each
desc.length = 4;
diff --git a/src/devices/cpu/rx01/rx01.cpp b/src/devices/cpu/rx01/rx01.cpp
index 18053c7069a..58f90dba842 100644
--- a/src/devices/cpu/rx01/rx01.cpp
+++ b/src/devices/cpu/rx01/rx01.cpp
@@ -39,8 +39,6 @@ rx01_cpu_device::rx01_cpu_device(const machine_config &mconfig, const char *tag,
: cpu_device(mconfig, RX01_CPU, tag, owner, clock)
, m_inst_config("program", ENDIANNESS_LITTLE, 8, 12, 0)
, m_data_config("sector data", ENDIANNESS_LITTLE, 8, 10, 0) // actually 1 bit wide
- , m_inst_cache(nullptr)
- , m_data_cache(nullptr)
, m_pc(0)
, m_ppc(0)
, m_mb(0)
@@ -77,8 +75,8 @@ device_memory_interface::space_config_vector rx01_cpu_device::memory_space_confi
void rx01_cpu_device::device_start()
{
- m_inst_cache = space(AS_PROGRAM).cache<0, 0, ENDIANNESS_LITTLE>();
- m_data_cache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_inst_cache);
+ space(AS_DATA).cache(m_data_cache);
set_icountptr(m_icount);
@@ -137,7 +135,7 @@ u8 rx01_cpu_device::mux_out()
if (BIT(m_mb, 0))
return m_sp[m_spar];
else
- return m_inst_cache->read_byte(m_pc);
+ return m_inst_cache.read_byte(m_pc);
}
bool rx01_cpu_device::data_in()
@@ -243,7 +241,7 @@ bool rx01_cpu_device::test_condition()
if (m_flags & FF_WRTBUF)
return sec_buf_in();
else
- return m_data_cache->read_byte(m_bar) & 1;
+ return m_data_cache.read_byte(m_bar) & 1;
case 074:
// Flag state equals one
@@ -259,7 +257,7 @@ bool rx01_cpu_device::test_condition()
void rx01_cpu_device::set_bar(u16 bar)
{
if (m_bar != bar && (m_flags & FF_WRTBUF))
- m_data_cache->write_byte(m_bar, sec_buf_in());
+ m_data_cache.write_byte(m_bar, sec_buf_in());
m_bar = bar;
}
@@ -303,7 +301,7 @@ void rx01_cpu_device::execute_run()
m_ppc = m_pc;
debugger_instruction_hook(m_pc);
- m_mb = m_inst_cache->read_byte(m_pc);
+ m_mb = m_inst_cache.read_byte(m_pc);
m_pc = (m_pc + 1) & 03777;
}
@@ -398,7 +396,7 @@ void rx01_cpu_device::execute_run()
m_flags |= FF_WRTBUF;
else if (m_flags & FF_WRTBUF)
{
- m_data_cache->write_byte(m_bar, sec_buf_in());
+ m_data_cache.write_byte(m_bar, sec_buf_in());
m_flags &= ~FF_WRTBUF;
}
break;
diff --git a/src/devices/cpu/rx01/rx01.h b/src/devices/cpu/rx01/rx01.h
index 1b138472b04..2b990e96867 100644
--- a/src/devices/cpu/rx01/rx01.h
+++ b/src/devices/cpu/rx01/rx01.h
@@ -70,8 +70,8 @@ private:
// address spaces
address_space_config m_inst_config;
address_space_config m_data_config;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_inst_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_data_cache;
+ memory_access<12, 0, 0, ENDIANNESS_LITTLE>::cache m_inst_cache;
+ memory_access<10, 0, 0, ENDIANNESS_LITTLE>::cache m_data_cache;
// internal state
u16 m_pc;
diff --git a/src/devices/cpu/s2650/s2650.cpp b/src/devices/cpu/s2650/s2650.cpp
index 9e36a1c8ae1..ccdc5694cd2 100644
--- a/src/devices/cpu/s2650/s2650.cpp
+++ b/src/devices/cpu/s2650/s2650.cpp
@@ -36,7 +36,7 @@ s2650_device::s2650_device(const machine_config &mconfig, const char *tag, devic
, m_sense_handler(*this)
, m_flag_handler(*this), m_intack_handler(*this)
, m_ppc(0), m_page(0), m_iar(0), m_ea(0), m_psl(0), m_psu(0), m_r(0)
- , m_halt(0), m_ir(0), m_irq_state(0), m_icount(0), m_cache(nullptr)
+ , m_halt(0), m_ir(0), m_irq_state(0), m_icount(0)
, m_debugger_temp(0)
{
memset(m_reg, 0x00, sizeof(m_reg));
@@ -167,7 +167,7 @@ static const int S2650_relative[0x100] =
* RDMEM
* read memory byte from addr
***************************************************************/
-#define RDMEM(addr) space(AS_PROGRAM).read_byte(addr)
+#define RDMEM(addr) m_program.read_byte(addr)
inline void s2650_device::set_psu(uint8_t new_val)
{
@@ -264,7 +264,7 @@ inline int s2650_device::check_irq_line()
***************************************************************/
inline uint8_t s2650_device::ROP()
{
- uint8_t result = m_cache->read_byte(m_page + m_iar);
+ uint8_t result = m_cprogram.read_byte(m_page + m_iar);
m_iar = (m_iar + 1) & PMSK;
return result;
}
@@ -275,7 +275,7 @@ inline uint8_t s2650_device::ROP()
***************************************************************/
inline uint8_t s2650_device::ARG()
{
- uint8_t result = m_cache->read_byte(m_page + m_iar);
+ uint8_t result = m_cprogram.read_byte(m_page + m_iar);
m_iar = (m_iar + 1) & PMSK;
return result;
}
@@ -561,7 +561,7 @@ inline uint8_t s2650_device::ARG()
* Store source register to memory addr (CC unchanged)
***************************************************************/
#define M_STR(address,source) \
- space(AS_PROGRAM).write_byte(address, source)
+ m_program.write_byte(address, source)
/***************************************************************
* M_AND
@@ -824,7 +824,10 @@ void s2650_device::device_start()
m_flag_handler.resolve_safe();
m_intack_handler.resolve_safe(0x00);
- m_cache = space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cprogram);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_ppc));
save_item(NAME(m_page));
@@ -1124,7 +1127,7 @@ void s2650_device::execute_run()
case 0x32: /* REDC,2 */
case 0x33: /* REDC,3 */
m_icount -= 6;
- m_reg[m_r] = space(AS_DATA).read_byte(S2650_CTRL_PORT);
+ m_reg[m_r] = m_data.read_byte(S2650_CTRL_PORT);
SET_CC( m_reg[m_r] );
break;
@@ -1214,7 +1217,7 @@ void s2650_device::execute_run()
case 0x56: /* REDE,2 v */
case 0x57: /* REDE,3 v */
m_icount -= 9;
- m_reg[m_r] = space(AS_IO).read_byte(ARG());
+ m_reg[m_r] = m_io.read_byte(ARG());
SET_CC(m_reg[m_r]);
break;
@@ -1273,7 +1276,7 @@ void s2650_device::execute_run()
case 0x72: /* REDD,2 */
case 0x73: /* REDD,3 */
m_icount -= 6;
- m_reg[m_r] = space(AS_DATA).read_byte(S2650_DATA_PORT);
+ m_reg[m_r] = m_data.read_byte(S2650_DATA_PORT);
SET_CC(m_reg[m_r]);
break;
@@ -1429,7 +1432,7 @@ void s2650_device::execute_run()
case 0xb2: /* WRTC,2 */
case 0xb3: /* WRTC,3 */
m_icount -= 6;
- space(AS_DATA).write_byte(S2650_CTRL_PORT,m_reg[m_r]);
+ m_data.write_byte(S2650_CTRL_PORT,m_reg[m_r]);
break;
case 0xb4: /* TPSU */
@@ -1515,7 +1518,7 @@ void s2650_device::execute_run()
case 0xd6: /* WRTE,2 v */
case 0xd7: /* WRTE,3 v */
m_icount -= 9;
- space(AS_IO).write_byte( ARG(), m_reg[m_r] );
+ m_io.write_byte( ARG(), m_reg[m_r] );
break;
case 0xd8: /* BIRR,0 (*)a */
@@ -1573,7 +1576,7 @@ void s2650_device::execute_run()
case 0xf2: /* WRTD,2 */
case 0xf3: /* WRTD,3 */
m_icount -= 6;
- space(AS_DATA).write_byte(S2650_DATA_PORT, m_reg[m_r]);
+ m_data.write_byte(S2650_DATA_PORT, m_reg[m_r]);
break;
case 0xf4: /* TMI,0 v */
diff --git a/src/devices/cpu/s2650/s2650.h b/src/devices/cpu/s2650/s2650.h
index 1bd42fa535c..008ea0bb31f 100644
--- a/src/devices/cpu/s2650/s2650.h
+++ b/src/devices/cpu/s2650/s2650.h
@@ -84,7 +84,10 @@ private:
uint8_t m_irq_state;
int m_icount;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<15, 0, 0, ENDIANNESS_BIG>::cache m_cprogram;
+ memory_access<15, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 1, 0, 0, ENDIANNESS_BIG>::specific m_data;
+ memory_access< 8, 0, 0, ENDIANNESS_BIG>::specific m_io;
// For debugger
uint16_t m_debugger_temp;
diff --git a/src/devices/cpu/saturn/satops.ipp b/src/devices/cpu/saturn/satops.ipp
index 87632ca859b..0232f84a9c7 100644
--- a/src/devices/cpu/saturn/satops.ipp
+++ b/src/devices/cpu/saturn/satops.ipp
@@ -14,7 +14,7 @@
inline int saturn_device::READ_OP()
{
m_icount-=3;
- const uint8_t data=m_cache->read_byte(m_pc);
+ const uint8_t data=m_cache.read_byte(m_pc);
saturn_assert(data<0x10);
m_pc=(m_pc+1)&0xfffff;
return data;
@@ -23,7 +23,7 @@ inline int saturn_device::READ_OP()
inline int saturn_device::READ_OP_ARG()
{
m_icount-=3;
- const uint8_t data=m_cache->read_byte(m_pc);
+ const uint8_t data=m_cache.read_byte(m_pc);
saturn_assert(data<0x10);
m_pc=(m_pc+1)&0xfffff;
return data;
@@ -83,7 +83,7 @@ inline int saturn_device::READ_OP_ARG20()
inline int saturn_device::READ_NIBBLE(uint32_t adr)
{
m_icount-=3;
- const uint8_t data=m_program->read_byte(adr&0xfffff);
+ const uint8_t data=m_program.read_byte(adr&0xfffff);
saturn_assert(data<0x10);
m_crc_func(adr&0xfffff, data, 0xffffffff);
return data;
@@ -127,7 +127,7 @@ inline void saturn_device::WRITE_NIBBLE(uint32_t adr, uint8_t nib)
{
m_icount-=3;
saturn_assert(nib<0x10);
- m_program->write_byte(adr&0xfffff,nib);
+ m_program.write_byte(adr&0xfffff,nib);
}
inline int saturn_device::S64_READ_X(int r)
diff --git a/src/devices/cpu/saturn/saturn.cpp b/src/devices/cpu/saturn/saturn.cpp
index 004c0c09994..c7baae6770f 100644
--- a/src/devices/cpu/saturn/saturn.cpp
+++ b/src/devices/cpu/saturn/saturn.cpp
@@ -56,7 +56,6 @@ saturn_device::saturn_device(const machine_config &mconfig, const char *tag, dev
, m_pc(0), m_oldpc(0), m_p(0), m_out(0), m_carry(0), m_decimal(0), m_st(0), m_hst(0)
, m_nmi_state(0), m_irq_state(0), m_irq_enable(0), m_in_irq(0), m_pending_irq(0)
, m_sleeping(0), m_monitor_id(0), m_monitor_in(0)
- , m_program(nullptr), m_cache(nullptr)
, m_icount(0)
, m_debugger_temp(0)
{
@@ -95,8 +94,8 @@ std::unique_ptr<util::disasm_interface> saturn_device::create_disassembler()
void saturn_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
m_out_func.resolve_safe();
m_in_func.resolve_safe(0);
diff --git a/src/devices/cpu/saturn/saturn.h b/src/devices/cpu/saturn/saturn.h
index a50742f7508..5111de6d7ed 100644
--- a/src/devices/cpu/saturn/saturn.h
+++ b/src/devices/cpu/saturn/saturn.h
@@ -137,8 +137,8 @@ private:
uint8_t m_sleeping; /* low-consumption state */
int m_monitor_id;
int m_monitor_in;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount;
int64_t m_debugger_temp;
diff --git a/src/devices/cpu/sc61860/sc61860.cpp b/src/devices/cpu/sc61860/sc61860.cpp
index bfb39ee305a..bd99080a9b5 100644
--- a/src/devices/cpu/sc61860/sc61860.cpp
+++ b/src/devices/cpu/sc61860/sc61860.cpp
@@ -109,8 +109,8 @@ void sc61860_device::device_start()
m_2ms_tick_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sc61860_device::sc61860_2ms_tick), this));
m_2ms_tick_timer->adjust(attotime::from_hz(500), 0, attotime::from_hz(500));
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
m_reset.resolve();
m_brk.resolve();
m_x.resolve();
diff --git a/src/devices/cpu/sc61860/sc61860.h b/src/devices/cpu/sc61860/sc61860.h
index 081f9230be0..df019b6b845 100644
--- a/src/devices/cpu/sc61860/sc61860.h
+++ b/src/devices/cpu/sc61860/sc61860.h
@@ -111,8 +111,9 @@ private:
struct { int t2ms, t512ms; int count; } m_timer;
emu_timer *m_2ms_tick_timer;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
+
int m_icount;
uint8_t m_ram[0x100]; // internal special ram, should be 0x60, 0x100 to avoid memory corruption for now
diff --git a/src/devices/cpu/sc61860/scops.hxx b/src/devices/cpu/sc61860/scops.hxx
index 4ceec0df223..23c122ac55f 100644
--- a/src/devices/cpu/sc61860/scops.hxx
+++ b/src/devices/cpu/sc61860/scops.hxx
@@ -18,29 +18,29 @@
uint8_t sc61860_device::READ_OP()
{
- return m_cache->read_byte(m_pc++);
+ return m_cache.read_byte(m_pc++);
}
uint8_t sc61860_device::READ_OP_ARG()
{
- return m_cache->read_byte(m_pc++);
+ return m_cache.read_byte(m_pc++);
}
uint16_t sc61860_device::READ_OP_ARG_WORD()
{
- uint16_t t=m_cache->read_byte(m_pc++)<<8;
- t|=m_cache->read_byte(m_pc++);
+ uint16_t t=m_cache.read_byte(m_pc++)<<8;
+ t|=m_cache.read_byte(m_pc++);
return t;
}
uint8_t sc61860_device::READ_BYTE(uint16_t adr)
{
- return m_program->read_byte(adr);
+ return m_program.read_byte(adr);
}
void sc61860_device::WRITE_BYTE(uint16_t a, uint8_t v)
{
- m_program->write_byte(a, v);
+ m_program.write_byte(a, v);
}
uint8_t sc61860_device::READ_RAM(int r)
diff --git a/src/devices/cpu/scmp/scmp.cpp b/src/devices/cpu/scmp/scmp.cpp
index fdcd8dd75fd..a9021737300 100644
--- a/src/devices/cpu/scmp/scmp.cpp
+++ b/src/devices/cpu/scmp/scmp.cpp
@@ -31,7 +31,7 @@ scmp_device::scmp_device(const machine_config &mconfig, const char *tag, device_
scmp_device::scmp_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: cpu_device(mconfig, type, tag, owner, clock)
, m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0)
- , m_AC(0), m_ER(0), m_SR(0), m_program(nullptr), m_cache(nullptr), m_icount(0)
+ , m_AC(0), m_ER(0), m_SR(0), m_icount(0)
, m_flag_out_func(*this)
, m_sout_func(*this)
, m_sin_func(*this)
@@ -70,24 +70,24 @@ uint8_t scmp_device::ROP()
{
uint16_t pc = m_PC.w.l;
m_PC.w.l = ADD12(m_PC.w.l,1);
- return m_cache->read_byte( pc);
+ return m_cache.read_byte( pc);
}
uint8_t scmp_device::ARG()
{
uint16_t pc = m_PC.w.l;
m_PC.w.l = ADD12(m_PC.w.l,1);
- return m_cache->read_byte(pc);
+ return m_cache.read_byte(pc);
}
uint8_t scmp_device::RM(uint32_t a)
{
- return m_program->read_byte(a);
+ return m_program.read_byte(a);
}
void scmp_device::WM(uint32_t a, uint8_t v)
{
- m_program->write_byte(a, v);
+ m_program.write_byte(a, v);
}
void scmp_device::illegal(uint8_t opcode)
@@ -502,8 +502,8 @@ void scmp_device::device_start()
state_add(SCMP_SR, "SR", m_SR);
}
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
/* resolve callbacks */
m_flag_out_func.resolve_safe();
diff --git a/src/devices/cpu/scmp/scmp.h b/src/devices/cpu/scmp/scmp.h
index 5d9167d65fd..7145973bdb1 100644
--- a/src/devices/cpu/scmp/scmp.h
+++ b/src/devices/cpu/scmp/scmp.h
@@ -58,8 +58,8 @@ private:
uint8_t m_ER;
uint8_t m_SR;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount;
devcb_write8 m_flag_out_func;
diff --git a/src/devices/cpu/score/score.cpp b/src/devices/cpu/score/score.cpp
index bf5b434cb06..a8666ac5828 100644
--- a/src/devices/cpu/score/score.cpp
+++ b/src/devices/cpu/score/score.cpp
@@ -72,8 +72,8 @@ score7_cpu_device::score7_cpu_device(const machine_config &mconfig, const char *
void score7_cpu_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
// set our instruction counter
set_icountptr(m_icount);
@@ -283,37 +283,37 @@ int32_t score7_cpu_device::sign_extend(uint32_t data, uint8_t len)
uint32_t score7_cpu_device::fetch()
{
- return m_cache->read_dword(m_pc & ~3);
+ return m_cache.read_dword(m_pc & ~3);
}
uint8_t score7_cpu_device::read_byte(offs_t offset)
{
- return m_program->read_byte(offset);
+ return m_program.read_byte(offset);
}
uint16_t score7_cpu_device::read_word(offs_t offset)
{
- return m_program->read_word(offset & ~1);
+ return m_program.read_word(offset & ~1);
}
uint32_t score7_cpu_device::read_dword(offs_t offset)
{
- return m_program->read_dword(offset & ~3);
+ return m_program.read_dword(offset & ~3);
}
void score7_cpu_device::write_byte(offs_t offset, uint8_t data)
{
- m_program->write_byte(offset, data);
+ m_program.write_byte(offset, data);
}
void score7_cpu_device::write_word(offs_t offset, uint16_t data)
{
- m_program->write_word(offset & ~1, data);
+ m_program.write_word(offset & ~1, data);
}
void score7_cpu_device::write_dword(offs_t offset, uint32_t data)
{
- m_program->write_dword(offset & ~3, data);
+ m_program.write_dword(offset & ~3, data);
}
void score7_cpu_device::check_irq()
diff --git a/src/devices/cpu/score/score.h b/src/devices/cpu/score/score.h
index b8f8c1680cd..0760b3779a8 100644
--- a/src/devices/cpu/score/score.h
+++ b/src/devices/cpu/score/score.h
@@ -107,8 +107,8 @@ private:
void op_iform1b();
address_space_config m_program_config;
- address_space * m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
// internal state
int m_icount;
diff --git a/src/devices/cpu/se3208/se3208.cpp b/src/devices/cpu/se3208/se3208.cpp
index a8d2381c0da..6e5a15bef2c 100644
--- a/src/devices/cpu/se3208/se3208.cpp
+++ b/src/devices/cpu/se3208/se3208.cpp
@@ -53,7 +53,7 @@ se3208_device::se3208_device(const machine_config &mconfig, const char *tag, dev
, m_program_config("program", ENDIANNESS_LITTLE, 32, 32, 0)
, m_machinex_cb(*this)
, m_iackx_cb(*this)
- , m_PC(0), m_SR(0), m_SP(0), m_ER(0), m_PPC(0), m_program(nullptr), m_cache(nullptr), m_IRQ(0), m_NMI(0), m_icount(0)
+ , m_PC(0), m_SR(0), m_SP(0), m_ER(0), m_PPC(0), m_IRQ(0), m_NMI(0), m_icount(0)
{
}
@@ -72,88 +72,66 @@ void se3208_device::device_resolve_objects()
}
-uint32_t se3208_device::read_dword_unaligned(address_space &space, uint32_t address)
+uint8_t se3208_device::SE3208_Read8(uint32_t address)
{
- if (DWORD_ALIGNED(address))
- return space.read_dword(address);
- else
- {
- osd_printf_debug("%08x: dword READ unaligned %08x\n", m_PC, address);
-#if ALLOW_UNALIGNED_DWORD_ACCESS
- return space.read_byte(address) | space.read_byte(address + 1) << 8 | space.read_byte(address + 2) << 16 | space.read_byte(address + 3) << 24;
-#else
- return 0;
-#endif
- }
+ return m_program.read_byte(address);
}
-uint16_t se3208_device::read_word_unaligned(address_space &space, uint32_t address)
+uint16_t se3208_device::SE3208_Read16(uint32_t address)
{
if (!WORD_ALIGNED(address))
- return space.read_byte(address) | space.read_byte(address+1)<<8;
+ return m_program.read_byte(address) | m_program.read_byte(address+1)<<8;
else
- return space.read_word(address);
+ return m_program.read_word(address);
}
-void se3208_device::write_dword_unaligned(address_space &space, uint32_t address, uint32_t data)
+uint32_t se3208_device::SE3208_Read32(uint32_t address)
{
if (DWORD_ALIGNED(address))
- space.write_dword(address, data);
+ return m_program.read_dword(address);
else
{
+ osd_printf_debug("%08x: dword READ unaligned %08x\n", m_PC, address);
#if ALLOW_UNALIGNED_DWORD_ACCESS
- space.write_byte(address, data & 0xff);
- space.write_byte(address + 1, (data >> 8) & 0xff);
- space.write_byte(address + 2, (data >> 16) & 0xff);
- space.write_byte(address + 3, (data >> 24) & 0xff);
+ return m_program.read_byte(address) | m_program.read_byte(address + 1) << 8 | m_program.read_byte(address + 2) << 16 | m_program.read_byte(address + 3) << 24;
+#else
+ return 0;
#endif
- osd_printf_debug("%08x: dword WRITE unaligned %08x\n", m_PC, address);
}
+}
+void se3208_device::SE3208_Write8(uint32_t address,uint8_t data)
+{
+ m_program.write_byte(address,data);
}
-void se3208_device::write_word_unaligned(address_space &space, uint32_t address, uint16_t data)
+void se3208_device::SE3208_Write16(uint32_t address,uint16_t data)
{
if (!WORD_ALIGNED(address))
{
- space.write_byte(address, data & 0xff);
- space.write_byte(address+1, (data>>8)&0xff);
+ m_program.write_byte(address, data & 0xff);
+ m_program.write_byte(address+1, (data>>8)&0xff);
}
else
{
- space.write_word(address, data);
+ m_program.write_word(address, data);
}
}
-
-uint8_t se3208_device::SE3208_Read8(uint32_t addr)
-{
- return m_program->read_byte(addr);
-}
-
-uint16_t se3208_device::SE3208_Read16(uint32_t addr)
+void se3208_device::SE3208_Write32(uint32_t address, uint32_t data)
{
- return read_word_unaligned(*m_program,addr);
-}
-
-uint32_t se3208_device::SE3208_Read32(uint32_t addr)
-{
- return read_dword_unaligned(*m_program,addr);
-}
-
-void se3208_device::SE3208_Write8(uint32_t addr,uint8_t val)
-{
- m_program->write_byte(addr,val);
-}
-
-void se3208_device::SE3208_Write16(uint32_t addr,uint16_t val)
-{
- write_word_unaligned(*m_program,addr,val);
-}
-
-void se3208_device::SE3208_Write32(uint32_t addr,uint32_t val)
-{
- write_dword_unaligned(*m_program,addr,val);
+ if (DWORD_ALIGNED(address))
+ m_program.write_dword(address, data);
+ else
+ {
+#if ALLOW_UNALIGNED_DWORD_ACCESS
+ m_program.write_byte(address, data & 0xff);
+ m_program.write_byte(address + 1, (data >> 8) & 0xff);
+ m_program.write_byte(address + 2, (data >> 16) & 0xff);
+ m_program.write_byte(address + 3, (data >> 24) & 0xff);
+#endif
+ osd_printf_debug("%08x: dword WRITE unaligned %08x\n", m_PC, address);
+ }
}
@@ -1732,8 +1710,8 @@ void se3208_device::device_reset()
m_SP = 0;
m_ER = 0;
m_PPC = 0;
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
m_PC=SE3208_Read32(0);
m_SR=0;
m_IRQ=CLEAR_LINE;
@@ -1777,7 +1755,7 @@ void se3208_device::execute_run()
{
do
{
- uint16_t Opcode=m_cache->read_word(m_PC, WORD_XOR_LE(0));
+ uint16_t Opcode=m_cache.read_word(m_PC, WORD_XOR_LE(0));
m_PPC = m_PC;
debugger_instruction_hook(m_PC);
@@ -1802,8 +1780,8 @@ void se3208_device::device_start()
{
BuildTable();
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
save_item(NAME(m_R));
save_item(NAME(m_PC));
diff --git a/src/devices/cpu/se3208/se3208.h b/src/devices/cpu/se3208/se3208.h
index 3a8f4182b42..d006a071bb4 100644
--- a/src/devices/cpu/se3208/se3208.h
+++ b/src/devices/cpu/se3208/se3208.h
@@ -62,17 +62,13 @@ private:
uint32_t m_ER;
uint32_t m_PPC;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
uint8_t m_IRQ;
uint8_t m_NMI;
int m_icount;
- inline uint32_t read_dword_unaligned(address_space &space, uint32_t address);
- inline uint16_t read_word_unaligned(address_space &space, uint32_t address);
- inline void write_dword_unaligned(address_space &space, uint32_t address, uint32_t data);
- inline void write_word_unaligned(address_space &space, uint32_t address, uint16_t data);
inline uint8_t SE3208_Read8(uint32_t addr);
inline uint16_t SE3208_Read16(uint32_t addr);
inline uint32_t SE3208_Read32(uint32_t addr);
diff --git a/src/devices/cpu/sh/sh.h b/src/devices/cpu/sh/sh.h
index 7c84bdffb8a..6920d85fd3b 100644
--- a/src/devices/cpu/sh/sh.h
+++ b/src/devices/cpu/sh/sh.h
@@ -385,6 +385,9 @@ public:
std::function<u16 (offs_t)> m_pr16;
std::function<const void * (offs_t)> m_prptr;
address_space *m_program;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache32;
+ memory_access<32, 3, 0, ENDIANNESS_BIG>::cache m_cache64be;
+ memory_access<32, 3, 0, ENDIANNESS_LITTLE>::cache m_cache64le;
std::unique_ptr<drcuml_state> m_drcuml; /* DRC UML generator state */
uint32_t m_drcoptions; /* configurable DRC options */
diff --git a/src/devices/cpu/sh/sh2.cpp b/src/devices/cpu/sh/sh2.cpp
index bdc6e8ef164..9d1014f1648 100644
--- a/src/devices/cpu/sh/sh2.cpp
+++ b/src/devices/cpu/sh/sh2.cpp
@@ -532,18 +532,18 @@ void sh2_device::device_start()
m_ftcsr_read_cb.resolve();
m_decrypted_program = has_space(AS_OPCODES) ? &space(AS_OPCODES) : &space(AS_PROGRAM);
- auto cache = m_decrypted_program->cache<2, 0, ENDIANNESS_BIG>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
+ m_decrypted_program->cache(m_cache32);
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache32.read_word(address); };
if (m_decrypted_program->endianness() != ENDIANNESS_NATIVE)
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~3));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache32.read_ptr(address & ~3));
if(!(address & 2))
ptr++;
return ptr;
};
else
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~3));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache32.read_ptr(address & ~3));
if(address & 2)
ptr++;
return ptr;
diff --git a/src/devices/cpu/sh/sh2.h b/src/devices/cpu/sh/sh2.h
index 7a64f87b973..8eaad7ad6c4 100644
--- a/src/devices/cpu/sh/sh2.h
+++ b/src/devices/cpu/sh/sh2.h
@@ -244,6 +244,8 @@ private:
int8_t m_irq_line_state[17];
address_space *m_internal;
+
+
// SCI
uint8_t m_smr = 0, m_brr = 0, m_scr = 0, m_tdr = 0, m_ssr = 0;
// FRT / FRC
diff --git a/src/devices/cpu/sh/sh4.cpp b/src/devices/cpu/sh/sh4.cpp
index b646882e0dc..0d212e7ffe2 100644
--- a/src/devices/cpu/sh/sh4.cpp
+++ b/src/devices/cpu/sh/sh4.cpp
@@ -2062,34 +2062,34 @@ void sh34_base_device::device_start()
m_io = &space(AS_IO);
if (m_program->endianness() == ENDIANNESS_LITTLE)
{
- auto cache = m_program->cache<3, 0, ENDIANNESS_LITTLE>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
+ m_program->cache(m_cache64le);
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache64le.read_word(address); };
if (ENDIANNESS_NATIVE != ENDIANNESS_LITTLE)
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache64le.read_ptr(address & ~7));
ptr += (~address >> 1) & 3;
return ptr;
};
else
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache64le.read_ptr(address & ~7));
ptr += (address >> 1) & 3;
return ptr;
};
}
else
{
- auto cache = m_program->cache<3, 0, ENDIANNESS_BIG>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
+ m_program->cache(m_cache64be);
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache64be.read_word(address); };
if (ENDIANNESS_NATIVE != ENDIANNESS_BIG)
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache64be.read_ptr(address & ~7));
ptr += (~address >> 1) & 3;
return ptr;
};
else
- m_prptr = [cache](offs_t address) -> const void * {
- const u16 *ptr = static_cast<u16 *>(cache->read_ptr(address & ~7));
+ m_prptr = [this](offs_t address) -> const void * {
+ const u16 *ptr = static_cast<u16 *>(m_cache64be.read_ptr(address & ~7));
ptr += (address >> 1) & 3;
return ptr;
};
diff --git a/src/devices/cpu/sparc/sparc.cpp b/src/devices/cpu/sparc/sparc.cpp
index 38a47934f1b..6dec789ca93 100644
--- a/src/devices/cpu/sparc/sparc.cpp
+++ b/src/devices/cpu/sparc/sparc.cpp
@@ -174,7 +174,7 @@ void sparc_base_device::device_start()
{
continue;
}
- m_asi[i] = space(i).specific<2, 0, ENDIANNESS_BIG>();
+ space(i).specific(m_asi[i]);
}
memset(m_dbgregs, 0, 24 * sizeof(uint32_t));
@@ -548,13 +548,13 @@ device_memory_interface::space_config_vector sparc_base_device::memory_space_con
inline uint32_t sparc_base_device::read_word(const uint8_t asi, const uint32_t address, const uint32_t mem_mask)
{
assert(asi < 0x10); // We do not currently support ASIs outside the range used by actual Sun machines.
- return m_asi[asi | 0x10]->read_dword(address, mem_mask);
+ return m_asi[asi | 0x10].read_dword(address, mem_mask);
}
inline void sparc_base_device::write_word(const uint8_t asi, const uint32_t address, const uint32_t data, const uint32_t mem_mask)
{
assert(asi < 0x10); // We do not currently support ASIs outside the range used by actual Sun machines.
- return m_asi[asi | 0x10]->write_dword(address, data, mem_mask);
+ return m_asi[asi | 0x10].write_dword(address, data, mem_mask);
}
diff --git a/src/devices/cpu/sparc/sparc.h b/src/devices/cpu/sparc/sparc.h
index e65e406ce1d..132fd6feabf 100644
--- a/src/devices/cpu/sparc/sparc.h
+++ b/src/devices/cpu/sparc/sparc.h
@@ -157,7 +157,7 @@ protected:
// address spaces
address_space_config m_debugger_config;
address_space_config m_asi_config[0x10];
- memory_access_specific<2, 0, ENDIANNESS_BIG> *m_asi[0x20];
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_asi[0x20];
// memory access
inline uint32_t read_word(const uint8_t asi, const uint32_t address, const uint32_t mem_mask = 0xffffffff);
diff --git a/src/devices/cpu/ssp1601/ssp1601.cpp b/src/devices/cpu/ssp1601/ssp1601.cpp
index 8f449d6d6a9..79119b6a97a 100644
--- a/src/devices/cpu/ssp1601/ssp1601.cpp
+++ b/src/devices/cpu/ssp1601/ssp1601.cpp
@@ -45,8 +45,8 @@
#define PPC m_ppc.w.h
-#define FETCH() m_cache->read_word(rPC++)
-#define PROGRAM_WORD(a) m_program->read_word(a)
+#define FETCH() m_cache.read_word(rPC++)
+#define PROGRAM_WORD(a) m_program.read_word(a)
#define GET_PPC_OFFS() PPC
#define REG_READ(r) (((r) <= 4) ? m_gr[r].w.h : (this->*reg_read_handlers[r])(r))
@@ -241,13 +241,13 @@ void ssp1601_device::write_unknown(int reg, uint32_t d)
uint32_t ssp1601_device::read_ext(int reg)
{
reg &= 7;
- return m_io->read_word((reg << 1));
+ return m_io.read_word((reg << 1));
}
void ssp1601_device::write_ext(int reg, uint32_t d)
{
reg &= 7;
- m_io->write_word((reg << 1), d);
+ m_io.write_word((reg << 1), d);
}
// 4
@@ -521,9 +521,9 @@ void ssp1601_device::device_start()
m_g_cycles = 0;
m_gr[0].w.h = 0xffff; // constant reg
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
state_add( SSP_R0, "REG0", m_gr[0].w.h).formatstr("%04X");
state_add( SSP_X, "X", rX).formatstr("%04X");
diff --git a/src/devices/cpu/ssp1601/ssp1601.h b/src/devices/cpu/ssp1601/ssp1601.h
index db86dddb875..e912ff9891b 100644
--- a/src/devices/cpu/ssp1601/ssp1601.h
+++ b/src/devices/cpu/ssp1601/ssp1601.h
@@ -71,9 +71,9 @@ private:
int m_g_cycles;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
- address_space *m_io;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 4, 1, 0, ENDIANNESS_BIG>::specific m_io;
void update_P();
uint32_t read_unknown(int reg);
diff --git a/src/devices/cpu/t11/t11.cpp b/src/devices/cpu/t11/t11.cpp
index 4ab5a587193..667d38de2ee 100644
--- a/src/devices/cpu/t11/t11.cpp
+++ b/src/devices/cpu/t11/t11.cpp
@@ -85,7 +85,7 @@ device_memory_interface::space_config_vector t11_device::memory_space_config() c
int t11_device::ROPCODE()
{
PC &= 0xfffe;
- int val = m_cache->read_word(PC);
+ int val = m_cache.read_word(PC);
PC += 2;
return val;
}
@@ -93,25 +93,25 @@ int t11_device::ROPCODE()
int t11_device::RBYTE(int addr)
{
- return m_program->read_byte(addr);
+ return m_program.read_byte(addr);
}
void t11_device::WBYTE(int addr, int data)
{
- m_program->write_byte(addr, data);
+ m_program.write_byte(addr, data);
}
int t11_device::RWORD(int addr)
{
- return m_program->read_word(addr & 0xfffe);
+ return m_program.read_word(addr & 0xfffe);
}
void t11_device::WWORD(int addr, int data)
{
- m_program->write_word(addr & 0xfffe, data);
+ m_program.write_word(addr & 0xfffe, data);
}
@@ -303,8 +303,8 @@ void t11_device::device_start()
};
m_initial_pc = initial_pc[c_initial_mode >> 13];
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
m_out_reset_func.resolve_safe();
m_in_iack_func.resolve_safe(0377);
diff --git a/src/devices/cpu/t11/t11.h b/src/devices/cpu/t11/t11.h
index 2b54933ba94..ff63ef311fe 100644
--- a/src/devices/cpu/t11/t11.h
+++ b/src/devices/cpu/t11/t11.h
@@ -93,8 +93,8 @@ protected:
bool m_power_fail;
bool m_ext_halt;
int m_icount;
- address_space *m_program;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 1, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 1, 0, ENDIANNESS_LITTLE>::specific m_program;
devcb_write_line m_out_reset_func;
devcb_read8 m_in_iack_func;
diff --git a/src/devices/cpu/tms32010/tms32010.cpp b/src/devices/cpu/tms32010/tms32010.cpp
index 4ac26dd3185..01c18fb4471 100644
--- a/src/devices/cpu/tms32010/tms32010.cpp
+++ b/src/devices/cpu/tms32010/tms32010.cpp
@@ -167,14 +167,14 @@ std::unique_ptr<util::disasm_interface> tms32010_device::create_disassembler()
* Input a word from given I/O port
*/
-#define TMS32010_In(Port) (m_io->read_word(Port))
+#define TMS32010_In(Port) (m_io.read_word(Port))
/****************************************************************************
* Output a word to given I/O port
*/
-#define TMS32010_Out(Port,Value) (m_io->write_word(Port,Value))
+#define TMS32010_Out(Port,Value) (m_io.write_word(Port,Value))
@@ -182,14 +182,14 @@ std::unique_ptr<util::disasm_interface> tms32010_device::create_disassembler()
* Read a word from given ROM memory location
*/
-#define TMS32010_ROM_RDMEM(A) (m_program->read_word(A))
+#define TMS32010_ROM_RDMEM(A) (m_program.read_word(A))
/****************************************************************************
* Write a word to given ROM memory location
*/
-#define TMS32010_ROM_WRMEM(A,V) (m_program->write_word(A,V))
+#define TMS32010_ROM_WRMEM(A,V) (m_program.write_word(A,V))
@@ -197,14 +197,14 @@ std::unique_ptr<util::disasm_interface> tms32010_device::create_disassembler()
* Read a word from given RAM memory location
*/
-#define TMS32010_RAM_RDMEM(A) (m_data->read_word(A))
+#define TMS32010_RAM_RDMEM(A) (m_data.read_word(A))
/****************************************************************************
* Write a word to given RAM memory location
*/
-#define TMS32010_RAM_WRMEM(A,V) (m_data->write_word(A,V))
+#define TMS32010_RAM_WRMEM(A,V) (m_data.write_word(A,V))
@@ -214,7 +214,7 @@ std::unique_ptr<util::disasm_interface> tms32010_device::create_disassembler()
* used to greatly speed up emulation
*/
-#define TMS32010_RDOP(A) (m_cache->read_word(A))
+#define TMS32010_RDOP(A) (m_cache.read_word(A))
/****************************************************************************
@@ -223,7 +223,7 @@ std::unique_ptr<util::disasm_interface> tms32010_device::create_disassembler()
* that use different encoding mechanisms for opcodes and opcode arguments
*/
-#define TMS32010_RDOP_ARG(A) (m_cache->read_word(A))
+#define TMS32010_RDOP_ARG(A) (m_cache.read_word(A))
/************************************************************************
@@ -835,10 +835,10 @@ void tms32010_device::device_start()
save_item(NAME(m_memaccess));
save_item(NAME(m_addr_mask));
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
m_bio_in.resolve_safe(0);
diff --git a/src/devices/cpu/tms32010/tms32010.h b/src/devices/cpu/tms32010/tms32010.h
index 247c9546a47..beebee1b0b0 100644
--- a/src/devices/cpu/tms32010/tms32010.h
+++ b/src/devices/cpu/tms32010/tms32010.h
@@ -101,10 +101,10 @@ private:
uint16_t m_memaccess;
int m_addr_mask;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<12, 1, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<12, 1, -1, ENDIANNESS_BIG>::specific m_program;
+ memory_access< 8, 1, -1, ENDIANNESS_BIG>::specific m_data;
+ memory_access< 4, 1, -1, ENDIANNESS_BIG>::specific m_io;
inline void CLR(uint16_t flag);
inline void SET_FLAG(uint16_t flag);
diff --git a/src/devices/cpu/tms32025/tms32025.cpp b/src/devices/cpu/tms32025/tms32025.cpp
index a3f8c588869..7d07c2f43df 100644
--- a/src/devices/cpu/tms32025/tms32025.cpp
+++ b/src/devices/cpu/tms32025/tms32025.cpp
@@ -546,7 +546,7 @@ void tms32025_device::GETDATA(int shift,int signext)
m_external_mem_access = 0;
}
- m_ALU.d = (uint16_t)m_data->read_word(m_memaccess);
+ m_ALU.d = (uint16_t)m_data.read_word(m_memaccess);
if (signext) m_ALU.d = (int16_t)m_ALU.d;
m_ALU.d <<= shift;
@@ -560,14 +560,14 @@ void tms32025_device::PUTDATA(uint16_t data)
if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */
else m_external_mem_access = 0;
- m_data->write_word(IND, data);
+ m_data.write_word(IND, data);
MODIFY_AR_ARP();
}
else {
if (m_memaccess >= 0x800) m_external_mem_access = 1; /* Pause if hold pin is active */
else m_external_mem_access = 0;
- m_data->write_word(DMA, data);
+ m_data.write_word(DMA, data);
}
}
void tms32025_device::PUTDATA_SST(uint16_t data)
@@ -582,7 +582,7 @@ void tms32025_device::PUTDATA_SST(uint16_t data)
m_opcode.b.l &= 0xf7; /* Stop ARP changes */
MODIFY_AR_ARP();
}
- m_data->write_word(m_memaccess, data);
+ m_data.write_word(m_memaccess, data);
}
@@ -670,8 +670,8 @@ void tms32025_device::addt()
void tms32025_device::adlk()
{
m_oldacc.d = m_ACC.d;
- if (SXM) m_ALU.d = (int16_t)m_cache->read_word(m_PC);
- else m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ if (SXM) m_ALU.d = (int16_t)m_cache.read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d += m_ALU.d;
@@ -690,7 +690,7 @@ void tms32025_device::and_()
void tms32025_device::andk()
{
m_oldacc.d = m_ACC.d;
- m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d &= m_ALU.d;
@@ -705,7 +705,7 @@ void tms32025_device::apac()
}
void tms32025_device::br()
{
- m_PC = m_cache->read_word(m_PC);
+ m_PC = m_cache.read_word(m_PC);
MODIFY_AR_ARP();
}
void tms32025_device::bacc()
@@ -714,43 +714,43 @@ void tms32025_device::bacc()
}
void tms32025_device::banz()
{
- if (m_AR[ARP]) m_PC = m_cache->read_word(m_PC);
+ if (m_AR[ARP]) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bbnz()
{
- if (TC) m_PC = m_cache->read_word(m_PC);
+ if (TC) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bbz()
{
- if (TC == 0) m_PC = m_cache->read_word(m_PC);
+ if (TC == 0) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bc()
{
- if (CARRY) m_PC = m_cache->read_word(m_PC);
+ if (CARRY) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bgez()
{
- if ( (int32_t)(m_ACC.d) >= 0 ) m_PC = m_cache->read_word(m_PC);
+ if ( (int32_t)(m_ACC.d) >= 0 ) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bgz()
{
- if ( (int32_t)(m_ACC.d) > 0 ) m_PC = m_cache->read_word(m_PC);
+ if ( (int32_t)(m_ACC.d) > 0 ) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bioz()
{
- if (m_bio_in() != CLEAR_LINE) m_PC = m_cache->read_word(m_PC);
+ if (m_bio_in() != CLEAR_LINE) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
@@ -768,17 +768,17 @@ void tms32025_device::bitt()
}
void tms32025_device::blez()
{
- if ( (int32_t)(m_ACC.d) <= 0 ) m_PC = m_cache->read_word(m_PC);
+ if ( (int32_t)(m_ACC.d) <= 0 ) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::blkd()
{ /** Fix cycle timing **/
if (m_init_load_addr) {
- m_PFC = m_cache->read_word(m_PC);
+ m_PFC = m_cache.read_word(m_PC);
m_PC++;
}
- m_ALU.d = m_data->read_word(m_PFC);
+ m_ALU.d = m_data.read_word(m_PFC);
PUTDATA(m_ALU.d);
m_PFC++;
m_tms32025_dec_cycles += (1*CLK);
@@ -786,29 +786,29 @@ void tms32025_device::blkd()
void tms32025_device::blkp()
{ /** Fix cycle timing **/
if (m_init_load_addr) {
- m_PFC = m_cache->read_word(m_PC);
+ m_PFC = m_cache.read_word(m_PC);
m_PC++;
}
- m_ALU.d = m_cache->read_word(m_PFC);
+ m_ALU.d = m_cache.read_word(m_PFC);
PUTDATA(m_ALU.d);
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
void tms32025_device::blz()
{
- if ( (int32_t)(m_ACC.d) < 0 ) m_PC = m_cache->read_word(m_PC);
+ if ( (int32_t)(m_ACC.d) < 0 ) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bnc()
{
- if (CARRY == 0) m_PC = m_cache->read_word(m_PC);
+ if (CARRY == 0) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bnv()
{
- if (OV == 0) m_PC = m_cache->read_word(m_PC);
+ if (OV == 0) m_PC = m_cache.read_word(m_PC);
else {
m_PC++ ;
CLR0(OV_FLAG);
@@ -817,14 +817,14 @@ void tms32025_device::bnv()
}
void tms32025_device::bnz()
{
- if (m_ACC.d != 0) m_PC = m_cache->read_word(m_PC);
+ if (m_ACC.d != 0) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
void tms32025_device::bv()
{
if (OV) {
- m_PC = m_cache->read_word(m_PC);
+ m_PC = m_cache.read_word(m_PC);
CLR0(OV_FLAG);
}
else m_PC++ ;
@@ -832,7 +832,7 @@ void tms32025_device::bv()
}
void tms32025_device::bz()
{
- if (m_ACC.d == 0) m_PC = m_cache->read_word(m_PC);
+ if (m_ACC.d == 0) m_PC = m_cache.read_word(m_PC);
else m_PC++ ;
MODIFY_AR_ARP();
}
@@ -845,7 +845,7 @@ void tms32025_device::call()
{
m_PC++ ;
PUSH_STACK(m_PC);
- m_PC = m_cache->read_word(m_PC - 1);
+ m_PC = m_cache.read_word(m_PC - 1);
MODIFY_AR_ARP();
}
void tms32025_device::cmpl()
@@ -873,16 +873,16 @@ void tms32025_device::cmpr()
void tms32025_device::cnfd() /** next two fetches need to use previous CNF value ! **/
{
if(m_STR1 & CNF0_REG) {
- m_program->unmap_readwrite(0xff00, 0xffff);
- m_data->install_ram(0x0200, 0x02ff, m_b0);
+ space(AS_PROGRAM).unmap_readwrite(0xff00, 0xffff);
+ space(AS_DATA).install_ram(0x0200, 0x02ff, m_b0);
CLR1(CNF0_REG);
}
}
void tms32025_device::cnfp() /** next two fetches need to use previous CNF value ! **/
{
if(!(m_STR1 & CNF0_REG)) {
- m_program->install_ram(0xff00, 0xffff, m_b0);
- m_data->unmap_readwrite(0x0200, 0x02ff);
+ space(AS_PROGRAM).install_ram(0xff00, 0xffff, m_b0);
+ space(AS_DATA).unmap_readwrite(0x0200, 0x02ff);
SET1(CNF0_REG);
}
}
@@ -918,27 +918,27 @@ void tms32026_device::conf() /** Need to reconfigure the memory blocks */
CLR1(CNF1_REG);
if(next < 1 && prev >= 1) {
- m_program->unmap_readwrite(0xfa00, 0xfbff);
- m_data->install_ram(0x0200, 0x03ff, m_b0);
+ space(AS_PROGRAM).unmap_readwrite(0xfa00, 0xfbff);
+ space(AS_DATA).install_ram(0x0200, 0x03ff, m_b0);
} else if(next >= 1 && prev < 1) {
- m_program->install_ram(0xfa00, 0xfbff, m_b0);
- m_data->unmap_readwrite(0x0200, 0x03ff);
+ space(AS_PROGRAM).install_ram(0xfa00, 0xfbff, m_b0);
+ space(AS_DATA).unmap_readwrite(0x0200, 0x03ff);
}
if(next < 2 && prev >= 2) {
- m_program->unmap_readwrite(0xfc00, 0xfdff);
- m_data->install_ram(0x0400, 0x05ff, m_b1);
+ space(AS_PROGRAM).unmap_readwrite(0xfc00, 0xfdff);
+ space(AS_DATA).install_ram(0x0400, 0x05ff, m_b1);
} else if(next >= 2 && prev < 2) {
- m_program->install_ram(0xfc00, 0xfdff, m_b1);
- m_data->unmap_readwrite(0x0400, 0x05ff);
+ space(AS_PROGRAM).install_ram(0xfc00, 0xfdff, m_b1);
+ space(AS_DATA).unmap_readwrite(0x0400, 0x05ff);
}
if(next < 3 && prev >= 3) {
- m_program->unmap_readwrite(0xfe00, 0xffff);
- m_data->install_ram(0x0600, 0x07ff, m_b3);
+ space(AS_PROGRAM).unmap_readwrite(0xfe00, 0xffff);
+ space(AS_DATA).install_ram(0x0600, 0x07ff, m_b3);
} else if(next >= 3 && prev < 3) {
- m_program->install_ram(0xfe00, 0xffff, m_b3);
- m_data->unmap_readwrite(0x0600, 0x07ff);
+ space(AS_PROGRAM).install_ram(0xfe00, 0xffff, m_b3);
+ space(AS_DATA).unmap_readwrite(0x0600, 0x07ff);
}
}
void tms32025_device::dint()
@@ -948,7 +948,7 @@ void tms32025_device::dint()
void tms32025_device::dmov() /** Careful with how memory is configured !! */
{
GETDATA(0, 0);
- m_data->write_word(m_memaccess + 1, m_ALU.w.l);
+ m_data.write_word(m_memaccess + 1, m_ALU.w.l);
}
void tms32025_device::eint()
{
@@ -966,7 +966,7 @@ void tms32025_device::idle()
}
void tms32025_device::in()
{
- m_ALU.w.l = m_io->read_word(m_opcode.b.h & 0xf);
+ m_ALU.w.l = m_io.read_word(m_opcode.b.h & 0xf);
PUTDATA(m_ALU.w.l);
}
void tms32025_device::lac()
@@ -985,8 +985,8 @@ void tms32025_device::lact()
}
void tms32025_device::lalk()
{
- if (SXM) m_ALU.d = (int16_t)m_cache->read_word(m_PC);
- else m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ if (SXM) m_ALU.d = (int16_t)m_cache.read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d = m_ALU.d;
@@ -1023,7 +1023,7 @@ void tms32025_device::lph()
}
void tms32025_device::lrlk()
{
- m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_AR[m_opcode.b.h & 7] = m_ALU.w.l;
}
@@ -1068,7 +1068,7 @@ void tms32025_device::ltd() /** Careful with how memory is configured !! */
m_oldacc.d = m_ACC.d;
GETDATA(0, 0);
m_Treg = m_ALU.w.l;
- m_data->write_word(m_memaccess+1, m_ALU.w.l);
+ m_data.write_word(m_memaccess+1, m_ALU.w.l);
SHIFT_Preg_TO_ALU();
m_ACC.d += m_ALU.d;
CALCULATE_ADD_OVERFLOW(m_ALU.d);
@@ -1096,7 +1096,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important !
{ /** Fix cycle timing **/
m_oldacc.d = m_ACC.d;
if (m_init_load_addr) {
- m_PFC = m_cache->read_word(m_PC);
+ m_PFC = m_cache.read_word(m_PC);
m_PC++;
}
SHIFT_Preg_TO_ALU();
@@ -1105,7 +1105,7 @@ void tms32025_device::mac() /** RAM blocks B0,B1,B2 may be important !
CALCULATE_ADD_CARRY();
GETDATA(0, 0);
m_Treg = m_ALU.w.l;
- m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_cache->read_word(m_PFC) );
+ m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_cache.read_word(m_PFC) );
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
@@ -1113,7 +1113,7 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important !
{ /** Fix cycle timing **/
m_oldacc.d = m_ACC.d;
if (m_init_load_addr) {
- m_PFC = m_cache->read_word(m_PC);
+ m_PFC = m_cache.read_word(m_PC);
m_PC++;
}
SHIFT_Preg_TO_ALU();
@@ -1122,10 +1122,10 @@ void tms32025_device::macd() /** RAM blocks B0,B1,B2 may be important !
CALCULATE_ADD_CARRY();
GETDATA(0, 0);
if ( (m_opcode.b.l & 0x80) || m_init_load_addr ) { /* No writing during repetition, or DMA mode */
- m_data->write_word(m_memaccess+1, m_ALU.w.l);
+ m_data.write_word(m_memaccess+1, m_ALU.w.l);
}
m_Treg = m_ALU.w.l;
- m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_cache->read_word(m_PFC) );
+ m_Preg.d = ( (int16_t)m_ALU.w.l * (int16_t)m_cache.read_word(m_PFC) );
m_PFC++;
m_tms32025_dec_cycles += (2*CLK);
}
@@ -1198,7 +1198,7 @@ void tms32025_device::or_()
}
void tms32025_device::ork()
{
- m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d |= (m_ALU.d);
@@ -1206,7 +1206,7 @@ void tms32025_device::ork()
void tms32025_device::out()
{
GETDATA(0, 0);
- m_io->write_word(m_opcode.b.h & 0xf, m_ALU.w.l );
+ m_io.write_word(m_opcode.b.h & 0xf, m_ALU.w.l );
}
void tms32025_device::pac()
{
@@ -1317,8 +1317,8 @@ void tms32025_device::sar_ar7() { PUTDATA(m_AR[7]); }
void tms32025_device::sblk()
{
m_oldacc.d = m_ACC.d;
- if (SXM) m_ALU.d = (int16_t)m_cache->read_word(m_PC);
- else m_ALU.d = (uint16_t)m_cache->read_word(m_PC);
+ if (SXM) m_ALU.d = (int16_t)m_cache.read_word(m_PC);
+ else m_ALU.d = (uint16_t)m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d -= m_ALU.d;
@@ -1509,7 +1509,7 @@ void tms32025_device::tblr()
if (m_init_load_addr) {
m_PFC = m_ACC.w.l;
}
- m_ALU.w.l = m_cache->read_word(m_PFC);
+ m_ALU.w.l = m_cache.read_word(m_PFC);
if ( (CNF0) && ( (uint16_t)(m_PFC) >= 0xff00 ) ) {} /** TMS32025 only */
else m_tms32025_dec_cycles += (1*CLK);
PUTDATA(m_ALU.w.l);
@@ -1523,7 +1523,7 @@ void tms32025_device::tblw()
m_tms32025_dec_cycles += (1*CLK);
GETDATA(0, 0);
if (m_external_mem_access) m_tms32025_dec_cycles += (1*CLK);
- m_program->write_word(m_PFC, m_ALU.w.l);
+ m_program.write_word(m_PFC, m_ALU.w.l);
m_PFC++;
}
void tms32025_device::trap()
@@ -1538,7 +1538,7 @@ void tms32025_device::xor_()
}
void tms32025_device::xork()
{
- m_ALU.d = m_cache->read_word(m_PC);
+ m_ALU.d = m_cache.read_word(m_PC);
m_PC++;
m_ALU.d <<= (m_opcode.b.h & 0xf);
m_ACC.d ^= m_ALU.d;
@@ -1651,14 +1651,14 @@ const tms32025_device::tms32025_opcode tms32025_device::s_opcode_Dx_subset[8]=
****************************************************************************/
void tms32025_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
if (!m_mp_mc) // if pin 1 is 0 then we're using internal ROM
{
- m_program->install_rom(0x0000, 0x0fff, memregion("internal")->base());
+ m_program.space().install_rom(0x0000, 0x0fff, memregion("internal")->base());
}
m_bio_in.resolve_safe(0xffff);
@@ -1823,8 +1823,8 @@ void tms32025_device::common_reset()
void tms32025_device::device_reset()
{
if(m_STR1 & CNF0_REG) {
- m_program->unmap_readwrite(0xff00, 0xffff);
- m_data->install_ram(0x0200, 0x02ff, m_b0);
+ m_program.space().unmap_readwrite(0xff00, 0xffff);
+ m_data.space().install_ram(0x0200, 0x02ff, m_b0);
}
common_reset();
@@ -2000,7 +2000,7 @@ void tms32025_device::execute_run()
debugger_instruction_hook(m_PC);
- m_opcode.d = m_cache->read_word(m_PC);
+ m_opcode.d = m_cache.read_word(m_PC);
m_PC++;
if (m_opcode.b.h == 0xCE) /* Opcode 0xCExx has many sub-opcodes in its minor byte */
@@ -2034,7 +2034,7 @@ void tms32025_device::execute_run()
debugger_instruction_hook(m_PC);
- m_opcode.d = m_cache->read_word(m_PC);
+ m_opcode.d = m_cache.read_word(m_PC);
m_PC++;
m_tms32025_dec_cycles += (1*CLK);
diff --git a/src/devices/cpu/tms32025/tms32025.h b/src/devices/cpu/tms32025/tms32025.h
index 677da427715..e2e2c799897 100644
--- a/src/devices/cpu/tms32025/tms32025.h
+++ b/src/devices/cpu/tms32025/tms32025.h
@@ -127,10 +127,10 @@ protected:
required_shared_ptr<uint16_t> m_b2;
optional_shared_ptr<uint16_t> m_b3;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::specific m_program;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::specific m_data;
+ memory_access<16, 1, -1, ENDIANNESS_BIG>::specific m_io;
typedef void ( tms32025_device::*opcode_func ) ();
struct tms32025_opcode
diff --git a/src/devices/cpu/tms32031/tms32031.cpp b/src/devices/cpu/tms32031/tms32031.cpp
index d7ace7fdb08..a90455c8bd4 100644
--- a/src/devices/cpu/tms32031/tms32031.cpp
+++ b/src/devices/cpu/tms32031/tms32031.cpp
@@ -392,8 +392,6 @@ tms3203x_device::tms3203x_device(const machine_config &mconfig, device_type type
m_irq_pending(false),
m_is_idling(false),
m_icount(0),
- m_program(nullptr),
- m_cache(nullptr),
m_internal_rom(*this, "internal_rom"),
m_mcbl_mode(false),
m_xf0_cb(*this),
@@ -463,7 +461,7 @@ const tiny_rom_entry *tms3203x_device::device_rom_region() const
inline uint32_t tms3203x_device::ROPCODE(offs_t pc)
{
- return m_cache->read_dword(pc);
+ return m_cache.read_dword(pc);
}
@@ -473,7 +471,7 @@ inline uint32_t tms3203x_device::ROPCODE(offs_t pc)
inline uint32_t tms3203x_device::RMEM(offs_t addr)
{
- return m_program->read_dword(addr);
+ return m_program.read_dword(addr);
}
@@ -483,7 +481,7 @@ inline uint32_t tms3203x_device::RMEM(offs_t addr)
inline void tms3203x_device::WMEM(offs_t addr, uint32_t data)
{
- m_program->write_dword(addr, data);
+ m_program.write_dword(addr, data);
}
@@ -494,8 +492,8 @@ inline void tms3203x_device::WMEM(offs_t addr, uint32_t data)
void tms3203x_device::device_start()
{
// find address spaces
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, -2, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
// resolve devcb handlers
m_xf0_cb.resolve_safe();
@@ -507,9 +505,9 @@ void tms3203x_device::device_start()
if (m_mcbl_mode)
{
if (m_internal_rom->base() != nullptr)
- m_program->install_rom(0x000000, 0x000fff, m_internal_rom->base());
+ m_program.space().install_rom(0x000000, 0x000fff, m_internal_rom->base());
else
- m_program->unmap_read(0x000000, 0x000fff);
+ m_program.space().unmap_read(0x000000, 0x000fff);
}
// save state
@@ -853,9 +851,9 @@ void tms3203x_device::execute_set_input(int inputnum, int state)
if (m_mcbl_mode != old_mode)
{
if (m_mcbl_mode && (m_internal_rom->base() != nullptr))
- m_program->install_rom(0x000000, 0x000fff, m_internal_rom->base());
+ m_program.space().install_rom(0x000000, 0x000fff, m_internal_rom->base());
else
- m_program->unmap_read(0x000000, 0x000fff);
+ m_program.space().unmap_read(0x000000, 0x000fff);
}
return;
}
diff --git a/src/devices/cpu/tms32031/tms32031.h b/src/devices/cpu/tms32031/tms32031.h
index 90ed93c8c89..5f998920089 100644
--- a/src/devices/cpu/tms32031/tms32031.h
+++ b/src/devices/cpu/tms32031/tms32031.h
@@ -768,8 +768,8 @@ protected:
int m_icount;
uint32_t m_iotemp;
- address_space * m_program;
- memory_access_cache<2, -2, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 2, -2, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<24, 2, -2, ENDIANNESS_LITTLE>::specific m_program;
optional_memory_region m_internal_rom;
diff --git a/src/devices/cpu/tms32051/32051ops.hxx b/src/devices/cpu/tms32051/32051ops.hxx
index e74fa06f1be..38d125a9de5 100644
--- a/src/devices/cpu/tms32051/32051ops.hxx
+++ b/src/devices/cpu/tms32051/32051ops.hxx
@@ -1378,7 +1378,7 @@ void tms32051_device::op_out()
uint16_t ea = GET_ADDRESS();
uint16_t data = DM_READ16(ea);
- m_io->write_word(port << 1, data);
+ m_io.write_word(port << 1, data);
// TODO: handle repeat
CYCLES(3);
diff --git a/src/devices/cpu/tms32051/tms32051.cpp b/src/devices/cpu/tms32051/tms32051.cpp
index ebcc1d216e5..1691c66b2e2 100644
--- a/src/devices/cpu/tms32051/tms32051.cpp
+++ b/src/devices/cpu/tms32051/tms32051.cpp
@@ -130,7 +130,7 @@ std::unique_ptr<util::disasm_interface> tms32051_device::create_disassembler()
#define CYCLES(x) (m_icount -= x)
-#define ROPCODE() m_cache->read_word(m_pc++)
+#define ROPCODE() m_cache.read_word(m_pc++)
void tms32051_device::CHANGE_PC(uint16_t new_pc)
{
@@ -139,22 +139,22 @@ void tms32051_device::CHANGE_PC(uint16_t new_pc)
uint16_t tms32051_device::PM_READ16(uint16_t address)
{
- return m_program->read_word(address);
+ return m_program.read_word(address);
}
void tms32051_device::PM_WRITE16(uint16_t address, uint16_t data)
{
- m_program->write_word(address, data);
+ m_program.write_word(address, data);
}
uint16_t tms32051_device::DM_READ16(uint16_t address)
{
- return m_data->read_word(address);
+ return m_data.read_word(address);
}
void tms32051_device::DM_WRITE16(uint16_t address, uint16_t data)
{
- m_data->write_word(address, data);
+ m_data.write_word(address, data);
}
#include "32051ops.hxx"
@@ -186,10 +186,10 @@ void tms32051_device::delay_slot(uint16_t startpc)
void tms32051_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, -1, ENDIANNESS_LITTLE>();
- m_data = &space(AS_DATA);
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_io);
m_pcstack_ptr = 0;
m_op = 0;
@@ -519,7 +519,7 @@ READ16_MEMBER( tms32051_device::cpuregs_r )
case 0x5d:
case 0x5e:
case 0x5f:
- return m_io->read_word(offset);
+ return m_io.read_word(offset);
default:
if (!machine().side_effects_disabled())
@@ -630,7 +630,7 @@ WRITE16_MEMBER( tms32051_device::cpuregs_w )
case 0x5d:
case 0x5e:
case 0x5f:
- m_io->write_word(offset, data);
+ m_io.write_word(offset, data);
break;
default:
diff --git a/src/devices/cpu/tms32051/tms32051.h b/src/devices/cpu/tms32051/tms32051.h
index a4d404fc78d..06f69489032 100644
--- a/src/devices/cpu/tms32051/tms32051.h
+++ b/src/devices/cpu/tms32051/tms32051.h
@@ -160,10 +160,10 @@ protected:
int32_t treg2;
} m_shadow;
- address_space *m_program;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_data;
- address_space *m_io;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<16, 1, -1, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
bool m_idle;
diff --git a/src/devices/cpu/tms32082/mp_ops.cpp b/src/devices/cpu/tms32082/mp_ops.cpp
index 0411e6996b6..cbae99b9d81 100644
--- a/src/devices/cpu/tms32082/mp_ops.cpp
+++ b/src/devices/cpu/tms32082/mp_ops.cpp
@@ -142,38 +142,38 @@ void tms32082_mp_device::vector_loadstore()
{
case 0x01: // vst.s
{
- m_program->write_dword(m_outp, m_reg[rd]);
+ m_program.write_dword(m_outp, m_reg[rd]);
m_outp += 4;
break;
}
case 0x03: // vst.d
{
uint64_t data = m_fpair[rd >> 1];
- m_program->write_qword(m_outp, data);
+ m_program.write_qword(m_outp, data);
m_outp += 8;
break;
}
case 0x04: // vld0.s
{
- m_reg[rd] = m_program->read_dword(m_in0p);
+ m_reg[rd] = m_program.read_dword(m_in0p);
m_in0p += 4;
break;
}
case 0x05: // vld1.s
{
- m_reg[rd] = m_program->read_dword(m_in1p);
+ m_reg[rd] = m_program.read_dword(m_in1p);
m_in1p += 4;
break;
}
case 0x06: // vld0.d
{
- m_fpair[rd >> 1] = m_program->read_qword(m_in0p);
+ m_fpair[rd >> 1] = m_program.read_qword(m_in0p);
m_in0p += 8;
break;
}
case 0x07: // vld1.d
{
- m_fpair[rd >> 1] = m_program->read_qword(m_in1p);
+ m_fpair[rd >> 1] = m_program.read_qword(m_in1p);
m_in1p += 8;
break;
}
@@ -518,7 +518,7 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data = (uint8_t)m_program->read_byte(address);
+ uint32_t data = (uint8_t)m_program.read_byte(address);
if (data & 0x80) data |= 0xffffff00;
if (rd)
m_reg[rd] = data;
@@ -537,7 +537,7 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data = (uint16_t)m_program->read_word(address);
+ uint32_t data = (uint16_t)m_program.read_word(address);
if (data & 0x8000) data |= 0xffff0000;
if (rd)
m_reg[rd] = data;
@@ -556,7 +556,7 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data = m_program->read_dword(address);
+ uint32_t data = m_program.read_dword(address);
if (rd)
m_reg[rd] = data;
@@ -574,8 +574,8 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data1 = m_program->read_dword(address);
- uint32_t data2 = m_program->read_dword(address+4);
+ uint32_t data1 = m_program.read_dword(address);
+ uint32_t data2 = m_program.read_dword(address+4);
if (rd)
{
m_reg[(rd & ~1)+1] = data1;
@@ -596,7 +596,7 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data = (uint8_t)(m_program->read_byte(address));
+ uint32_t data = (uint8_t)(m_program.read_byte(address));
if (rd)
m_reg[rd] = data;
@@ -614,7 +614,7 @@ void tms32082_mp_device::execute_short_imm()
int32_t offset = OP_SIMM15();
uint32_t address = m_reg[base] + offset;
- uint32_t data = (uint16_t)(m_program->read_word(address));
+ uint32_t data = (uint16_t)(m_program.read_word(address));
if (rd)
m_reg[rd] = data;
@@ -633,7 +633,7 @@ void tms32082_mp_device::execute_short_imm()
uint32_t address = m_reg[base] + offset;
- m_program->write_byte(address, (uint8_t)(m_reg[rd]));
+ m_program.write_byte(address, (uint8_t)(m_reg[rd]));
if (m && base)
m_reg[base] = address;
@@ -650,7 +650,7 @@ void tms32082_mp_device::execute_short_imm()
uint32_t address = m_reg[base] + offset;
- m_program->write_word(address, (uint16_t)(m_reg[rd]));
+ m_program.write_word(address, (uint16_t)(m_reg[rd]));
if (m && base)
m_reg[base] = address;
@@ -667,7 +667,7 @@ void tms32082_mp_device::execute_short_imm()
uint32_t address = m_reg[base] + offset;
- m_program->write_dword(address, m_reg[rd]);
+ m_program.write_dword(address, m_reg[rd]);
if (m && base)
m_reg[base] = address;
@@ -684,8 +684,8 @@ void tms32082_mp_device::execute_short_imm()
uint32_t address = m_reg[base] + offset;
- m_program->write_dword(address+0, m_reg[(rd & ~1) + 1]);
- m_program->write_dword(address+4, m_reg[rd & ~1]);
+ m_program.write_dword(address+0, m_reg[(rd & ~1) + 1]);
+ m_program.write_dword(address+4, m_reg[rd & ~1]);
if (m && base)
m_reg[base] = address;
@@ -1043,7 +1043,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + (has_imm ? imm32 : m_reg[OP_SRC1()]);
- uint32_t r = m_program->read_byte(address);
+ uint32_t r = m_program.read_byte(address);
if (r & 0x80) r |= 0xffffff00;
if (rd)
@@ -1066,7 +1066,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- uint32_t r = m_program->read_word(address);
+ uint32_t r = m_program.read_word(address);
if (r & 0x8000) r |= 0xffff0000;
if (rd)
@@ -1088,7 +1088,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- uint32_t r = m_program->read_dword(address);
+ uint32_t r = m_program.read_dword(address);
if (rd)
m_reg[rd] = r;
@@ -1109,7 +1109,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- uint64_t r = m_program->read_qword(address);
+ uint64_t r = m_program.read_qword(address);
if (rd)
m_fpair[rd >> 1] = r;
@@ -1129,7 +1129,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + (has_imm ? imm32 : m_reg[OP_SRC1()]);
- uint32_t r = (uint8_t)(m_program->read_byte(address));
+ uint32_t r = (uint8_t)(m_program.read_byte(address));
if (rd)
m_reg[rd] = r;
@@ -1150,7 +1150,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int rd = OP_RD();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- uint32_t r = (uint16_t)(m_program->read_word(address));
+ uint32_t r = (uint16_t)(m_program.read_word(address));
if (rd)
m_reg[rd] = r;
@@ -1170,7 +1170,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int base = OP_BASE();
uint32_t address = m_reg[base] + (has_imm ? imm32 : m_reg[OP_SRC1()]);
- m_program->write_byte(address, (uint8_t)(m_reg[OP_RD()]));
+ m_program.write_byte(address, (uint8_t)(m_reg[OP_RD()]));
if (m && base)
m_reg[base] = address;
@@ -1188,7 +1188,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int base = OP_BASE();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- m_program->write_word(address, (uint16_t)(m_reg[OP_RD()]));
+ m_program.write_word(address, (uint16_t)(m_reg[OP_RD()]));
if (m && base)
m_reg[base] = address;
@@ -1206,7 +1206,7 @@ void tms32082_mp_device::execute_reg_long_imm()
int base = OP_BASE();
uint32_t address = m_reg[base] + ((has_imm ? imm32 : m_reg[OP_SRC1()]) << shift);
- m_program->write_dword(address, m_reg[OP_RD()]);
+ m_program.write_dword(address, m_reg[OP_RD()]);
if (m && base)
m_reg[base] = address;
diff --git a/src/devices/cpu/tms32082/tms32082.cpp b/src/devices/cpu/tms32082/tms32082.cpp
index a14bf89c346..9df37455e99 100644
--- a/src/devices/cpu/tms32082/tms32082.cpp
+++ b/src/devices/cpu/tms32082/tms32082.cpp
@@ -90,20 +90,20 @@ WRITE32_MEMBER(tms32082_mp_device::mp_param_w)
// TODO: move TC functionality to separate device
uint32_t address = data;
- uint32_t next_entry = m_program->read_dword(address + 0);
- uint32_t pt_options = m_program->read_dword(address + 4);
- uint32_t src_addr = m_program->read_dword(address + 8);
- uint32_t dst_addr = m_program->read_dword(address + 12);
- uint32_t src_b_count = m_program->read_word(address + 16);
- uint32_t src_a_count = m_program->read_word(address + 18);
- uint32_t dst_b_count = m_program->read_word(address + 20);
- uint32_t dst_a_count = m_program->read_word(address + 22);
- uint32_t src_c_count = m_program->read_dword(address + 24);
- uint32_t dst_c_count = m_program->read_dword(address + 28);
- uint32_t src_b_pitch = m_program->read_dword(address + 32);
- uint32_t dst_b_pitch = m_program->read_dword(address + 36);
- uint32_t src_c_pitch = m_program->read_dword(address + 40);
- uint32_t dst_c_pitch = m_program->read_dword(address + 44);
+ uint32_t next_entry = m_program.read_dword(address + 0);
+ uint32_t pt_options = m_program.read_dword(address + 4);
+ uint32_t src_addr = m_program.read_dword(address + 8);
+ uint32_t dst_addr = m_program.read_dword(address + 12);
+ uint32_t src_b_count = m_program.read_word(address + 16);
+ uint32_t src_a_count = m_program.read_word(address + 18);
+ uint32_t dst_b_count = m_program.read_word(address + 20);
+ uint32_t dst_a_count = m_program.read_word(address + 22);
+ uint32_t src_c_count = m_program.read_dword(address + 24);
+ uint32_t dst_c_count = m_program.read_dword(address + 28);
+ uint32_t src_b_pitch = m_program.read_dword(address + 32);
+ uint32_t dst_b_pitch = m_program.read_dword(address + 36);
+ uint32_t src_c_pitch = m_program.read_dword(address + 40);
+ uint32_t dst_c_pitch = m_program.read_dword(address + 44);
printf("TC operation:\n");
printf(" Next entry: %08X\n", next_entry);
@@ -137,8 +137,8 @@ WRITE32_MEMBER(tms32082_mp_device::mp_param_w)
uint32_t src = src_addr + c_src_offset + b_src_offset + ia;
uint32_t dst = dst_addr + c_dst_offset + b_dst_offset + ia;
- uint32_t data = m_program->read_byte(src);
- m_program->write_byte(dst, data);
+ uint32_t data = m_program.read_byte(src);
+ m_program.write_byte(dst, data);
//printf("%08X: %02X -> %08X\n", src, data, dst);
}
@@ -151,7 +151,7 @@ WRITE32_MEMBER(tms32082_mp_device::mp_param_w)
void tms32082_mp_device::device_start()
{
- m_program = &space(AS_PROGRAM);
+ space(AS_PROGRAM).specific(m_program);
m_cmd_callback.resolve();
save_item(NAME(m_pc));
@@ -218,8 +218,8 @@ void tms32082_mp_device::device_start()
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
set_icountptr(m_icount);
}
@@ -294,7 +294,7 @@ void tms32082_mp_device::processor_command(uint32_t command)
printf("PP0 ");
if (!m_cmd_callback.isnull())
- m_cmd_callback(*m_program, 0, command, 0xffffffff);
+ m_cmd_callback(space(AS_PROGRAM), 0, command, 0xffffffff);
printf("\n");
}
@@ -403,7 +403,7 @@ void tms32082_mp_device::check_interrupts()
m_ie &= ~1; // clear global interrupt mask
// get new pc from vector table
- m_fetchpc = m_pc = m_program->read_dword(0x01010180 + (i * 4));
+ m_fetchpc = m_pc = m_program.read_dword(0x01010180 + (i * 4));
return;
}
}
@@ -436,7 +436,7 @@ void tms32082_mp_device::execute_set_input(int inputnum, int state)
uint32_t tms32082_mp_device::fetch()
{
- uint32_t w = m_cache->read_dword(m_fetchpc);
+ uint32_t w = m_cache.read_dword(m_fetchpc);
m_fetchpc += 4;
return w;
}
@@ -506,7 +506,7 @@ std::unique_ptr<util::disasm_interface> tms32082_pp_device::create_disassembler(
void tms32082_pp_device::device_start()
{
- m_program = &space(AS_PROGRAM);
+ space(AS_PROGRAM).specific(m_program);
save_item(NAME(m_pc));
save_item(NAME(m_fetchpc));
@@ -517,8 +517,8 @@ void tms32082_pp_device::device_start()
state_add(STATE_GENPC, "GENPC", m_pc).noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc).noshow();
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
set_icountptr(m_icount);
}
diff --git a/src/devices/cpu/tms32082/tms32082.h b/src/devices/cpu/tms32082/tms32082.h
index e571255192d..ae68967fba4 100644
--- a/src/devices/cpu/tms32082/tms32082.h
+++ b/src/devices/cpu/tms32082/tms32082.h
@@ -129,8 +129,8 @@ protected:
int m_icount;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_BIG> * m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_program;
write32_delegate m_cmd_callback;
@@ -189,8 +189,8 @@ protected:
int m_icount;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_BIG> * m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_program;
};
diff --git a/src/devices/cpu/tms34010/34010gfx.hxx b/src/devices/cpu/tms34010/34010gfx.hxx
index 80d9aa0669f..9e810704184 100644
--- a/src/devices/cpu/tms34010/34010gfx.hxx
+++ b/src/devices/cpu/tms34010/34010gfx.hxx
@@ -205,7 +205,7 @@ int tms340x0_device::compute_pixblt_b_cycles(int left_partials, int right_partia
/* Shift register handling */
-void tms340x0_device::memory_w(address_space &space, offs_t offset,uint16_t data)
+void tms340x0_device::memory_w(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset,uint16_t data)
{
//logerror("memory_w %08x %04x\n", offset << 3, data);
if((offset << 3) == 0x02005010 && data == 0x0000) {
@@ -215,12 +215,12 @@ void tms340x0_device::memory_w(address_space &space, offs_t offset,uint16_t data
space.write_word(offset, data);
}
-uint16_t tms340x0_device::memory_r(address_space &space, offs_t offset)
+uint16_t tms340x0_device::memory_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset)
{
return space.read_word(offset);
}
-void tms340x0_device::shiftreg_w(address_space &space, offs_t offset,uint16_t data)
+void tms340x0_device::shiftreg_w(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset,uint16_t data)
{
//logerror("shiftreg_w %08x %04x\n", offset << 3, data);
if (!m_from_shiftreg_cb.isnull())
@@ -229,7 +229,7 @@ void tms340x0_device::shiftreg_w(address_space &space, offs_t offset,uint16_t da
logerror("From ShiftReg function not set. PC = %08X\n", m_pc);
}
-uint16_t tms340x0_device::shiftreg_r(address_space &space, offs_t offset)
+uint16_t tms340x0_device::shiftreg_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset)
{
if (!m_to_shiftreg_cb.isnull())
m_to_shiftreg_cb(space, offset, &m_shiftreg[0]);
@@ -238,7 +238,7 @@ uint16_t tms340x0_device::shiftreg_r(address_space &space, offs_t offset)
return m_shiftreg[0];
}
-uint16_t tms340x0_device::dummy_shiftreg_r(address_space &space, offs_t offset)
+uint16_t tms340x0_device::dummy_shiftreg_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset)
{
return m_shiftreg[0];
}
@@ -1034,13 +1034,13 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
uint32_t srcword, dstword = 0;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, srcwordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, srcwordaddr++ << 4);
readwrites++;
/* fetch the initial dest word */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY || (daddr & 0x0f) != 0)
{
- dstword = (this->*word_read)(*m_program, dstwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dstwordaddr << 4);
readwrites++;
}
@@ -1053,7 +1053,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch more words if necessary */
if (srcbit + BITS_PER_PIXEL > 16)
{
- srcword |= (this->*word_read)(*m_program, srcwordaddr++ << 4) << 16;
+ srcword |= (this->*word_read)(m_program, srcwordaddr++ << 4) << 16;
readwrites++;
}
@@ -1070,7 +1070,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
if (dstbit + BITS_PER_PIXEL > 16)
{
- dstword |= (this->*word_read)(*m_program, (dstwordaddr + 1) << 4) << 16;
+ dstword |= (this->*word_read)(m_program, (dstwordaddr + 1) << 4) << 16;
readwrites++;
}
@@ -1085,7 +1085,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
dstbit += BITS_PER_PIXEL;
if (dstbit > 16)
{
- (this->*word_write)(*m_program, dstwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dstwordaddr++ << 4, dstword);
readwrites++;
dstbit -= 16;
dstword >>= 16;
@@ -1098,13 +1098,13 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* if we're right-partial, read and mask the remaining bits */
if (dstbit != 16)
{
- uint16_t origdst = (this->*word_read)(*m_program, dstwordaddr << 4);
+ uint16_t origdst = (this->*word_read)(m_program, dstwordaddr << 4);
uint16_t mask = 0xffff << dstbit;
dstword = (dstword & ~mask) | (origdst & mask);
readwrites++;
}
- (this->*word_write)(*m_program, dstwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dstwordaddr++ << 4, dstword);
readwrites++;
}
@@ -1136,14 +1136,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
dwordaddr = daddr >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK << (saddr & 15);
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1152,7 +1152,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch another word if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1174,7 +1174,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1182,7 +1182,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1193,7 +1193,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
/* fetch another word if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1215,14 +1215,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1232,7 +1232,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
if (srcmask == 0)
{
LOGGFX((" right fetch @ %08x\n", swordaddr));
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = PIXEL_MASK;
}
@@ -1254,7 +1254,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt)(int src_is_linear, int dst_is_linear
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
#endif
@@ -1405,14 +1405,14 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
dwordaddr = (daddr + 15) >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, --swordaddr << 4);
+ srcword = (this->*word_read)(m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << ((saddr - BITS_PER_PIXEL) & 15);
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, --dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, --dwordaddr << 4);
dstmask = PIXEL_MASK << ((daddr - BITS_PER_PIXEL) & 15);
/* loop over partials */
@@ -1421,7 +1421,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 4);
+ srcword = (this->*word_read)(m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1448,7 +1448,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr << 4, dstword);
}
/* loop over full words */
@@ -1457,7 +1457,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch the destination word (if necessary) */
dwordaddr--;
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
@@ -1468,7 +1468,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 4);
+ srcword = (this->*word_read)(m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1495,14 +1495,14 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr << 4, dstword);
}
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, --dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, --dwordaddr << 4);
dstmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
/* loop over partials */
@@ -1511,7 +1511,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
/* fetch the source pixel if necessary */
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, --swordaddr << 4);
+ srcword = (this->*word_read)(m_program, --swordaddr << 4);
srcmask = PIXEL_MASK << (16 - BITS_PER_PIXEL);
}
@@ -1538,7 +1538,7 @@ if ((daddr & (BITS_PER_PIXEL - 1)) != 0) osd_printf_debug("PIXBLT_R%d with odd d
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr << 4, dstword);
}
/* update for next row */
@@ -1663,14 +1663,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
dwordaddr = daddr >> 4;
/* fetch the initial source word */
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = 1 << (saddr & 15);
/* handle the left partial word */
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1687,7 +1687,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1696,7 +1696,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1704,7 +1704,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1723,7 +1723,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1732,14 +1732,14 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1756,7 +1756,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
srcmask <<= 1;
if (srcmask == 0)
{
- srcword = (this->*word_read)(*m_program, swordaddr++ << 4);
+ srcword = (this->*word_read)(m_program, swordaddr++ << 4);
srcmask = 0x0001;
}
@@ -1765,7 +1765,7 @@ void FUNCTION_NAME(tms340x0_device::pixblt_b)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* update for next row */
@@ -1879,7 +1879,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
if (left_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK << (daddr & 15);
/* loop over partials */
@@ -1896,7 +1896,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* loop over full words */
@@ -1904,7 +1904,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
{
/* fetch the destination word (if necessary) */
if (PIXEL_OP_REQUIRES_SOURCE || TRANSPARENCY)
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
else
dstword = 0;
dstmask = PIXEL_MASK;
@@ -1923,14 +1923,14 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* handle the right partial word */
if (right_partials != 0)
{
/* fetch the destination word */
- dstword = (this->*word_read)(*m_program, dwordaddr << 4);
+ dstword = (this->*word_read)(m_program, dwordaddr << 4);
dstmask = PIXEL_MASK;
/* loop over partials */
@@ -1947,7 +1947,7 @@ void FUNCTION_NAME(tms340x0_device::fill)(int dst_is_linear)
}
/* write the result */
- (this->*word_write)(*m_program, dwordaddr++ << 4, dstword);
+ (this->*word_write)(m_program, dwordaddr++ << 4, dstword);
}
/* update for next row */
diff --git a/src/devices/cpu/tms34010/34010ops.h b/src/devices/cpu/tms34010/34010ops.h
index ca936202eb8..ae4aa8f6e06 100644
--- a/src/devices/cpu/tms34010/34010ops.h
+++ b/src/devices/cpu/tms34010/34010ops.h
@@ -21,20 +21,20 @@
MEMORY I/O MACROS
***************************************************************************/
-#define TMS34010_RDMEM(A) ((unsigned)m_program->read_byte (A))
-#define TMS34010_RDMEM_WORD(A) ((unsigned)m_program->read_word (A))
+#define TMS34010_RDMEM(A) ((unsigned)m_program.read_byte (A))
+#define TMS34010_RDMEM_WORD(A) ((unsigned)m_program.read_word (A))
inline uint32_t tms340x0_device::TMS34010_RDMEM_DWORD(offs_t A)
{
- uint32_t result = m_program->read_word(A);
- return result | (m_program->read_word(A+16)<<16);
+ uint32_t result = m_program.read_word(A);
+ return result | (m_program.read_word(A+16)<<16);
}
-#define TMS34010_WRMEM(A,V) (m_program->write_byte(A,V))
-#define TMS34010_WRMEM_WORD(A,V) (m_program->write_word(A,V))
+#define TMS34010_WRMEM(A,V) (m_program.write_byte(A,V))
+#define TMS34010_WRMEM_WORD(A,V) (m_program.write_word(A,V))
inline void tms340x0_device::TMS34010_WRMEM_DWORD(offs_t A, uint32_t V)
{
- m_program->write_word(A,V);
- m_program->write_word(A+16,V>>16);
+ m_program.write_word(A,V);
+ m_program.write_word(A+16,V>>16);
}
diff --git a/src/devices/cpu/tms34010/34010ops.hxx b/src/devices/cpu/tms34010/34010ops.hxx
index 2c4639db628..96c6f3e17f4 100644
--- a/src/devices/cpu/tms34010/34010ops.hxx
+++ b/src/devices/cpu/tms34010/34010ops.hxx
@@ -80,13 +80,13 @@ void tms340x0_device::unimpl(uint16_t op)
{
/* kludge for Super High Impact -- this doesn't seem to cause */
/* an illegal opcode exception */
- if (m_cache->read_word(m_pc - 0x10) == 0x0007)
+ if (m_cache.read_word(m_pc - 0x10) == 0x0007)
return;
/* 9 Ball Shootout calls to FFDF7468, expecting it */
/* to execute the next instruction from FFDF7470 */
/* but the instruction at FFDF7460 is an 0x0001 */
- if (m_cache->read_word(m_pc - 0x10) == 0x0001)
+ if (m_cache.read_word(m_pc - 0x10) == 0x0001)
return;
PUSH(m_pc);
@@ -96,7 +96,7 @@ void tms340x0_device::unimpl(uint16_t op)
COUNT_UNKNOWN_CYCLES(16);
/* extra check to prevent bad things */
- if (m_pc == 0 || s_opcode_table[m_cache->read_word(m_pc) >> 4] == &tms34010_device::unimpl)
+ if (m_pc == 0 || s_opcode_table[m_cache.read_word(m_pc) >> 4] == &tms34010_device::unimpl)
{
set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
machine().debug_break();
diff --git a/src/devices/cpu/tms34010/tms34010.cpp b/src/devices/cpu/tms34010/tms34010.cpp
index bd039d7e706..cda86ced222 100644
--- a/src/devices/cpu/tms34010/tms34010.cpp
+++ b/src/devices/cpu/tms34010/tms34010.cpp
@@ -82,8 +82,6 @@ tms340x0_device::tms340x0_device(const machine_config &mconfig, device_type type
, m_hblank_stable(0)
, m_external_host_access(0)
, m_executing(0)
- , m_program(nullptr)
- , m_cache(nullptr)
, m_pixclock(0)
, m_pixperclock(0)
, m_scantimer(nullptr)
@@ -236,32 +234,32 @@ inline uint32_t tms340x0_device::ROPCODE()
{
uint32_t pc = m_pc;
m_pc += 2 << 3;
- return m_cache->read_word(pc);
+ return m_cache.read_word(pc);
}
inline int16_t tms340x0_device::PARAM_WORD()
{
uint32_t pc = m_pc;
m_pc += 2 << 3;
- return m_cache->read_word(pc);
+ return m_cache.read_word(pc);
}
inline int32_t tms340x0_device::PARAM_LONG()
{
uint32_t pc = m_pc;
m_pc += 4 << 3;
- return (uint16_t)m_cache->read_word(pc) | (m_cache->read_word(pc + 16) << 16);
+ return (uint16_t)m_cache.read_word(pc) | (m_cache.read_word(pc + 16) << 16);
}
inline int16_t tms340x0_device::PARAM_WORD_NO_INC()
{
- return m_cache->read_word(m_pc);
+ return m_cache.read_word(m_pc);
}
inline int32_t tms340x0_device::PARAM_LONG_NO_INC()
{
uint32_t pc = m_pc;
- return (uint16_t)m_cache->read_word(pc) | (m_cache->read_word(pc + 16) << 16);
+ return (uint16_t)m_cache.read_word(pc) | (m_cache.read_word(pc + 16) << 16);
}
/* read memory byte */
@@ -333,7 +331,7 @@ uint32_t tms340x0_device::read_pixel_32(offs_t offset)
uint32_t tms340x0_device::read_pixel_shiftreg(offs_t offset)
{
if (!m_to_shiftreg_cb.isnull())
- m_to_shiftreg_cb(*m_program, offset, &m_shiftreg[0]);
+ m_to_shiftreg_cb(m_program, offset, &m_shiftreg[0]);
else
fatalerror("To ShiftReg function not set. PC = %08X\n", m_pc);
return m_shiftreg[0];
@@ -475,7 +473,7 @@ void tms340x0_device::write_pixel_r_t_32(offs_t offset, uint32_t data)
void tms340x0_device::write_pixel_shiftreg(offs_t offset, uint32_t data)
{
if (!m_from_shiftreg_cb.isnull())
- m_from_shiftreg_cb(*m_program, offset, &m_shiftreg[0]);
+ m_from_shiftreg_cb(m_program, offset, &m_shiftreg[0]);
else
fatalerror("From ShiftReg function not set. PC = %08X\n", m_pc);
}
@@ -642,8 +640,8 @@ void tms340x0_device::device_start()
m_external_host_access = false;
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<1, 3, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
/* set up the state table */
{
diff --git a/src/devices/cpu/tms34010/tms34010.h b/src/devices/cpu/tms34010/tms34010.h
index e79337f36ea..961036b3439 100644
--- a/src/devices/cpu/tms34010/tms34010.h
+++ b/src/devices/cpu/tms34010/tms34010.h
@@ -105,8 +105,8 @@ enum
#define TMS340X0_SCANLINE_IND16_CB_MEMBER(_name) void _name(screen_device &screen, bitmap_ind16 &bitmap, int scanline, const tms340x0_device::display_params *params)
#define TMS340X0_SCANLINE_RGB32_CB_MEMBER(_name) void _name(screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const tms340x0_device::display_params *params)
-#define TMS340X0_TO_SHIFTREG_CB_MEMBER(_name) void _name(address_space &space, offs_t address, uint16_t *shiftreg)
-#define TMS340X0_FROM_SHIFTREG_CB_MEMBER(_name) void _name(address_space &space, offs_t address, uint16_t *shiftreg)
+#define TMS340X0_TO_SHIFTREG_CB_MEMBER(_name) void _name(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t address, uint16_t *shiftreg)
+#define TMS340X0_FROM_SHIFTREG_CB_MEMBER(_name) void _name(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t address, uint16_t *shiftreg)
class tms340x0_device : public cpu_device,
@@ -126,8 +126,8 @@ public:
typedef device_delegate<void (screen_device &screen, bitmap_ind16 &bitmap, int scanline, const display_params *params)> scanline_ind16_cb_delegate;
typedef device_delegate<void (screen_device &screen, bitmap_rgb32 &bitmap, int scanline, const display_params *params)> scanline_rgb32_cb_delegate;
- typedef device_delegate<void (address_space &space, offs_t address, uint16_t *shiftreg)> shiftreg_in_cb_delegate;
- typedef device_delegate<void (address_space &space, offs_t address, uint16_t *shiftreg)> shiftreg_out_cb_delegate;
+ typedef device_delegate<void (memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t address, uint16_t *shiftreg)> shiftreg_in_cb_delegate;
+ typedef device_delegate<void (memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t address, uint16_t *shiftreg)> shiftreg_out_cb_delegate;
void set_halt_on_reset(bool halt_on_reset) { m_halt_on_reset = halt_on_reset; }
void set_pixel_clock(uint32_t pixclock) { m_pixclock = pixclock; }
@@ -281,8 +281,8 @@ protected:
typedef uint32_t (tms340x0_device::*pixel_op_func)(uint32_t, uint32_t, uint32_t);
typedef void (tms340x0_device::*pixblt_op_func)(int, int);
typedef void (tms340x0_device::*pixblt_b_op_func)(int);
- typedef void (tms340x0_device::*word_write_func)(address_space &space, offs_t offset,uint16_t data);
- typedef uint16_t (tms340x0_device::*word_read_func)(address_space &space, offs_t offset);
+ typedef void (tms340x0_device::*word_write_func)(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset,uint16_t data);
+ typedef uint16_t (tms340x0_device::*word_read_func)(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset);
static const wfield_func s_wfield_functions[32];
static const rfield_func s_rfield_functions[64];
@@ -318,8 +318,8 @@ protected:
uint8_t m_hblank_stable;
uint8_t m_external_host_access;
uint8_t m_executing;
- address_space *m_program;
- memory_access_cache<1, 3, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 1, 3, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific m_program;
uint32_t m_pixclock; /* the pixel clock (0 means don't adjust screen size) */
int m_pixperclock; /* pixels per clock */
emu_timer *m_scantimer;
@@ -892,11 +892,11 @@ protected:
int compute_fill_cycles(int left_partials, int right_partials, int full_words, int op_timing);
int compute_pixblt_cycles(int left_partials, int right_partials, int full_words, int op_timing);
int compute_pixblt_b_cycles(int left_partials, int right_partials, int full_words, int rows, int op_timing, int bpp);
- void memory_w(address_space &space, offs_t offset,uint16_t data);
- uint16_t memory_r(address_space &space, offs_t offset);
- void shiftreg_w(address_space &space, offs_t offset, uint16_t data);
- uint16_t shiftreg_r(address_space &space, offs_t offset);
- uint16_t dummy_shiftreg_r(address_space &space, offs_t offset);
+ void memory_w(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset,uint16_t data);
+ uint16_t memory_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset);
+ void shiftreg_w(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset, uint16_t data);
+ uint16_t shiftreg_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset);
+ uint16_t dummy_shiftreg_r(memory_access<32, 1, 3, ENDIANNESS_LITTLE>::specific &space, offs_t offset);
uint32_t pixel_op00(uint32_t dstpix, uint32_t mask, uint32_t srcpix);
uint32_t pixel_op01(uint32_t dstpix, uint32_t mask, uint32_t srcpix);
uint32_t pixel_op02(uint32_t dstpix, uint32_t mask, uint32_t srcpix);
diff --git a/src/devices/cpu/tms7000/tms7000.cpp b/src/devices/cpu/tms7000/tms7000.cpp
index 23667e31820..cc3c0a1ff88 100644
--- a/src/devices/cpu/tms7000/tms7000.cpp
+++ b/src/devices/cpu/tms7000/tms7000.cpp
@@ -196,8 +196,8 @@ device_memory_interface::space_config_vector tms7000_device::memory_space_config
void tms7000_device::device_start()
{
// init/zerofill
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
set_icountptr(m_icount);
@@ -635,7 +635,7 @@ void tms7000_device::execute_run()
{
debugger_instruction_hook(m_pc);
- m_op = m_cache->read_byte(m_pc++);
+ m_op = m_cache.read_byte(m_pc++);
execute_one(m_op);
} while (m_icount > 0);
}
diff --git a/src/devices/cpu/tms7000/tms7000.h b/src/devices/cpu/tms7000/tms7000.h
index cf1ced0e9b0..a35656422ff 100644
--- a/src/devices/cpu/tms7000/tms7000.h
+++ b/src/devices/cpu/tms7000/tms7000.h
@@ -113,8 +113,8 @@ protected:
const uint32_t m_info_flags;
unsigned m_divider;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
int m_icount;
bool m_irq_state[2];
@@ -148,26 +148,26 @@ protected:
void timer_tick_low(int tmr);
// internal read/write
- inline uint8_t read_r8(uint8_t address) { return m_program->read_byte(address); }
- inline void write_r8(uint8_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_r16(uint8_t address) { return m_program->read_byte((address - 1) & 0xff) << 8 | m_program->read_byte(address); }
- inline void write_r16(uint8_t address, uint16_t data) { m_program->write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program->write_byte(address, data & 0xff); }
-
- inline uint8_t read_p(uint8_t address) { return m_program->read_byte(0x100 + address); }
- inline void write_p(uint8_t address, uint8_t data) { m_program->write_byte(0x100 + address, data); }
-
- inline uint8_t read_mem8(uint16_t address) { return m_program->read_byte(address); }
- inline void write_mem8(uint16_t address, uint8_t data) { m_program->write_byte(address, data); }
- inline uint16_t read_mem16(uint16_t address) { return m_program->read_byte(address) << 8 | m_program->read_byte((address + 1) & 0xffff); }
- inline void write_mem16(uint16_t address, uint16_t data) { m_program->write_byte(address, data >> 8 & 0xff); m_program->write_byte((address + 1) & 0xffff, data & 0xff); }
-
- inline uint8_t imm8() { return m_cache->read_byte(m_pc++); }
- inline uint16_t imm16() { uint16_t ret = m_cache->read_byte(m_pc++) << 8; return ret | m_cache->read_byte(m_pc++); }
-
- inline uint8_t pull8() { return m_program->read_byte(m_sp--); }
- inline void push8(uint8_t data) { m_program->write_byte(++m_sp, data); }
- inline uint16_t pull16() { uint16_t ret = m_program->read_byte(m_sp--); return ret | m_program->read_byte(m_sp--) << 8; }
- inline void push16(uint16_t data) { m_program->write_byte(++m_sp, data >> 8 & 0xff); m_program->write_byte(++m_sp, data & 0xff); }
+ inline uint8_t read_r8(uint8_t address) { return m_program.read_byte(address); }
+ inline void write_r8(uint8_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_r16(uint8_t address) { return m_program.read_byte((address - 1) & 0xff) << 8 | m_program.read_byte(address); }
+ inline void write_r16(uint8_t address, uint16_t data) { m_program.write_byte((address - 1) & 0xff, data >> 8 & 0xff); m_program.write_byte(address, data & 0xff); }
+
+ inline uint8_t read_p(uint8_t address) { return m_program.read_byte(0x100 + address); }
+ inline void write_p(uint8_t address, uint8_t data) { m_program.write_byte(0x100 + address, data); }
+
+ inline uint8_t read_mem8(uint16_t address) { return m_program.read_byte(address); }
+ inline void write_mem8(uint16_t address, uint8_t data) { m_program.write_byte(address, data); }
+ inline uint16_t read_mem16(uint16_t address) { return m_program.read_byte(address) << 8 | m_program.read_byte((address + 1) & 0xffff); }
+ inline void write_mem16(uint16_t address, uint16_t data) { m_program.write_byte(address, data >> 8 & 0xff); m_program.write_byte((address + 1) & 0xffff, data & 0xff); }
+
+ inline uint8_t imm8() { return m_cache.read_byte(m_pc++); }
+ inline uint16_t imm16() { uint16_t ret = m_cache.read_byte(m_pc++) << 8; return ret | m_cache.read_byte(m_pc++); }
+
+ inline uint8_t pull8() { return m_program.read_byte(m_sp--); }
+ inline void push8(uint8_t data) { m_program.write_byte(++m_sp, data); }
+ inline uint16_t pull16() { uint16_t ret = m_program.read_byte(m_sp--); return ret | m_program.read_byte(m_sp--) << 8; }
+ inline void push16(uint16_t data) { m_program.write_byte(++m_sp, data >> 8 & 0xff); m_program.write_byte(++m_sp, data & 0xff); }
// statusreg flags
enum
diff --git a/src/devices/cpu/unsp/unsp.cpp b/src/devices/cpu/unsp/unsp.cpp
index 40adc713f01..ea416cbe05c 100644
--- a/src/devices/cpu/unsp/unsp.cpp
+++ b/src/devices/cpu/unsp/unsp.cpp
@@ -41,12 +41,11 @@ unsp_device::unsp_device(const machine_config &mconfig, device_type type, const
: cpu_device(mconfig, type, tag, owner, clock)
, m_core(nullptr)
, m_program_config("program", ENDIANNESS_BIG, 16, 23, -1, internal)
- , m_program(nullptr)
, m_debugger_temp(0)
#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
, m_log_ops(0)
#endif
- , m_cache(CACHE_SIZE + sizeof(unsp_device))
+ , m_drccache(CACHE_SIZE + sizeof(unsp_device))
, m_drcuml(nullptr)
, m_drcfe(nullptr)
, m_drcoptions(0)
@@ -193,7 +192,7 @@ void unsp_device::unimplemented_opcode(uint16_t op, uint16_t ximm, uint16_t ximm
void unsp_device::device_start()
{
- m_core = (internal_unsp_state *)m_cache.alloc_near(sizeof(internal_unsp_state));
+ m_core = (internal_unsp_state *)m_drccache.alloc_near(sizeof(internal_unsp_state));
memset(m_core, 0, sizeof(internal_unsp_state));
#if ENABLE_UNSP_DRC
@@ -211,13 +210,11 @@ void unsp_device::device_start()
m_debugger_temp = 0;
- m_program = &space(AS_PROGRAM);
- auto cache = m_program->cache<1, -1, ENDIANNESS_BIG>();
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word(address); };
- m_prptr = [cache](offs_t address) -> const void * { return cache->read_ptr(address); };
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
uint32_t umlflags = 0;
- m_drcuml = std::make_unique<drcuml_state>(*this, m_cache, umlflags, 1, 23, 0);
+ m_drcuml = std::make_unique<drcuml_state>(*this, m_drccache, umlflags, 1, 23, 0);
// add UML symbols-
m_drcuml->symbol_add(&m_core->m_r[REG_SP], sizeof(uint32_t), "SP");
diff --git a/src/devices/cpu/unsp/unsp.h b/src/devices/cpu/unsp/unsp.h
index b5f77d239db..c55daf885c7 100644
--- a/src/devices/cpu/unsp/unsp.h
+++ b/src/devices/cpu/unsp/unsp.h
@@ -209,14 +209,14 @@ protected:
internal_unsp_state* m_core;
protected:
- uint16_t read16(uint32_t address) { return m_program->read_word(address); }
+ uint16_t read16(uint32_t address) { return m_program.read_word(address); }
void write16(uint32_t address, uint16_t data)
{
#if UNSP_LOG_REGS
log_write(address, data);
#endif
- m_program->write_word(address, data);
+ m_program.write_word(address, data);
}
void add_lpc(const int32_t offset)
@@ -287,9 +287,8 @@ private:
address_space_config m_program_config;
- address_space *m_program;
- std::function<u16 (offs_t)> m_pr16;
- std::function<const void * (offs_t)> m_prptr;
+ memory_access<23, 2, -1, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<23, 2, -1, ENDIANNESS_BIG>::specific m_program;
uint32_t m_debugger_temp;
#if UNSP_LOG_OPCODES || UNSP_LOG_REGS
@@ -300,7 +299,7 @@ private:
inline void trigger_irq(int line);
void check_irqs();
- drc_cache m_cache;
+ drc_cache m_drccache;
std::unique_ptr<drcuml_state> m_drcuml;
std::unique_ptr<unsp_frontend> m_drcfe;
uint32_t m_drcoptions;
diff --git a/src/devices/cpu/unsp/unspdrc.cpp b/src/devices/cpu/unsp/unspdrc.cpp
index 32011522c2e..8db11bc19e1 100644
--- a/src/devices/cpu/unsp/unspdrc.cpp
+++ b/src/devices/cpu/unsp/unspdrc.cpp
@@ -204,7 +204,7 @@ void unsp_device::code_compile_block(offs_t pc)
}
/* validate this code block if we're not pointing into ROM */
- if (m_program->get_write_ptr(seqhead->physpc) != nullptr)
+ if (m_program.space().get_write_ptr(seqhead->physpc) != nullptr)
generate_checksum_block(block, compiler, seqhead, seqlast);
/* label this instruction, if it may be jumped to locally */
@@ -526,7 +526,7 @@ void unsp_device::generate_checksum_block(drcuml_block &block, compiler_state &c
}
/* full verification; sum up everything */
- void *memptr = m_program->get_write_ptr(seqhead->physpc);
+ void *memptr = m_program.space().get_write_ptr(seqhead->physpc);
UML_LOAD(block, I0, memptr, 0, SIZE_WORD, SCALE_x2);
uint32_t sum = seqhead->opptr.w[0];
for (int i = 1; i < seqhead->length; i++)
@@ -539,7 +539,7 @@ void unsp_device::generate_checksum_block(drcuml_block &block, compiler_state &c
{
if (!(curdesc->flags & OPFLAG_VIRTUAL_NOOP))
{
- memptr = m_program->get_write_ptr(curdesc->physpc);
+ memptr = m_program.space().get_write_ptr(curdesc->physpc);
UML_LOAD(block, I1, memptr, 0, SIZE_WORD, SCALE_x2);
UML_ADD(block, I0, I0, I1);
sum += curdesc->opptr.w[0];
@@ -1158,7 +1158,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler,
case 0x01: // imm16
{
UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r1 = m_pr16(desc->pc + 1);
+ const uint16_t r1 = m_cache.read_word(desc->pc + 1);
generate_add_lpc(block, 1);
UML_MOV(block, I1, r1);
break;
@@ -1167,7 +1167,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler,
case 0x02: // [imm16]
{
UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r1 = m_pr16(desc->pc + 1);
+ const uint16_t r1 = m_cache.read_word(desc->pc + 1);
generate_add_lpc(block, 1);
UML_MOV(block, I0, r1);
if (op0 != 0x0d)
@@ -1179,7 +1179,7 @@ bool unsp_device::generate_opcode(drcuml_block &block, compiler_state &compiler,
{
UML_MOV(block, I1, I2);
UML_MOV(block, I2, mem(&m_core->m_r[opb]));
- const uint16_t r2 = m_pr16(desc->pc + 1);
+ const uint16_t r2 = m_cache.read_word(desc->pc + 1);
generate_add_lpc(block, 1);
UML_MOV(block, I0, r2);
break;
diff --git a/src/devices/cpu/unsp/unspfe.cpp b/src/devices/cpu/unsp/unspfe.cpp
index 5da9b6febdc..f93423379a1 100644
--- a/src/devices/cpu/unsp/unspfe.cpp
+++ b/src/devices/cpu/unsp/unspfe.cpp
@@ -24,7 +24,7 @@ unsp_frontend::unsp_frontend(unsp_device *unsp, uint32_t window_start, uint32_t
inline uint16_t unsp_frontend::read_op_word(opcode_desc &desc, int offset)
{
- return m_cpu->m_pr16(desc.physpc + offset);
+ return m_cpu->m_cache.read_word(desc.physpc + offset);
}
/*-------------------------------------------------
diff --git a/src/devices/cpu/upd7725/upd7725.cpp b/src/devices/cpu/upd7725/upd7725.cpp
index e1564ccffa1..d2d52a31959 100644
--- a/src/devices/cpu/upd7725/upd7725.cpp
+++ b/src/devices/cpu/upd7725/upd7725.cpp
@@ -31,9 +31,6 @@ necdsp_device::necdsp_device(const machine_config &mconfig, device_type type, co
m_data_config("data", ENDIANNESS_BIG, 16, dbits, -1), m_icount(0), // -1 for WORD-addressable
m_irq(0),
m_irq_firing(0),
- m_program(nullptr),
- m_data(nullptr),
- m_cache(nullptr),
m_in_int_cb(*this),
//m_in_si_cb(*this),
//m_in_sck_cb(*this),
@@ -66,9 +63,9 @@ upd96050_device::upd96050_device(const machine_config &mconfig, const char *tag,
void necdsp_device::device_start()
{
// get our address spaces
- m_program = &space(AS_PROGRAM);
- m_data = &space(AS_DATA);
- m_cache = m_program->cache<2, -2, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_DATA).specific(m_data);
// register our state for the debugger
state_add(STATE_GENPC, "GENPC", regs.pc).noshow();
@@ -340,7 +337,7 @@ void necdsp_device::execute_run()
if (m_irq_firing == 0) // normal opcode
{
- opcode = m_cache->read_dword(regs.pc) >> 8;
+ opcode = m_cache.read_dword(regs.pc) >> 8;
regs.pc++;
}
else if (m_irq_firing == 1) // if we're in an interrupt cycle, execute a op 'nop' first...
@@ -392,7 +389,7 @@ void necdsp_device::exec_op(uint32_t opcode) {
case 3: regs.idb = regs.tr; break;
case 4: regs.idb = regs.dp; break;
case 5: regs.idb = regs.rp; break;
- case 6: regs.idb = m_data->read_word(regs.rp); break;
+ case 6: regs.idb = m_data.read_word(regs.rp); break;
case 7: regs.idb = 0x8000 - regs.flaga.s1; break; //SGN
case 8: regs.idb = regs.dr; regs.sr.rqm = 1; break;
case 9: regs.idb = regs.dr; break;
@@ -589,7 +586,7 @@ void necdsp_device::exec_ld(uint32_t opcode) {
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;
+ case 11: regs.k = id; regs.l = m_data.read_word(regs.rp); break;
case 12: regs.l = id; regs.k = dataRAM[regs.dp | 0x40]; break;
case 13: regs.l = id; break;
case 14: regs.trb = id; break;
diff --git a/src/devices/cpu/upd7725/upd7725.h b/src/devices/cpu/upd7725/upd7725.h
index a4fc0ea1ce8..ed17af002eb 100644
--- a/src/devices/cpu/upd7725/upd7725.h
+++ b/src/devices/cpu/upd7725/upd7725.h
@@ -144,8 +144,9 @@ private:
// 1 = next opcode is the first half of int firing 'NOP'
// 2 = next opcode is the second half of int firing 'CALL 0100'
int m_irq_firing;
- address_space *m_program, *m_data;
- memory_access_cache<2, -2, ENDIANNESS_BIG> *m_cache;
+ memory_access<14, 2, -2, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<14, 2, -2, ENDIANNESS_BIG>::specific m_program;
+ memory_access<12, 1, -1, ENDIANNESS_BIG>::specific m_data;
protected:
devcb_read_line m_in_int_cb;
diff --git a/src/devices/cpu/upd7810/upd7810.cpp b/src/devices/cpu/upd7810/upd7810.cpp
index f836d1074a1..bd459b2f141 100644
--- a/src/devices/cpu/upd7810/upd7810.cpp
+++ b/src/devices/cpu/upd7810/upd7810.cpp
@@ -1602,8 +1602,8 @@ void upd78c05_device::handle_timers(int cycles)
void upd7810_device::base_device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_PROGRAM).cache(m_opcodes);
m_to_func.resolve_safe();
m_co0_func.resolve_safe();
diff --git a/src/devices/cpu/upd7810/upd7810.h b/src/devices/cpu/upd7810/upd7810.h
index 1eb39a2b975..84b86bb3e99 100644
--- a/src/devices/cpu/upd7810/upd7810.h
+++ b/src/devices/cpu/upd7810/upd7810.h
@@ -343,8 +343,8 @@ protected:
const struct opcode_s *m_op64;
const struct opcode_s *m_op70;
const struct opcode_s *m_op74;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_opcodes;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount;
uint8_t RP(offs_t port);
diff --git a/src/devices/cpu/upd7810/upd7810_macros.h b/src/devices/cpu/upd7810/upd7810_macros.h
index 82c0f3f2138..0ae44c63243 100644
--- a/src/devices/cpu/upd7810/upd7810_macros.h
+++ b/src/devices/cpu/upd7810/upd7810_macros.h
@@ -105,10 +105,10 @@
// MEMORY/OPCODE READ/WRITE
//**************************************************************************
-#define RDOP(O) O = m_cache->read_byte(PCD); PC++
-#define RDOPARG(A) A = m_cache->read_byte(PCD); PC++
-#define RM(A) m_program->read_byte(A)
-#define WM(A,V) m_program->write_byte(A,V)
+#define RDOP(O) O = m_opcodes.read_byte(PCD); PC++
+#define RDOPARG(A) A = m_opcodes.read_byte(PCD); PC++
+#define RM(A) m_program.read_byte(A)
+#define WM(A,V) m_program.write_byte(A,V)
//**************************************************************************
diff --git a/src/devices/cpu/upd78k/upd78k0.cpp b/src/devices/cpu/upd78k/upd78k0.cpp
index ff87be3553c..6af06e02685 100644
--- a/src/devices/cpu/upd78k/upd78k0.cpp
+++ b/src/devices/cpu/upd78k/upd78k0.cpp
@@ -30,10 +30,6 @@ upd78k0_device::upd78k0_device(const machine_config &mconfig, device_type type,
address_map_constructor(FUNC(upd78k0_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_size(iram_size)
- , m_program_space(nullptr)
- , m_program_cache(nullptr)
- , m_iram_cache(nullptr)
- , m_sfr_space(nullptr)
, m_subclock(0)
, m_pc(0)
, m_ppc(0)
@@ -103,10 +99,10 @@ inline u16 upd78k0_device::debug_register_base() const noexcept
void upd78k0_device::device_start()
{
// get address spaces and access caches
- m_program_space = &space(AS_PROGRAM);
- m_program_cache = m_program_space->cache<0, 0, ENDIANNESS_LITTLE>();
- m_iram_cache = space(AS_DATA).cache<1, 0, ENDIANNESS_LITTLE>();
- m_sfr_space = &space(AS_IO);
+ space(AS_PROGRAM).specific(m_program_space);
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_DATA).cache(m_iram_cache);
+ space(AS_IO).specific(m_sfr_space);
set_icountptr(m_icount);
@@ -158,7 +154,7 @@ void upd78k0_device::device_reset()
void upd78k0_device::execute_run()
{
- m_pc = m_program_cache->read_word(0);
+ m_pc = m_program_cache.read_word(0);
m_ppc = m_pc;
debugger_instruction_hook(m_pc);
diff --git a/src/devices/cpu/upd78k/upd78k0.h b/src/devices/cpu/upd78k/upd78k0.h
index 84c7fca788a..566dfab340f 100644
--- a/src/devices/cpu/upd78k/upd78k0.h
+++ b/src/devices/cpu/upd78k/upd78k0.h
@@ -61,10 +61,10 @@ private:
address_space_config m_iram_config;
address_space_config m_sfr_config;
const u16 m_iram_size;
- address_space *m_program_space;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_program_cache;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_iram_cache;
- address_space *m_sfr_space;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_program_cache;
+ memory_access<10, 1, 0, ENDIANNESS_LITTLE>::cache m_iram_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program_space;
+ memory_access< 8, 1, 0, ENDIANNESS_LITTLE>::specific m_sfr_space;
// miscellaneous configuration
u32 m_subclock;
diff --git a/src/devices/cpu/upd78k/upd78k2.cpp b/src/devices/cpu/upd78k/upd78k2.cpp
index 823bc438883..91f25b29618 100644
--- a/src/devices/cpu/upd78k/upd78k2.cpp
+++ b/src/devices/cpu/upd78k/upd78k2.cpp
@@ -30,10 +30,6 @@ upd78k2_device::upd78k2_device(const machine_config &mconfig, device_type type,
, m_iram_config("IRAM", ENDIANNESS_LITTLE, 16, iram_bits, 0, address_map_constructor(FUNC(upd78k2_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
, m_iram_addrmask((offs_t(1) << iram_bits) - 1)
- , m_program_space(nullptr)
- , m_program_cache(nullptr)
- , m_iram_cache(nullptr)
- , m_sfr_space(nullptr)
, m_pc(0)
, m_ppc(0)
, m_psw(0)
@@ -86,10 +82,10 @@ inline u8 upd78k2_device::register_base() const noexcept
void upd78k2_device::device_start()
{
// get address spaces and access caches
- m_program_space = &space(AS_PROGRAM);
- m_program_cache = m_program_space->cache<0, 0, ENDIANNESS_LITTLE>();
- m_iram_cache = space(AS_DATA).cache<1, 0, ENDIANNESS_LITTLE>();
- m_sfr_space = &space(AS_IO);
+ space(AS_PROGRAM).specific(m_program_space);
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_DATA).cache(m_iram_cache);
+ space(AS_IO).specific(m_sfr_space);
set_icountptr(m_icount);
@@ -141,7 +137,7 @@ void upd78k2_device::device_reset()
void upd78k2_device::execute_run()
{
- m_pc = m_program_cache->read_word(0);
+ m_pc = m_program_cache.read_word(0);
m_ppc = m_pc;
debugger_instruction_hook(m_pc);
diff --git a/src/devices/cpu/upd78k/upd78k2.h b/src/devices/cpu/upd78k/upd78k2.h
index a18ceefb396..c0a8e07b825 100644
--- a/src/devices/cpu/upd78k/upd78k2.h
+++ b/src/devices/cpu/upd78k/upd78k2.h
@@ -61,10 +61,10 @@ private:
address_space_config m_iram_config;
address_space_config m_sfr_config;
const offs_t m_iram_addrmask;
- address_space *m_program_space;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_program_cache;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_iram_cache;
- address_space *m_sfr_space;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_program_cache;
+ memory_access< 8, 1, 0, ENDIANNESS_LITTLE>::cache m_iram_cache;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::specific m_program_space;
+ memory_access< 8, 1, 0, ENDIANNESS_LITTLE>::specific m_sfr_space;
// core registers and execution state
u16 m_pc;
diff --git a/src/devices/cpu/upd78k/upd78k3.cpp b/src/devices/cpu/upd78k/upd78k3.cpp
index f2831c543b2..ef7ee4008e9 100644
--- a/src/devices/cpu/upd78k/upd78k3.cpp
+++ b/src/devices/cpu/upd78k/upd78k3.cpp
@@ -29,11 +29,7 @@ upd78k3_device::upd78k3_device(const machine_config &mconfig, device_type type,
, m_program_config("program", ENDIANNESS_LITTLE, 8, 16, 0, mem_map)
, m_iram_config("IRAM", ENDIANNESS_LITTLE, 16, 8, 0, address_map_constructor(FUNC(upd78k3_device::iram_map), this))
, m_sfr_config("SFR", ENDIANNESS_LITTLE, 16, 8, 0, sfr_map)
- , m_program_space(nullptr)
- , m_program_cache(nullptr)
, m_iram(*this, "iram")
- , m_iram_cache(nullptr)
- , m_sfr_space(nullptr)
, m_pc(0)
, m_ppc(0)
, m_psw(0)
@@ -132,10 +128,10 @@ void upd78k3_device::state_add_psw()
void upd78k3_device::device_start()
{
// get address spaces and access caches
- m_program_space = &space(AS_PROGRAM);
- m_program_cache = m_program_space->cache<0, 0, ENDIANNESS_LITTLE>();
- m_iram_cache = space(AS_DATA).cache<1, 0, ENDIANNESS_LITTLE>();
- m_sfr_space = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_PROGRAM).specific(m_program_space);
+ space(AS_DATA).cache(m_iram_cache);
+ space(AS_IO).specific(m_sfr_space);
set_icountptr(m_icount);
@@ -211,7 +207,7 @@ void upd78k3_device::device_reset()
void upd78k3_device::execute_run()
{
- m_pc = m_program_cache->read_word(0);
+ m_pc = m_program_cache.read_word(0);
m_ppc = m_pc;
debugger_instruction_hook(m_pc);
diff --git a/src/devices/cpu/upd78k/upd78k3.h b/src/devices/cpu/upd78k/upd78k3.h
index 07fcb49534a..22867376847 100644
--- a/src/devices/cpu/upd78k/upd78k3.h
+++ b/src/devices/cpu/upd78k/upd78k3.h
@@ -73,11 +73,12 @@ private:
address_space_config m_program_config;
address_space_config m_iram_config;
address_space_config m_sfr_config;
- address_space *m_program_space;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_program_cache;
required_shared_ptr<u16> m_iram;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_iram_cache;
- address_space *m_sfr_space;
+
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_program_cache;
+ memory_access< 8, 1, 0, ENDIANNESS_LITTLE>::cache m_iram_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program_space;
+ memory_access< 8, 1, 0, ENDIANNESS_LITTLE>::specific m_sfr_space;
// core registers and execution state
u16 m_pc;
diff --git a/src/devices/cpu/v30mz/v30mz.cpp b/src/devices/cpu/v30mz/v30mz.cpp
index c556f3f01f3..db96c6b92e5 100644
--- a/src/devices/cpu/v30mz/v30mz.cpp
+++ b/src/devices/cpu/v30mz/v30mz.cpp
@@ -146,9 +146,9 @@ device_memory_interface::space_config_vector v30mz_cpu_device::memory_space_conf
void v30mz_cpu_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_IO).specific(m_io);
save_item(NAME(m_regs.w));
save_item(NAME(m_sregs));
@@ -282,44 +282,44 @@ inline uint32_t v30mz_cpu_device::pc()
inline uint8_t v30mz_cpu_device::read_byte(uint32_t addr)
{
- return m_program->read_byte(addr);
+ return m_program.read_byte(addr);
}
inline uint16_t v30mz_cpu_device::read_word(uint32_t addr)
{
- return m_program->read_byte(addr) | ( m_program->read_byte(addr+1) << 8 );
+ return m_program.read_byte(addr) | ( m_program.read_byte(addr+1) << 8 );
}
inline void v30mz_cpu_device::write_byte(uint32_t addr, uint8_t data)
{
- m_program->write_byte(addr, data);
+ m_program.write_byte(addr, data);
}
inline void v30mz_cpu_device::write_word(uint32_t addr, uint16_t data)
{
- m_program->write_byte( addr, data & 0xff );
- m_program->write_byte( addr + 1, data >> 8 );
+ m_program.write_byte( addr, data & 0xff );
+ m_program.write_byte( addr + 1, data >> 8 );
}
inline uint8_t v30mz_cpu_device::read_port(uint16_t port)
{
- return m_io->read_byte(port);
+ return m_io.read_byte(port);
}
inline void v30mz_cpu_device::write_port(uint16_t port, uint8_t data)
{
- m_io->write_byte(port, data);
+ m_io.write_byte(port, data);
}
inline uint8_t v30mz_cpu_device::fetch_op()
{
- uint8_t data = m_cache->read_byte( pc() );
+ uint8_t data = m_cache.read_byte( pc() );
m_ip++;
return data;
}
@@ -327,7 +327,7 @@ inline uint8_t v30mz_cpu_device::fetch_op()
inline uint8_t v30mz_cpu_device::fetch()
{
- uint8_t data = m_cache->read_byte( pc() );
+ uint8_t data = m_cache.read_byte( pc() );
m_ip++;
return data;
}
diff --git a/src/devices/cpu/v30mz/v30mz.h b/src/devices/cpu/v30mz/v30mz.h
index 5e575ba8dc2..7d8d06c7b68 100644
--- a/src/devices/cpu/v30mz/v30mz.h
+++ b/src/devices/cpu/v30mz/v30mz.h
@@ -189,9 +189,9 @@ protected:
uint8_t m_no_interrupt;
uint8_t m_fire_trap;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_io;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
int m_icount;
uint32_t m_prefix_base; /* base address of the latest prefix segment */
diff --git a/src/devices/cpu/v60/v60.cpp b/src/devices/cpu/v60/v60.cpp
index 989e509ef2e..0a9030ad313 100644
--- a/src/devices/cpu/v60/v60.cpp
+++ b/src/devices/cpu/v60/v60.cpp
@@ -412,17 +412,17 @@ void v60_device::device_start()
m_program = &space(AS_PROGRAM);
if (m_program->data_width() == 16)
{
- auto cache = m_program->cache<1, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word_unaligned(address); };
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword_unaligned(address); };
+ m_program->cache(m_cache16);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache16.read_byte(address); };
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache16.read_word_unaligned(address); };
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache16.read_dword_unaligned(address); };
}
else
{
- auto cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_pr8 = [cache](offs_t address) -> u8 { return cache->read_byte(address); };
- m_pr16 = [cache](offs_t address) -> u16 { return cache->read_word_unaligned(address); };
- m_pr32 = [cache](offs_t address) -> u32 { return cache->read_dword_unaligned(address); };
+ m_program->cache(m_cache32);
+ m_pr8 = [this](offs_t address) -> u8 { return m_cache32.read_byte(address); };
+ m_pr16 = [this](offs_t address) -> u16 { return m_cache32.read_word_unaligned(address); };
+ m_pr32 = [this](offs_t address) -> u32 { return m_cache32.read_dword_unaligned(address); };
}
m_io = &space(AS_IO);
diff --git a/src/devices/cpu/v60/v60.h b/src/devices/cpu/v60/v60.h
index 35c5843c487..0cb41bd18a8 100644
--- a/src/devices/cpu/v60/v60.h
+++ b/src/devices/cpu/v60/v60.h
@@ -163,6 +163,9 @@ private:
uint8_t m_irq_line;
uint8_t m_nmi_line;
address_space *m_program;
+ memory_access<32, 1, 0, ENDIANNESS_LITTLE>::cache m_cache16;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache32;
+
std::function<u8 (offs_t)> m_pr8;
std::function<u16 (offs_t)> m_pr16;
std::function<u32 (offs_t)> m_pr32;
diff --git a/src/devices/cpu/v810/v810.cpp b/src/devices/cpu/v810/v810.cpp
index 11656b22c9f..a5a7e8dfc52 100644
--- a/src/devices/cpu/v810/v810.cpp
+++ b/src/devices/cpu/v810/v810.cpp
@@ -126,26 +126,26 @@ std::unique_ptr<util::disasm_interface> v810_device::create_disassembler()
#define SET_EP(val) (PSW = (PSW & ~0x00004000) | ((val) << 14))
#define SET_NP(val) (PSW = (PSW & ~0x00008000) | ((val) << 15))
-#define R_B(addr) (m_program->read_byte(addr))
-#define R_H(addr) (m_program->read_word(addr))
-#define R_W(addr) (m_program->read_dword(addr))
+#define R_B(addr) (m_program.read_byte(addr))
+#define R_H(addr) (m_program.read_word(addr))
+#define R_W(addr) (m_program.read_dword(addr))
-#define W_B(addr, val) (m_program->write_byte(addr,val))
-#define W_H(addr, val) (m_program->write_word(addr,val))
-#define W_W(addr, val) (m_program->write_dword(addr,val))
+#define W_B(addr, val) (m_program.write_byte(addr,val))
+#define W_H(addr, val) (m_program.write_word(addr,val))
+#define W_W(addr, val) (m_program.write_dword(addr,val))
-#define RIO_B(addr) (m_io->read_byte(addr))
-#define RIO_H(addr) (m_io->read_word(addr))
-#define RIO_W(addr) (m_io->read_dword(addr))
+#define RIO_B(addr) (m_io.read_byte(addr))
+#define RIO_H(addr) (m_io.read_word(addr))
+#define RIO_W(addr) (m_io.read_dword(addr))
-#define WIO_B(addr, val) (m_io->write_byte(addr,val))
-#define WIO_H(addr, val) (m_io->write_word(addr,val))
-#define WIO_W(addr, val) (m_io->write_dword(addr,val))
+#define WIO_B(addr, val) (m_io.write_byte(addr,val))
+#define WIO_H(addr, val) (m_io.write_word(addr,val))
+#define WIO_W(addr, val) (m_io.write_dword(addr,val))
-#define R_OP(addr) (m_cache->read_word(addr))
+#define R_OP(addr) (m_cache.read_word(addr))
#define GET1 (op&0x1f)
#define GET2 ((op>>5)&0x1f)
@@ -1255,9 +1255,9 @@ const v810_device::opcode_func v810_device::s_OpCodeTable[64] =
void v810_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
- m_io = has_space(AS_IO) ? &space(AS_IO) : m_program;
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(has_space(AS_IO) ? AS_IO : AS_PROGRAM).specific(m_io);
m_irq_line = 0;
m_irq_state = CLEAR_LINE;
diff --git a/src/devices/cpu/v810/v810.h b/src/devices/cpu/v810/v810.h
index 4adb04e071e..a24abe48751 100644
--- a/src/devices/cpu/v810/v810.h
+++ b/src/devices/cpu/v810/v810.h
@@ -117,9 +117,9 @@ private:
uint8_t m_irq_line;
uint8_t m_irq_state;
uint8_t m_nmi_line;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_io;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_io;
uint32_t m_PPC;
int m_icount;
diff --git a/src/devices/cpu/vt50/vt50.cpp b/src/devices/cpu/vt50/vt50.cpp
index b12b75e79da..961dca5aa2c 100644
--- a/src/devices/cpu/vt50/vt50.cpp
+++ b/src/devices/cpu/vt50/vt50.cpp
@@ -75,8 +75,6 @@ vt5x_cpu_device::vt5x_cpu_device(const machine_config &mconfig, device_type type
, device_video_interface(mconfig, *this)
, m_rom_config("program", ENDIANNESS_LITTLE, 8, 10, 0)
, m_ram_config("data", ENDIANNESS_LITTLE, 8, 6 + ybits, 0) // actually 7 bits wide
- , m_rom_cache(nullptr)
- , m_ram_cache(nullptr)
, m_baud_9600_callback(*this)
, m_vert_count_callback(*this)
, m_uart_rd_callback(*this)
@@ -195,8 +193,8 @@ void vt52_cpu_device::device_resolve_objects()
void vt5x_cpu_device::device_start()
{
// acquire address spaces
- m_rom_cache = space(AS_PROGRAM).cache<0, 0, ENDIANNESS_LITTLE>();
- m_ram_cache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_rom_cache);
+ space(AS_DATA).cache(m_ram_cache);
screen().register_screen_bitmap(m_bitmap);
set_icountptr(m_icount);
@@ -531,7 +529,7 @@ void vt50_cpu_device::execute_tg(u8 inst)
break;
}
- m_ram_cache->write_byte(translate_xy(), m_ram_do);
+ m_ram_cache.write_byte(translate_xy(), m_ram_do);
m_write_ff = false;
}
@@ -560,7 +558,7 @@ void vt52_cpu_device::execute_tg(u8 inst)
break;
}
- m_ram_cache->write_byte(translate_xy(), m_ram_do);
+ m_ram_cache.write_byte(translate_xy(), m_ram_do);
m_write_ff = false;
}
@@ -757,15 +755,15 @@ void vt5x_cpu_device::execute_run()
case 1:
if (!en_cycle)
- execute_te(m_rom_cache->read_byte(m_pc));
+ execute_te(m_rom_cache.read_byte(m_pc));
m_t = 2;
break;
case 2:
if (!en_cycle)
- execute_tf(m_rom_cache->read_byte(m_pc));
+ execute_tf(m_rom_cache.read_byte(m_pc));
if (!m_write_ff)
- m_ram_do = m_ram_cache->read_byte(translate_xy()) & 0177;
+ m_ram_do = m_ram_cache.read_byte(translate_xy()) & 0177;
m_cursor_active = m_ac == (m_x ^ (m_x8 ? 8 : 0));
if (u8(m_horiz_count - 2) >= 2 * 16)
{
@@ -784,13 +782,13 @@ void vt5x_cpu_device::execute_run()
case 3:
if (en_cycle && m_write_ff)
- execute_tg(m_rom_cache->read_byte(m_pc));
+ execute_tg(m_rom_cache.read_byte(m_pc));
m_t = 4;
break;
case 4:
if (en_cycle)
- execute_th(m_rom_cache->read_byte(m_pc));
+ execute_th(m_rom_cache.read_byte(m_pc));
m_t = 5;
break;
@@ -800,13 +798,13 @@ void vt5x_cpu_device::execute_run()
case 6:
if (en_cycle && m_flag_test_ff)
- execute_tj(m_rom_cache->read_byte(m_pc));
+ execute_tj(m_rom_cache.read_byte(m_pc));
m_t = 7;
break;
case 7:
if (!en_cycle)
- execute_tw(m_rom_cache->read_byte(m_pc));
+ execute_tw(m_rom_cache.read_byte(m_pc));
m_t = 8;
break;
diff --git a/src/devices/cpu/vt50/vt50.h b/src/devices/cpu/vt50/vt50.h
index fd73d1fd83e..e9d0b39b1bc 100644
--- a/src/devices/cpu/vt50/vt50.h
+++ b/src/devices/cpu/vt50/vt50.h
@@ -73,8 +73,8 @@ protected:
// address spaces
address_space_config m_rom_config;
address_space_config m_ram_config;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_rom_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_ram_cache;
+ memory_access<10, 0, 0, ENDIANNESS_LITTLE>::cache m_rom_cache;
+ memory_access<11, 0, 0, ENDIANNESS_LITTLE>::cache m_ram_cache;
// device callbacks
devcb_write_line m_baud_9600_callback;
diff --git a/src/devices/cpu/vt61/vt61.cpp b/src/devices/cpu/vt61/vt61.cpp
index 96fba64faf5..377d9e58244 100644
--- a/src/devices/cpu/vt61/vt61.cpp
+++ b/src/devices/cpu/vt61/vt61.cpp
@@ -20,9 +20,6 @@ vt61_cpu_device::vt61_cpu_device(const machine_config &mconfig, const char *tag,
, m_program_config("microprogram", ENDIANNESS_LITTLE, 16, 10, -1)
, m_memory_config("memory", ENDIANNESS_LITTLE, 8, 16, 0)
, m_idr_config("IDR", ENDIANNESS_LITTLE, 8, 6, 0)
- , m_program_cache(nullptr)
- , m_memory_cache(nullptr)
- , m_idr_cache(nullptr)
, m_pc(0)
, m_ac(0)
, m_mar(0)
@@ -55,9 +52,9 @@ device_memory_interface::space_config_vector vt61_cpu_device::memory_space_confi
void vt61_cpu_device::device_start()
{
- m_program_cache = space(AS_PROGRAM).cache<1, -1, ENDIANNESS_LITTLE>();
- m_memory_cache = space(AS_DATA).cache<0, 0, ENDIANNESS_LITTLE>();
- m_idr_cache = space(AS_IDR).cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_DATA).cache(m_memory_cache);
+ space(AS_IDR).cache(m_idr_cache);
set_icountptr(m_icount);
diff --git a/src/devices/cpu/vt61/vt61.h b/src/devices/cpu/vt61/vt61.h
index c5c3013641f..c2aa2d39f6b 100644
--- a/src/devices/cpu/vt61/vt61.h
+++ b/src/devices/cpu/vt61/vt61.h
@@ -51,9 +51,9 @@ private:
address_space_config m_program_config;
address_space_config m_memory_config;
address_space_config m_idr_config;
- memory_access_cache<1, -1, ENDIANNESS_LITTLE> *m_program_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_memory_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_idr_cache;
+ memory_access<10, 1, -1, ENDIANNESS_LITTLE>::cache m_program_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_memory_cache;
+ memory_access< 6, 0, 0, ENDIANNESS_LITTLE>::cache m_idr_cache;
// processor state
u16 m_pc;
diff --git a/src/devices/cpu/we32000/we32100.cpp b/src/devices/cpu/we32000/we32100.cpp
index 1d4b5fbcd04..b7f166e5287 100644
--- a/src/devices/cpu/we32000/we32100.cpp
+++ b/src/devices/cpu/we32000/we32100.cpp
@@ -18,8 +18,6 @@ DEFINE_DEVICE_TYPE(WE32100, we32100_device, "we32100", "AT&T WE32100")
we32100_device::we32100_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: cpu_device(mconfig, WE32100, tag, owner, clock)
, m_space_config("program", ENDIANNESS_BIG, 32, 32, 0)
- , m_space(nullptr)
- , m_cache(nullptr)
, m_r{0}
, m_icount(0)
{
@@ -39,8 +37,8 @@ device_memory_interface::space_config_vector we32100_device::memory_space_config
void we32100_device::device_start()
{
- m_space = &space(AS_PROGRAM);
- m_cache = m_space->cache<2, 0, ENDIANNESS_BIG>();
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_space);
set_icountptr(m_icount);
@@ -70,10 +68,10 @@ void we32100_device::device_reset()
void we32100_device::execute_run()
{
// On-reset sequence: load PCBP, then load PSW, PC and SP from there
- m_r[13] = m_space->read_dword(0x00000080);
- m_r[11] = m_space->read_dword(m_r[13]);
- m_r[15] = m_space->read_dword(m_r[13] + 4);
- m_r[12] = m_space->read_dword(m_r[13] + 8);
+ m_r[13] = m_space.read_dword(0x00000080);
+ m_r[11] = m_space.read_dword(m_r[13]);
+ m_r[15] = m_space.read_dword(m_r[13] + 4);
+ m_r[12] = m_space.read_dword(m_r[13] + 8);
debugger_instruction_hook(m_r[15]);
diff --git a/src/devices/cpu/we32000/we32100.h b/src/devices/cpu/we32000/we32100.h
index 54e1edc4a3e..c34afc4279e 100644
--- a/src/devices/cpu/we32000/we32100.h
+++ b/src/devices/cpu/we32000/we32100.h
@@ -45,8 +45,8 @@ protected:
private:
// address space
address_space_config m_space_config;
- address_space *m_space;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_space;
// internal state
u32 m_r[16];
diff --git a/src/devices/cpu/xavix2/xavix2.cpp b/src/devices/cpu/xavix2/xavix2.cpp
index 4c1d150564a..84a6da150ce 100644
--- a/src/devices/cpu/xavix2/xavix2.cpp
+++ b/src/devices/cpu/xavix2/xavix2.cpp
@@ -18,8 +18,8 @@ xavix2_device::xavix2_device(const machine_config &mconfig, const char *tag, dev
void xavix2_device::device_start()
{
- m_program = &space(AS_PROGRAM);
- m_program_cache = m_program->cache<2, 0, ENDIANNESS_LITTLE>();
+ space(AS_PROGRAM).cache(m_program_cache);
+ space(AS_PROGRAM).specific(m_program);
state_add(STATE_GENPC, "GENPC", m_pc).callexport().noshow();
state_add(STATE_GENPCBASE, "CURPC", m_pc).callexport().noshow();
@@ -201,13 +201,13 @@ void xavix2_device::execute_run()
if(machine().debug_flags & DEBUG_FLAG_ENABLED)
debugger_instruction_hook(m_pc);
- u32 opcode = m_program_cache->read_byte(m_pc) << 24;
+ u32 opcode = m_program_cache.read_byte(m_pc) << 24;
m_icount --;
u8 nb = bpo[opcode >> 29];
u32 npc = m_pc + nb;
for(u8 i=1; i != nb; i++) {
- opcode |= m_program_cache->read_byte(m_pc + i) << (24 - 8*i);
+ opcode |= m_program_cache.read_byte(m_pc + i) << (24 - 8*i);
m_icount --;
}
@@ -222,14 +222,14 @@ void xavix2_device::execute_run()
case 0x0c: case 0x0d: m_r[r1(opcode)] = snz(m_r[r2(opcode)] | val19u(opcode)); break;
case 0x0e: case 0x0f: m_r[r1(opcode)] = snz(m_r[r2(opcode)] ^ val19u(opcode)); break;
- case 0x10: case 0x11: m_r[r1(opcode)] = (s8)m_program->read_byte(m_r[r2(opcode)] + val19s(opcode)); break;
- case 0x12: case 0x13: m_r[r1(opcode)] = m_program->read_byte(m_r[r2(opcode)] + val19s(opcode)); break;
- case 0x14: case 0x15: m_r[r1(opcode)] = (s16)m_program->read_word(m_r[r2(opcode)] + val19s(opcode)); break;
- case 0x16: case 0x17: m_r[r1(opcode)] = m_program->read_word(m_r[r2(opcode)] + val19s(opcode)); break;
- case 0x18: case 0x19: m_r[r1(opcode)] = m_program->read_dword(m_r[r2(opcode)] + val19s(opcode)); break;
- case 0x1a: case 0x1b: m_program->write_byte(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
- case 0x1c: case 0x1d: m_program->write_word(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
- case 0x1e: case 0x1f: m_program->write_dword(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
+ case 0x10: case 0x11: m_r[r1(opcode)] = (s8)m_program.read_byte(m_r[r2(opcode)] + val19s(opcode)); break;
+ case 0x12: case 0x13: m_r[r1(opcode)] = m_program.read_byte(m_r[r2(opcode)] + val19s(opcode)); break;
+ case 0x14: case 0x15: m_r[r1(opcode)] = (s16)m_program.read_word(m_r[r2(opcode)] + val19s(opcode)); break;
+ case 0x16: case 0x17: m_r[r1(opcode)] = m_program.read_word(m_r[r2(opcode)] + val19s(opcode)); break;
+ case 0x18: case 0x19: m_r[r1(opcode)] = m_program.read_dword(m_r[r2(opcode)] + val19s(opcode)); break;
+ case 0x1a: case 0x1b: m_program.write_byte(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
+ case 0x1c: case 0x1d: m_program.write_word(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
+ case 0x1e: case 0x1f: m_program.write_dword(m_r[r2(opcode)] + val19s(opcode), m_r[r1(opcode)]); break;
case 0x20: case 0x21: m_r[r1(opcode)] = do_add(m_r[r2(opcode)], val11s(opcode)); break;
case 0x22: case 0x23: m_r[r1(opcode)] = val14h(opcode); break;
@@ -241,32 +241,32 @@ void xavix2_device::execute_run()
case 0x2c: case 0x2d: m_r[r1(opcode)] = snz(m_r[r2(opcode)] | val11u(opcode)); break;
case 0x2e: case 0x2f: m_r[r1(opcode)] = snz(m_r[r2(opcode)] ^ val11u(opcode)); break;
- case 0x30: case 0x31: m_r[r1(opcode)] = (s8)m_program->read_byte(m_r[6] + val14s(opcode)); break;
- case 0x32: case 0x33: m_r[r1(opcode)] = m_program->read_byte(m_r[6] + val14s(opcode)); break;
- case 0x34: case 0x35: m_r[r1(opcode)] = (s16)m_program->read_word(m_r[6] + val14s(opcode)); break;
- case 0x36: case 0x37: m_r[r1(opcode)] = m_program->read_word(m_r[6] + val14s(opcode)); break;
- case 0x38: case 0x39: m_r[r1(opcode)] = m_program->read_dword(m_r[6] + val14s(opcode)); break;
- case 0x3a: case 0x3b: m_program->write_byte(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
- case 0x3c: case 0x3d: m_program->write_word(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
- case 0x3e: case 0x3f: m_program->write_dword(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
-
- case 0x40: case 0x41: m_r[r1(opcode)] = (s8)m_program->read_byte(m_r[r2(opcode)] + val11s(opcode)); break;
- case 0x42: case 0x43: m_r[r1(opcode)] = m_program->read_byte(m_r[r2(opcode)] + val11s(opcode)); break;
- case 0x44: case 0x45: m_r[r1(opcode)] = (s16)m_program->read_word(m_r[r2(opcode)] + val11s(opcode)); break;
- case 0x46: case 0x47: m_r[r1(opcode)] = m_program->read_word(m_r[r2(opcode)] + val11s(opcode)); break;
- case 0x48: case 0x49: m_r[r1(opcode)] = m_program->read_dword(m_r[r2(opcode)] + val11s(opcode)); break;
- case 0x4a: case 0x4b: m_program->write_byte(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
- case 0x4c: case 0x4d: m_program->write_word(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
- case 0x4e: case 0x4f: m_program->write_dword(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
-
- case 0x50: case 0x51: m_r[r1(opcode)] = (s8)m_program->read_byte(val14s(opcode)); break;
- case 0x52: case 0x53: m_r[r1(opcode)] = m_program->read_byte(val14s(opcode)); break;
- case 0x54: case 0x55: m_r[r1(opcode)] = (s16)m_program->read_word(val14s(opcode)); break;
- case 0x56: case 0x57: m_r[r1(opcode)] = m_program->read_word(val14s(opcode)); break;
- case 0x58: case 0x59: m_r[r1(opcode)] = m_program->read_dword(val14s(opcode)); break;
- case 0x5a: case 0x5b: m_program->write_byte(val14s(opcode), m_r[r1(opcode)]); break;
- case 0x5c: case 0x5d: m_program->write_word(val14s(opcode), m_r[r1(opcode)]); break;
- case 0x5e: case 0x5f: m_program->write_dword(val14s(opcode), m_r[r1(opcode)]); break;
+ case 0x30: case 0x31: m_r[r1(opcode)] = (s8)m_program.read_byte(m_r[6] + val14s(opcode)); break;
+ case 0x32: case 0x33: m_r[r1(opcode)] = m_program.read_byte(m_r[6] + val14s(opcode)); break;
+ case 0x34: case 0x35: m_r[r1(opcode)] = (s16)m_program.read_word(m_r[6] + val14s(opcode)); break;
+ case 0x36: case 0x37: m_r[r1(opcode)] = m_program.read_word(m_r[6] + val14s(opcode)); break;
+ case 0x38: case 0x39: m_r[r1(opcode)] = m_program.read_dword(m_r[6] + val14s(opcode)); break;
+ case 0x3a: case 0x3b: m_program.write_byte(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
+ case 0x3c: case 0x3d: m_program.write_word(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
+ case 0x3e: case 0x3f: m_program.write_dword(m_r[6] + val14s(opcode), m_r[r1(opcode)]); break;
+
+ case 0x40: case 0x41: m_r[r1(opcode)] = (s8)m_program.read_byte(m_r[r2(opcode)] + val11s(opcode)); break;
+ case 0x42: case 0x43: m_r[r1(opcode)] = m_program.read_byte(m_r[r2(opcode)] + val11s(opcode)); break;
+ case 0x44: case 0x45: m_r[r1(opcode)] = (s16)m_program.read_word(m_r[r2(opcode)] + val11s(opcode)); break;
+ case 0x46: case 0x47: m_r[r1(opcode)] = m_program.read_word(m_r[r2(opcode)] + val11s(opcode)); break;
+ case 0x48: case 0x49: m_r[r1(opcode)] = m_program.read_dword(m_r[r2(opcode)] + val11s(opcode)); break;
+ case 0x4a: case 0x4b: m_program.write_byte(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
+ case 0x4c: case 0x4d: m_program.write_word(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
+ case 0x4e: case 0x4f: m_program.write_dword(m_r[r2(opcode)] + val11s(opcode), m_r[r1(opcode)]); break;
+
+ case 0x50: case 0x51: m_r[r1(opcode)] = (s8)m_program.read_byte(val14s(opcode)); break;
+ case 0x52: case 0x53: m_r[r1(opcode)] = m_program.read_byte(val14s(opcode)); break;
+ case 0x54: case 0x55: m_r[r1(opcode)] = (s16)m_program.read_word(val14s(opcode)); break;
+ case 0x56: case 0x57: m_r[r1(opcode)] = m_program.read_word(val14s(opcode)); break;
+ case 0x58: case 0x59: m_r[r1(opcode)] = m_program.read_dword(val14s(opcode)); break;
+ case 0x5a: case 0x5b: m_program.write_byte(val14s(opcode), m_r[r1(opcode)]); break;
+ case 0x5c: case 0x5d: m_program.write_word(val14s(opcode), m_r[r1(opcode)]); break;
+ case 0x5e: case 0x5f: m_program.write_dword(val14s(opcode), m_r[r1(opcode)]); break;
case 0x60: case 0x61: m_r[r1(opcode)] = do_add(m_r[r1(opcode)], val6s(opcode)); break;
case 0x62: case 0x63: m_r[r1(opcode)] = val6s(opcode); break;
@@ -277,14 +277,14 @@ void xavix2_device::execute_run()
case 0x6c: case 0x6d: m_r[r1(opcode)] = do_lsr(m_r[r2(opcode)], val3u(opcode)); break;
case 0x6e: case 0x6f: m_r[r1(opcode)] = do_lsl(m_r[r2(opcode)], val3u(opcode)); break;
- case 0x70: case 0x71: m_r[r1(opcode)] = (s8)m_program->read_byte(m_r[6] + val6s(opcode)); break;
- case 0x72: case 0x73: m_r[r1(opcode)] = m_program->read_byte(m_r[6] + val6s(opcode)); break;
- case 0x74: case 0x75: m_r[r1(opcode)] = (s16)m_program->read_word(m_r[6] + val6s(opcode)); break;
- case 0x76: case 0x77: m_r[r1(opcode)] = m_program->read_word(m_r[6] + val6s(opcode)); break;
- case 0x78: case 0x79: m_r[r1(opcode)] = m_program->read_dword(m_r[6] + val6s(opcode)); break;
- case 0x7a: case 0x7b: m_program->write_byte(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
- case 0x7c: case 0x7d: m_program->write_word(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
- case 0x7e: case 0x7f: m_program->write_dword(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
+ case 0x70: case 0x71: m_r[r1(opcode)] = (s8)m_program.read_byte(m_r[6] + val6s(opcode)); break;
+ case 0x72: case 0x73: m_r[r1(opcode)] = m_program.read_byte(m_r[6] + val6s(opcode)); break;
+ case 0x74: case 0x75: m_r[r1(opcode)] = (s16)m_program.read_word(m_r[6] + val6s(opcode)); break;
+ case 0x76: case 0x77: m_r[r1(opcode)] = m_program.read_word(m_r[6] + val6s(opcode)); break;
+ case 0x78: case 0x79: m_r[r1(opcode)] = m_program.read_dword(m_r[6] + val6s(opcode)); break;
+ case 0x7a: case 0x7b: m_program.write_byte(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
+ case 0x7c: case 0x7d: m_program.write_word(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
+ case 0x7e: case 0x7f: m_program.write_dword(m_r[6] + val6s(opcode), m_r[r1(opcode)]); break;
case 0x80: case 0x81: m_r[r1(opcode)] = do_add(m_r[r2(opcode)], m_r[r3(opcode)]); break;
// 82-83
@@ -296,14 +296,14 @@ void xavix2_device::execute_run()
case 0x8c: case 0x8d: m_r[r1(opcode)] = snz(m_r[r2(opcode)] | m_r[r3(opcode)]); break;
case 0x8e: case 0x8f: m_r[r1(opcode)] = snz(m_r[r2(opcode)] ^ m_r[r3(opcode)]); break;
- case 0x90: case 0x91: m_r[r1(opcode)] = (s8)m_program->read_byte(m_r[r2(opcode)] + val3s(opcode)); break;
- case 0x92: case 0x93: m_r[r1(opcode)] = m_program->read_byte(m_r[r2(opcode)] + val3s(opcode)); break;
- case 0x94: case 0x95: m_r[r1(opcode)] = (s16)m_program->read_word(m_r[r2(opcode)] + val3s(opcode)); break;
- case 0x96: case 0x97: m_r[r1(opcode)] = m_program->read_word(m_r[r2(opcode)] + val3s(opcode)); break;
- case 0x98: case 0x99: m_r[r1(opcode)] = m_program->read_dword(m_r[r2(opcode)] + val3s(opcode)); break;
- case 0x9a: case 0x9b: m_program->write_byte(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
- case 0x9c: case 0x9d: m_program->write_word(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
- case 0x9e: case 0x9f: m_program->write_dword(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
+ case 0x90: case 0x91: m_r[r1(opcode)] = (s8)m_program.read_byte(m_r[r2(opcode)] + val3s(opcode)); break;
+ case 0x92: case 0x93: m_r[r1(opcode)] = m_program.read_byte(m_r[r2(opcode)] + val3s(opcode)); break;
+ case 0x94: case 0x95: m_r[r1(opcode)] = (s16)m_program.read_word(m_r[r2(opcode)] + val3s(opcode)); break;
+ case 0x96: case 0x97: m_r[r1(opcode)] = m_program.read_word(m_r[r2(opcode)] + val3s(opcode)); break;
+ case 0x98: case 0x99: m_r[r1(opcode)] = m_program.read_dword(m_r[r2(opcode)] + val3s(opcode)); break;
+ case 0x9a: case 0x9b: m_program.write_byte(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
+ case 0x9c: case 0x9d: m_program.write_word(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
+ case 0x9e: case 0x9f: m_program.write_dword(m_r[r2(opcode)] + val3s(opcode), m_r[r1(opcode)]); break;
case 0xa0: case 0xa1: m_r[r1(opcode)] = ~m_r[r2(opcode)]; break;
case 0xa2: case 0xa3: m_r[r1(opcode)] = m_r[r2(opcode)]; break;
diff --git a/src/devices/cpu/xavix2/xavix2.h b/src/devices/cpu/xavix2/xavix2.h
index de4d62e38bc..30e9ec5faea 100644
--- a/src/devices/cpu/xavix2/xavix2.h
+++ b/src/devices/cpu/xavix2/xavix2.h
@@ -39,8 +39,8 @@ protected:
virtual void state_string_export(const device_state_entry &entry, std::string &str) const override;
const address_space_config m_program_config;
- address_space *m_program;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_program_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_program_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::specific m_program;
int m_icount, m_ei_count;
u32 m_pc;
diff --git a/src/devices/cpu/z180/z180.cpp b/src/devices/cpu/z180/z180.cpp
index 48956d8f283..b95edbb20ca 100644
--- a/src/devices/cpu/z180/z180.cpp
+++ b/src/devices/cpu/z180/z180.cpp
@@ -484,18 +484,18 @@ device_memory_interface::space_config_vector z180_device::memory_space_config()
uint8_t z180_device::z180_read_memory(offs_t addr)
{
- return m_program->read_byte(addr);
+ return m_program.read_byte(addr);
}
void z180_device::z180_write_memory(offs_t addr, uint8_t data)
{
- m_program->write_byte(addr, data);
+ m_program.write_byte(addr, data);
}
uint8_t z180_device::z180_readcontrol(offs_t port)
{
// normal external readport (ignore the data)
- (void)m_iospace->read_byte(port);
+ (void)m_io.read_byte(port);
// read the internal register
return z180_internal_port_read(port & (m_extended_io ? 0x7f : 0x3f));
@@ -861,7 +861,7 @@ uint8_t z180_device::z180_internal_port_read(uint8_t port)
void z180_device::z180_writecontrol(offs_t port, uint8_t data)
{
// normal external write port
- m_iospace->write_byte(port, data);
+ m_io.write_byte(port, data);
// store the data in the internal register
z180_internal_port_write(port & (m_extended_io ? 0x7f : 0x3f), data);
@@ -1442,16 +1442,16 @@ int z180_device::z180_dma1()
switch (m_dcntl & (Z180_DCNTL_DIM1 | Z180_DCNTL_DIM0))
{
case 0x00: /* memory MAR1+1 to I/O IAR1 fixed */
- m_iospace->write_byte(iar1, z180_read_memory(mar1++));
+ m_io.write_byte(iar1, z180_read_memory(mar1++));
break;
case 0x01: /* memory MAR1-1 to I/O IAR1 fixed */
- m_iospace->write_byte(iar1, z180_read_memory(mar1--));
+ m_io.write_byte(iar1, z180_read_memory(mar1--));
break;
case 0x02: /* I/O IAR1 fixed to memory MAR1+1 */
- z180_write_memory(mar1++, m_iospace->read_byte(iar1));
+ z180_write_memory(mar1++, m_io.read_byte(iar1));
break;
case 0x03: /* I/O IAR1 fixed to memory MAR1-1 */
- z180_write_memory(mar1--, m_iospace->read_byte(iar1));
+ z180_write_memory(mar1--, m_io.read_byte(iar1));
break;
}
@@ -1682,11 +1682,10 @@ void z180_device::device_start()
if( (i & 0x0f) == 0x0f ) SZHV_dec[i] |= HF;
}
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_oprogram = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_ocache = m_oprogram->cache<0, 0, ENDIANNESS_LITTLE>();
- m_iospace = &space(AS_IO);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_PROGRAM).cache(m_cprogram);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_copcodes);
+ space(AS_IO).specific(m_io);
/* set up the state table */
{
diff --git a/src/devices/cpu/z180/z180.h b/src/devices/cpu/z180/z180.h
index 69663c73814..5153c5e1f89 100644
--- a/src/devices/cpu/z180/z180.h
+++ b/src/devices/cpu/z180/z180.h
@@ -203,11 +203,9 @@ private:
uint8_t m_timer_cnt; // timer counter / divide by 20
uint8_t m_dma0_cnt; // DMA0 counter / divide by 20
uint8_t m_dma1_cnt; // DMA1 counter / divide by 20
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- address_space *m_oprogram;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_ocache;
- address_space *m_iospace;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_cprogram, m_copcodes;
+ memory_access<20, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
uint8_t m_rtemp;
uint32_t m_ioltemp;
int m_icount;
diff --git a/src/devices/cpu/z180/z180dd.hxx b/src/devices/cpu/z180/z180dd.hxx
index 0676af905ae..48c9cc497f2 100644
--- a/src/devices/cpu/z180/z180dd.hxx
+++ b/src/devices/cpu/z180/z180dd.hxx
@@ -2,7 +2,7 @@
// copyright-holders:Juergen Buchmueller
OP(illegal,1) {
logerror("Z180 '%s' ill. opcode $%02x $%02x\n",
- tag(), m_ocache->read_byte((_PCD-1)&0xffff), m_ocache->read_byte(_PCD));
+ tag(), m_copcodes.read_byte((_PCD-1)&0xffff), m_copcodes.read_byte(_PCD));
}
/**********************************************************
diff --git a/src/devices/cpu/z180/z180ed.hxx b/src/devices/cpu/z180/z180ed.hxx
index 68925107c1d..949ede4b268 100644
--- a/src/devices/cpu/z180/z180ed.hxx
+++ b/src/devices/cpu/z180/z180ed.hxx
@@ -3,7 +3,7 @@
OP(illegal,2)
{
logerror("Z180 '%s' ill. opcode $ed $%02x\n",
- tag(), m_ocache->read_byte((_PCD-1)&0xffff));
+ tag(), m_copcodes.read_byte((_PCD-1)&0xffff));
}
/**********************************************************
diff --git a/src/devices/cpu/z180/z180ops.h b/src/devices/cpu/z180/z180ops.h
index 7b4d0f159f2..0e57ff64532 100644
--- a/src/devices/cpu/z180/z180ops.h
+++ b/src/devices/cpu/z180/z180ops.h
@@ -27,7 +27,7 @@ inline u8 z180_device::IN(u16 port)
if (is_internal_io_address(port))
return z180_readcontrol(port);
m_extra_cycles += io_wait_states();
- return m_iospace->read_byte(port);
+ return m_io.read_byte(port);
}
/***************************************************************
@@ -40,7 +40,7 @@ inline void z180_device::OUT(u16 port, u8 value)
else
{
m_extra_cycles += io_wait_states();
- m_iospace->write_byte(port, value);
+ m_io.write_byte(port, value);
}
}
@@ -117,7 +117,7 @@ uint8_t z180_device::ROP()
offs_t addr = _PCD;
_PC++;
m_extra_cycles += memory_wait_states();
- return m_ocache->read_byte(MMU_REMAP_ADDR(addr));
+ return m_copcodes.read_byte(MMU_REMAP_ADDR(addr));
}
/****************************************************************
@@ -131,7 +131,7 @@ uint8_t z180_device::ARG()
offs_t addr = _PCD;
_PC++;
m_extra_cycles += memory_wait_states();
- return m_cache->read_byte(MMU_REMAP_ADDR(addr));
+ return m_cprogram.read_byte(MMU_REMAP_ADDR(addr));
}
uint32_t z180_device::ARG16()
@@ -139,7 +139,7 @@ uint32_t z180_device::ARG16()
offs_t addr = _PCD;
_PC += 2;
m_extra_cycles += memory_wait_states() * 2;
- return m_cache->read_byte(MMU_REMAP_ADDR(addr)) | (m_cache->read_byte(MMU_REMAP_ADDR(addr+1)) << 8);
+ return m_cprogram.read_byte(MMU_REMAP_ADDR(addr)) | (m_cprogram.read_byte(MMU_REMAP_ADDR(addr+1)) << 8);
}
/***************************************************************
diff --git a/src/devices/cpu/z8/z8.cpp b/src/devices/cpu/z8/z8.cpp
index f958754537c..cad09b4e7b9 100644
--- a/src/devices/cpu/z8/z8.cpp
+++ b/src/devices/cpu/z8/z8.cpp
@@ -286,7 +286,7 @@ uint16_t z8_device::mask_external_address(uint16_t addr)
uint8_t z8_device::fetch()
{
uint16_t real_pc = (m_pc < m_rom_size) ? m_pc : mask_external_address(m_pc);
- uint8_t data = m_cache->read_byte(real_pc);
+ uint8_t data = m_cache.read_byte(real_pc);
m_pc++;
@@ -299,7 +299,7 @@ uint8_t z8_device::fetch_opcode()
m_ppc = (m_pc < m_rom_size) ? m_pc : mask_external_address(m_pc);
debugger_instruction_hook(m_ppc);
- uint8_t data = m_cache->read_byte(m_ppc);
+ uint8_t data = m_cache.read_byte(m_ppc);
m_pc++;
@@ -912,12 +912,12 @@ void z8_device::spl_write(uint8_t data)
uint16_t z8_device::register_pair_read(uint8_t offset)
{
- return m_regs->read_word_unaligned(offset);
+ return m_regs.read_word_unaligned(offset);
}
void z8_device::register_pair_write(uint8_t offset, uint16_t data)
{
- m_regs->write_word_unaligned(offset, data);
+ m_regs.write_word_unaligned(offset, data);
}
uint8_t z8_device::get_working_register(int offset) const
@@ -956,7 +956,7 @@ void z8_device::stack_push_byte(uint8_t src)
m_sp.w = sp;
// @SP <- src
- m_data->write_byte(mask_external_address(sp), src);
+ m_data.write_byte(mask_external_address(sp), src);
}
}
@@ -978,7 +978,7 @@ void z8_device::stack_push_word(uint16_t src)
m_sp.w = sp;
// @SP <- src
- m_data->write_word_unaligned(mask_external_address(sp), src);
+ m_data.write_word_unaligned(mask_external_address(sp), src);
}
}
@@ -999,7 +999,7 @@ uint8_t z8_device::stack_pop_byte()
{
// @SP <- src
uint16_t sp = m_sp.w;
- uint8_t byte = m_data->read_byte(mask_external_address(sp));
+ uint8_t byte = m_data.read_byte(mask_external_address(sp));
// SP <- SP + 1 (postincrement)
m_sp.w = sp + 1;
@@ -1025,7 +1025,7 @@ uint16_t z8_device::stack_pop_word()
{
// @SP <- src
uint16_t sp = m_sp.w;
- uint16_t word = m_data->read_word_unaligned(mask_external_address(sp));
+ uint16_t word = m_data.read_word_unaligned(mask_external_address(sp));
// SP <- SP + 2 (postincrement)
m_sp.w = sp + 2;
@@ -1219,10 +1219,10 @@ void z8_device::device_start()
}
/* find address spaces */
- m_program = &space(AS_PROGRAM);
- m_cache = m_program->cache<0, 0, ENDIANNESS_BIG>();
- m_data = has_space(AS_DATA) ? &space(AS_DATA) : m_program;
- m_regs = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+ space(AS_DATA).specific(m_data);
+ space(AS_IO).specific(m_regs);
/* allocate timers */
m_internal_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(z8_device::timeout<0>), this));
@@ -1324,8 +1324,8 @@ void z8_device::take_interrupt(int irq)
stack_push_byte(m_flags);
// branch to the vector
- m_pc = m_cache->read_byte(vector) << 8;
- m_pc |= m_cache->read_byte(vector + 1);
+ m_pc = m_cache.read_byte(vector) << 8;
+ m_pc |= m_cache.read_byte(vector + 1);
}
void z8_device::process_interrupts()
diff --git a/src/devices/cpu/z8/z8.h b/src/devices/cpu/z8/z8.h
index c21c9189359..22ad98513b5 100644
--- a/src/devices/cpu/z8/z8.h
+++ b/src/devices/cpu/z8/z8.h
@@ -74,10 +74,10 @@ private:
address_space_config m_data_config;
address_space_config m_register_config;
- address_space *m_program;
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cache;
- address_space *m_data;
- address_space *m_regs;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::specific m_data;
+ memory_access< 8, 0, 0, ENDIANNESS_BIG>::specific m_regs;
// callbacks
devcb_read8::array<4> m_input_cb;
@@ -191,9 +191,9 @@ private:
inline uint8_t fetch();
inline uint8_t fetch_opcode();
inline uint16_t fetch_word();
- inline uint8_t register_read(uint8_t offset) { return m_regs->read_byte(offset); }
+ inline uint8_t register_read(uint8_t offset) { return m_regs.read_byte(offset); }
inline uint16_t register_pair_read(uint8_t offset);
- inline void register_write(uint8_t offset, uint8_t data) { m_regs->write_byte(offset, data); }
+ inline void register_write(uint8_t offset, uint8_t data) { m_regs.write_byte(offset, data); }
inline void register_pair_write(uint8_t offset, uint16_t data);
inline uint8_t get_working_register(int offset) const;
inline uint8_t get_register(uint8_t offset) const;
@@ -205,10 +205,10 @@ private:
inline void set_flag(uint8_t flag, int state);
inline void clear(uint8_t dst);
inline void load(uint8_t dst, uint8_t src);
- inline void load_from_memory(address_space &space);
- inline void load_to_memory(address_space &space);
- inline void load_from_memory_autoinc(address_space &space);
- inline void load_to_memory_autoinc(address_space &space);
+ inline void load_from_memory(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space);
+ inline void load_to_memory(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space);
+ inline void load_from_memory_autoinc(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space);
+ inline void load_to_memory_autoinc(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space);
inline void pop(uint8_t dst);
inline void push(uint8_t src);
inline void add_carry(uint8_t dst, uint8_t src);
diff --git a/src/devices/cpu/z8/z8ops.hxx b/src/devices/cpu/z8/z8ops.hxx
index b1cfae93970..51172f2d142 100644
--- a/src/devices/cpu/z8/z8ops.hxx
+++ b/src/devices/cpu/z8/z8ops.hxx
@@ -139,7 +139,7 @@ INSTRUCTION( ld_IR2_R1 ) { mode_IR2_R1(load) }
INSTRUCTION( ld_R1_IM ) { mode_R1_IM(load) }
INSTRUCTION( ld_IR1_IM ) { mode_IR1_IM(load) }
-void z8_device::load_from_memory(address_space &space)
+void z8_device::load_from_memory(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space)
{
uint8_t operands = fetch();
uint8_t dst = get_working_register(operands >> 4);
@@ -148,29 +148,29 @@ void z8_device::load_from_memory(address_space &space)
uint16_t address = register_pair_read(src);
uint8_t data;
- if (&space == m_program && address < m_rom_size)
- data = m_cache->read_byte(address);
+ if (space.space().spacenum() == AS_PROGRAM && address < m_rom_size)
+ data = m_cache.read_byte(address);
else
data = space.read_byte(mask_external_address(address));
register_write(dst, data);
}
-void z8_device::load_to_memory(address_space &space)
+void z8_device::load_to_memory(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space)
{
uint8_t operands = fetch();
uint8_t src = get_working_register(operands >> 4);
uint8_t dst = get_working_register(operands & 0x0f);
uint16_t address = register_pair_read(dst);
- if (&space != m_program || address >= m_rom_size)
+ if (space.space().spacenum() != AS_PROGRAM || address >= m_rom_size)
address = mask_external_address(address);
uint8_t data = register_read(src);
space.write_byte(address, data);
}
-void z8_device::load_from_memory_autoinc(address_space &space)
+void z8_device::load_from_memory_autoinc(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space)
{
uint8_t operands = fetch();
uint8_t dst = get_working_register(operands >> 4);
@@ -180,8 +180,8 @@ void z8_device::load_from_memory_autoinc(address_space &space)
uint16_t address = register_pair_read(src);
uint8_t data;
- if (&space == m_program && address < m_rom_size)
- data = m_cache->read_byte(address);
+ if (space.space().spacenum() == AS_PROGRAM && address < m_rom_size)
+ data = m_cache.read_byte(address);
else
data = space.read_byte(mask_external_address(address));
register_write(real_dst, data);
@@ -190,7 +190,7 @@ void z8_device::load_from_memory_autoinc(address_space &space)
register_pair_write(src, address + 1);
}
-void z8_device::load_to_memory_autoinc(address_space &space)
+void z8_device::load_to_memory_autoinc(memory_access<16, 0, 0, ENDIANNESS_BIG>::specific &space)
{
uint8_t operands = fetch();
uint8_t src = get_working_register(operands >> 4);
@@ -200,7 +200,7 @@ void z8_device::load_to_memory_autoinc(address_space &space)
uint16_t address = register_pair_read(dst);
uint8_t data = register_read(real_src);
- if (&space != m_program || address >= m_rom_size)
+ if (space.space().spacenum() == AS_PROGRAM || address >= m_rom_size)
address = mask_external_address(address);
space.write_byte(address, data);
@@ -208,14 +208,14 @@ void z8_device::load_to_memory_autoinc(address_space &space)
register_write(src, real_src + 1);
}
-INSTRUCTION( ldc_r1_Irr2 ) { load_from_memory(*m_program); }
-INSTRUCTION( ldc_r2_Irr1 ) { load_to_memory(*m_program); }
-INSTRUCTION( ldci_Ir1_Irr2 ) { load_from_memory_autoinc(*m_program); }
-INSTRUCTION( ldci_Ir2_Irr1 ) { load_to_memory_autoinc(*m_program); }
-INSTRUCTION( lde_r1_Irr2 ) { load_from_memory(*m_data); }
-INSTRUCTION( lde_r2_Irr1 ) { load_to_memory(*m_data); }
-INSTRUCTION( ldei_Ir1_Irr2 ) { load_from_memory_autoinc(*m_data); }
-INSTRUCTION( ldei_Ir2_Irr1 ) { load_to_memory_autoinc(*m_data); }
+INSTRUCTION( ldc_r1_Irr2 ) { load_from_memory(m_program); }
+INSTRUCTION( ldc_r2_Irr1 ) { load_to_memory(m_program); }
+INSTRUCTION( ldci_Ir1_Irr2 ) { load_from_memory_autoinc(m_program); }
+INSTRUCTION( ldci_Ir2_Irr1 ) { load_to_memory_autoinc(m_program); }
+INSTRUCTION( lde_r1_Irr2 ) { load_from_memory(m_data); }
+INSTRUCTION( lde_r2_Irr1 ) { load_to_memory(m_data); }
+INSTRUCTION( ldei_Ir1_Irr2 ) { load_from_memory_autoinc(m_data); }
+INSTRUCTION( ldei_Ir2_Irr1 ) { load_to_memory_autoinc(m_data); }
void z8_device::pop(uint8_t dst)
{
diff --git a/src/devices/cpu/z80/z80.cpp b/src/devices/cpu/z80/z80.cpp
index 8e1e29a8a1f..7df7eaff074 100644
--- a/src/devices/cpu/z80/z80.cpp
+++ b/src/devices/cpu/z80/z80.cpp
@@ -426,7 +426,7 @@ inline void z80_device::leave_halt()
***************************************************************/
inline uint8_t z80_device::in(uint16_t port)
{
- return m_io->read_byte(port);
+ return m_io.read_byte(port);
}
/***************************************************************
@@ -434,7 +434,7 @@ inline uint8_t z80_device::in(uint16_t port)
***************************************************************/
inline void z80_device::out(uint16_t port, uint8_t value)
{
- m_io->write_byte(port, value);
+ m_io.write_byte(port, value);
}
/***************************************************************
@@ -442,7 +442,7 @@ inline void z80_device::out(uint16_t port, uint8_t value)
***************************************************************/
inline uint8_t z80_device::rm(uint16_t addr)
{
- return m_program->read_byte(addr);
+ return m_data.read_byte(addr);
}
/***************************************************************
@@ -459,7 +459,7 @@ inline void z80_device::rm16(uint16_t addr, PAIR &r)
***************************************************************/
inline void z80_device::wm(uint16_t addr, uint8_t value)
{
- m_program->write_byte(addr, value);
+ m_data.write_byte(addr, value);
}
/***************************************************************
@@ -480,7 +480,7 @@ inline uint8_t z80_device::rop()
{
unsigned pc = PCD;
PC++;
- uint8_t res = m_opcodes_cache->read_byte(pc);
+ uint8_t res = m_opcodes.read_byte(pc);
m_icount -= 2;
m_refresh_cb((m_i << 8) | (m_r2 & 0x80) | ((m_r-1) & 0x7f), 0x00, 0xff);
m_icount += 2;
@@ -497,14 +497,14 @@ inline uint8_t z80_device::arg()
{
unsigned pc = PCD;
PC++;
- return m_cache->read_byte(pc);
+ return m_args.read_byte(pc);
}
inline uint16_t z80_device::arg16()
{
unsigned pc = PCD;
PC += 2;
- return m_cache->read_byte(pc) | (m_cache->read_byte((pc+1)&0xffff) << 8);
+ return m_args.read_word(pc);
}
/***************************************************************
@@ -1956,7 +1956,7 @@ OP(xycb,ff) { A = set(7, rm(m_ea)); wm(m_ea, A); } /* SET 7,A=(XY+o) */
OP(illegal,1) {
logerror("Z80 ill. opcode $%02x $%02x ($%04x)\n",
- m_opcodes_cache->read_byte((PCD-1)&0xffff), m_opcodes_cache->read_byte(PCD), PCD-1);
+ m_opcodes.read_byte((PCD-1)&0xffff), m_opcodes.read_byte(PCD), PCD-1);
}
/**********************************************************
@@ -2544,7 +2544,7 @@ OP(fd,ff) { illegal_1(); op_ff(); } /* DB FD
OP(illegal,2)
{
logerror("Z80 ill. opcode $ed $%02x\n",
- m_opcodes_cache->read_byte((PCD-1)&0xffff));
+ m_opcodes.read_byte((PCD-1)&0xffff));
}
/**********************************************************
@@ -3406,11 +3406,10 @@ void z80_device::device_start()
m_after_ldair = 0;
m_ea = 0;
- m_program = &space(AS_PROGRAM);
- m_opcodes = has_space(AS_OPCODES) ? &space(AS_OPCODES) : m_program;
- m_cache = m_program->cache<0, 0, ENDIANNESS_LITTLE>();
- m_opcodes_cache = m_opcodes->cache<0, 0, ENDIANNESS_LITTLE>();
- m_io = &space(AS_IO);
+ space(AS_PROGRAM).cache(m_args);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_opcodes);
+ space(AS_PROGRAM).specific(m_data);
+ space(AS_IO).specific(m_io);
IX = IY = 0xffff; /* IX and IY are FFFF after a reset! */
F = ZF; /* Zero flag is set */
diff --git a/src/devices/cpu/z80/z80.h b/src/devices/cpu/z80/z80.h
index bbf278f591d..11f4756deff 100644
--- a/src/devices/cpu/z80/z80.h
+++ b/src/devices/cpu/z80/z80.h
@@ -236,11 +236,11 @@ protected:
const address_space_config m_program_config;
const address_space_config m_opcodes_config;
const address_space_config m_io_config;
- address_space *m_program;
- address_space *m_opcodes;
- address_space *m_io;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_opcodes_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_args;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_opcodes;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_io;
+
devcb_write_line m_irqack_cb;
devcb_write8 m_refresh_cb;
devcb_write_line m_halt_cb;
diff --git a/src/devices/cpu/z8000/z8000.cpp b/src/devices/cpu/z8000/z8000.cpp
index 4684054ccc1..4ce857cecb5 100644
--- a/src/devices/cpu/z8000/z8000.cpp
+++ b/src/devices/cpu/z8000/z8000.cpp
@@ -42,7 +42,7 @@ z8002_device::z8002_device(const machine_config &mconfig, device_type type, cons
, m_sio_config("special I/O", ENDIANNESS_BIG, 16, 16, 0)
, m_iack_in(*this)
, m_mo_out(*this)
- , m_ppc(0), m_pc(0), m_psapseg(0), m_psapoff(0), m_fcw(0), m_refresh(0), m_nspseg(0), m_nspoff(0), m_irq_req(0), m_irq_vec(0), m_op_valid(0), m_nmi_state(0), m_mi(0), m_halt(false), m_program(nullptr), m_data(nullptr), m_cache(nullptr), m_io(nullptr), m_icount(0)
+ , m_ppc(0), m_pc(0), m_psapseg(0), m_psapoff(0), m_fcw(0), m_refresh(0), m_nspseg(0), m_nspoff(0), m_irq_req(0), m_irq_vec(0), m_op_valid(0), m_nmi_state(0), m_mi(0), m_halt(false), m_icount(0)
, m_vector_mult(vecmult)
{
}
@@ -96,7 +96,7 @@ uint32_t z8002_device::addr_sub(uint32_t addr, uint32_t subtrahend)
uint16_t z8002_device::RDOP()
{
- uint16_t res = m_opcache->read_word(m_pc);
+ uint16_t res = m_opcache.read_word(m_pc);
m_pc += 2;
return res;
}
@@ -112,7 +112,7 @@ uint32_t z8002_device::get_operand(int opnum)
if (! (m_op_valid & (1 << opnum)))
{
- m_op[opnum] = m_cache->read_word(m_pc);
+ m_op[opnum] = m_cache.read_word(m_pc);
m_pc += 2;
m_op_valid |= (1 << opnum);
}
@@ -130,13 +130,13 @@ uint32_t z8002_device::get_addr_operand(int opnum)
if (! (m_op_valid & (1 << opnum)))
{
- uint32_t seg = m_cache->read_word(m_pc);
+ uint32_t seg = m_cache.read_word(m_pc);
m_pc += 2;
if (get_segmented_mode())
{
if (seg & 0x8000)
{
- m_op[opnum] = ((seg & 0x7f00) << 8) | m_cache->read_word(m_pc);
+ m_op[opnum] = ((seg & 0x7f00) << 8) | m_cache.read_word(m_pc);
m_pc += 2;
}
else
@@ -160,13 +160,13 @@ uint32_t z8002_device::get_raw_addr_operand(int opnum)
if (! (m_op_valid & (1 << opnum)))
{
- uint32_t seg = m_cache->read_word(m_pc);
+ uint32_t seg = m_cache.read_word(m_pc);
m_pc += 2;
if (get_segmented_mode())
{
if (seg & 0x8000)
{
- m_op[opnum] = (seg << 16) | m_cache->read_word(m_pc);
+ m_op[opnum] = (seg << 16) | m_cache.read_word(m_pc);
m_pc += 2;
}
else
@@ -196,13 +196,13 @@ uint32_t z8001_device::adjust_addr_for_nonseg_mode(uint32_t addr)
}
}
-uint8_t z8002_device::RDMEM_B(address_space &space, uint32_t addr)
+uint8_t z8002_device::RDMEM_B(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr)
{
addr = adjust_addr_for_nonseg_mode(addr);
return space.read_byte(addr);
}
-uint16_t z8002_device::RDMEM_W(address_space &space, uint32_t addr)
+uint16_t z8002_device::RDMEM_W(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr)
{
addr = adjust_addr_for_nonseg_mode(addr);
addr &= ~1;
@@ -214,7 +214,7 @@ uint16_t z8002_device::RDMEM_W(address_space &space, uint32_t addr)
return space.read_word(addr);
}
-uint32_t z8002_device::RDMEM_L(address_space &space, uint32_t addr)
+uint32_t z8002_device::RDMEM_L(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr)
{
uint32_t result;
addr = adjust_addr_for_nonseg_mode(addr);
@@ -223,21 +223,21 @@ uint32_t z8002_device::RDMEM_L(address_space &space, uint32_t addr)
return result + space.read_word(addr_add(addr, 2));
}
-void z8002_device::WRMEM_B(address_space &space, uint32_t addr, uint8_t value)
+void z8002_device::WRMEM_B(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint8_t value)
{
addr = adjust_addr_for_nonseg_mode(addr);
uint16_t value16 = value | (value << 8);
space.write_word(addr & ~1, value16, BIT(addr, 0) ? 0x00ff : 0xff00);
}
-void z8002_device::WRMEM_W(address_space &space, uint32_t addr, uint16_t value)
+void z8002_device::WRMEM_W(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint16_t value)
{
addr = adjust_addr_for_nonseg_mode(addr);
addr &= ~1;
space.write_word(addr, value);
}
-void z8002_device::WRMEM_L(address_space &space, uint32_t addr, uint32_t value)
+void z8002_device::WRMEM_L(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint32_t value)
{
addr = adjust_addr_for_nonseg_mode(addr);
addr &= ~1;
@@ -247,13 +247,13 @@ void z8002_device::WRMEM_L(address_space &space, uint32_t addr, uint32_t value)
uint8_t z8002_device::RDPORT_B(int mode, uint16_t addr)
{
- address_space &space = (mode == 0) ? *m_io : *m_sio;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific &space = (mode == 0) ? m_io : m_sio;
return space.read_byte(addr);
}
uint16_t z8002_device::RDPORT_W(int mode, uint16_t addr)
{
- address_space &space = (mode == 0) ? *m_io : *m_sio;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific &space = (mode == 0) ? m_io : m_sio;
if (BIT(addr, 0))
return swapendian_int16(space.read_word(addr & ~1, 0x00ff));
else
@@ -262,14 +262,14 @@ uint16_t z8002_device::RDPORT_W(int mode, uint16_t addr)
void z8002_device::WRPORT_B(int mode, uint16_t addr, uint8_t value)
{
- address_space &space = (mode == 0) ? *m_io : *m_sio;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific &space = (mode == 0) ? m_io : m_sio;
uint16_t value16 = value | (value << 8);
space.write_word(addr & ~1, value16, BIT(addr, 0) ? 0x00ff : 0xff00);
}
void z8002_device::WRPORT_W(int mode, uint16_t addr, uint16_t value)
{
- address_space &space = (mode == 0) ? *m_io : *m_sio;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific &space = (mode == 0) ? m_io : m_sio;
if (BIT(addr, 0))
space.write_word(addr & ~1, swapendian_int16(value), 0x00ff);
else
@@ -297,32 +297,32 @@ void z8001_device::PUSH_PC()
uint32_t z8002_device::GET_PC(uint32_t VEC)
{
- return RDMEM_W(*m_program, VEC + 2);
+ return RDMEM_W(m_program, VEC + 2);
}
uint32_t z8001_device::GET_PC(uint32_t VEC)
{
- return segmented_addr(RDMEM_L(*m_program, VEC + 4));
+ return segmented_addr(RDMEM_L(m_program, VEC + 4));
}
uint32_t z8002_device::get_reset_pc()
{
- return RDMEM_W(*m_program, 4);
+ return RDMEM_W(m_program, 4);
}
uint32_t z8001_device::get_reset_pc()
{
- return segmented_addr(RDMEM_L(*m_program, 4));
+ return segmented_addr(RDMEM_L(m_program, 4));
}
uint16_t z8002_device::GET_FCW(uint32_t VEC)
{
- return RDMEM_W(*m_program, VEC);
+ return RDMEM_W(m_program, VEC);
}
uint16_t z8001_device::GET_FCW(uint32_t VEC)
{
- return RDMEM_W(*m_program, VEC + 2);
+ return RDMEM_W(m_program, VEC + 2);
}
uint32_t z8002_device::F_SEG_Z8001()
@@ -353,7 +353,7 @@ void z8002_device::Interrupt()
if (m_irq_req & Z8000_RESET)
{
m_irq_req &= Z8000_NVI | Z8000_VI;
- CHANGE_FCW(RDMEM_W(*m_program, 2)); /* get reset m_fcw */
+ CHANGE_FCW(RDMEM_W(m_program, 2)); /* get reset m_fcw */
m_pc = get_reset_pc(); /* get reset m_pc */
}
else
@@ -419,7 +419,7 @@ void z8002_device::Interrupt()
PUSH_PC();
PUSHW(SP, fcw); /* save current m_fcw */
PUSHW(SP, m_irq_vec); /* save interrupt/trap type tag */
- m_pc = RDMEM_W(*m_program, NMI);
+ m_pc = RDMEM_W(m_program, NMI);
m_irq_req &= ~Z8000_NMI;
CHANGE_FCW(GET_FCW(NMI));
m_pc = GET_PC(NMI);
@@ -461,13 +461,13 @@ void z8002_device::Interrupt()
uint32_t z8002_device::read_irq_vector()
{
- return RDMEM_W(*m_program, VEC00 + 2 * (m_irq_vec & 0xff));
+ return RDMEM_W(m_program, VEC00 + 2 * (m_irq_vec & 0xff));
}
uint32_t z8001_device::read_irq_vector()
{
- return segmented_addr(RDMEM_L(*m_program, VEC00 + 2 * (m_irq_vec & 0xff)));
+ return segmented_addr(RDMEM_L(m_program, VEC00 + 2 * (m_irq_vec & 0xff)));
}
@@ -492,7 +492,7 @@ void z8002_device::clear_internal_state()
void z8002_device::register_debug_state()
{
- state_add( Z8000_PC, "PC", m_pc ).mask(m_program->addrmask());
+ state_add( Z8000_PC, "PC", m_pc ).mask(m_program.space().addrmask());
state_add( Z8000_NSPOFF, "NSPOFF", m_nspoff ).formatstr("%04X");
state_add( Z8000_NSPSEG, "NSPSEG", m_nspseg ).formatstr("%04X");
state_add( Z8000_FCW, "FCW", m_fcw ).formatstr("%04X");
@@ -573,27 +573,16 @@ void z8002_device::register_save_state()
void z8002_device::init_spaces()
{
- m_program = &space(AS_PROGRAM);
+ space(AS_PROGRAM).cache(m_cache);
+ space(AS_PROGRAM).specific(m_program);
+
/* If the system decodes STn lines to distinguish between data and program memory fetches,
install the data space. If it doesn't, install the program memory into data memory space. */
- if (has_space(AS_DATA))
- m_data = &space(AS_DATA);
- else
- m_data = m_program;
- if (has_space(AS_STACK))
- m_stack = &space(AS_STACK);
- else
- m_stack = m_data;
- m_cache = m_program->cache<1, 0, ENDIANNESS_BIG>();
- if (has_space(AS_OPCODES))
- m_opcache = space(AS_OPCODES).cache<1, 0, ENDIANNESS_BIG>();
- else
- m_opcache = m_cache;
- m_io = &space(AS_IO);
- if (has_space(AS_SIO))
- m_sio = &space(AS_SIO);
- else
- m_sio = m_io;
+ space(has_space(AS_DATA) ? AS_DATA : AS_PROGRAM).specific(m_data);
+ space(has_space(AS_STACK) ? AS_STACK : has_space(AS_DATA) ? AS_DATA : AS_PROGRAM).specific(m_stack);
+ space(has_space(AS_OPCODES) ? AS_OPCODES : AS_PROGRAM).cache(m_opcache);
+ space(AS_IO).specific(m_io);
+ space(has_space(AS_SIO) ? AS_SIO : AS_IO).specific(m_sio);
}
void z8002_device::init_tables()
diff --git a/src/devices/cpu/z8000/z8000.h b/src/devices/cpu/z8000/z8000.h
index 907aedd1d01..921f8f4eb0f 100644
--- a/src/devices/cpu/z8000/z8000.h
+++ b/src/devices/cpu/z8000/z8000.h
@@ -146,13 +146,13 @@ protected:
int m_irq_state[2]; /* IRQ line states (NVI, VI) */
int m_mi;
bool m_halt;
- address_space *m_program;
- address_space *m_data;
- address_space *m_stack;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_cache;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_opcache;
- address_space *m_io;
- address_space *m_sio;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::cache m_cache;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::cache m_opcache;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific m_program;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific m_stack;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_io;
+ memory_access<16, 1, 0, ENDIANNESS_BIG>::specific m_sio;
int m_icount;
const int m_vector_mult;
@@ -167,12 +167,12 @@ protected:
inline uint32_t get_addr_operand(int opnum);
inline uint32_t get_raw_addr_operand(int opnum);
virtual uint32_t adjust_addr_for_nonseg_mode(uint32_t addr);
- inline uint8_t RDMEM_B(address_space &space, uint32_t addr);
- inline uint16_t RDMEM_W(address_space &space, uint32_t addr);
- inline uint32_t RDMEM_L(address_space &space, uint32_t addr);
- inline void WRMEM_B(address_space &space, uint32_t addr, uint8_t value);
- inline void WRMEM_W(address_space &space, uint32_t addr, uint16_t value);
- inline void WRMEM_L(address_space &space, uint32_t addr, uint32_t value);
+ inline uint8_t RDMEM_B(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr);
+ inline uint16_t RDMEM_W(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr);
+ inline uint32_t RDMEM_L(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr);
+ inline void WRMEM_B(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint8_t value);
+ inline void WRMEM_W(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint16_t value);
+ inline void WRMEM_L(memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space, uint32_t addr, uint32_t value);
inline uint8_t RDPORT_B(int mode, uint16_t addr);
inline uint16_t RDPORT_W(int mode, uint16_t addr);
inline void WRPORT_B(int mode, uint16_t addr, uint8_t value);
diff --git a/src/devices/cpu/z8000/z8000ops.hxx b/src/devices/cpu/z8000/z8000ops.hxx
index 82b9bd86442..1e3b2834a2d 100644
--- a/src/devices/cpu/z8000/z8000ops.hxx
+++ b/src/devices/cpu/z8000/z8000ops.hxx
@@ -137,62 +137,62 @@ void z8002_device::set_pc(uint32_t addr)
uint8_t z8002_device::RDIR_B(uint8_t reg)
{
- return RDMEM_B(reg == SP ? *m_stack : *m_data, addr_from_reg(reg));
+ return RDMEM_B(reg == SP ? m_stack : m_data, addr_from_reg(reg));
}
uint16_t z8002_device::RDIR_W(uint8_t reg)
{
- return RDMEM_W(reg == SP ? *m_stack : *m_data, addr_from_reg(reg));
+ return RDMEM_W(reg == SP ? m_stack : m_data, addr_from_reg(reg));
}
uint32_t z8002_device::RDIR_L(uint8_t reg)
{
- return RDMEM_L(reg == SP ? *m_stack : *m_data, addr_from_reg(reg));
+ return RDMEM_L(reg == SP ? m_stack : m_data, addr_from_reg(reg));
}
void z8002_device::WRIR_B(uint8_t reg, uint8_t value)
{
- WRMEM_B(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value);
+ WRMEM_B(reg == SP ? m_stack : m_data, addr_from_reg(reg), value);
}
void z8002_device::WRIR_W(uint8_t reg, uint16_t value)
{
- WRMEM_W(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value);
+ WRMEM_W(reg == SP ? m_stack : m_data, addr_from_reg(reg), value);
}
void z8002_device::WRIR_L(uint8_t reg, uint32_t value)
{
- WRMEM_L(reg == SP ? *m_stack : *m_data, addr_from_reg(reg), value);
+ WRMEM_L(reg == SP ? m_stack : m_data, addr_from_reg(reg), value);
}
uint8_t z8002_device::RDBX_B(uint8_t reg, uint16_t idx)
{
- return RDMEM_B(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx));
+ return RDMEM_B(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx));
}
uint16_t z8002_device::RDBX_W(uint8_t reg, uint16_t idx)
{
- return RDMEM_W(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx));
+ return RDMEM_W(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx));
}
uint32_t z8002_device::RDBX_L(uint8_t reg, uint16_t idx)
{
- return RDMEM_L(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx));
+ return RDMEM_L(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx));
}
void z8002_device::WRBX_B(uint8_t reg, uint16_t idx, uint8_t value)
{
- WRMEM_B(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value);
+ WRMEM_B(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx), value);
}
void z8002_device::WRBX_W(uint8_t reg, uint16_t idx, uint16_t value)
{
- WRMEM_W(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value);
+ WRMEM_W(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx), value);
}
void z8002_device::WRBX_L(uint8_t reg, uint16_t idx, uint32_t value)
{
- WRMEM_L(reg == SP ? *m_stack : *m_data, addr_add(addr_from_reg(reg), idx), value);
+ WRMEM_L(reg == SP ? m_stack : m_data, addr_add(addr_from_reg(reg), idx), value);
}
void z8002_device::PUSHW(uint8_t dst, uint16_t value)
@@ -1535,7 +1535,7 @@ void z8002_device::Z0B_ssN0_dddd()
void z8002_device::Z0C_ddN0_0000()
{
GET_DST(OP0,NIB3);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, COMB(RDMEM_B(space, addr)));
}
@@ -1558,7 +1558,7 @@ void z8002_device::Z0C_ddN0_0001_imm8()
void z8002_device::Z0C_ddN0_0010()
{
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, NEGB(RDMEM_B(space, addr)));
}
@@ -1591,7 +1591,7 @@ void z8002_device::Z0C_ddN0_0101_imm8()
void z8002_device::Z0C_ddN0_0110()
{
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
if (RDMEM_B(space, addr) & S08) SET_S; else CLR_S;
WRMEM_B(space, addr, 0xff);
@@ -1614,7 +1614,7 @@ void z8002_device::Z0C_ddN0_1000()
void z8002_device::Z0D_ddN0_0000()
{
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, COMW(RDMEM_W(space, addr)));
}
@@ -1637,7 +1637,7 @@ void z8002_device::Z0D_ddN0_0001_imm16()
void z8002_device::Z0D_ddN0_0010()
{
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, NEGW(RDMEM_W(space, addr)));
}
@@ -1670,7 +1670,7 @@ void z8002_device::Z0D_ddN0_0101_imm16()
void z8002_device::Z0D_ddN0_0110()
{
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
if (RDMEM_W(space, addr) & S16) SET_S; else CLR_S;
WRMEM_W(space, addr, 0xffff);
@@ -1966,7 +1966,7 @@ void z8002_device::Z1C_ddN0_1001_0000_ssss_0000_nmin1()
GET_DST(OP0,NIB2);
GET_CNT(OP1,NIB3);
GET_SRC(OP1,NIB1);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
while (cnt-- >= 0) {
WRMEM_W(space, addr, RW(src));
@@ -1984,7 +1984,7 @@ void z8002_device::Z1C_ssN0_0001_0000_dddd_0000_nmin1()
GET_SRC(OP0,NIB2);
GET_CNT(OP1,NIB3);
GET_DST(OP1,NIB1);
- address_space &space = src == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = src == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(src);
while (cnt-- >= 0) {
RW(dst) = RDMEM_W(space, addr);
@@ -2098,7 +2098,7 @@ void z8002_device::Z22_ddN0_imm4()
{
GET_BIT(OP0);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, RDMEM_B(space, addr) & ~bit);
}
@@ -2122,7 +2122,7 @@ void z8002_device::Z23_ddN0_imm4()
{
GET_BIT(OP0);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, RDMEM_W(space, addr) & ~bit);
}
@@ -2146,7 +2146,7 @@ void z8002_device::Z24_ddN0_imm4()
{
GET_BIT(OP0);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, RDMEM_B(space, addr) | bit);
}
@@ -2170,7 +2170,7 @@ void z8002_device::Z25_ddN0_imm4()
{
GET_BIT(OP0);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, RDMEM_W(space, addr) | bit);
}
@@ -2227,7 +2227,7 @@ void z8002_device::Z28_ddN0_imm4m1()
{
GET_I4M1(OP0,NIB3);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, INCB(RDMEM_B(space, addr), i4p1));
}
@@ -2240,7 +2240,7 @@ void z8002_device::Z29_ddN0_imm4m1()
{
GET_I4M1(OP0,NIB3);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, INCW(RDMEM_W(space, addr), i4p1));
}
@@ -2253,7 +2253,7 @@ void z8002_device::Z2A_ddN0_imm4m1()
{
GET_I4M1(OP0,NIB3);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_B(space, addr, DECB(RDMEM_B(space, addr), i4p1));
}
@@ -2266,7 +2266,7 @@ void z8002_device::Z2B_ddN0_imm4m1()
{
GET_I4M1(OP0,NIB3);
GET_DST(OP0,NIB2);
- address_space &space = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = dst == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(dst);
WRMEM_W(space, addr, DECW(RDMEM_W(space, addr), i4p1));
}
@@ -2279,7 +2279,7 @@ void z8002_device::Z2C_ssN0_dddd()
{
GET_DST(OP0,NIB3);
GET_SRC(OP0,NIB2);
- address_space &space = src == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = src == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(src);
uint8_t tmp = RDMEM_B(space, addr);
WRMEM_B(space, addr, RB(dst));
@@ -2294,7 +2294,7 @@ void z8002_device::Z2D_ssN0_dddd()
{
GET_DST(OP0,NIB3);
GET_SRC(OP0,NIB2);
- address_space &space = src == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = src == SP ? m_stack : m_data;
uint32_t addr = addr_from_reg(src);
uint16_t tmp = RDMEM_W(space, addr);
WRMEM_W(space, addr, RW(dst));
@@ -2331,7 +2331,7 @@ void z8002_device::Z30_0000_dddd_dsp16()
{
GET_DST(OP0,NIB3);
GET_DSP16;
- RB(dst) = RDMEM_B(*m_program, dsp16);
+ RB(dst) = RDMEM_B(m_program, dsp16);
}
/******************************************
@@ -2354,7 +2354,7 @@ void z8002_device::Z31_0000_dddd_dsp16()
{
GET_DST(OP0,NIB3);
GET_DSP16;
- RW(dst) = RDMEM_W(*m_program, dsp16);
+ RW(dst) = RDMEM_W(m_program, dsp16);
}
/******************************************
@@ -2377,7 +2377,7 @@ void z8002_device::Z32_0000_ssss_dsp16()
{
GET_SRC(OP0,NIB3);
GET_DSP16;
- WRMEM_B(*m_program, dsp16, RB(src));
+ WRMEM_B(m_program, dsp16, RB(src));
}
/******************************************
@@ -2400,7 +2400,7 @@ void z8002_device::Z33_0000_ssss_dsp16()
{
GET_SRC(OP0,NIB3);
GET_DSP16;
- WRMEM_W(*m_program, dsp16, RW(src));
+ WRMEM_W(m_program, dsp16, RW(src));
}
/******************************************
@@ -2452,7 +2452,7 @@ void z8002_device::Z35_0000_dddd_dsp16()
{
GET_DST(OP0,NIB3);
GET_DSP16;
- RL(dst) = RDMEM_L(*m_program, dsp16);
+ RL(dst) = RDMEM_L(m_program, dsp16);
}
/******************************************
@@ -2499,7 +2499,7 @@ void z8002_device::Z37_0000_ssss_dsp16()
{
GET_SRC(OP0,NIB3);
GET_DSP16;
- WRMEM_L(*m_program, dsp16, RL(src));
+ WRMEM_L(m_program, dsp16, RL(src));
}
/******************************************
@@ -2537,7 +2537,7 @@ void z8002_device::Z39_ssN0_0000()
CHECK_PRIVILEGED_INSTR();
GET_SRC(OP0,NIB2);
uint16_t fcw;
- address_space &space = src == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &space = src == SP ? m_stack : m_data;
if (get_segmented_mode()) {
uint32_t addr = addr_from_reg(src);
fcw = RDMEM_W(space, addr + 2);
@@ -2988,7 +2988,7 @@ void z8002_device::Z40_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = ADDB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ADDB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3001,7 +3001,7 @@ void z8002_device::Z40_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = ADDB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ADDB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3012,7 +3012,7 @@ void z8002_device::Z41_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = ADDW(RW(dst), RDMEM_W(*m_data, addr)); /* EHC */
+ RW(dst) = ADDW(RW(dst), RDMEM_W(m_data, addr)); /* EHC */
}
/******************************************
@@ -3025,7 +3025,7 @@ void z8002_device::Z41_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = ADDW(RW(dst), RDMEM_W(*m_data, addr)); /* ASG */
+ RW(dst) = ADDW(RW(dst), RDMEM_W(m_data, addr)); /* ASG */
}
/******************************************
@@ -3036,7 +3036,7 @@ void z8002_device::Z42_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = SUBB(RB(dst), RDMEM_B(*m_data, addr)); /* EHC */
+ RB(dst) = SUBB(RB(dst), RDMEM_B(m_data, addr)); /* EHC */
}
/******************************************
@@ -3049,7 +3049,7 @@ void z8002_device::Z42_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = SUBB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = SUBB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3060,7 +3060,7 @@ void z8002_device::Z43_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = SUBW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = SUBW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3073,7 +3073,7 @@ void z8002_device::Z43_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = SUBW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = SUBW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3084,7 +3084,7 @@ void z8002_device::Z44_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = ORB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ORB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3097,7 +3097,7 @@ void z8002_device::Z44_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = ORB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ORB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3108,7 +3108,7 @@ void z8002_device::Z45_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = ORW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = ORW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3121,7 +3121,7 @@ void z8002_device::Z45_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = ORW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = ORW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3132,7 +3132,7 @@ void z8002_device::Z46_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = ANDB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ANDB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3145,7 +3145,7 @@ void z8002_device::Z46_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = ANDB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = ANDB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3156,7 +3156,7 @@ void z8002_device::Z47_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = ANDW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = ANDW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3169,7 +3169,7 @@ void z8002_device::Z47_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = ANDW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = ANDW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3180,7 +3180,7 @@ void z8002_device::Z48_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = XORB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = XORB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3193,7 +3193,7 @@ void z8002_device::Z48_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = XORB(RB(dst), RDMEM_B(*m_data, addr));
+ RB(dst) = XORB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3204,7 +3204,7 @@ void z8002_device::Z49_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = XORW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = XORW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3217,7 +3217,7 @@ void z8002_device::Z49_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = XORW(RW(dst), RDMEM_W(*m_data, addr));
+ RW(dst) = XORW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3228,7 +3228,7 @@ void z8002_device::Z4A_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- CPB(RB(dst), RDMEM_B(*m_data, addr));
+ CPB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3241,7 +3241,7 @@ void z8002_device::Z4A_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- CPB(RB(dst), RDMEM_B(*m_data, addr));
+ CPB(RB(dst), RDMEM_B(m_data, addr));
}
/******************************************
@@ -3252,7 +3252,7 @@ void z8002_device::Z4B_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- CPW(RW(dst), RDMEM_W(*m_data, addr));
+ CPW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3265,7 +3265,7 @@ void z8002_device::Z4B_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- CPW(RW(dst), RDMEM_W(*m_data, addr));
+ CPW(RW(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3275,7 +3275,7 @@ void z8002_device::Z4B_ssN0_dddd_addr()
void z8002_device::Z4C_0000_0000_addr()
{
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, COMB(RDMEM_W(*m_data, addr)));
+ WRMEM_B(m_data, addr, COMB(RDMEM_W(m_data, addr)));
}
/******************************************
@@ -3286,7 +3286,7 @@ void z8002_device::Z4C_0000_0001_addr_imm8()
{
GET_ADDR(OP1);
GET_IMM8(OP2);
- CPB(RDMEM_B(*m_data, addr), imm8);
+ CPB(RDMEM_B(m_data, addr), imm8);
}
/******************************************
@@ -3296,7 +3296,7 @@ void z8002_device::Z4C_0000_0001_addr_imm8()
void z8002_device::Z4C_0000_0010_addr()
{
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, NEGB(RDMEM_B(*m_data, addr)));
+ WRMEM_B(m_data, addr, NEGB(RDMEM_B(m_data, addr)));
}
/******************************************
@@ -3306,7 +3306,7 @@ void z8002_device::Z4C_0000_0010_addr()
void z8002_device::Z4C_0000_0100_addr()
{
GET_ADDR(OP1);
- TESTB(RDMEM_B(*m_data, addr));
+ TESTB(RDMEM_B(m_data, addr));
}
/******************************************
@@ -3317,7 +3317,7 @@ void z8002_device::Z4C_0000_0101_addr_imm8()
{
GET_ADDR(OP1);
GET_IMM8(OP2);
- WRMEM_B(*m_data, addr, imm8);
+ WRMEM_B(m_data, addr, imm8);
}
/******************************************
@@ -3327,8 +3327,8 @@ void z8002_device::Z4C_0000_0101_addr_imm8()
void z8002_device::Z4C_0000_0110_addr()
{
GET_ADDR(OP1);
- if (RDMEM_B(*m_data, addr) & S08) SET_S; else CLR_S;
- WRMEM_B(*m_data, addr, 0xff);
+ if (RDMEM_B(m_data, addr) & S08) SET_S; else CLR_S;
+ WRMEM_B(m_data, addr, 0xff);
}
/******************************************
@@ -3338,7 +3338,7 @@ void z8002_device::Z4C_0000_0110_addr()
void z8002_device::Z4C_0000_1000_addr()
{
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, 0);
+ WRMEM_B(m_data, addr, 0);
}
/******************************************
@@ -3350,7 +3350,7 @@ void z8002_device::Z4C_ddN0_0000_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, COMB(RDMEM_B(*m_data, addr)));
+ WRMEM_B(m_data, addr, COMB(RDMEM_B(m_data, addr)));
}
/******************************************
@@ -3363,7 +3363,7 @@ void z8002_device::Z4C_ddN0_0001_addr_imm8()
GET_ADDR(OP1);
GET_IMM8(OP2);
addr = addr_add(addr, RW(dst));
- CPB(RDMEM_B(*m_data, addr), imm8);
+ CPB(RDMEM_B(m_data, addr), imm8);
}
/******************************************
@@ -3375,7 +3375,7 @@ void z8002_device::Z4C_ddN0_0010_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, NEGB(RDMEM_B(*m_data, addr)));
+ WRMEM_B(m_data, addr, NEGB(RDMEM_B(m_data, addr)));
}
/******************************************
@@ -3387,7 +3387,7 @@ void z8002_device::Z4C_ddN0_0100_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- TESTB(RDMEM_B(*m_data, addr));
+ TESTB(RDMEM_B(m_data, addr));
}
/******************************************
@@ -3400,7 +3400,7 @@ void z8002_device::Z4C_ddN0_0101_addr_imm8()
GET_ADDR(OP1);
GET_IMM8(OP2);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, imm8);
+ WRMEM_B(m_data, addr, imm8);
}
/******************************************
@@ -3412,8 +3412,8 @@ void z8002_device::Z4C_ddN0_0110_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- if (RDMEM_B(*m_data, addr) & S08) SET_S; else CLR_S;
- WRMEM_B(*m_data, addr, 0xff);
+ if (RDMEM_B(m_data, addr) & S08) SET_S; else CLR_S;
+ WRMEM_B(m_data, addr, 0xff);
}
/******************************************
@@ -3425,7 +3425,7 @@ void z8002_device::Z4C_ddN0_1000_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, 0);
+ WRMEM_B(m_data, addr, 0);
}
/******************************************
@@ -3435,7 +3435,7 @@ void z8002_device::Z4C_ddN0_1000_addr()
void z8002_device::Z4D_0000_0000_addr()
{
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, COMW(RDMEM_W(*m_data, addr)));
+ WRMEM_W(m_data, addr, COMW(RDMEM_W(m_data, addr)));
}
/******************************************
@@ -3446,7 +3446,7 @@ void z8002_device::Z4D_0000_0001_addr_imm16()
{
GET_ADDR(OP1);
GET_IMM16(OP2);
- CPW(RDMEM_W(*m_data, addr), imm16);
+ CPW(RDMEM_W(m_data, addr), imm16);
}
/******************************************
@@ -3456,7 +3456,7 @@ void z8002_device::Z4D_0000_0001_addr_imm16()
void z8002_device::Z4D_0000_0010_addr()
{
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, NEGW(RDMEM_W(*m_data, addr)));
+ WRMEM_W(m_data, addr, NEGW(RDMEM_W(m_data, addr)));
}
/******************************************
@@ -3466,7 +3466,7 @@ void z8002_device::Z4D_0000_0010_addr()
void z8002_device::Z4D_0000_0100_addr()
{
GET_ADDR(OP1);
- TESTW(RDMEM_W(*m_data, addr));
+ TESTW(RDMEM_W(m_data, addr));
}
/******************************************
@@ -3477,7 +3477,7 @@ void z8002_device::Z4D_0000_0101_addr_imm16()
{
GET_ADDR(OP1);
GET_IMM16(OP2);
- WRMEM_W(*m_data, addr, imm16);
+ WRMEM_W(m_data, addr, imm16);
}
/******************************************
@@ -3487,8 +3487,8 @@ void z8002_device::Z4D_0000_0101_addr_imm16()
void z8002_device::Z4D_0000_0110_addr()
{
GET_ADDR(OP1);
- if (RDMEM_W(*m_data, addr) & S16) SET_S; else CLR_S;
- WRMEM_W(*m_data, addr, 0xffff);
+ if (RDMEM_W(m_data, addr) & S16) SET_S; else CLR_S;
+ WRMEM_W(m_data, addr, 0xffff);
}
/******************************************
@@ -3498,7 +3498,7 @@ void z8002_device::Z4D_0000_0110_addr()
void z8002_device::Z4D_0000_1000_addr()
{
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, 0);
+ WRMEM_W(m_data, addr, 0);
}
/******************************************
@@ -3510,7 +3510,7 @@ void z8002_device::Z4D_ddN0_0000_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, COMW(RDMEM_W(*m_data, addr)));
+ WRMEM_W(m_data, addr, COMW(RDMEM_W(m_data, addr)));
}
/******************************************
@@ -3523,7 +3523,7 @@ void z8002_device::Z4D_ddN0_0001_addr_imm16()
GET_ADDR(OP1);
GET_IMM16(OP2);
addr = addr_add(addr, RW(dst));
- CPW(RDMEM_W(*m_data, addr), imm16);
+ CPW(RDMEM_W(m_data, addr), imm16);
}
/******************************************
@@ -3535,7 +3535,7 @@ void z8002_device::Z4D_ddN0_0010_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, NEGW(RDMEM_W(*m_data, addr)));
+ WRMEM_W(m_data, addr, NEGW(RDMEM_W(m_data, addr)));
}
/******************************************
@@ -3547,7 +3547,7 @@ void z8002_device::Z4D_ddN0_0100_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- TESTW(RDMEM_W(*m_data, addr));
+ TESTW(RDMEM_W(m_data, addr));
}
/******************************************
@@ -3560,7 +3560,7 @@ void z8002_device::Z4D_ddN0_0101_addr_imm16()
GET_ADDR(OP1);
GET_IMM16(OP2);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, imm16);
+ WRMEM_W(m_data, addr, imm16);
}
/******************************************
@@ -3572,8 +3572,8 @@ void z8002_device::Z4D_ddN0_0110_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- if (RDMEM_W(*m_data, addr) & S16) SET_S; else CLR_S;
- WRMEM_W(*m_data, addr, 0xffff);
+ if (RDMEM_W(m_data, addr) & S16) SET_S; else CLR_S;
+ WRMEM_W(m_data, addr, 0xffff);
}
/******************************************
@@ -3585,7 +3585,7 @@ void z8002_device::Z4D_ddN0_1000_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, 0);
+ WRMEM_W(m_data, addr, 0);
}
/******************************************
@@ -3598,7 +3598,7 @@ void z8002_device::Z4E_ddN0_ssN0_addr()
GET_SRC(OP0,NIB3);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, RB(src));
+ WRMEM_B(m_data, addr, RB(src));
}
/******************************************
@@ -3609,7 +3609,7 @@ void z8002_device::Z50_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- CPL(RL(dst), RDMEM_L(*m_data, addr));
+ CPL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3622,7 +3622,7 @@ void z8002_device::Z50_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- CPL(RL(dst), RDMEM_L(*m_data, addr));
+ CPL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3633,7 +3633,7 @@ void z8002_device::Z51_ddN0_0000_addr()
{
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
- PUSHL(dst, RDMEM_L(*m_data, addr));
+ PUSHL(dst, RDMEM_L(m_data, addr));
}
/******************************************
@@ -3646,7 +3646,7 @@ void z8002_device::Z51_ddN0_ssN0_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- PUSHL(dst, RDMEM_L(*m_data, addr));
+ PUSHL(dst, RDMEM_L(m_data, addr));
}
/******************************************
@@ -3657,7 +3657,7 @@ void z8002_device::Z52_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RL(dst) = SUBL(RL(dst), RDMEM_L(*m_data, addr));
+ RL(dst) = SUBL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3670,7 +3670,7 @@ void z8002_device::Z52_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RL(dst) = SUBL(RL(dst), RDMEM_L(*m_data, addr));
+ RL(dst) = SUBL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3681,7 +3681,7 @@ void z8002_device::Z53_ddN0_0000_addr()
{
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
- PUSHW(dst, RDMEM_W(*m_data, addr));
+ PUSHW(dst, RDMEM_W(m_data, addr));
}
/******************************************
@@ -3694,7 +3694,7 @@ void z8002_device::Z53_ddN0_ssN0_addr()
GET_SRC(OP0,NIB3);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- PUSHW(dst, RDMEM_W(*m_data, addr));
+ PUSHW(dst, RDMEM_W(m_data, addr));
}
/******************************************
@@ -3705,7 +3705,7 @@ void z8002_device::Z54_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RL(dst) = RDMEM_L(*m_data, addr);
+ RL(dst) = RDMEM_L(m_data, addr);
}
/******************************************
@@ -3718,7 +3718,7 @@ void z8002_device::Z54_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RL(dst) = RDMEM_L(*m_data, addr);
+ RL(dst) = RDMEM_L(m_data, addr);
}
/******************************************
@@ -3729,7 +3729,7 @@ void z8002_device::Z55_ssN0_0000_addr()
{
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
- WRMEM_L(*m_data, addr, POPL(src));
+ WRMEM_L(m_data, addr, POPL(src));
}
/******************************************
@@ -3742,7 +3742,7 @@ void z8002_device::Z55_ssN0_ddN0_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_L(*m_data, addr, POPL(src));
+ WRMEM_L(m_data, addr, POPL(src));
}
/******************************************
@@ -3753,7 +3753,7 @@ void z8002_device::Z56_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RL(dst) = ADDL(RL(dst), RDMEM_L(*m_data, addr));
+ RL(dst) = ADDL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3766,7 +3766,7 @@ void z8002_device::Z56_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RL(dst) = ADDL(RL(dst), RDMEM_L(*m_data, addr));
+ RL(dst) = ADDL(RL(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3777,7 +3777,7 @@ void z8002_device::Z57_ssN0_0000_addr()
{
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, POPW(src));
+ WRMEM_W(m_data, addr, POPW(src));
}
/******************************************
@@ -3790,7 +3790,7 @@ void z8002_device::Z57_ssN0_ddN0_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, POPW(src));
+ WRMEM_W(m_data, addr, POPW(src));
}
/******************************************
@@ -3801,7 +3801,7 @@ void z8002_device::Z58_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RQ(dst) = MULTL(RQ(dst), RDMEM_L(*m_data, addr));
+ RQ(dst) = MULTL(RQ(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3814,7 +3814,7 @@ void z8002_device::Z58_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RQ(dst) = MULTL(RQ(dst), RDMEM_L(*m_data, addr));
+ RQ(dst) = MULTL(RQ(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3825,7 +3825,7 @@ void z8002_device::Z59_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RL(dst) = MULTW(RL(dst), RDMEM_W(*m_data, addr));
+ RL(dst) = MULTW(RL(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3838,7 +3838,7 @@ void z8002_device::Z59_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RL(dst) = MULTW(RL(dst), RDMEM_W(*m_data, addr));
+ RL(dst) = MULTW(RL(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3849,7 +3849,7 @@ void z8002_device::Z5A_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RQ(dst) = DIVL(RQ(dst), RDMEM_L(*m_data, addr));
+ RQ(dst) = DIVL(RQ(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3862,7 +3862,7 @@ void z8002_device::Z5A_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RQ(dst) = DIVL(RQ(dst), RDMEM_L(*m_data, addr));
+ RQ(dst) = DIVL(RQ(dst), RDMEM_L(m_data, addr));
}
/******************************************
@@ -3873,7 +3873,7 @@ void z8002_device::Z5B_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RL(dst) = DIVW(RL(dst), RDMEM_W(*m_data, addr));
+ RL(dst) = DIVW(RL(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3886,7 +3886,7 @@ void z8002_device::Z5B_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RL(dst) = DIVW(RL(dst), RDMEM_W(*m_data, addr));
+ RL(dst) = DIVW(RL(dst), RDMEM_W(m_data, addr));
}
/******************************************
@@ -3899,7 +3899,7 @@ void z8002_device::Z5C_0000_0001_0000_dddd_0000_nmin1_addr()
GET_CNT(OP1,NIB3);
GET_ADDR(OP2);
while (cnt-- >= 0) {
- RW(dst) = RDMEM_W(*m_data, addr);
+ RW(dst) = RDMEM_W(m_data, addr);
dst = (dst+1) & 15;
addr = addr_add (addr, 2);
}
@@ -3912,7 +3912,7 @@ void z8002_device::Z5C_0000_0001_0000_dddd_0000_nmin1_addr()
void z8002_device::Z5C_0000_1000_addr()
{
GET_ADDR(OP1);
- TESTL(RDMEM_L(*m_data, addr));
+ TESTL(RDMEM_L(m_data, addr));
}
/******************************************
@@ -3925,7 +3925,7 @@ void z8002_device::Z5C_0000_1001_0000_ssss_0000_nmin1_addr()
GET_CNT(OP1,NIB3);
GET_ADDR(OP2);
while (cnt-- >= 0) {
- WRMEM_W(*m_data, addr, RW(src));
+ WRMEM_W(m_data, addr, RW(src));
src = (src+1) & 15;
addr = addr_add (addr, 2);
}
@@ -3940,7 +3940,7 @@ void z8002_device::Z5C_ddN0_1000_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- TESTL(RDMEM_L(*m_data, addr));
+ TESTL(RDMEM_L(m_data, addr));
}
/******************************************
@@ -3955,7 +3955,7 @@ void z8002_device::Z5C_ddN0_1001_0000_ssN0_0000_nmin1_addr()
GET_ADDR(OP2);
addr = addr_add(addr, RW(dst));
while (cnt-- >= 0) {
- WRMEM_W(*m_data, addr, RW(src));
+ WRMEM_W(m_data, addr, RW(src));
src = (src+1) & 15;
addr = addr_add(addr, 2);
}
@@ -3973,7 +3973,7 @@ void z8002_device::Z5C_ssN0_0001_0000_dddd_0000_nmin1_addr()
GET_ADDR(OP2);
addr = addr_add(addr, RW(src));
while (cnt-- >= 0) {
- RW(dst) = RDMEM_W(*m_data, addr);
+ RW(dst) = RDMEM_W(m_data, addr);
dst = (dst+1) & 15;
addr = addr_add(addr, 2);
}
@@ -3987,7 +3987,7 @@ void z8002_device::Z5D_0000_ssss_addr()
{
GET_SRC(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_L(*m_data, addr, RL(src));
+ WRMEM_L(m_data, addr, RL(src));
}
/******************************************
@@ -4000,7 +4000,7 @@ void z8002_device::Z5D_ddN0_ssss_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_L(*m_data, addr, RL(src));
+ WRMEM_L(m_data, addr, RL(src));
}
/******************************************
@@ -4099,7 +4099,7 @@ void z8002_device::Z60_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RB(dst) = RDMEM_B(*m_data, addr);
+ RB(dst) = RDMEM_B(m_data, addr);
}
/******************************************
@@ -4112,7 +4112,7 @@ void z8002_device::Z60_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RB(dst) = RDMEM_B(*m_data, addr);
+ RB(dst) = RDMEM_B(m_data, addr);
}
/******************************************
@@ -4123,7 +4123,7 @@ void z8002_device::Z61_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- RW(dst) = RDMEM_W(*m_data, addr);
+ RW(dst) = RDMEM_W(m_data, addr);
}
/******************************************
@@ -4136,7 +4136,7 @@ void z8002_device::Z61_ssN0_dddd_addr()
GET_SRC(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(src));
- RW(dst) = RDMEM_W(*m_data, addr);
+ RW(dst) = RDMEM_W(m_data, addr);
}
/******************************************
@@ -4147,7 +4147,7 @@ void z8002_device::Z62_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) & ~bit);
+ WRMEM_B(m_data, addr, RDMEM_B(m_data, addr) & ~bit);
}
/******************************************
@@ -4160,7 +4160,7 @@ void z8002_device::Z62_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) & ~bit);
+ WRMEM_B(m_data, addr, RDMEM_B(m_data, addr) & ~bit);
}
/******************************************
@@ -4171,7 +4171,7 @@ void z8002_device::Z63_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) & ~bit);
+ WRMEM_W(m_data, addr, RDMEM_W(m_data, addr) & ~bit);
}
/******************************************
@@ -4184,7 +4184,7 @@ void z8002_device::Z63_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) & ~bit);
+ WRMEM_W(m_data, addr, RDMEM_W(m_data, addr) & ~bit);
}
/******************************************
@@ -4195,7 +4195,7 @@ void z8002_device::Z64_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) | bit);
+ WRMEM_B(m_data, addr, RDMEM_B(m_data, addr) | bit);
}
/******************************************
@@ -4208,7 +4208,7 @@ void z8002_device::Z64_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, RDMEM_B(*m_data, addr) | bit);
+ WRMEM_B(m_data, addr, RDMEM_B(m_data, addr) | bit);
}
/******************************************
@@ -4219,7 +4219,7 @@ void z8002_device::Z65_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) | bit);
+ WRMEM_W(m_data, addr, RDMEM_W(m_data, addr) | bit);
}
/******************************************
@@ -4232,7 +4232,7 @@ void z8002_device::Z65_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, RDMEM_W(*m_data, addr) | bit);
+ WRMEM_W(m_data, addr, RDMEM_W(m_data, addr) | bit);
}
/******************************************
@@ -4243,7 +4243,7 @@ void z8002_device::Z66_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- if (RDMEM_B(*m_data, addr) & bit) CLR_Z; else SET_Z;
+ if (RDMEM_B(m_data, addr) & bit) CLR_Z; else SET_Z;
}
/******************************************
@@ -4256,7 +4256,7 @@ void z8002_device::Z66_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- if (RDMEM_B(*m_data, addr) & bit) CLR_Z; else SET_Z;
+ if (RDMEM_B(m_data, addr) & bit) CLR_Z; else SET_Z;
}
/******************************************
@@ -4267,7 +4267,7 @@ void z8002_device::Z67_0000_imm4_addr()
{
GET_BIT(OP0);
GET_ADDR(OP1);
- if (RDMEM_W(*m_data, addr) & bit) CLR_Z; else SET_Z;
+ if (RDMEM_W(m_data, addr) & bit) CLR_Z; else SET_Z;
}
/******************************************
@@ -4280,7 +4280,7 @@ void z8002_device::Z67_ddN0_imm4_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- if (RDMEM_W(*m_data, addr) & bit) CLR_Z; else SET_Z;
+ if (RDMEM_W(m_data, addr) & bit) CLR_Z; else SET_Z;
}
/******************************************
@@ -4291,7 +4291,7 @@ void z8002_device::Z68_0000_imm4m1_addr()
{
GET_I4M1(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, INCB(RDMEM_B(*m_data, addr), i4p1));
+ WRMEM_B(m_data, addr, INCB(RDMEM_B(m_data, addr), i4p1));
}
/******************************************
@@ -4304,7 +4304,7 @@ void z8002_device::Z68_ddN0_imm4m1_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, INCB(RDMEM_B(*m_data, addr), i4p1));
+ WRMEM_B(m_data, addr, INCB(RDMEM_B(m_data, addr), i4p1));
}
/******************************************
@@ -4315,7 +4315,7 @@ void z8002_device::Z69_0000_imm4m1_addr()
{
GET_I4M1(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, INCW(RDMEM_W(*m_data, addr), i4p1));
+ WRMEM_W(m_data, addr, INCW(RDMEM_W(m_data, addr), i4p1));
}
/******************************************
@@ -4328,7 +4328,7 @@ void z8002_device::Z69_ddN0_imm4m1_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, INCW(RDMEM_W(*m_data, addr), i4p1));
+ WRMEM_W(m_data, addr, INCW(RDMEM_W(m_data, addr), i4p1));
}
/******************************************
@@ -4339,7 +4339,7 @@ void z8002_device::Z6A_0000_imm4m1_addr()
{
GET_I4M1(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, DECB(RDMEM_B(*m_data, addr), i4p1));
+ WRMEM_B(m_data, addr, DECB(RDMEM_B(m_data, addr), i4p1));
}
/******************************************
@@ -4352,7 +4352,7 @@ void z8002_device::Z6A_ddN0_imm4m1_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, DECB(RDMEM_B(*m_data, addr), i4p1));
+ WRMEM_B(m_data, addr, DECB(RDMEM_B(m_data, addr), i4p1));
}
/******************************************
@@ -4363,7 +4363,7 @@ void z8002_device::Z6B_0000_imm4m1_addr()
{
GET_I4M1(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, DECW(RDMEM_W(*m_data, addr), i4p1));
+ WRMEM_W(m_data, addr, DECW(RDMEM_W(m_data, addr), i4p1));
}
/******************************************
@@ -4376,7 +4376,7 @@ void z8002_device::Z6B_ddN0_imm4m1_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, DECW(RDMEM_W(*m_data, addr), i4p1));
+ WRMEM_W(m_data, addr, DECW(RDMEM_W(m_data, addr), i4p1));
}
/******************************************
@@ -4387,8 +4387,8 @@ void z8002_device::Z6C_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- uint8_t tmp = RDMEM_B(*m_data, addr);
- WRMEM_B(*m_data, addr, RB(dst));
+ uint8_t tmp = RDMEM_B(m_data, addr);
+ WRMEM_B(m_data, addr, RB(dst));
RB(dst) = tmp;
}
@@ -4403,8 +4403,8 @@ void z8002_device::Z6C_ssN0_dddd_addr()
GET_ADDR(OP1);
uint8_t tmp;
addr = addr_add(addr, RW(src));
- tmp = RDMEM_B(*m_data, addr);
- WRMEM_B(*m_data, addr, RB(dst));
+ tmp = RDMEM_B(m_data, addr);
+ WRMEM_B(m_data, addr, RB(dst));
RB(dst) = tmp;
}
@@ -4416,8 +4416,8 @@ void z8002_device::Z6D_0000_dddd_addr()
{
GET_DST(OP0,NIB3);
GET_ADDR(OP1);
- uint16_t tmp = RDMEM_W(*m_data, addr);
- WRMEM_W(*m_data, addr, RW(dst));
+ uint16_t tmp = RDMEM_W(m_data, addr);
+ WRMEM_W(m_data, addr, RW(dst));
RW(dst) = tmp;
}
@@ -4432,8 +4432,8 @@ void z8002_device::Z6D_ssN0_dddd_addr()
GET_ADDR(OP1);
uint16_t tmp;
addr = addr_add(addr, RW(src));
- tmp = RDMEM_W(*m_data, addr);
- WRMEM_W(*m_data, addr, RW(dst));
+ tmp = RDMEM_W(m_data, addr);
+ WRMEM_W(m_data, addr, RW(dst));
RW(dst) = tmp;
}
@@ -4445,7 +4445,7 @@ void z8002_device::Z6E_0000_ssss_addr()
{
GET_SRC(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_B(*m_data, addr, RB(src));
+ WRMEM_B(m_data, addr, RB(src));
}
/******************************************
@@ -4458,7 +4458,7 @@ void z8002_device::Z6E_ddN0_ssss_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_B(*m_data, addr, RB(src));
+ WRMEM_B(m_data, addr, RB(src));
}
/******************************************
@@ -4469,7 +4469,7 @@ void z8002_device::Z6F_0000_ssss_addr()
{
GET_SRC(OP0,NIB3);
GET_ADDR(OP1);
- WRMEM_W(*m_data, addr, RW(src));
+ WRMEM_W(m_data, addr, RW(src));
}
/******************************************
@@ -4482,7 +4482,7 @@ void z8002_device::Z6F_ddN0_ssss_addr()
GET_DST(OP0,NIB2);
GET_ADDR(OP1);
addr = addr_add(addr, RW(dst));
- WRMEM_W(*m_data, addr, RW(src));
+ WRMEM_W(m_data, addr, RW(src));
}
/******************************************
@@ -4634,12 +4634,12 @@ void z8002_device::Z79_0000_0000_addr()
GET_ADDR(OP1);
uint16_t fcw;
if (get_segmented_mode()) {
- fcw = RDMEM_W(*m_data, addr + 2);
- set_pc(segmented_addr(RDMEM_L(*m_data, addr + 4)));
+ fcw = RDMEM_W(m_data, addr + 2);
+ set_pc(segmented_addr(RDMEM_L(m_data, addr + 4)));
}
else {
- fcw = RDMEM_W(*m_data, addr);
- set_pc(RDMEM_W(*m_data, (uint16_t)(addr + 2)));
+ fcw = RDMEM_W(m_data, addr);
+ set_pc(RDMEM_W(m_data, (uint16_t)(addr + 2)));
}
CHANGE_FCW(fcw); /* check for user/system mode change */
}
@@ -4656,12 +4656,12 @@ void z8002_device::Z79_ssN0_0000_addr()
uint16_t fcw;
addr = addr_add(addr, RW(src));
if (get_segmented_mode()) {
- fcw = RDMEM_W(*m_data, addr + 2);
- set_pc(segmented_addr(RDMEM_L(*m_data, addr + 4)));
+ fcw = RDMEM_W(m_data, addr + 2);
+ set_pc(segmented_addr(RDMEM_L(m_data, addr + 4)));
}
else {
- fcw = RDMEM_W(*m_data, addr);
- m_pc = RDMEM_W(*m_data, (uint16_t)(addr + 2));
+ fcw = RDMEM_W(m_data, addr);
+ m_pc = RDMEM_W(m_data, (uint16_t)(addr + 2));
}
if ((fcw ^ m_fcw) & F_SEG) printf("ldps 3 (0x%05x): changing from %ssegmented mode to %ssegmented mode\n", m_pc, (fcw & F_SEG) ? "non-" : "", (fcw & F_SEG) ? "" : "non-");
CHANGE_FCW(fcw); /* check for user/system mode change */
@@ -6064,7 +6064,7 @@ void z8002_device::ZB8_ddN0_0000_0000_rrrr_ssN0_0000()
GET_DST(OP0,NIB2);
GET_SRC(OP1,NIB2);
GET_CNT(OP1,NIB1);
- address_space &dstspace = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &dstspace = dst == SP ? m_stack : m_data;
uint32_t dstaddr = addr_from_reg(dst);
uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr));
WRMEM_B(dstspace, dstaddr, xlt);
@@ -6082,7 +6082,7 @@ void z8002_device::ZB8_ddN0_0100_0000_rrrr_ssN0_0000()
GET_DST(OP0,NIB2);
GET_SRC(OP1,NIB2);
GET_CNT(OP1,NIB1);
- address_space &dstspace = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &dstspace = dst == SP ? m_stack : m_data;
uint32_t dstaddr = addr_from_reg(dst);
uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr));
WRMEM_B(dstspace, dstaddr, xlt);
@@ -6100,7 +6100,7 @@ void z8002_device::ZB8_ddN0_1000_0000_rrrr_ssN0_0000()
GET_DST(OP0,NIB2);
GET_SRC(OP1,NIB2);
GET_CNT(OP1,NIB1);
- address_space &dstspace = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &dstspace = dst == SP ? m_stack : m_data;
uint32_t dstaddr = addr_from_reg(dst);
uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr));
WRMEM_B(dstspace, dstaddr, xlt);
@@ -6118,7 +6118,7 @@ void z8002_device::ZB8_ddN0_1100_0000_rrrr_ssN0_0000()
GET_DST(OP0,NIB2);
GET_SRC(OP1,NIB2);
GET_CNT(OP1,NIB1);
- address_space &dstspace = dst == SP ? *m_stack : *m_data;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::specific &dstspace = dst == SP ? m_stack : m_data;
uint32_t dstaddr = addr_from_reg(dst);
uint8_t xlt = RDBX_B(src, RDMEM_B(dstspace, dstaddr));
WRMEM_B(dstspace, dstaddr, xlt);
diff --git a/src/devices/machine/68307.cpp b/src/devices/machine/68307.cpp
index 70992f45b07..7419b58937c 100644
--- a/src/devices/machine/68307.cpp
+++ b/src/devices/machine/68307.cpp
@@ -130,15 +130,16 @@ inline int m68307_cpu_device::calc_cs(offs_t address) const
void m68307_cpu_device::init16_m68307(address_space &space)
{
m_space = &space;
- auto cache = space.cache<1, 0, ENDIANNESS_BIG>();
-
- m_readimm16 = [cache](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return cache->read_word(address); };
- m_read8 = [this](offs_t address) -> u8 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_byte(address); };
- m_read16 = [this](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_word(address); };
- m_read32 = [this](offs_t address) -> u32 { /* m_m68307_currentcs = calc_cs(address); */ return m_space->read_dword(address); };
- m_write8 = [this](offs_t address, u8 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_byte(address, data); };
- m_write16 = [this](offs_t address, u16 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_word(address, data); };
- m_write32 = [this](offs_t address, u32 data) { /* m_m68307_currentcs = calc_cs(address); */ m_space->write_dword(address, data); };
+ space.cache(m_oprogram16);
+ space.specific(m_program16);
+
+ m_readimm16 = [this](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return m_oprogram16.read_word(address); };
+ m_read8 = [this](offs_t address) -> u8 { /* m_m68307_currentcs = calc_cs(address); */ return m_program16.read_byte(address); };
+ m_read16 = [this](offs_t address) -> u16 { /* m_m68307_currentcs = calc_cs(address); */ return m_program16.read_word(address); };
+ m_read32 = [this](offs_t address) -> u32 { /* m_m68307_currentcs = calc_cs(address); */ return m_program16.read_dword(address); };
+ m_write8 = [this](offs_t address, u8 data) { /* m_m68307_currentcs = calc_cs(address); */ m_program16.write_byte(address, data); };
+ m_write16 = [this](offs_t address, u16 data) { /* m_m68307_currentcs = calc_cs(address); */ m_program16.write_word(address, data); };
+ m_write32 = [this](offs_t address, u32 data) { /* m_m68307_currentcs = calc_cs(address); */ m_program16.write_dword(address, data); };
}
diff --git a/src/devices/machine/mc68328.cpp b/src/devices/machine/mc68328.cpp
index 4b9e9a8b97e..3df500d2f0c 100644
--- a/src/devices/machine/mc68328.cpp
+++ b/src/devices/machine/mc68328.cpp
@@ -3043,7 +3043,6 @@ uint16_t mc68328_device::internal_read(offs_t offset, uint16_t mem_mask)
/* THIS IS PRETTY MUCH TOTALLY WRONG AND DOESN'T REFLECT THE MC68328'S INTERNAL FUNCTIONALITY AT ALL! */
uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
- auto mcache = space(AS_PROGRAM).cache<1, 0, ENDIANNESS_BIG>();
uint32_t vram_addr = m_regs.lssa & 0x00fffffe;
uint16_t word;
uint16_t *line;
@@ -3057,7 +3056,7 @@ uint32_t mc68328_device::screen_update(screen_device &screen, bitmap_ind16 &bitm
for (x = 0; x < 160; x += 16, vram_addr += 2)
{
- word = mcache->read_word(vram_addr);
+ word = space(AS_PROGRAM).read_word(vram_addr);
for (b = 0; b < 16; b++)
{
line[x + b] = (word >> (15 - b)) & 0x0001;
diff --git a/src/devices/machine/ripple_counter.cpp b/src/devices/machine/ripple_counter.cpp
index ec0808181ff..96ce53aeec6 100644
--- a/src/devices/machine/ripple_counter.cpp
+++ b/src/devices/machine/ripple_counter.cpp
@@ -35,7 +35,7 @@ DEFINE_DEVICE_TYPE(RIPPLE_COUNTER, ripple_counter_device, "ripple_counter", "Gen
ripple_counter_device::ripple_counter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, RIPPLE_COUNTER, tag, owner, clock),
- device_rom_interface(mconfig, *this, 0, ENDIANNESS_LITTLE, 8),
+ device_rom_interface(mconfig, *this),
m_count_out_cb(*this),
m_rom_out_cb(*this),
m_count_timer(nullptr),
diff --git a/src/devices/machine/ripple_counter.h b/src/devices/machine/ripple_counter.h
index 5a4ad3e1295..450dc2118bb 100644
--- a/src/devices/machine/ripple_counter.h
+++ b/src/devices/machine/ripple_counter.h
@@ -11,20 +11,22 @@
#pragma once
+#include "dirom.h"
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
// ======================> ripple_counter_device
-class ripple_counter_device : public device_t, public device_rom_interface
+class ripple_counter_device : public device_t, public device_rom_interface<14>
{
public:
// construction/destruction
ripple_counter_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
// configuration
- void set_stages(u8 stages) { m_count_mask = (1U << stages) - 1; set_rom_addr_width(stages); }
+ void set_stages(u8 stages) { m_count_mask = (1U << stages) - 1; override_address_width(stages); }
auto count_out_cb() { return m_count_out_cb.bind(); }
auto rom_out_cb() { return m_rom_out_cb.bind(); }
diff --git a/src/devices/machine/s3c2400.h b/src/devices/machine/s3c2400.h
index 8ffff4968ff..6c5bdf4d40f 100644
--- a/src/devices/machine/s3c2400.h
+++ b/src/devices/machine/s3c2400.h
@@ -454,8 +454,7 @@ private:
required_device<arm7_cpu_device> m_cpu;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
-
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
memcon_t m_memcon;
usbhost_t m_usbhost;
diff --git a/src/devices/machine/s3c2410.h b/src/devices/machine/s3c2410.h
index dd87eba239f..9c270d5802f 100644
--- a/src/devices/machine/s3c2410.h
+++ b/src/devices/machine/s3c2410.h
@@ -562,8 +562,7 @@ private:
required_device<arm7_cpu_device> m_cpu;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
-
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
uint8_t m_steppingstone[4*1024];
memcon_t m_memcon;
diff --git a/src/devices/machine/s3c2440.h b/src/devices/machine/s3c2440.h
index 40a92776c3f..9c3cfa9c337 100644
--- a/src/devices/machine/s3c2440.h
+++ b/src/devices/machine/s3c2440.h
@@ -607,8 +607,7 @@ private:
required_device<arm7_cpu_device> m_cpu;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
-
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<24, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
uint8_t m_steppingstone[4*1024];
memcon_t m_memcon;
diff --git a/src/devices/machine/s3c24xx.hxx b/src/devices/machine/s3c24xx.hxx
index 603ee085b1b..707daa62318 100644
--- a/src/devices/machine/s3c24xx.hxx
+++ b/src/devices/machine/s3c24xx.hxx
@@ -292,8 +292,8 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
uint8_t data[4];
for (int i = 0; i < 2; i++)
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur + 0);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur + 1);
m_lcd.vramaddr_cur += 2;
m_lcd.pagewidth_cur++;
if (m_lcd.pagewidth_cur >= m_lcd.pagewidth_max)
@@ -338,39 +338,39 @@ uint32_t S3C24_CLASS_NAME::s3c24xx_lcd_dma_read()
{
if ((m_lcd.vramaddr_cur & 2) == 0)
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur + 3);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur + 2);
}
else
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur - 1);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur - 2);
}
}
else
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur + 0);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur + 1);
}
}
else
{
if (m_lcd.bswp == 0)
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur + 1);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur + 0);
}
else
{
if ((m_lcd.vramaddr_cur & 2) == 0)
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur + 2);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur + 3);
}
else
{
- data[i*2+0] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
- data[i*2+1] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
+ data[i*2+0] = m_cache.read_byte(m_lcd.vramaddr_cur - 2);
+ data[i*2+1] = m_cache.read_byte(m_lcd.vramaddr_cur - 1);
}
}
}
@@ -744,7 +744,7 @@ void S3C24_CLASS_NAME::s3c24xx_video_start()
m_lcd.bitmap[0] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height());
m_lcd.bitmap[1] = std::make_unique<bitmap_rgb32>(m_screen->width(), m_screen->height());
- m_cache = m_cpu->space(AS_PROGRAM).cache<2, 0, ENDIANNESS_LITTLE>();
+ m_cpu->space(AS_PROGRAM).cache(m_cache);
}
void S3C24_CLASS_NAME::bitmap_blend( bitmap_rgb32 &bitmap_dst, bitmap_rgb32 &bitmap_src_1, bitmap_rgb32 &bitmap_src_2)
diff --git a/src/devices/machine/s3c44b0.cpp b/src/devices/machine/s3c44b0.cpp
index 8478f54bc58..009b400210e 100644
--- a/src/devices/machine/s3c44b0.cpp
+++ b/src/devices/machine/s3c44b0.cpp
@@ -264,7 +264,7 @@ void s3c44b0_device::device_start()
m_data_r_cb.resolve_safe(0);
m_data_w_cb.resolve();
- m_cache = m_cpu->space(AS_PROGRAM).cache<2, 0, ENDIANNESS_LITTLE>();
+ m_cpu->space(AS_PROGRAM).cache(m_cache);
for (int i = 0; i < 6; i++) m_pwm.timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::pwm_timer_exp),this));
for (auto & elem : m_uart) elem.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(s3c44b0_device::uart_timer_exp),this));
@@ -543,19 +543,19 @@ void s3c44b0_device::lcd_dma_read(int count, uint8_t *data)
{
if ((m_lcd.vramaddr_cur & 2) == 0)
{
- data[0] = m_cache->read_byte(m_lcd.vramaddr_cur + 3);
- data[1] = m_cache->read_byte(m_lcd.vramaddr_cur + 2);
+ data[0] = m_cache.read_byte(m_lcd.vramaddr_cur + 3);
+ data[1] = m_cache.read_byte(m_lcd.vramaddr_cur + 2);
}
else
{
- data[0] = m_cache->read_byte(m_lcd.vramaddr_cur - 1);
- data[1] = m_cache->read_byte(m_lcd.vramaddr_cur - 2);
+ data[0] = m_cache.read_byte(m_lcd.vramaddr_cur - 1);
+ data[1] = m_cache.read_byte(m_lcd.vramaddr_cur - 2);
}
}
else
{
- data[0] = m_cache->read_byte(m_lcd.vramaddr_cur + 0);
- data[1] = m_cache->read_byte(m_lcd.vramaddr_cur + 1);
+ data[0] = m_cache.read_byte(m_lcd.vramaddr_cur + 0);
+ data[1] = m_cache.read_byte(m_lcd.vramaddr_cur + 1);
}
m_lcd.vramaddr_cur += 2;
m_lcd.pagewidth_cur++;
diff --git a/src/devices/machine/s3c44b0.h b/src/devices/machine/s3c44b0.h
index bebddc710ac..89dfa020920 100644
--- a/src/devices/machine/s3c44b0.h
+++ b/src/devices/machine/s3c44b0.h
@@ -600,7 +600,7 @@ private:
devcb_read32 m_data_r_cb;
devcb_write16 m_data_w_cb;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_cache;
};
DECLARE_DEVICE_TYPE(S3C44B0, s3c44b0_device)
diff --git a/src/devices/machine/s_smp.cpp b/src/devices/machine/s_smp.cpp
index d71b0449f65..fb4396b68d5 100644
--- a/src/devices/machine/s_smp.cpp
+++ b/src/devices/machine/s_smp.cpp
@@ -86,9 +86,8 @@ void s_smp_device::device_start()
m_dsp_io_r_cb.resolve_safe(0);
m_dsp_io_w_cb.resolve_safe();
- m_data = &space(AS_DATA);
- // Find our direct access
- m_dcache = m_data->cache<0, 0, ENDIANNESS_LITTLE>();
+ space(AS_DATA).specific(m_data);
+ space(AS_DATA).cache(m_dcache);
m_tick_timer = timer_alloc(TIMER_TICK_ID);
diff --git a/src/devices/machine/s_smp.h b/src/devices/machine/s_smp.h
index 5fe04b1880a..9fd0232329c 100644
--- a/src/devices/machine/s_smp.h
+++ b/src/devices/machine/s_smp.h
@@ -39,17 +39,17 @@ protected:
address_space_config m_data_config;
private:
- address_space *m_data;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_dcache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_dcache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
inline u8 data_read_byte(offs_t a)
{
/* IPL ROM enabled */
if (a >= 0xffc0 && m_ctrl & 0x80)
return m_ipl_region[a & 0x3f];
- return m_dcache->read_byte(a);
+ return m_dcache.read_byte(a);
}
- inline void data_write_byte(offs_t a, u8 d) { m_data->write_byte(a, d); }
+ inline void data_write_byte(offs_t a, u8 d) { m_data.write_byte(a, d); }
required_region_ptr<u8> m_ipl_region; /* SPC top 64 bytes */
diff --git a/src/devices/sound/2608intf.cpp b/src/devices/sound/2608intf.cpp
index e6f24c7fef0..1bc634d34c2 100644
--- a/src/devices/sound/2608intf.cpp
+++ b/src/devices/sound/2608intf.cpp
@@ -156,7 +156,7 @@ DEFINE_DEVICE_TYPE(YM2608, ym2608_device, "ym2608", "YM2608 OPNA")
ym2608_device::ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: ay8910_device(mconfig, YM2608, tag, owner, clock, PSG_TYPE_YM, 1, 2)
- , device_rom_interface(mconfig, *this, 21)
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
, m_timer{ nullptr, nullptr }
, m_chip(nullptr)
diff --git a/src/devices/sound/2608intf.h b/src/devices/sound/2608intf.h
index b9b34f9cfd8..97e488805c4 100644
--- a/src/devices/sound/2608intf.h
+++ b/src/devices/sound/2608intf.h
@@ -5,6 +5,7 @@
#pragma once
+#include "dirom.h"
#include "ay8910.h"
@@ -12,7 +13,7 @@ struct ssg_callbacks;
class ym2608_device : public ay8910_device,
- public device_rom_interface
+ public device_rom_interface<21>
{
public:
ym2608_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/8950intf.cpp b/src/devices/sound/8950intf.cpp
index af981b756be..3907daa4700 100644
--- a/src/devices/sound/8950intf.cpp
+++ b/src/devices/sound/8950intf.cpp
@@ -160,7 +160,7 @@ DEFINE_DEVICE_TYPE(Y8950, y8950_device, "y8950", "Y8950 MSX-Audio")
y8950_device::y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, Y8950, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 21)
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
, m_timer{ nullptr, nullptr }
, m_chip(nullptr)
diff --git a/src/devices/sound/8950intf.h b/src/devices/sound/8950intf.h
index ac4584626e4..221c02bfb20 100644
--- a/src/devices/sound/8950intf.h
+++ b/src/devices/sound/8950intf.h
@@ -5,10 +5,11 @@
#pragma once
+#include "dirom.h"
class y8950_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<21>
{
public:
y8950_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp
index 7143a116490..f3ce7c337e0 100644
--- a/src/devices/sound/aica.cpp
+++ b/src/devices/sound/aica.cpp
@@ -435,8 +435,8 @@ void aica_device::Init()
m_MidiR = m_MidiW = 0;
m_MidiOutR = m_MidiOutW = 0;
- m_DSP.space = m_data;
- m_DSP.cache = m_cache;
+ space().specific(m_DSP.space);
+ space().cache(m_DSP.cache);
m_timerA = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerA_cb), this));
m_timerB = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerB_cb), this));
m_timerC = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aica_device::timerC_cb), this));
@@ -1112,8 +1112,8 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot)
if (PCMS(slot) == 1) // 8-bit signed
{
- s8 p1 = m_cache->read_byte(SA(slot) + addr1);
- s8 p2 = m_cache->read_byte(SA(slot) + addr2);
+ s8 p1 = m_cache.read_byte(SA(slot) + addr1);
+ s8 p2 = m_cache.read_byte(SA(slot) + addr2);
s32 s;
s32 fpart=slot->cur_addr & ((1 << SHIFT) - 1);
s = (int)(p1 << 8) * ((1 << SHIFT) - fpart) + (int)(p2 << 8) * fpart;
@@ -1121,8 +1121,8 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot)
}
else if (PCMS(slot) == 0) //16 bit signed
{
- s16 p1 = m_cache->read_word(SA(slot) + addr1);
- s16 p2 = m_cache->read_word(SA(slot) + addr2);
+ s16 p1 = m_cache.read_word(SA(slot) + addr1);
+ s16 p2 = m_cache.read_word(SA(slot) + addr2);
s32 s;
s32 fpart = slot->cur_addr & ((1 << SHIFT) - 1);
s = (int)(p1) * ((1 << SHIFT) - fpart) + (int)(p2) * fpart;
@@ -1142,7 +1142,7 @@ s32 aica_device::UpdateSlot(AICA_SLOT *slot)
while (curstep < steps_to_go)
{
int shift1 = 4 & (curstep << 2);
- u8 delta1 = (m_cache->read_byte(base) >> shift1) & 0xf;
+ u8 delta1 = (m_cache.read_byte(base) >> shift1) & 0xf;
DecodeADPCM(&(slot->cur_sample), delta1, &(slot->cur_quant));
if (!(++curstep & 1))
base++;
@@ -1329,7 +1329,7 @@ void aica_device::exec_dma()
{
for (i = 0; i < m_dma.dlg; i+=2)
{
- m_data->write_word(m_dma.dmea, 0);
+ m_data.write_word(m_dma.dmea, 0);
m_dma.dmea += 2;
}
}
@@ -1339,7 +1339,7 @@ void aica_device::exec_dma()
{
u16 tmp;
tmp = r16(m_dma.drga);
- m_data->write_word(m_dma.dmea, tmp);
+ m_data.write_word(m_dma.dmea, tmp);
m_dma.dmea += 4;
m_dma.drga += 4;
}
@@ -1359,7 +1359,7 @@ void aica_device::exec_dma()
{
for (i = 0; i < m_dma.dlg; i+=2)
{
- u16 tmp = m_cache->read_word(m_dma.dmea);
+ u16 tmp = m_cache.read_word(m_dma.dmea);
w16(m_dma.drga, tmp);
m_dma.dmea += 4;
m_dma.drga += 4;
@@ -1408,9 +1408,8 @@ void aica_device::sound_stream_update(sound_stream &stream, stream_sample_t **in
void aica_device::device_start()
{
- m_data = &space(0);
- // Find our direct access
- m_cache = space().cache<1, 0, ENDIANNESS_LITTLE>();
+ space().specific(m_data);
+ space().cache(m_cache);
// init the emulation
Init();
diff --git a/src/devices/sound/aica.h b/src/devices/sound/aica.h
index 0f2c33d4355..7c5597b5aa6 100644
--- a/src/devices/sound/aica.h
+++ b/src/devices/sound/aica.h
@@ -147,8 +147,8 @@ private:
u16 m_EFSPAN[0x48];
AICA_SLOT m_Slots[64];
- address_space *m_data;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::specific m_data;
sound_stream * m_stream;
u32 m_IrqTimA;
diff --git a/src/devices/sound/aicadsp.cpp b/src/devices/sound/aicadsp.cpp
index 4ff8f6fa7d2..20faff8e5b8 100644
--- a/src/devices/sound/aicadsp.cpp
+++ b/src/devices/sound/aicadsp.cpp
@@ -273,21 +273,21 @@ void AICADSP::step()
ADDR &= 0xFFFF;
//ADDR <<= 1;
//ADDR += RBP << 13;
- //MEMVAL = space->read_word(ADDR >> 1);
+ //MEMVAL = space.read_word(ADDR >> 1);
ADDR += RBP << 10;
if (MRD && (step & 1)) //memory only allowed on odd? DoA inserts NOPs on even
{
if (NOFL)
- MEMVAL = cache->read_word(ADDR) << 8;
+ MEMVAL = cache.read_word(ADDR) << 8;
else
- MEMVAL = UNPACK(cache->read_word(ADDR));
+ MEMVAL = UNPACK(cache.read_word(ADDR));
}
if (MWT && (step&1))
{
if (NOFL)
- space->write_word(ADDR, SHIFTED>>8);
+ space.write_word(ADDR, SHIFTED>>8);
else
- space->write_word(ADDR, PACK(SHIFTED));
+ space.write_word(ADDR, PACK(SHIFTED));
}
}
diff --git a/src/devices/sound/aicadsp.h b/src/devices/sound/aicadsp.h
index 5820970e020..b7b38a27d03 100644
--- a/src/devices/sound/aicadsp.h
+++ b/src/devices/sound/aicadsp.h
@@ -14,8 +14,8 @@ struct AICADSP
void start();
//Config
- address_space *space;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *cache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache cache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::specific space;
u32 RBP; //Ring buf pointer
u32 RBL; //Delay ram (Ring buffer) size in words
diff --git a/src/devices/sound/bsmt2000.cpp b/src/devices/sound/bsmt2000.cpp
index 9b5610fac5c..e316e370ee0 100644
--- a/src/devices/sound/bsmt2000.cpp
+++ b/src/devices/sound/bsmt2000.cpp
@@ -64,7 +64,7 @@ ROM_END
bsmt2000_device::bsmt2000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, BSMT2000, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 32)
+ , device_rom_interface(mconfig, *this)
, m_ready_callback(*this)
, m_stream(nullptr)
, m_cpu(*this, "bsmt2000")
diff --git a/src/devices/sound/bsmt2000.h b/src/devices/sound/bsmt2000.h
index 361d270b282..7e91afa06aa 100644
--- a/src/devices/sound/bsmt2000.h
+++ b/src/devices/sound/bsmt2000.h
@@ -14,6 +14,7 @@
#pragma once
#include "cpu/tms32010/tms32010.h"
+#include "dirom.h"
//**************************************************************************
@@ -25,7 +26,7 @@
class bsmt2000_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<32>
{
public:
typedef device_delegate<void ()> ready_callback;
diff --git a/src/devices/sound/c140.cpp b/src/devices/sound/c140.cpp
index 7b0b13b9cb4..37573b2b530 100644
--- a/src/devices/sound/c140.cpp
+++ b/src/devices/sound/c140.cpp
@@ -95,7 +95,7 @@ c140_device::c140_device(const machine_config &mconfig, const char *tag, device_
c140_device::c140_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 25, ENDIANNESS_BIG, 16) // Verified from schematics (24 bit address, 12(16? for C219) bit data)
+ , device_rom_interface(mconfig, *this)
, m_int1_callback(*this)
, m_sample_rate(0)
, m_stream(nullptr)
diff --git a/src/devices/sound/c140.h b/src/devices/sound/c140.h
index 1d3279730ee..6f645a06d9e 100644
--- a/src/devices/sound/c140.h
+++ b/src/devices/sound/c140.h
@@ -7,6 +7,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -14,10 +15,11 @@
// ======================> c140_device
+ // Verified from schematics (24 bit address, 12(16? for C219) bit data)
class c140_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<25, 1, 0, ENDIANNESS_BIG>
{
public:
c140_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/c352.cpp b/src/devices/sound/c352.cpp
index 73fe655522d..91cc2ba6671 100644
--- a/src/devices/sound/c352.cpp
+++ b/src/devices/sound/c352.cpp
@@ -44,7 +44,7 @@ DEFINE_DEVICE_TYPE(C352, c352_device, "c352", "Namco C352")
c352_device::c352_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, C352, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 24)
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
{
}
diff --git a/src/devices/sound/c352.h b/src/devices/sound/c352.h
index e5cc155dae5..c00aa667b05 100644
--- a/src/devices/sound/c352.h
+++ b/src/devices/sound/c352.h
@@ -5,6 +5,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -14,7 +15,7 @@
class c352_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<24>
{
public:
// construction/destruction
diff --git a/src/devices/sound/es5503.cpp b/src/devices/sound/es5503.cpp
index bdabc86a2de..fccc2f3a6e4 100644
--- a/src/devices/sound/es5503.cpp
+++ b/src/devices/sound/es5503.cpp
@@ -55,7 +55,7 @@ static constexpr int resshifts[8] = { 9, 10, 11, 12, 13, 14, 15, 16 };
es5503_device::es5503_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ES5503, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 17),
+ device_rom_interface(mconfig, *this),
m_irq_func(*this),
m_adc_func(*this)
{
diff --git a/src/devices/sound/es5503.h b/src/devices/sound/es5503.h
index 0fdfcd45786..18305d500bb 100644
--- a/src/devices/sound/es5503.h
+++ b/src/devices/sound/es5503.h
@@ -5,11 +5,13 @@
#pragma once
+#include "dirom.h"
+
// ======================> es5503_device
class es5503_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<17>
{
public:
// construction/destruction
diff --git a/src/devices/sound/es8712.cpp b/src/devices/sound/es8712.cpp
index f927f942bd0..7efb7647be4 100644
--- a/src/devices/sound/es8712.cpp
+++ b/src/devices/sound/es8712.cpp
@@ -39,7 +39,7 @@ DEFINE_DEVICE_TYPE(ES8712, es8712_device, "es8712", "Excellent Systems ES8712 So
es8712_device::es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, ES8712, tag, owner, clock)
- , device_rom_interface(mconfig, *this, 20) // TODO : 20 address bits?
+ , device_rom_interface(mconfig, *this)
, m_adpcm_select(*this, "adpcm_select")
, m_msm(*this, finder_base::DUMMY_TAG)
, m_reset_handler(*this)
diff --git a/src/devices/sound/es8712.h b/src/devices/sound/es8712.h
index aa87135426d..02a51a23c16 100644
--- a/src/devices/sound/es8712.h
+++ b/src/devices/sound/es8712.h
@@ -9,6 +9,7 @@
#include "machine/74157.h"
#include "sound/msm5205.h"
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -17,7 +18,7 @@
// ======================> es8712_device
-class es8712_device : public device_t, public device_rom_interface
+class es8712_device : public device_t, public device_rom_interface<20> // TODO : 20 address bits?
{
public:
es8712_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/gaelco.cpp b/src/devices/sound/gaelco.cpp
index af34c9ee80f..f340c5dfa4d 100644
--- a/src/devices/sound/gaelco.cpp
+++ b/src/devices/sound/gaelco.cpp
@@ -64,7 +64,7 @@ gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, const char
gaelco_gae1_device::gaelco_gae1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 27) // Unknown address bits
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
{
}
diff --git a/src/devices/sound/gaelco.h b/src/devices/sound/gaelco.h
index 5d26292d086..f10cf4446e2 100644
--- a/src/devices/sound/gaelco.h
+++ b/src/devices/sound/gaelco.h
@@ -5,6 +5,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -12,9 +13,11 @@
// ======================> gaelco_gae1_device
+#include "dirom.h"
+
class gaelco_gae1_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<27> // Unknown address bits
{
public:
gaelco_gae1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
diff --git a/src/devices/sound/iremga20.cpp b/src/devices/sound/iremga20.cpp
index be8b00e85c2..041ec44241e 100644
--- a/src/devices/sound/iremga20.cpp
+++ b/src/devices/sound/iremga20.cpp
@@ -61,7 +61,7 @@ DEFINE_DEVICE_TYPE(IREMGA20, iremga20_device, "iremga20", "Irem GA20")
iremga20_device::iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, IREMGA20, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 20),
+ device_rom_interface(mconfig, *this),
m_stream(nullptr)
{
}
diff --git a/src/devices/sound/iremga20.h b/src/devices/sound/iremga20.h
index 61a37d40f8c..dfe5040f65e 100644
--- a/src/devices/sound/iremga20.h
+++ b/src/devices/sound/iremga20.h
@@ -10,6 +10,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -20,7 +21,7 @@
class iremga20_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<20>
{
public:
iremga20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp
index 82bca0fe3f9..116b1aec9b1 100644
--- a/src/devices/sound/k053260.cpp
+++ b/src/devices/sound/k053260.cpp
@@ -94,7 +94,7 @@ const int k053260_device::pan_mul[8][2] = {
k053260_device::k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, K053260, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 21)
+ , device_rom_interface(mconfig, *this)
, m_sh1_cb(*this)
, m_sh2_cb(*this)
, m_stream(nullptr)
diff --git a/src/devices/sound/k053260.h b/src/devices/sound/k053260.h
index aacff441281..e556e23a7a6 100644
--- a/src/devices/sound/k053260.h
+++ b/src/devices/sound/k053260.h
@@ -11,6 +11,8 @@
#pragma once
+#include "dirom.h"
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -18,8 +20,8 @@
// ======================> k053260_device
class k053260_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<21>
{
public:
k053260_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/sound/k054539.cpp b/src/devices/sound/k054539.cpp
index b824650544d..6178afa7af7 100644
--- a/src/devices/sound/k054539.cpp
+++ b/src/devices/sound/k054539.cpp
@@ -21,7 +21,7 @@ DEFINE_DEVICE_TYPE(K054539, k054539_device, "k054539", "K054539 ADPCM")
k054539_device::k054539_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, K054539, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 24)
+ , device_rom_interface(mconfig, *this)
, flags(0)
, ram(nullptr)
, reverb_pos(0)
diff --git a/src/devices/sound/k054539.h b/src/devices/sound/k054539.h
index 65a551b1c4b..b2732b8cad3 100644
--- a/src/devices/sound/k054539.h
+++ b/src/devices/sound/k054539.h
@@ -11,11 +11,13 @@
#pragma once
+#include "dirom.h"
+
#define K054539_CB_MEMBER(_name) void _name(double left, double right)
class k054539_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<24>
{
public:
// control flags, may be set at DRIVER_INIT().
diff --git a/src/devices/sound/ks0164.cpp b/src/devices/sound/ks0164.cpp
index 3c88e69b7a2..e56c7c8dce0 100644
--- a/src/devices/sound/ks0164.cpp
+++ b/src/devices/sound/ks0164.cpp
@@ -51,7 +51,7 @@ void ks0164_device::device_start()
}
m_stream = stream_alloc(0, 2, clock()/3/2/2/32);
- m_mem_cache = space().cache<1, 0, ENDIANNESS_BIG>();
+ space().cache(m_mem_cache);
m_timer = timer_alloc(0);
save_item(NAME(m_bank1_base));
@@ -176,32 +176,32 @@ void ks0164_device::mpu401_w(u8 data)
u16 ks0164_device::vec_r(offs_t offset, u16 mem_mask)
{
- return m_mem_cache->read_word(offset << 1, mem_mask);
+ return m_mem_cache.read_word(offset << 1, mem_mask);
}
u16 ks0164_device::rom_r(offs_t offset, u16 mem_mask)
{
- return m_mem_cache->read_word((offset << 1) + 0x80, mem_mask);
+ return m_mem_cache.read_word((offset << 1) + 0x80, mem_mask);
}
u16 ks0164_device::bank1_r(offs_t offset, u16 mem_mask)
{
- return m_mem_cache->read_word(((offset << 1) & 0x3fff) | m_bank1_base, mem_mask);
+ return m_mem_cache.read_word(((offset << 1) & 0x3fff) | m_bank1_base, mem_mask);
}
void ks0164_device::bank1_w(offs_t offset, u16 data, u16 mem_mask)
{
- m_mem_cache->write_word(((offset << 1) & 0x3fff) | m_bank1_base, data, mem_mask);
+ m_mem_cache.write_word(((offset << 1) & 0x3fff) | m_bank1_base, data, mem_mask);
}
u16 ks0164_device::bank2_r(offs_t offset, u16 mem_mask)
{
- return m_mem_cache->read_word(((offset << 1) & 0x3fff) | m_bank2_base, mem_mask);
+ return m_mem_cache.read_word(((offset << 1) & 0x3fff) | m_bank2_base, mem_mask);
}
void ks0164_device::bank2_w(offs_t offset, u16 data, u16 mem_mask)
{
- m_mem_cache->write_word(((offset << 1) & 0x3fff) | m_bank2_base, data, mem_mask);
+ m_mem_cache.write_word(((offset << 1) & 0x3fff) | m_bank2_base, data, mem_mask);
}
u16 ks0164_device::bank1_select_r()
@@ -393,13 +393,13 @@ void ks0164_device::sound_stream_update(sound_stream &stream, stream_sample_t **
s16 samp0, samp1;
switch(regs[0] & 0x8400) {
case 0x0000: // 16 bits linear
- samp0 = m_mem_cache->read_word(2*adr);
- samp1 = m_mem_cache->read_word(2*adr+2);
+ samp0 = m_mem_cache.read_word(2*adr);
+ samp1 = m_mem_cache.read_word(2*adr+2);
break;
case 0x8400: // 8 bits compressed
- samp0 = uncomp_8_16(m_mem_cache->read_byte(adr));
- samp1 = uncomp_8_16(m_mem_cache->read_byte(adr+1));
+ samp0 = uncomp_8_16(m_mem_cache.read_byte(adr));
+ samp1 = uncomp_8_16(m_mem_cache.read_byte(adr+1));
break;
default:
diff --git a/src/devices/sound/ks0164.h b/src/devices/sound/ks0164.h
index f99d4952aab..bb654c83cc4 100644
--- a/src/devices/sound/ks0164.h
+++ b/src/devices/sound/ks0164.h
@@ -42,7 +42,7 @@ private:
address_space_config m_mem_config;
sound_stream *m_stream;
emu_timer *m_timer;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_mem_cache;
+ memory_access<23, 1, 0, ENDIANNESS_BIG>::cache m_mem_cache;
u32 m_bank1_base, m_bank2_base;
u16 m_bank1_select, m_bank2_select;
diff --git a/src/devices/sound/multipcm.cpp b/src/devices/sound/multipcm.cpp
index 8cc00b649d7..6698792fbe1 100644
--- a/src/devices/sound/multipcm.cpp
+++ b/src/devices/sound/multipcm.cpp
@@ -453,7 +453,7 @@ DEFINE_DEVICE_TYPE(MULTIPCM, multipcm_device, "ymw258f", "Yamaha YMW-258-F")
multipcm_device::multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MULTIPCM, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 24),
+ device_rom_interface(mconfig, *this),
m_stream(nullptr),
m_slots(nullptr),
m_cur_slot(0),
diff --git a/src/devices/sound/multipcm.h b/src/devices/sound/multipcm.h
index 135478239fa..7a4bc55fc2c 100644
--- a/src/devices/sound/multipcm.h
+++ b/src/devices/sound/multipcm.h
@@ -5,6 +5,8 @@
#pragma once
+#include "dirom.h"
+
#define MULTIPCM_LOG_SAMPLES 0
#if MULTIPCM_LOG_SAMPLES
@@ -13,7 +15,7 @@
class multipcm_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<24>
{
public:
multipcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/okim6295.cpp b/src/devices/sound/okim6295.cpp
index 10375f7736a..ec845dbd522 100644
--- a/src/devices/sound/okim6295.cpp
+++ b/src/devices/sound/okim6295.cpp
@@ -88,7 +88,7 @@ const uint8_t okim6295_device::s_volume_table[16] =
okim6295_device::okim6295_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, OKIM6295, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 18),
+ device_rom_interface(mconfig, *this),
m_region(*this, DEVICE_SELF),
m_command(-1),
m_stream(nullptr),
diff --git a/src/devices/sound/okim6295.h b/src/devices/sound/okim6295.h
index 0e836c29ad9..ee7c38f03c1 100644
--- a/src/devices/sound/okim6295.h
+++ b/src/devices/sound/okim6295.h
@@ -14,6 +14,7 @@
#pragma once
#include "sound/okiadpcm.h"
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -24,7 +25,7 @@
class okim6295_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<18>
{
public:
enum pin7_state
diff --git a/src/devices/sound/okim6376.cpp b/src/devices/sound/okim6376.cpp
index 2170bd5e898..76ee6a5f0a7 100644
--- a/src/devices/sound/okim6376.cpp
+++ b/src/devices/sound/okim6376.cpp
@@ -116,7 +116,7 @@ DEFINE_DEVICE_TYPE(OKIM6650, okim6650_device, "okim6650", "OKI MSM6650 ADPCM")
okim6376_device::okim6376_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int addrbits)
: device_t(mconfig, type, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, addrbits, ENDIANNESS_BIG, 8),
+ device_rom_interface(mconfig, *this),
//m_command[OKIM6376_VOICES],
m_latch(0),
//m_stage[OKIM6376_VOICES],
@@ -132,6 +132,7 @@ okim6376_device::okim6376_device(const machine_config &mconfig, device_type type
m_ch2_update(0),
m_st_update(0)
{
+ override_address_width(addrbits);
}
okim6376_device::okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
diff --git a/src/devices/sound/okim6376.h b/src/devices/sound/okim6376.h
index 361a9d2ccb0..5a73bae88e3 100644
--- a/src/devices/sound/okim6376.h
+++ b/src/devices/sound/okim6376.h
@@ -5,9 +5,11 @@
#pragma once
+#include "dirom.h"
+
/* an interface for the OKIM6376 and similar chips (CPU interface only) */
-class okim6376_device : public device_t, public device_sound_interface, public device_rom_interface
+class okim6376_device : public device_t, public device_sound_interface, public device_rom_interface<23, 0, 0, ENDIANNESS_BIG>
{
public:
okim6376_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/okim9810.cpp b/src/devices/sound/okim9810.cpp
index d2426cb4947..c9ae6e29c4a 100644
--- a/src/devices/sound/okim9810.cpp
+++ b/src/devices/sound/okim9810.cpp
@@ -80,7 +80,7 @@ const uint32_t okim9810_device::s_sampling_freq_div_table[16] =
okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, OKIM9810, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 24),
+ device_rom_interface(mconfig, *this),
m_stream(nullptr),
m_TMP_register(0x00),
m_global_volume(0x00),
diff --git a/src/devices/sound/okim9810.h b/src/devices/sound/okim9810.h
index b9fcb2db367..b5c8d566de0 100644
--- a/src/devices/sound/okim9810.h
+++ b/src/devices/sound/okim9810.h
@@ -17,6 +17,7 @@
#pragma once
+#include "dirom.h"
#include "okiadpcm.h"
@@ -29,7 +30,7 @@
class okim9810_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<24>
{
public:
// construction/destruction
diff --git a/src/devices/sound/qs1000.cpp b/src/devices/sound/qs1000.cpp
index 1d9ddcee7e4..4f6f86fa6d1 100644
--- a/src/devices/sound/qs1000.cpp
+++ b/src/devices/sound/qs1000.cpp
@@ -167,7 +167,7 @@ ROM_END
qs1000_device::qs1000_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, QS1000, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 24),
+ device_rom_interface(mconfig, *this),
m_external_rom(false),
m_in_p1_cb(*this),
m_in_p2_cb(*this),
diff --git a/src/devices/sound/qs1000.h b/src/devices/sound/qs1000.h
index e9e9b615951..d8e5fa8c545 100644
--- a/src/devices/sound/qs1000.h
+++ b/src/devices/sound/qs1000.h
@@ -15,6 +15,7 @@
#include "cpu/mcs51/mcs51.h"
#include "sound/okiadpcm.h"
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -24,7 +25,7 @@
class qs1000_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<24>
{
public:
static constexpr feature_type imperfect_features() { return feature::SOUND; }
diff --git a/src/devices/sound/qsound.cpp b/src/devices/sound/qsound.cpp
index 84a28073621..6d2e4479e9b 100644
--- a/src/devices/sound/qsound.cpp
+++ b/src/devices/sound/qsound.cpp
@@ -133,7 +133,7 @@ ROM_END
qsound_device::qsound_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock)
: device_t(mconfig, QSOUND, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 24)
+ , device_rom_interface(mconfig, *this)
, m_dsp(*this, "dsp"), m_stream(nullptr)
, m_rom_bank(0U), m_rom_offset(0U), m_cmd_addr(0U), m_cmd_data(0U), m_new_data(0U), m_cmd_pending(0U), m_dsp_ready(1U)
, m_samples{ 0, 0 }, m_sr(0U), m_fsr(0U), m_ock(1U), m_old(1U), m_ready(0U), m_channel(0U)
diff --git a/src/devices/sound/qsound.h b/src/devices/sound/qsound.h
index e63d3ac5fd0..d4694f1bf5f 100644
--- a/src/devices/sound/qsound.h
+++ b/src/devices/sound/qsound.h
@@ -10,10 +10,11 @@
#pragma once
+#include "dirom.h"
#include "cpu/dsp16/dsp16.h"
-class qsound_device : public device_t, public device_sound_interface, public device_rom_interface
+class qsound_device : public device_t, public device_sound_interface, public device_rom_interface<24>
{
public:
// default 60MHz clock (divided by 2 for DSP core clock, and then by 1248 for sample rate)
diff --git a/src/devices/sound/qsoundhle.cpp b/src/devices/sound/qsoundhle.cpp
index e332add2977..ef99f0ee837 100644
--- a/src/devices/sound/qsoundhle.cpp
+++ b/src/devices/sound/qsoundhle.cpp
@@ -42,7 +42,7 @@ ROM_END
qsound_hle_device::qsound_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, QSOUND_HLE, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 24)
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
, m_dsp_rom(*this, "dsp")
, m_data_latch(0)
diff --git a/src/devices/sound/qsoundhle.h b/src/devices/sound/qsoundhle.h
index 744569184cd..6c9872fcc9d 100644
--- a/src/devices/sound/qsoundhle.h
+++ b/src/devices/sound/qsoundhle.h
@@ -11,9 +11,10 @@
#pragma once
#include "cpu/dsp16/dsp16.h"
+#include "dirom.h"
-class qsound_hle_device : public device_t, public device_sound_interface, public device_rom_interface
+class qsound_hle_device : public device_t, public device_sound_interface, public device_rom_interface<24>
{
public:
// default 60MHz clock (divided by 2 for DSP core clock, and then by 1248 for sample rate)
diff --git a/src/devices/sound/rf5c400.cpp b/src/devices/sound/rf5c400.cpp
index 27dfa033118..4436ee07a5e 100644
--- a/src/devices/sound/rf5c400.cpp
+++ b/src/devices/sound/rf5c400.cpp
@@ -129,7 +129,7 @@ void rf5c400_device::envelope_tables::init(uint32_t clock)
rf5c400_device::rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, RF5C400, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 25, ENDIANNESS_LITTLE, 16)
+ , device_rom_interface(mconfig, *this)
, m_stream(nullptr)
, m_env_tables()
{
diff --git a/src/devices/sound/rf5c400.h b/src/devices/sound/rf5c400.h
index 7b5d420049b..d6b17ccaa3c 100644
--- a/src/devices/sound/rf5c400.h
+++ b/src/devices/sound/rf5c400.h
@@ -7,6 +7,8 @@
#pragma once
+#include "dirom.h"
+
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
@@ -15,8 +17,8 @@
// ======================> rf5c400_device
class rf5c400_device : public device_t,
- public device_sound_interface,
- public device_rom_interface
+ public device_sound_interface,
+ public device_rom_interface<25, 2, 0, ENDIANNESS_LITTLE>
{
public:
rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/rf5c68.cpp b/src/devices/sound/rf5c68.cpp
index 56661d9a6d4..1f1159b0afa 100644
--- a/src/devices/sound/rf5c68.cpp
+++ b/src/devices/sound/rf5c68.cpp
@@ -59,9 +59,8 @@ rf5c164_device::rf5c164_device(const machine_config &mconfig, const char *tag, d
void rf5c68_device::device_start()
{
- m_data = &space(0);
// Find our direct access
- m_cache = space().cache<0, 0, ENDIANNESS_LITTLE>();
+ space(0).cache(m_cache);
m_sample_end_cb.resolve();
/* allocate the stream */
@@ -140,11 +139,11 @@ void rf5c68_device::sound_stream_update(sound_stream &stream, stream_sample_t **
}
/* fetch the sample and handle looping */
- sample = m_cache->read_byte((chan.addr >> 11) & 0xffff);
+ sample = m_cache.read_byte((chan.addr >> 11) & 0xffff);
if (sample == 0xff)
{
chan.addr = chan.loopst << 11;
- sample = m_cache->read_byte((chan.addr >> 11) & 0xffff);
+ sample = m_cache.read_byte((chan.addr >> 11) & 0xffff);
/* if we loop to a loop point, we're effectively dead */
if (sample == 0xff)
@@ -269,7 +268,7 @@ void rf5c68_device::rf5c68_w(offs_t offset, u8 data)
u8 rf5c68_device::rf5c68_mem_r(offs_t offset)
{
- return m_cache->read_byte(m_wbank | offset);
+ return m_cache.read_byte(m_wbank | offset);
}
@@ -279,5 +278,5 @@ u8 rf5c68_device::rf5c68_mem_r(offs_t offset)
void rf5c68_device::rf5c68_mem_w(offs_t offset, u8 data)
{
- m_data->write_byte(m_wbank | offset, data);
+ m_cache.write_byte(m_wbank | offset, data);
}
diff --git a/src/devices/sound/rf5c68.h b/src/devices/sound/rf5c68.h
index d8cd3bf344a..7681c8940ef 100644
--- a/src/devices/sound/rf5c68.h
+++ b/src/devices/sound/rf5c68.h
@@ -50,6 +50,7 @@ protected:
virtual space_config_vector memory_space_config() const override;
address_space_config m_data_config;
+
private:
static constexpr unsigned NUM_CHANNELS = 8;
@@ -66,13 +67,12 @@ private:
uint16_t loopst = 0;
};
- address_space *m_data;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- sound_stream* m_stream;
- pcm_channel m_chan[NUM_CHANNELS];
- uint8_t m_cbank;
- uint16_t m_wbank;
- uint8_t m_enable;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ sound_stream* m_stream;
+ pcm_channel m_chan[NUM_CHANNELS];
+ uint8_t m_cbank;
+ uint16_t m_wbank;
+ uint8_t m_enable;
sample_end_cb_delegate m_sample_end_cb;
};
diff --git a/src/devices/sound/rolandpcm.cpp b/src/devices/sound/rolandpcm.cpp
index af79f20f9aa..08e8158afbe 100644
--- a/src/devices/sound/rolandpcm.cpp
+++ b/src/devices/sound/rolandpcm.cpp
@@ -32,7 +32,7 @@ DEFINE_DEVICE_TYPE(MB87419_MB87420, mb87419_mb87420_device, "mb87419_mb87420", "
mb87419_mb87420_device::mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MB87419_MB87420, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 22)
+ , device_rom_interface(mconfig, *this)
, m_int_callback(*this)
, m_clock(0)
, m_rate(0)
diff --git a/src/devices/sound/rolandpcm.h b/src/devices/sound/rolandpcm.h
index 08815f398e7..42dfa91efba 100644
--- a/src/devices/sound/rolandpcm.h
+++ b/src/devices/sound/rolandpcm.h
@@ -5,7 +5,9 @@
#pragma once
-class mb87419_mb87420_device : public device_t, public device_sound_interface, public device_rom_interface
+#include "dirom.h"
+
+class mb87419_mb87420_device : public device_t, public device_sound_interface, public device_rom_interface<22>
{
public:
mb87419_mb87420_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/s_dsp.cpp b/src/devices/sound/s_dsp.cpp
index 976fb33f5a2..487b77bff2f 100644
--- a/src/devices/sound/s_dsp.cpp
+++ b/src/devices/sound/s_dsp.cpp
@@ -156,9 +156,9 @@ s_dsp_device::s_dsp_device(const machine_config &mconfig, const char *tag, devic
void s_dsp_device::device_start()
{
- m_data = &space(0);
// Find our direct access
- m_cache = m_data->cache<0, 0, ENDIANNESS_LITTLE>();
+ space().cache(m_cache);
+ space().specific(m_data);
m_channel = machine().sound().stream_alloc(*this, 0, 2, clock() / 64);
diff --git a/src/devices/sound/s_dsp.h b/src/devices/sound/s_dsp.h
index 296ac0c4dca..953991dcd2c 100644
--- a/src/devices/sound/s_dsp.h
+++ b/src/devices/sound/s_dsp.h
@@ -38,11 +38,11 @@ protected:
address_space_config m_data_config;
private:
- address_space *m_data;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
- inline u8 read_byte(offs_t a) { return m_cache->read_byte(a); }
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_data;
+ inline u8 read_byte(offs_t a) { return m_cache.read_byte(a); }
inline u16 read_word(offs_t a) { return read_byte(a) | (read_byte(a + 1) << 8); }
- inline void write_byte(offs_t a, u8 d) { m_data->write_byte(a, d); }
+ inline void write_byte(offs_t a, u8 d) { m_data.write_byte(a, d); }
inline void write_word(offs_t a, u16 d) { write_byte(a, d & 0xff); write_byte(a + 1, (d >> 8) & 0xff); }
enum class env_state_t32 : u8
diff --git a/src/devices/sound/scsp.cpp b/src/devices/sound/scsp.cpp
index 2ee00c22880..63faf391116 100644
--- a/src/devices/sound/scsp.cpp
+++ b/src/devices/sound/scsp.cpp
@@ -148,7 +148,7 @@ DEFINE_DEVICE_TYPE(SCSP, scsp_device, "scsp", "Yamaha YMF292-F SCSP")
scsp_device::scsp_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, SCSP, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 20, ENDIANNESS_BIG, 16),
+ device_rom_interface(mconfig, *this),
m_irq_cb(*this),
m_main_irq_cb(*this),
m_BUFPTR(0),
diff --git a/src/devices/sound/scsp.h b/src/devices/sound/scsp.h
index 725dff85914..c349339c463 100644
--- a/src/devices/sound/scsp.h
+++ b/src/devices/sound/scsp.h
@@ -9,6 +9,7 @@
#pragma once
+#include "dirom.h"
#include "scspdsp.h"
#define SCSP_FM_DELAY 0 // delay in number of slots processed before samples are written to the FM ring buffer
@@ -17,7 +18,7 @@
class scsp_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<20, 1, 0, ENDIANNESS_BIG>
{
public:
static constexpr feature_type imperfect_features() { return feature::SOUND; } // DSP / EG incorrections, etc
diff --git a/src/devices/sound/segapcm.cpp b/src/devices/sound/segapcm.cpp
index c9a9f6be8ab..576bc3d2cd0 100644
--- a/src/devices/sound/segapcm.cpp
+++ b/src/devices/sound/segapcm.cpp
@@ -20,7 +20,7 @@ DEFINE_DEVICE_TYPE(SEGAPCM, segapcm_device, "segapcm", "Sega PCM")
segapcm_device::segapcm_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SEGAPCM, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 21)
+ , device_rom_interface(mconfig, *this)
, m_ram(nullptr)
, m_bankshift(12)
, m_bankmask(0x70)
diff --git a/src/devices/sound/segapcm.h b/src/devices/sound/segapcm.h
index 2a25c1eefeb..666a0efed2c 100644
--- a/src/devices/sound/segapcm.h
+++ b/src/devices/sound/segapcm.h
@@ -9,6 +9,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -16,7 +17,7 @@
class segapcm_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<21>
{
public:
static constexpr int BANK_256 = 11;
diff --git a/src/devices/sound/swp00.cpp b/src/devices/sound/swp00.cpp
index eb0d7c59107..0fa494658b1 100644
--- a/src/devices/sound/swp00.cpp
+++ b/src/devices/sound/swp00.cpp
@@ -11,7 +11,7 @@ DEFINE_DEVICE_TYPE(SWP00, swp00_device, "swp00", "Yamaha SWP00 (TC170C120SF / XQ
swp00_device::swp00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SWP00, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32)
+ device_rom_interface(mconfig, *this)
{
}
diff --git a/src/devices/sound/swp00.h b/src/devices/sound/swp00.h
index f440c96d46e..9ada0cdaadb 100644
--- a/src/devices/sound/swp00.h
+++ b/src/devices/sound/swp00.h
@@ -9,8 +9,9 @@
#pragma once
#include "meg.h"
+#include "dirom.h"
-class swp00_device : public device_t, public device_sound_interface, public device_rom_interface
+class swp00_device : public device_t, public device_sound_interface, public device_rom_interface<25+2, 2, 0, ENDIANNESS_LITTLE>
{
public:
swp00_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 33868800);
diff --git a/src/devices/sound/swp20.cpp b/src/devices/sound/swp20.cpp
index aa4bddaad7d..c5127168f11 100644
--- a/src/devices/sound/swp20.cpp
+++ b/src/devices/sound/swp20.cpp
@@ -11,7 +11,7 @@ DEFINE_DEVICE_TYPE(SWP20, swp20_device, "swp20", "Yamaha SWP20 sound chip")
swp20_device::swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SWP20, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 23+2, ENDIANNESS_LITTLE, 16)
+ device_rom_interface(mconfig, *this)
{
}
diff --git a/src/devices/sound/swp20.h b/src/devices/sound/swp20.h
index fa1c2e1de9f..b2aca4c8a71 100644
--- a/src/devices/sound/swp20.h
+++ b/src/devices/sound/swp20.h
@@ -8,7 +8,9 @@
#pragma once
-class swp20_device : public device_t, public device_sound_interface, public device_rom_interface
+#include "dirom.h"
+
+class swp20_device : public device_t, public device_sound_interface, public device_rom_interface<23+2, 1, 0, ENDIANNESS_LITTLE>
{
public:
swp20_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 11289600);
diff --git a/src/devices/sound/swp30.cpp b/src/devices/sound/swp30.cpp
index f43df8084f9..18b4f498c1b 100644
--- a/src/devices/sound/swp30.cpp
+++ b/src/devices/sound/swp30.cpp
@@ -150,7 +150,7 @@ DEFINE_DEVICE_TYPE(SWP30, swp30_device, "swp30", "Yamaha SWP30 sound chip")
swp30_device::swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SWP30, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 25+2, ENDIANNESS_LITTLE, 32),
+ device_rom_interface(mconfig, *this),
m_meg(*this, "meg")
{
(void)m_map;
diff --git a/src/devices/sound/swp30.h b/src/devices/sound/swp30.h
index dd95a8dd85f..35a90341bf3 100644
--- a/src/devices/sound/swp30.h
+++ b/src/devices/sound/swp30.h
@@ -9,8 +9,9 @@
#pragma once
#include "meg.h"
+#include "dirom.h"
-class swp30_device : public device_t, public device_sound_interface, public device_rom_interface
+class swp30_device : public device_t, public device_sound_interface, public device_rom_interface<25+2, 2, 0, ENDIANNESS_LITTLE>
{
public:
swp30_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 33868800);
diff --git a/src/devices/sound/upd7759.cpp b/src/devices/sound/upd7759.cpp
index 3cb175bcdd8..35a66d0b736 100644
--- a/src/devices/sound/upd7759.cpp
+++ b/src/devices/sound/upd7759.cpp
@@ -145,7 +145,7 @@
upd775x_device::upd775x_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 17)
+ , device_rom_interface(mconfig, *this)
, m_channel(nullptr)
, m_sample_offset_shift(0)
, m_pos(0)
diff --git a/src/devices/sound/upd7759.h b/src/devices/sound/upd7759.h
index e65b26b9fec..813f5270d89 100644
--- a/src/devices/sound/upd7759.h
+++ b/src/devices/sound/upd7759.h
@@ -5,6 +5,8 @@
#pragma once
+#include "dirom.h"
+
/* NEC uPD7759/55/56/P56/57/58 ADPCM Speech Processor */
/* There are two modes for the uPD7759, selected through the !MD pin.
@@ -15,7 +17,7 @@
class upd775x_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<17>
{
public:
enum : u32 { STANDARD_CLOCK = 640'000 };
diff --git a/src/devices/sound/vlm5030.cpp b/src/devices/sound/vlm5030.cpp
index f58540558d4..0d71f7e60b9 100644
--- a/src/devices/sound/vlm5030.cpp
+++ b/src/devices/sound/vlm5030.cpp
@@ -162,7 +162,7 @@ DEFINE_DEVICE_TYPE(VLM5030, vlm5030_device, "vlm5030", "Sanyo VLM5030")
vlm5030_device::vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, VLM5030, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 16),
+ device_rom_interface(mconfig, *this),
m_channel(nullptr),
m_coeff(nullptr),
m_address(0),
diff --git a/src/devices/sound/vlm5030.h b/src/devices/sound/vlm5030.h
index adbd9173c2b..891fb7ca595 100644
--- a/src/devices/sound/vlm5030.h
+++ b/src/devices/sound/vlm5030.h
@@ -5,7 +5,9 @@
#pragma once
-class vlm5030_device : public device_t, public device_sound_interface, public device_rom_interface
+#include "dirom.h"
+
+class vlm5030_device : public device_t, public device_sound_interface, public device_rom_interface<16>
{
public:
vlm5030_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/vrender0.cpp b/src/devices/sound/vrender0.cpp
index 833acdc46bb..370bc2f44e0 100644
--- a/src/devices/sound/vrender0.cpp
+++ b/src/devices/sound/vrender0.cpp
@@ -142,11 +142,11 @@ void vr0sound_device::device_start()
m_irq_cb.resolve_safe();
// Find our direct access
- m_texcache = space(AS_TEXTURE).cache<1, 0, ENDIANNESS_LITTLE>();
- m_fbcache = space(AS_FRAME).cache<1, 0, ENDIANNESS_LITTLE>();
- m_texcache_ctrl = m_fbcache;
+ space(AS_TEXTURE).cache(m_texcache);
+ space(AS_FRAME).cache(m_fbcache);
+ m_texcache_ctrl = &m_fbcache;
for (auto &elem : m_channel)
- elem.Cache = m_fbcache;
+ elem.Cache = &m_fbcache;
m_stream = stream_alloc(0, 2, clock() / 972); // TODO : Correct source / divider?
@@ -229,7 +229,7 @@ void vr0sound_device::channel_w(offs_t offset, u16 data, u16 mem_mask)
m_channel[(offset >> 4) & 0x1f].write(offset & 0xf, data, mem_mask);
if ((old_mode ^ channel->Modes) & MODE_TEXTURE)
{
- channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : m_fbcache;
+ channel->Cache = (channel->Modes & MODE_TEXTURE) ? m_texcache_ctrl : &m_fbcache;
}
}
@@ -356,7 +356,7 @@ void vr0sound_device::ctrl_w(offs_t offset, u16 data, u16 mem_mask)
const u16 old_ctrl = m_Ctrl;
COMBINE_DATA(&m_Ctrl);
if ((old_ctrl ^ m_Ctrl) & CTRL_TM)
- m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? m_texcache : m_fbcache;
+ m_texcache_ctrl = (m_Ctrl & CTRL_TM) ? &m_texcache : &m_fbcache;
}
/*
diff --git a/src/devices/sound/vrender0.h b/src/devices/sound/vrender0.h
index 89432d4303b..324276b8ff0 100644
--- a/src/devices/sound/vrender0.h
+++ b/src/devices/sound/vrender0.h
@@ -115,7 +115,7 @@ private:
std::fill(std::begin(EnvTarget), std::end(EnvTarget), 0);
}
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *Cache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache *Cache;
u32 CurSAddr = 0; // Current Address Pointer, 22.10 Fixed Point
s32 EnvVol = 0; // Envelope Volume (Overall Volume), S.7.16 Fixed Point
u8 EnvStage = 1; // Envelope Stage
@@ -132,9 +132,9 @@ private:
void write(offs_t offset, u16 data, u16 mem_mask);
};
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_texcache;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_fbcache;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_texcache_ctrl;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_texcache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache m_fbcache;
+ memory_access<23, 1, 0, ENDIANNESS_LITTLE>::cache *m_texcache_ctrl;
channel_t m_channel[32];
sound_stream *m_stream;
diff --git a/src/devices/sound/x1_010.cpp b/src/devices/sound/x1_010.cpp
index a52f8504ddd..fdb824c0df7 100644
--- a/src/devices/sound/x1_010.cpp
+++ b/src/devices/sound/x1_010.cpp
@@ -89,7 +89,7 @@ DEFINE_DEVICE_TYPE(X1_010, x1_010_device, "x1_010", "Seta X1-010")
x1_010_device::x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, X1_010, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 20)
+ , device_rom_interface(mconfig, *this)
, m_rate(0)
, m_stream(nullptr)
, m_sound_enable(0)
diff --git a/src/devices/sound/x1_010.h b/src/devices/sound/x1_010.h
index 5f85fe77671..1664e2abd4c 100644
--- a/src/devices/sound/x1_010.h
+++ b/src/devices/sound/x1_010.h
@@ -5,7 +5,9 @@
#pragma once
-class x1_010_device : public device_t, public device_sound_interface, public device_rom_interface
+#include "dirom.h"
+
+class x1_010_device : public device_t, public device_sound_interface, public device_rom_interface<20>
{
public:
x1_010_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
diff --git a/src/devices/sound/ymf271.cpp b/src/devices/sound/ymf271.cpp
index f2ef28cfeeb..4032a2b6bd8 100644
--- a/src/devices/sound/ymf271.cpp
+++ b/src/devices/sound/ymf271.cpp
@@ -1805,7 +1805,7 @@ DEFINE_DEVICE_TYPE(YMF271, ymf271_device, "ymf271", "Yamaha YMF271 OPX")
ymf271_device::ymf271_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, YMF271, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 23)
+ , device_rom_interface(mconfig, *this)
, m_timerA(0)
, m_timerB(0)
, m_irqstate(0)
diff --git a/src/devices/sound/ymf271.h b/src/devices/sound/ymf271.h
index efee18db0ad..18ddd4e7b67 100644
--- a/src/devices/sound/ymf271.h
+++ b/src/devices/sound/ymf271.h
@@ -5,8 +5,9 @@
#pragma once
+#include "dirom.h"
-class ymf271_device : public device_t, public device_sound_interface, public device_rom_interface
+class ymf271_device : public device_t, public device_sound_interface, public device_rom_interface<23>
{
public:
static constexpr feature_type imperfect_features() { return feature::SOUND; }
diff --git a/src/devices/sound/ymf278b.cpp b/src/devices/sound/ymf278b.cpp
index 0f6c6eb3fad..4e8ed1005ee 100644
--- a/src/devices/sound/ymf278b.cpp
+++ b/src/devices/sound/ymf278b.cpp
@@ -1055,7 +1055,7 @@ DEFINE_DEVICE_TYPE(YMF278B, ymf278b_device, "ymf278b", "Yamaha YMF278B OPL4")
ymf278b_device::ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, YMF278B, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 22)
+ , device_rom_interface(mconfig, *this)
, m_irq_handler(*this)
, m_last_fm_data(0)
{
diff --git a/src/devices/sound/ymf278b.h b/src/devices/sound/ymf278b.h
index 524ed7aebd2..039662fed1a 100644
--- a/src/devices/sound/ymf278b.h
+++ b/src/devices/sound/ymf278b.h
@@ -5,8 +5,9 @@
#pragma once
+#include "dirom.h"
-class ymf278b_device : public device_t, public device_sound_interface, public device_rom_interface
+class ymf278b_device : public device_t, public device_sound_interface, public device_rom_interface<22>
{
public:
ymf278b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/sound/ymz280b.cpp b/src/devices/sound/ymz280b.cpp
index 0b182509fb5..570b4e64990 100644
--- a/src/devices/sound/ymz280b.cpp
+++ b/src/devices/sound/ymz280b.cpp
@@ -927,7 +927,7 @@ DEFINE_DEVICE_TYPE(YMZ280B, ymz280b_device, "ymz280b", "Yamaha YMZ280B PCMD8")
ymz280b_device::ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, YMZ280B, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 24)
+ , device_rom_interface(mconfig, *this)
, m_current_register(0)
, m_status_register(0)
, m_irq_state(0)
diff --git a/src/devices/sound/ymz280b.h b/src/devices/sound/ymz280b.h
index 0a8ada2ae5b..898d952c0d2 100644
--- a/src/devices/sound/ymz280b.h
+++ b/src/devices/sound/ymz280b.h
@@ -12,10 +12,11 @@
#pragma once
+#include "dirom.h"
#define YMZ280B_MAKE_WAVS 0
-class ymz280b_device : public device_t, public device_sound_interface, public device_rom_interface
+class ymz280b_device : public device_t, public device_sound_interface, public device_rom_interface<24>
{
public:
ymz280b_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/devices/video/sed1330.cpp b/src/devices/video/sed1330.cpp
index 4b52400142d..101ebe72944 100644
--- a/src/devices/video/sed1330.cpp
+++ b/src/devices/video/sed1330.cpp
@@ -174,7 +174,7 @@ const tiny_rom_entry *sed1330_device::device_rom_region() const
void sed1330_device::device_start()
{
- m_cache = space().cache<0, 0, ENDIANNESS_LITTLE>();
+ space().cache(m_cache);
// register for state saving
save_item(NAME(m_bf));
@@ -611,8 +611,8 @@ void sed1330_device::draw_text_scanline(bitmap_ind16 &bitmap, const rectangle &c
{
if (m_m0 && !m_m1)
{
- uint8_t c = m_cache->read_byte(va + sx);
- uint8_t data = m_cache->read_byte(0xf000 | (m_m2 ? u16(c) << 4 | r : u16(c) << 3 | (r & 7)));
+ uint8_t c = m_cache.read_byte(va + sx);
+ uint8_t data = m_cache.read_byte(0xf000 | (m_m2 ? u16(c) << 4 | r : u16(c) << 3 | (r & 7)));
for (int x = 0; x < m_fx; x++, data <<= 1)
if (BIT(data, 7))
p[x] = 1;
diff --git a/src/devices/video/sed1330.h b/src/devices/video/sed1330.h
index 2baf3b011cd..c9bff82f578 100644
--- a/src/devices/video/sed1330.h
+++ b/src/devices/video/sed1330.h
@@ -94,7 +94,7 @@ private:
// address space configurations
const address_space_config m_space_config;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_cache;
inline uint8_t readbyte(offs_t address);
inline void writebyte(offs_t address, uint8_t m_data);
diff --git a/src/emu/dirom.cpp b/src/emu/dirom.cpp
deleted file mode 100644
index 6440fa2cfc6..00000000000
--- a/src/emu/dirom.cpp
+++ /dev/null
@@ -1,285 +0,0 @@
-// license:BSD-3-Clause
-// copyright-holders:Olivier Galibert
-
-#include "emu.h"
-
-
-device_rom_interface::device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian, u8 datawidth) :
- device_memory_interface(mconfig, device),
- m_rom_tag(device.basetag()),
- m_rom_config("rom", endian, datawidth, addrwidth),
- m_bank(nullptr),
- m_cur_bank(-1)
-{
-}
-
-device_rom_interface::~device_rom_interface()
-{
-}
-
-device_memory_interface::space_config_vector device_rom_interface::memory_space_config() const
-{
- return space_config_vector {
- std::make_pair(0, &m_rom_config)
- };
-}
-
-void device_rom_interface::rom_bank_updated()
-{
-}
-
-void device_rom_interface::set_rom_bank(int bank)
-{
- if(!m_bank)
- emu_fatalerror("%s: device_rom_interface::set_rom_bank called without banking setup", device().tag());
-
- if(bank >= m_bank_count) {
- device().logerror("Warning: requested bank %x higher than actual bank count %x\n", bank, m_bank_count);
- bank = bank % m_bank_count;
- }
-
- if (m_cur_bank != bank) {
- m_cur_bank = bank;
- m_bank->set_entry(bank);
- rom_bank_updated();
- }
-}
-
-void device_rom_interface::interface_post_load()
-{
- if(m_bank)
- m_bank->set_entry(m_cur_bank);
-}
-
-void device_rom_interface::set_rom(const void *base, u32 size)
-{
- u32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
- u32 rend = size-1;
- m_bank_count = mend == 0xffffffff ? 1 : (rend+1) / (mend+1);
- if(m_bank_count < 1)
- m_bank_count = 1;
-
- if(rend >= mend) {
- space().install_read_bank(0, mend, device().tag());
- m_bank = device().machine().memory().banks().find(device().tag())->second.get();
- m_bank->configure_entries(0, m_bank_count, const_cast<void *>(base), mend+1);
- m_cur_bank = 0;
-
- } else {
- // Round up to the nearest power-of-two-minus-one
- u32 rmask = rend;
- rmask |= rmask >> 1;
- rmask |= rmask >> 2;
- rmask |= rmask >> 4;
- rmask |= rmask >> 8;
- rmask |= rmask >> 16;
- if(rmask != rend)
- space().unmap_read(0, mend);
- // Mirror over the high bits. mend and rmask are both
- // powers-of-two-minus-one, so the xor works
- space().install_rom(0, rend, mend ^ rmask, const_cast<void *>(base));
- }
-}
-
-void device_rom_interface::interface_pre_start()
-{
- if(!has_space(0))
- return;
-
- switch(space().data_width()) {
- case 8:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<0, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<0, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
-
- case 16:
- switch(space().addr_shift()) {
- case 3:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, 3, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, 3, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<1, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<1, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
-
- case 32:
- switch(space().addr_shift()) {
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -2:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<2, -2, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<2, -2, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
-
- case 64:
- switch(space().addr_shift()) {
- case 0:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, 0, ENDIANNESS_LITTLE>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, 0, ENDIANNESS_BIG>();
- m_r8 = [cache] (offs_t byteaddress) -> u8 { return cache->read_byte(byteaddress); };
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -1:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -1, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -1, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = [cache] (offs_t byteaddress) -> u16 { return cache->read_word(byteaddress); };
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -2:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -2, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -2, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = [cache] (offs_t byteaddress) -> u32 { return cache->read_dword(byteaddress); };
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- case -3:
- if(space().endianness() == ENDIANNESS_LITTLE) {
- auto cache = space().cache<3, -3, ENDIANNESS_LITTLE>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = nullptr;
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- } else {
- auto cache = space().cache<3, -3, ENDIANNESS_BIG>();
- m_r8 = nullptr;
- m_r16 = nullptr;
- m_r32 = nullptr;
- m_r64 = [cache] (offs_t byteaddress) -> u64 { return cache->read_qword(byteaddress); };
- }
- break;
- }
- break;
- }
-
- device().save_item(NAME(m_cur_bank));
- device().save_item(NAME(m_bank_count));
-
- if(!has_configured_map(0)) {
- memory_region *reg = device().owner()->memregion(m_rom_tag);
- if(reg)
- set_rom(reg->base(), reg->bytes());
- else {
- device().logerror("ROM region '%s' not found\n", m_rom_tag);
- u32 end = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
- space().unmap_read(0, end);
- }
- }
-}
diff --git a/src/emu/dirom.h b/src/emu/dirom.h
index 761e1d357ec..62566f433d3 100644
--- a/src/emu/dirom.h
+++ b/src/emu/dirom.h
@@ -10,25 +10,22 @@
#pragma once
-#ifndef __EMU_H__
-#error Dont include this file directly; include emu.h instead.
-#endif
-
#ifndef MAME_EMU_DIROM_H
#define MAME_EMU_DIROM_H
-class device_rom_interface : public device_memory_interface
+// Beware, DataWidth is 0-3
+template<int AddrWidth, int DataWidth = 0, int AddrShift = 0, endianness_t Endian = ENDIANNESS_LITTLE> class device_rom_interface : public device_memory_interface
{
public:
- device_rom_interface(const machine_config &mconfig, device_t &device, u8 addrwidth, endianness_t endian = ENDIANNESS_LITTLE, u8 datawidth = 8);
- virtual ~device_rom_interface();
+ device_rom_interface(const machine_config &mconfig, device_t &device);
+ virtual ~device_rom_interface() = default;
void set_device_rom_tag(const char *tag) { m_rom_tag = tag; }
- inline u8 read_byte(offs_t byteaddress) { return m_r8(byteaddress); }
- inline u16 read_word(offs_t byteaddress) { return m_r16(byteaddress); }
- inline u32 read_dword(offs_t byteaddress) { return m_r32(byteaddress); }
- inline u64 read_qword(offs_t byteaddress) { return m_r64(byteaddress); }
+ inline u8 read_byte(offs_t byteaddress) { return m_rom_cache.read_byte(byteaddress); }
+ inline u16 read_word(offs_t byteaddress) { return m_rom_cache.read_word(byteaddress); }
+ inline u32 read_dword(offs_t byteaddress) { return m_rom_cache.read_dword(byteaddress); }
+ inline u64 read_qword(offs_t byteaddress) { return m_rom_cache.read_qword(byteaddress); }
void set_rom(const void *base, u32 size);
void set_rom_bank(int bank);
@@ -37,17 +34,12 @@ protected:
virtual void rom_bank_updated() = 0;
virtual space_config_vector memory_space_config() const override;
- void set_rom_endianness(endianness_t endian) { assert(!device().configured()); m_rom_config.m_endianness = endian; }
- void set_rom_data_width(u8 width) { assert(!device().configured()); m_rom_config.m_data_width = width; }
- void set_rom_addr_width(u8 width) { assert(!device().configured()); m_rom_config.m_addr_width = m_rom_config.m_logaddr_width = width; }
+ void override_address_width(u8 width);
private:
const char *m_rom_tag;
address_space_config m_rom_config;
- std::function<u8 (offs_t)> m_r8;
- std::function<u16 (offs_t)> m_r16;
- std::function<u32 (offs_t)> m_r32;
- std::function<u64 (offs_t)> m_r64;
+ typename memory_access<AddrWidth, DataWidth, AddrShift, Endian>::cache m_rom_cache;
memory_bank *m_bank;
int m_cur_bank, m_bank_count;
@@ -56,4 +48,6 @@ private:
virtual void interface_post_load() override;
};
+#include "dirom.ipp"
+
#endif // MAME_EMU_DIROM_H
diff --git a/src/emu/dirom.ipp b/src/emu/dirom.ipp
new file mode 100644
index 00000000000..42447932df9
--- /dev/null
+++ b/src/emu/dirom.ipp
@@ -0,0 +1,109 @@
+// license:BSD-3-Clause
+// copyright-holders:Olivier Galibert
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::device_rom_interface(const machine_config &mconfig, device_t &device) :
+ device_memory_interface(mconfig, device),
+ m_rom_tag(device.basetag()),
+ m_rom_config("rom", Endian, 8 << DataWidth, AddrWidth, AddrShift),
+ m_bank(nullptr),
+ m_cur_bank(-1)
+{
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::override_address_width(u8 width)
+{
+ // cach does not need level match, only specific does at this point
+ // if(emu::detail::handler_entry_dispatch_level(AddrWidth) != emu::detail::handler_entry_dispatch_level(width))
+ // emu_fatalerror("%s: Widths %d and %d are incompatible", device().tag(), width, AddrWidth);
+
+ m_rom_config.m_addr_width = width;
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+device_memory_interface::space_config_vector device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::memory_space_config() const
+{
+ return space_config_vector {
+ std::make_pair(0, &m_rom_config)
+ };
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::set_rom_bank(int bank)
+{
+ if(!m_bank)
+ emu_fatalerror("%s: device_rom_interface::set_rom_bank called without banking setup", device().tag());
+
+ if(bank >= m_bank_count) {
+ device().logerror("Warning: requested bank %x higher than actual bank count %x\n", bank, m_bank_count);
+ bank = bank % m_bank_count;
+ }
+
+ if (m_cur_bank != bank) {
+ m_cur_bank = bank;
+ m_bank->set_entry(bank);
+ rom_bank_updated();
+ }
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::interface_post_load()
+{
+ if(m_bank)
+ m_bank->set_entry(m_cur_bank);
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::set_rom(const void *base, u32 size)
+{
+ u32 mend = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
+ u32 rend = size-1;
+ m_bank_count = mend == 0xffffffff ? 1 : (rend+1) / (mend+1);
+ if(m_bank_count < 1)
+ m_bank_count = 1;
+
+ if(rend >= mend) {
+ space().install_read_bank(0, mend, device().tag());
+ m_bank = device().machine().memory().banks().find(device().tag())->second.get();
+ m_bank->configure_entries(0, m_bank_count, const_cast<void *>(base), mend+1);
+ m_cur_bank = 0;
+
+ } else {
+ // Round up to the nearest power-of-two-minus-one
+ u32 rmask = rend;
+ rmask |= rmask >> 1;
+ rmask |= rmask >> 2;
+ rmask |= rmask >> 4;
+ rmask |= rmask >> 8;
+ rmask |= rmask >> 16;
+ if(rmask != rend)
+ space().unmap_read(0, mend);
+ // Mirror over the high bits. mend and rmask are both
+ // powers-of-two-minus-one, so the xor works
+ space().install_rom(0, rend, mend ^ rmask, const_cast<void *>(base));
+ }
+}
+
+template<int AddrWidth, int DataWidth, int AddrShift, endianness_t Endian>
+void device_rom_interface<AddrWidth, DataWidth, AddrShift, Endian>::interface_pre_start()
+{
+ if(!has_space(0))
+ return;
+
+ space().cache(m_rom_cache);
+
+ device().save_item(NAME(m_cur_bank));
+ device().save_item(NAME(m_bank_count));
+
+ if(!has_configured_map(0)) {
+ memory_region *reg = device().owner()->memregion(m_rom_tag);
+ if(reg)
+ set_rom(reg->base(), reg->bytes());
+ else {
+ device().logerror("ROM region '%s' not found\n", m_rom_tag);
+ u32 end = m_rom_config.addr_width() == 32 ? 0xffffffff : (1 << m_rom_config.addr_width()) - 1;
+ space().unmap_read(0, end);
+ }
+ }
+}
diff --git a/src/emu/emu.h b/src/emu/emu.h
index 35a5d6a3f60..6e1d90ba82f 100644
--- a/src/emu/emu.h
+++ b/src/emu/emu.h
@@ -67,7 +67,6 @@
#include "addrmap.h" // Needs optional_device<> and required_device<>
#include "distate.h"
#include "dimemory.h"
-#include "dirom.h"
#include "opresolv.h"
#include "dipalette.h"
#include "digfx.h"
diff --git a/src/emu/emufwd.h b/src/emu/emufwd.h
index 97955067865..275d1fecedd 100644
--- a/src/emu/emufwd.h
+++ b/src/emu/emufwd.h
@@ -140,7 +140,6 @@ class driver_device;
// declared in emumem.h
class address_space;
-template<int Width, int AddrShift, int Endian> class memory_access_cache;
class memory_bank;
class memory_block;
class memory_manager;
diff --git a/src/emu/emumem.cpp b/src/emu/emumem.cpp
index e0cbaf6c828..e48b13d9a51 100644
--- a/src/emu/emumem.cpp
+++ b/src/emu/emumem.cpp
@@ -80,103 +80,103 @@ void handler_entry::enumerate_references(handler_entry::reflist &refs) const
{
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int Width, int AddrShift, endianness_t Endian> const handler_entry_read<Width, AddrShift, Endian> *const *handler_entry_read<Width, AddrShift, Endian>::get_dispatch() const
{
fatalerror("get_dispatch called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
{
fatalerror("lookup called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return nullptr;
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
fatalerror("detach called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int Width, int AddrShift, endianness_t Endian> const handler_entry_write<Width, AddrShift, Endian> *const *handler_entry_write<Width, AddrShift, Endian>::get_dispatch() const
{
fatalerror("get_dispatch called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
fatalerror("populate called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
fatalerror("populate_mismatched called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
fatalerror("populate_passthrough called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
{
fatalerror("lookup called on non-dispatching class\n");
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return nullptr;
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
fatalerror("detach called on non-dispatching class\n");
}
@@ -283,12 +283,12 @@ const int MEMORY_BLOCK_CHUNK = 65536; // minimum chunk size of
// ======================> address_space_specific
// this is a derived class of address_space with specific width, endianness, and table size
-template<int Width, int AddrShift, endianness_t Endian>
+template<int Level, int Width, int AddrShift, endianness_t Endian>
class address_space_specific : public address_space
{
using uX = typename emu::detail::handler_entry_size<Width>::uX;
using NativeType = uX;
- using this_type = address_space_specific<Width, AddrShift, Endian>;
+ using this_type = address_space_specific<Level, Width, AddrShift, Endian>;
// constants describing the native size
static constexpr u32 NATIVE_BYTES = 1 << Width;
@@ -299,10 +299,8 @@ class address_space_specific : public address_space
static constexpr offs_t offset_to_byte(offs_t offset) { return AddrShift < 0 ? offset << iabs(AddrShift) : offset >> iabs(AddrShift); }
public:
- handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
- handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
- u8 m_shift_read;
- u8 m_shift_write;
+ const handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
+ const handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
std::string get_handler_string(read_or_write readorwrite, offs_t byteaddress) const override;
void dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const override;
@@ -519,16 +517,22 @@ public:
default: fatalerror("Unhandled address bus width %d\n", address_width);
}
- m_root_read->get_dispatch(m_dispatch_read, m_shift_read);
- m_root_write->get_dispatch(m_dispatch_write, m_shift_write);
+ m_dispatch_read = m_root_read ->get_dispatch();
+ m_dispatch_write = m_root_write->get_dispatch();
}
- void *create_cache() override {
- return new memory_access_cache<Width, AddrShift, Endian>(*this, m_root_read, m_root_write);
+ std::pair<void *, void *> get_cache_info() override {
+ std::pair<void *, void *> rw;
+ rw.first = m_root_read;
+ rw.second = m_root_write;
+ return rw;
}
- void *create_specific() override {
- return new memory_access_specific<Width, AddrShift, Endian>(*this, m_dispatch_read, m_shift_read, m_dispatch_write, m_shift_write);
+ std::pair<const void *, const void *> get_specific_info() override {
+ std::pair<const void *, const void *> rw;
+ rw.first = m_dispatch_read;
+ rw.second = m_dispatch_write;
+ return rw;
}
void delayed_ref(handler_entry *e) {
@@ -595,25 +599,25 @@ public:
// native read
NativeType read_native(offs_t offset, NativeType mask)
{
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, offset & m_addrmask, mask, m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, offset, mask, m_dispatch_read);;
}
// mask-less native read
NativeType read_native(offs_t offset)
{
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, offset & m_addrmask, uX(0xffffffffffffffffU), m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, offset, uX(0xffffffffffffffffU), m_dispatch_read);
}
// native write
void write_native(offs_t offset, NativeType data, NativeType mask)
{
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, offset & m_addrmask, data, mask, m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, offset, data, mask, m_dispatch_write);;
}
// mask-less native write
void write_native(offs_t offset, NativeType data)
{
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, offset & m_addrmask, data, uX(0xffffffffffffffffU), m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, offset, data, uX(0xffffffffffffffffU), m_dispatch_write);;
}
// virtual access to these functions
@@ -907,92 +911,69 @@ void memory_manager::allocate(device_memory_interface &memory)
address_space_config const *const spaceconfig = memory.space_config(spacenum);
if (spaceconfig)
{
+ int level = emu::detail::handler_entry_dispatch_level(spaceconfig->addr_width());
// allocate one of the appropriate type
- switch (spaceconfig->data_width() | (spaceconfig->addr_shift() + 4))
+ switch ((level << 8) | (spaceconfig->endianness() == ENDIANNESS_BIG ? 0x1000 : 0) |spaceconfig->data_width() | (spaceconfig->addr_shift() + 4))
{
- case 8|(4+1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<0, 1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<0, 1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 8|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<0, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<0, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4+3):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, 3, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, 3, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 16|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<1, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<1, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 32|(4-2):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<2, -2, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<2, -2, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-0):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, 0, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, 0, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-1):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -1, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -1, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-2):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -2, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -2, ENDIANNESS_BIG >>(*this, spacenum);
- break;
-
- case 64|(4-3):
- if (spaceconfig->endianness() == ENDIANNESS_LITTLE)
- memory.allocate<address_space_specific<3, -3, ENDIANNESS_LITTLE>>(*this, spacenum);
- else
- memory.allocate<address_space_specific<3, -3, ENDIANNESS_BIG >>(*this, spacenum);
- break;
+ case 0x0000|0x000| 8|(4+1): memory.allocate<address_space_specific<0, 0, 1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000| 8|(4+1): memory.allocate<address_space_specific<0, 0, 1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100| 8|(4+1): memory.allocate<address_space_specific<1, 0, 1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100| 8|(4+1): memory.allocate<address_space_specific<1, 0, 1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000| 8|(4-0): memory.allocate<address_space_specific<0, 0, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000| 8|(4-0): memory.allocate<address_space_specific<0, 0, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100| 8|(4-0): memory.allocate<address_space_specific<1, 0, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100| 8|(4-0): memory.allocate<address_space_specific<1, 0, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4+3): memory.allocate<address_space_specific<0, 1, 3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4+3): memory.allocate<address_space_specific<0, 1, 3, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4+3): memory.allocate<address_space_specific<1, 1, 3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4+3): memory.allocate<address_space_specific<1, 1, 3, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4-0): memory.allocate<address_space_specific<0, 1, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4-0): memory.allocate<address_space_specific<0, 1, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4-0): memory.allocate<address_space_specific<1, 1, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4-0): memory.allocate<address_space_specific<1, 1, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|16|(4-1): memory.allocate<address_space_specific<0, 1, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|16|(4-1): memory.allocate<address_space_specific<0, 1, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|16|(4-1): memory.allocate<address_space_specific<1, 1, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|16|(4-1): memory.allocate<address_space_specific<1, 1, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-0): memory.allocate<address_space_specific<0, 2, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-0): memory.allocate<address_space_specific<0, 2, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-0): memory.allocate<address_space_specific<1, 2, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-0): memory.allocate<address_space_specific<1, 2, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-1): memory.allocate<address_space_specific<0, 2, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-1): memory.allocate<address_space_specific<0, 2, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-1): memory.allocate<address_space_specific<1, 2, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-1): memory.allocate<address_space_specific<1, 2, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|32|(4-2): memory.allocate<address_space_specific<0, 2, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|32|(4-2): memory.allocate<address_space_specific<0, 2, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|32|(4-2): memory.allocate<address_space_specific<1, 2, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|32|(4-2): memory.allocate<address_space_specific<1, 2, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-0): memory.allocate<address_space_specific<0, 3, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-0): memory.allocate<address_space_specific<0, 3, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-0): memory.allocate<address_space_specific<1, 3, 0, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-0): memory.allocate<address_space_specific<1, 3, 0, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-1): memory.allocate<address_space_specific<0, 3, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-1): memory.allocate<address_space_specific<0, 3, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-1): memory.allocate<address_space_specific<1, 3, -1, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-1): memory.allocate<address_space_specific<1, 3, -1, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-2): memory.allocate<address_space_specific<0, 3, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-2): memory.allocate<address_space_specific<0, 3, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-2): memory.allocate<address_space_specific<1, 3, -2, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-2): memory.allocate<address_space_specific<1, 3, -2, ENDIANNESS_BIG >>(*this, spacenum); break;
+
+ case 0x0000|0x000|64|(4-3): memory.allocate<address_space_specific<0, 3, -3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x000|64|(4-3): memory.allocate<address_space_specific<0, 3, -3, ENDIANNESS_BIG >>(*this, spacenum); break;
+ case 0x0000|0x100|64|(4-3): memory.allocate<address_space_specific<1, 3, -3, ENDIANNESS_LITTLE>>(*this, spacenum); break;
+ case 0x1000|0x100|64|(4-3): memory.allocate<address_space_specific<1, 3, -3, ENDIANNESS_BIG >>(*this, spacenum); break;
default:
throw emu_fatalerror("Invalid width %d/shift %d specified for address_space::allocate", spaceconfig->data_width(), spaceconfig->addr_shift());
@@ -1885,7 +1866,7 @@ memory_passthrough_handler *address_space::install_readwrite_tap(offs_t addrstar
// describing the handler at a particular offset
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> std::string address_space_specific<Width, AddrShift, Endian>::get_handler_string(read_or_write readorwrite, offs_t address) const
+template<int Level, int Width, int AddrShift, endianness_t Endian> std::string address_space_specific<Level, Width, AddrShift, Endian>::get_handler_string(read_or_write readorwrite, offs_t address) const
{
if (readorwrite == read_or_write::READ) {
offs_t start, end;
@@ -1900,7 +1881,7 @@ template<int Width, int AddrShift, endianness_t Endian> std::string address_spac
}
}
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::dump_maps(std::vector<memory_entry> &read_map, std::vector<memory_entry> &write_map) const
{
read_map.clear();
write_map.clear();
@@ -1917,7 +1898,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// unmap - unmap a section of address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet)
{
VPRINTF(("address_space::unmap(%s-%s mirror=%s, %s, %s)\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -1949,7 +1930,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// install_read_tap - install a read tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_read_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_read_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_read_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -1971,7 +1952,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// install_write_tap - install a write tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_write_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_write_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -1992,7 +1973,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// install_write_tap - install a read and a write tap on the bus
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Width, AddrShift, Endian>::install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph)
+template<int Level, int Width, int AddrShift, endianness_t Endian> memory_passthrough_handler *address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_tap(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapr, std::function<void (offs_t offset, uX &data, uX mem_mask)> tapw, memory_passthrough_handler *mph)
{
offs_t nstart, nend, nmask, nmirror;
check_optimize_mirror("install_readwrite_tap", addrstart, addrend, addrmirror, nstart, nend, nmask, nmirror);
@@ -2023,7 +2004,7 @@ template<int Width, int AddrShift, endianness_t Endian> memory_passthrough_handl
// of a live device into this address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_device_delegate(offs_t addrstart, offs_t addrend, device_t &device, address_map_constructor &delegate, u64 unitmask, int cswidth)
{
check_address("install_device_delegate", addrstart, addrend);
address_map map(*this, addrstart, addrend, unitmask, cswidth, m_device, delegate);
@@ -2038,7 +2019,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// handler into this address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_readwrite_port(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{
VPRINTF(("address_space::install_readwrite_port(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2082,7 +2063,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// mapping to a particular bank
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, std::string rtag, std::string wtag)
{
VPRINTF(("address_space::install_readwrite_bank(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2118,7 +2099,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
}
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_bank_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, memory_bank *rbank, memory_bank *wbank)
{
VPRINTF(("address_space::install_readwrite_bank(%s-%s mirror=%s, read=\"%s\" / write=\"%s\")\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2153,7 +2134,7 @@ template<int Width, int AddrShift, endianness_t Endian> void address_space_speci
// RAM region into the given address space
//-------------------------------------------------
-template<int Width, int AddrShift, endianness_t Endian> void address_space_specific<Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void address_space_specific<Level, Width, AddrShift, Endian>::install_ram_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, void *baseptr)
{
VPRINTF(("address_space::install_ram_generic(%s-%s mirror=%s, %s, %p)\n",
core_i64_hex_format(addrstart, m_addrchars), core_i64_hex_format(addrend, m_addrchars),
@@ -2370,80 +2351,6 @@ memory_bank &address_space::bank_find_or_allocate(const char *tag, offs_t addrst
//**************************************************************************
-// CACHE MEMORY RANGES
-//**************************************************************************
-
-//-------------------------------------------------
-// memory_access_cache - constructor
-//-------------------------------------------------
-
-template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian>::memory_access_cache(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *root_read,
- handler_entry_write<Width, AddrShift, Endian> *root_write)
- : m_space(space),
- m_addrmask(space.addrmask()),
- m_addrstart_r(1),
- m_addrend_r(0),
- m_addrstart_w(1),
- m_addrend_w(0),
- m_cache_r(nullptr),
- m_cache_w(nullptr),
- m_root_read(root_read),
- m_root_write(root_write)
-{
- m_notifier_id = space.add_change_notifier([this](read_or_write mode) {
- if(u32(mode) & u32(read_or_write::READ)) {
- m_addrend_r = 0;
- m_addrstart_r = 1;
- m_cache_r = nullptr;
- }
- if(u32(mode) & u32(read_or_write::WRITE)) {
- m_addrend_w = 0;
- m_addrstart_w = 1;
- m_cache_w = nullptr;
- }
- });
-}
-
-
-//-------------------------------------------------
-// ~memory_access_cache - destructor
-//-------------------------------------------------
-
-template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian>::~memory_access_cache()
-{
- m_space.remove_change_notifier(m_notifier_id);
-}
-
-
-template class memory_access_cache<0, 1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<0, 1, ENDIANNESS_BIG>;
-template class memory_access_cache<0, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<0, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<1, 3, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, 3, ENDIANNESS_BIG>;
-template class memory_access_cache<1, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<1, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<1, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<2, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<2, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<2, -2, ENDIANNESS_LITTLE>;
-template class memory_access_cache<2, -2, ENDIANNESS_BIG>;
-template class memory_access_cache<3, 0, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, 0, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -1, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -1, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -2, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -2, ENDIANNESS_BIG>;
-template class memory_access_cache<3, -3, ENDIANNESS_LITTLE>;
-template class memory_access_cache<3, -3, ENDIANNESS_BIG>;
-
-
-
-//**************************************************************************
// MEMORY BLOCK
//**************************************************************************
diff --git a/src/emu/emumem.h b/src/emu/emumem.h
index 995a09a1606..4554bea5ed6 100644
--- a/src/emu/emumem.h
+++ b/src/emu/emumem.h
@@ -438,6 +438,16 @@ template<> struct handler_entry_size<3> { using uX = u64; };
// =====================-> Address segmentation for the search tree
+constexpr int handler_entry_dispatch_level(int highbits)
+{
+ return (highbits > 48) ? 3 : (highbits > 32) ? 2 : (highbits > 14) ? 1 : 0;
+}
+
+constexpr int handler_entry_dispatch_level_to_lowbits(int level, int width, int ashift)
+{
+ return level == 3 ? 48 : level == 2 ? 32 : level == 1 ? 14 : width + ashift;
+}
+
constexpr int handler_entry_dispatch_lowbits(int highbits, int width, int ashift)
{
return (highbits > 48) ? 48 :
@@ -451,7 +461,7 @@ constexpr int handler_entry_dispatch_lowbits(int highbits, int width, int ashift
// ======================> memory_units_descritor forwards declaration
-template<int Width, int AddrShift, int Endian> class memory_units_descriptor;
+template<int Width, int AddrShift, endianness_t Endian> class memory_units_descriptor;
@@ -463,7 +473,7 @@ class handler_entry
{
DISABLE_COPYING(handler_entry);
- template<int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
+ template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
public:
// Typing flags
@@ -535,9 +545,9 @@ protected:
// Provides the populate/read/get_ptr/lookup API
-template<int Width, int AddrShift, int Endian> class handler_entry_read_passthrough;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_passthrough;
-template<int Width, int AddrShift, int Endian> class handler_entry_read : public handler_entry
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read : public handler_entry
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -553,7 +563,7 @@ public:
handler_entry_read(address_space *space, u32 flags) : handler_entry(space, flags) {}
~handler_entry_read() {}
- virtual uX read(offs_t offset, uX mem_mask) = 0;
+ virtual uX read(offs_t offset, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const;
@@ -599,16 +609,16 @@ public:
virtual void detach(const std::unordered_set<handler_entry *> &handlers);
// Return the internal structures of the root dispatch
- virtual void get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const;
+ virtual const handler_entry_read<Width, AddrShift, Endian> *const *get_dispatch() const;
};
// =====================-> The parent class of all write handlers
// Provides the populate/write/get_ptr/lookup API
-template<int Width, int AddrShift, int Endian> class handler_entry_write_passthrough;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_passthrough;
-template<int Width, int AddrShift, int Endian> class handler_entry_write : public handler_entry
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write : public handler_entry
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -624,7 +634,7 @@ public:
handler_entry_write(address_space *space, u32 flags) : handler_entry(space, flags) {}
virtual ~handler_entry_write() {}
- virtual void write(offs_t offset, uX data, uX mem_mask) = 0;
+ virtual void write(offs_t offset, uX data, uX mem_mask) const = 0;
virtual void *get_ptr(offs_t offset) const;
virtual void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const;
@@ -671,14 +681,14 @@ public:
virtual void detach(const std::unordered_set<handler_entry *> &handlers);
// Return the internal structures of the root dispatch
- virtual void get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const;
+ virtual const handler_entry_write<Width, AddrShift, Endian> *const *get_dispatch() const;
};
// =====================-> Passthrough handler management structure
class memory_passthrough_handler
{
- template<int Width, int AddrShift, int Endian> friend class handler_entry_read_passthrough;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_write_passthrough;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_read_passthrough;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_write_passthrough;
public:
memory_passthrough_handler(address_space &space) : m_space(space) {}
@@ -695,8 +705,8 @@ private:
// =====================-> Forward declaration for address_space
-template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped;
-template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_unmapped;
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_unmapped;
// ======================> address offset -> byte offset
@@ -705,7 +715,7 @@ constexpr offs_t memory_offset_to_byte(offs_t offset, int AddrShift) { return Ad
// ======================> generic read/write decomposition routines
// generic direct read
-template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> typename emu::detail::handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename T> typename emu::detail::handler_entry_size<TargetWidth>::uX memory_read_generic(T rop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using TargetType = typename emu::detail::handler_entry_size<TargetWidth>::uX;
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
@@ -839,7 +849,7 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
}
// generic direct write
-template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian, int TargetWidth, bool Aligned, typename T> void memory_write_generic(T wop, offs_t address, typename emu::detail::handler_entry_size<TargetWidth>::uX data, typename emu::detail::handler_entry_size<TargetWidth>::uX mask)
{
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
@@ -964,15 +974,17 @@ template<int Width, int AddrShift, int Endian, int TargetWidth, bool Aligned, ty
// ======================> Direct dispatching
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX dispatch_read(offs_t mask, u8 shift, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX mem_mask, handler_entry_read<Width, AddrShift, Endian> *const *dispatch)
+template<int Level, int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX dispatch_read(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_read<Width, AddrShift, Endian> *const *dispatch)
{
- return dispatch[(offset >> shift) & mask]->read(offset, mem_mask);
+ static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
+ return dispatch[(offset & mask) >> LowBits]->read(offset, mem_mask);
}
-template<int Width, int AddrShift, int Endian> void dispatch_write(offs_t mask, u8 shift, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mem_mask, handler_entry_write<Width, AddrShift, Endian> *const *dispatch)
+template<int Level, int Width, int AddrShift, endianness_t Endian> void dispatch_write(offs_t mask, offs_t offset, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mem_mask, const handler_entry_write<Width, AddrShift, Endian> *const *dispatch)
{
- return dispatch[(offset >> shift) & mask]->write(offset, data, mem_mask);
+ static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_level_to_lowbits(Level, Width, AddrShift);
+ return dispatch[(offset & mask) >> LowBits]->write(offset, data, mem_mask);
}
@@ -980,21 +992,29 @@ template<int Width, int AddrShift, int Endian> void dispatch_write(offs_t mask,
// memory_access_specific does uncached but faster accesses by shortcutting the address_space virtual call
-template<int Width, int AddrShift, int Endian> class memory_access_specific
+namespace emu { namespace detail {
+
+template<int Level, int Width, int AddrShift, endianness_t Endian> class memory_access_specific
{
+ friend class ::address_space;
+
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
public:
// construction/destruction
- memory_access_specific(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *const *dispatch_read, u8 shift_read,
- handler_entry_write<Width, AddrShift, Endian> *const *dispatch_write, u8 shift_write);
-
+ memory_access_specific()
+ : m_space(nullptr),
+ m_addrmask(0),
+ m_dispatch_read(nullptr),
+ m_dispatch_write(nullptr)
+ {
+ }
- // getters
- address_space &space() const { return m_space; }
+ inline address_space &space() const {
+ return *m_space;
+ }
u8 read_byte(offs_t address) { return Width == 0 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 0, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xff); }
u16 read_word(offs_t address) { return Width == 1 ? read_native(address & ~NATIVE_MASK) : memory_read_generic<Width, AddrShift, Endian, 1, true>([this](offs_t offset, NativeType mask) -> NativeType { return read_native(offset, mask); }, address, 0xffff); }
@@ -1025,22 +1045,22 @@ public:
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
private:
- address_space & m_space;
+ address_space * m_space;
offs_t m_addrmask; // address mask
- handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
- handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
- u8 m_shift_read;
- u8 m_shift_write;
+ const handler_entry_read<Width, AddrShift, Endian> *const *m_dispatch_read;
+ const handler_entry_write<Width, AddrShift, Endian> *const *m_dispatch_write;
NativeType read_native(offs_t address, NativeType mask = ~NativeType(0)) {
- return dispatch_read<Width, AddrShift, Endian>(offs_t(-1), m_shift_read, address & m_addrmask, mask, m_dispatch_read);
+ return dispatch_read<Level, Width, AddrShift, Endian>(m_addrmask, address, mask, m_dispatch_read);;
}
void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0)) {
- dispatch_write<Width, AddrShift, Endian>(offs_t(-1), m_shift_write, address & m_addrmask, data, mask, m_dispatch_write);
+ dispatch_write<Level, Width, AddrShift, Endian>(m_addrmask, address, data, mask, m_dispatch_write);;
}
+
+ void set(address_space *space, std::pair<const void *, const void *> rw);
};
@@ -1048,23 +1068,32 @@ private:
// ======================> memory_access_cache
// memory_access_cache contains state data for cached access
-template<int Width, int AddrShift, int Endian> class memory_access_cache
+template<int Width, int AddrShift, endianness_t Endian> class memory_access_cache
{
+ friend class ::address_space;
+
using NativeType = typename emu::detail::handler_entry_size<Width>::uX;
static constexpr u32 NATIVE_BYTES = 1 << Width;
static constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? (1 << (Width + AddrShift)) - 1 : 0;
public:
// construction/destruction
- memory_access_cache(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *root_read,
- handler_entry_write<Width, AddrShift, Endian> *root_write);
+ memory_access_cache()
+ : m_space(nullptr),
+ m_addrmask(0),
+ m_addrstart_r(1),
+ m_addrend_r(0),
+ m_addrstart_w(1),
+ m_addrend_w(0),
+ m_cache_r(nullptr),
+ m_cache_w(nullptr),
+ m_root_read(nullptr),
+ m_root_write(nullptr)
+ {
+ }
~memory_access_cache();
- // getters
- address_space &space() const { return m_space; }
-
// see if an address is within bounds, update it if not
void check_address_r(offs_t address) {
if(address >= m_addrstart_r && address <= m_addrend_r)
@@ -1080,6 +1109,10 @@ public:
// accessor methods
+ inline address_space &space() const {
+ return *m_space;
+ }
+
void *read_ptr(offs_t address) {
address &= m_addrmask;
check_address_r(address);
@@ -1115,7 +1148,7 @@ public:
void write_qword_unaligned(offs_t address, u64 data, u64 mask) { memory_write_generic<Width, AddrShift, Endian, 3, false>([this](offs_t offset, NativeType data, NativeType mask) { write_native(offset, data, mask); }, address, data, mask); }
private:
- address_space & m_space;
+ address_space * m_space;
int m_notifier_id; // id to remove the notifier on destruction
@@ -1124,7 +1157,7 @@ private:
offs_t m_addrend_r; // maximum valid address for reading
offs_t m_addrstart_w; // minimum valid address for writing
offs_t m_addrend_w; // maximum valid address for writing
- handler_entry_read<Width, AddrShift, Endian> *m_cache_r; // read cache
+ handler_entry_read <Width, AddrShift, Endian> *m_cache_r; // read cache
handler_entry_write<Width, AddrShift, Endian> *m_cache_w; // write cache
handler_entry_read <Width, AddrShift, Endian> *m_root_read; // decode tree roots
@@ -1132,9 +1165,23 @@ private:
NativeType read_native(offs_t address, NativeType mask = ~NativeType(0));
void write_native(offs_t address, NativeType data, NativeType mask = ~NativeType(0));
+
+ void set(address_space *space, std::pair<void *, void *> rw);
+};
+}}
+
+
+// ======================> memory_access cache/specific type dispatcher
+
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> struct memory_access {
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
+
+ using cache = emu::detail::memory_access_cache<Width, AddrShift, Endian>;
+ using specific = emu::detail::memory_access_specific<Level, Width, AddrShift, Endian>;
};
+
// ======================> address_space_config
// describes an address space and provides basic functions to map addresses to bytes
@@ -1190,9 +1237,8 @@ class address_space
{
friend class memory_bank;
friend class memory_block;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_read_unmapped;
- template<int Width, int AddrShift, int Endian> friend class handler_entry_write_unmapped;
- template<int Width, int AddrShift, int Endian> friend class memory_access_cache;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_read_unmapped;
+ template<int Width, int AddrShift, endianness_t Endian> friend class handler_entry_write_unmapped;
struct notifier_t {
std::function<void (read_or_write)> m_notifier;
@@ -1212,7 +1258,7 @@ public:
int spacenum() const { return m_spacenum; }
address_map *map() const { return m_map.get(); }
- template<int Width, int AddrShift, int Endian> memory_access_cache<Width, AddrShift, Endian> *cache() {
+ template<int Width, int AddrShift, endianness_t Endian> void cache(emu::detail::memory_access_cache<Width, AddrShift, Endian> &v) {
if(AddrShift != m_config.addr_shift())
fatalerror("Requesting cache() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
if(8 << Width != m_config.data_width())
@@ -1221,19 +1267,21 @@ public:
fatalerror("Requesting cache() with endianness %s while the config says %s\n",
endianness_names[Endian], endianness_names[m_config.endianness()]);
- return static_cast<memory_access_cache<Width, AddrShift, Endian> *>(create_cache());
+ v.set(this, get_cache_info());
}
- template<int Width, int AddrShift, int Endian> memory_access_specific<Width, AddrShift, Endian> *specific() {
+ template<int Level, int Width, int AddrShift, endianness_t Endian> void specific(emu::detail::memory_access_specific<Level, Width, AddrShift, Endian> &v) {
+ if(Level != emu::detail::handler_entry_dispatch_level(m_config.addr_width()))
+ fatalerror("Requesting specific() with wrong level, bad address witdh (the config says %d\n", m_config.addr_width());
if(AddrShift != m_config.addr_shift())
- fatalerror("Requesting cache() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
+ fatalerror("Requesting specific() with address shift %d while the config says %d\n", AddrShift, m_config.addr_shift());
if(8 << Width != m_config.data_width())
- fatalerror("Requesting cache() with data width %d while the config says %d\n", 8 << Width, m_config.data_width());
+ fatalerror("Requesting specific() with data width %d while the config says %d\n", 8 << Width, m_config.data_width());
if(Endian != m_config.endianness())
- fatalerror("Requesting cache() with endianness %s while the config says %s\n",
+ fatalerror("Requesting spefific() with endianness %s while the config says %s\n",
endianness_names[Endian], endianness_names[m_config.endianness()]);
- return static_cast<memory_access_specific<Width, AddrShift, Endian> *>(create_specific());
+ v.set(this, get_specific_info());
}
int add_change_notifier(std::function<void (read_or_write)> n);
@@ -1551,13 +1599,13 @@ public:
void allocate_memory();
void locate_memory();
- template<int Width, int AddrShift, int Endian> handler_entry_read_unmapped <Width, AddrShift, Endian> *get_unmap_r() const { return static_cast<handler_entry_read_unmapped <Width, AddrShift, Endian> *>(m_unmap_r); }
- template<int Width, int AddrShift, int Endian> handler_entry_write_unmapped<Width, AddrShift, Endian> *get_unmap_w() const { return static_cast<handler_entry_write_unmapped<Width, AddrShift, Endian> *>(m_unmap_w); }
+ template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_unmapped <Width, AddrShift, Endian> *get_unmap_r() const { return static_cast<handler_entry_read_unmapped <Width, AddrShift, Endian> *>(m_unmap_r); }
+ template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_unmapped<Width, AddrShift, Endian> *get_unmap_w() const { return static_cast<handler_entry_write_unmapped<Width, AddrShift, Endian> *>(m_unmap_w); }
protected:
// internal helpers
- virtual void *create_cache() = 0;
- virtual void *create_specific() = 0;
+ virtual std::pair<void *, void *> get_cache_info() = 0;
+ virtual std::pair<const void *, const void *> get_specific_info() = 0;
void populate_map_entry(const address_map_entry &entry, read_or_write readorwrite);
virtual void unmap_generic(offs_t addrstart, offs_t addrend, offs_t addrmirror, read_or_write readorwrite, bool quiet) = 0;
@@ -1797,7 +1845,7 @@ private:
class memory_manager
{
friend class address_space;
- template<int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
+ template<int Level, int Width, int AddrShift, endianness_t Endian> friend class address_space_specific;
friend memory_region::memory_region(running_machine &machine, const char *name, u32 length, u8 width, endianness_t endian);
public:
// construction/destruction
@@ -1913,14 +1961,19 @@ private:
#define QWORD_ALIGNED(a) (((a) & 7) == 0)
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX memory_access_cache<Width, AddrShift, Endian>::read_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian>
+typename emu::detail::handler_entry_size<Width>::uX
+emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+read_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX mask)
{
address &= m_addrmask;
check_address_r(address);
return m_cache_r->read(address, mask);
}
-template<int Width, int AddrShift, int Endian> void memory_access_cache<Width, AddrShift, Endian>::write_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+write_native(offs_t address, typename emu::detail::handler_entry_size<Width>::uX data, typename emu::detail::handler_entry_size<Width>::uX mask)
{
address &= m_addrmask;
check_address_w(address);
@@ -1932,16 +1985,47 @@ void memory_passthrough_handler::remove()
m_space.remove_passthrough(m_handlers);
}
-template<int Width, int AddrShift, int Endian> memory_access_specific<Width, AddrShift, Endian>::memory_access_specific(address_space &space,
- handler_entry_read <Width, AddrShift, Endian> *const *dispatch_read, u8 shift_read,
- handler_entry_write<Width, AddrShift, Endian> *const *dispatch_write, u8 shift_write)
- : m_space(space),
- m_addrmask(space.addrmask()),
- m_dispatch_read(dispatch_read),
- m_dispatch_write(dispatch_write),
- m_shift_read(shift_read),
- m_shift_write(shift_write)
+
+template<int Level, int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_specific<Level, Width, AddrShift, Endian>::
+set(address_space *space, std::pair<const void *, const void *> rw)
+{
+ m_space = space;
+ m_addrmask = space->addrmask();
+ m_dispatch_read = (const handler_entry_read <Width, AddrShift, Endian> *const *)(rw.first);
+ m_dispatch_write = (const handler_entry_write<Width, AddrShift, Endian> *const *)(rw.second);
+}
+
+
+template<int Width, int AddrShift, endianness_t Endian>
+void emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+set(address_space *space, std::pair<void *, void *> rw)
+{
+ m_space = space;
+ m_addrmask = space->addrmask();
+
+ m_notifier_id = space->add_change_notifier([this](read_or_write mode) {
+ if(u32(mode) & u32(read_or_write::READ)) {
+ m_addrend_r = 0;
+ m_addrstart_r = 1;
+ m_cache_r = nullptr;
+ }
+ if(u32(mode) & u32(read_or_write::WRITE)) {
+ m_addrend_w = 0;
+ m_addrstart_w = 1;
+ m_cache_w = nullptr;
+ }
+ });
+ m_root_read = (handler_entry_read <Width, AddrShift, Endian> *)(rw.first);
+ m_root_write = (handler_entry_write<Width, AddrShift, Endian> *)(rw.second);
+}
+
+template<int Width, int AddrShift, endianness_t Endian>
+emu::detail::memory_access_cache<Width, AddrShift, Endian>::
+~memory_access_cache()
{
+ if(m_space)
+ m_space->remove_change_notifier(m_notifier_id);
}
#endif /* MAME_EMU_EMUMEM_H */
diff --git a/src/emu/emumem_hea.h b/src/emu/emumem_hea.h
index 2dfb4eb2426..d7120ea0fd8 100644
--- a/src/emu/emumem_hea.h
+++ b/src/emu/emumem_hea.h
@@ -5,7 +5,7 @@
// parent class for final handlers which want an address base and a mask
-template<int Width, int AddrShift, int Endian> class handler_entry_read_address : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_address : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -22,7 +22,7 @@ protected:
offs_t m_address_base, m_address_mask;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_address : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_address : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
diff --git a/src/emu/emumem_hedp.cpp b/src/emu/emumem_hedp.cpp
index ccaa4ed650e..9a71f98184b 100644
--- a/src/emu/emumem_hedp.cpp
+++ b/src/emu/emumem_hedp.cpp
@@ -5,142 +5,142 @@
#include "emumem_hea.h"
#include "emumem_hedp.h"
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8_delegate>::value ||
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8m_delegate>::value ||
std::is_same<R, read16m_delegate>::value ||
std::is_same<R, read32m_delegate>::value ||
std::is_same<R, read64m_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8mo_delegate>::value ||
std::is_same<R, read16mo_delegate>::value ||
std::is_same<R, read32mo_delegate>::value ||
std::is_same<R, read64mo_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate(*inh::m_space);
}
-template<int Width, int AddrShift, int Endian, typename READ> template<typename R>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
- typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask)
+ typename emu::detail::handler_entry_size<Width>::uX> handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read_impl(offs_t offset, uX mem_mask) const
{
return m_delegate();
}
-template<int Width, int AddrShift, int Endian, typename READ> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian, typename READ> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_delegate<Width, AddrShift, Endian, READ>::read(offs_t offset, uX mem_mask) const
{
return read_impl<READ>(offset, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, Endian, READ>::name() const
+template<int Width, int AddrShift, endianness_t Endian, typename READ> std::string handler_entry_read_delegate<Width, AddrShift, Endian, READ>::name() const
{
return m_delegate.name();
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8_delegate>::value ||
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8m_delegate>::value ||
std::is_same<W, write16m_delegate>::value ||
std::is_same<W, write32m_delegate>::value ||
std::is_same<W, write64m_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift), data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8mo_delegate>::value ||
std::is_same<W, write16mo_delegate>::value ||
std::is_same<W, write32mo_delegate>::value ||
std::is_same<W, write64mo_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(*inh::m_space, data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> template<typename W>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
- void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask)
+ void> handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write_impl(offs_t offset, uX data, uX mem_mask) const
{
m_delegate(data);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> void handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> void handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::write(offs_t offset, uX data, uX mem_mask) const
{
write_impl<WRITE>(offset, data, mem_mask);
}
-template<int Width, int AddrShift, int Endian, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::name() const
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> std::string handler_entry_write_delegate<Width, AddrShift, Endian, WRITE>::name() const
{
return m_delegate.name();
}
@@ -148,22 +148,22 @@ template<int Width, int AddrShift, int Endian, typename WRITE> std::string handl
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_ioport<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return m_port->read();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_ioport<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_ioport<Width, AddrShift, Endian>::name() const
{
return m_port->tag();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_ioport<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_ioport<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
m_port->write(data, mem_mask);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_ioport<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_ioport<Width, AddrShift, Endian>::name() const
{
return m_port->tag();
}
diff --git a/src/emu/emumem_hedp.h b/src/emu/emumem_hedp.h
index 37b47747d61..3cd1c646f17 100644
--- a/src/emu/emumem_hedp.h
+++ b/src/emu/emumem_hedp.h
@@ -5,7 +5,7 @@
// Executes an access through called a delegate, usually containing a handler or a lambda
-template<int Width, int AddrShift, int Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian, typename READ> class handler_entry_read_delegate : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_delegate(address_space *space, const READ &delegate) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
~handler_entry_read_delegate() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -26,45 +26,45 @@ private:
std::is_same<R, read16_delegate>::value ||
std::is_same<R, read32_delegate>::value ||
std::is_same<R, read64_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8m_delegate>::value ||
std::is_same<R, read16m_delegate>::value ||
std::is_same<R, read32m_delegate>::value ||
std::is_same<R, read64m_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8s_delegate>::value ||
std::is_same<R, read16s_delegate>::value ||
std::is_same<R, read32s_delegate>::value ||
std::is_same<R, read64s_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8sm_delegate>::value ||
std::is_same<R, read16sm_delegate>::value ||
std::is_same<R, read32sm_delegate>::value ||
std::is_same<R, read64sm_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8mo_delegate>::value ||
std::is_same<R, read16mo_delegate>::value ||
std::is_same<R, read32mo_delegate>::value ||
std::is_same<R, read64mo_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
template<typename R>
std::enable_if_t<std::is_same<R, read8smo_delegate>::value ||
std::is_same<R, read16smo_delegate>::value ||
std::is_same<R, read32smo_delegate>::value ||
std::is_same<R, read64smo_delegate>::value,
- uX> read_impl(offs_t offset, uX mem_mask);
+ uX> read_impl(offs_t offset, uX mem_mask) const;
};
-template<int Width, int AddrShift, int Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian, typename WRITE> class handler_entry_write_delegate : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -73,7 +73,7 @@ public:
handler_entry_write_delegate(address_space *space, const WRITE &delegate) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_delegate(delegate) {}
~handler_entry_write_delegate() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
@@ -85,42 +85,42 @@ private:
std::is_same<W, write16_delegate>::value ||
std::is_same<W, write32_delegate>::value ||
std::is_same<W, write64_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8m_delegate>::value ||
std::is_same<W, write16m_delegate>::value ||
std::is_same<W, write32m_delegate>::value ||
std::is_same<W, write64m_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8s_delegate>::value ||
std::is_same<W, write16s_delegate>::value ||
std::is_same<W, write32s_delegate>::value ||
std::is_same<W, write64s_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8sm_delegate>::value ||
std::is_same<W, write16sm_delegate>::value ||
std::is_same<W, write32sm_delegate>::value ||
std::is_same<W, write64sm_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8mo_delegate>::value ||
std::is_same<W, write16mo_delegate>::value ||
std::is_same<W, write32mo_delegate>::value ||
std::is_same<W, write64mo_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
template<typename W>
std::enable_if_t<std::is_same<W, write8smo_delegate>::value ||
std::is_same<W, write16smo_delegate>::value ||
std::is_same<W, write32smo_delegate>::value ||
std::is_same<W, write64smo_delegate>::value,
- void> write_impl(offs_t offset, uX data, uX mem_mask);
+ void> write_impl(offs_t offset, uX data, uX mem_mask) const;
};
@@ -128,7 +128,7 @@ private:
// Accesses an ioport
-template<int Width, int AddrShift, int Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_ioport : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -137,7 +137,7 @@ public:
handler_entry_read_ioport(address_space *space, ioport_port *port) : handler_entry_read<Width, AddrShift, Endian>(space, 0), m_port(port) {}
~handler_entry_read_ioport() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -145,7 +145,7 @@ private:
ioport_port *m_port;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_ioport : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -154,7 +154,7 @@ public:
handler_entry_write_ioport(address_space *space, ioport_port *port) : handler_entry_write<Width, AddrShift, Endian>(space, 0), m_port(port) {}
~handler_entry_write_ioport() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_hedr.h b/src/emu/emumem_hedr.h
index 90dfab6d130..30e819bd990 100644
--- a/src/emu/emumem_hedr.h
+++ b/src/emu/emumem_hedr.h
@@ -5,7 +5,7 @@
// dispatches an access among multiple handlers indexed on part of the address
-template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_read_dispatch : public handler_entry_read<Width, AddrShift, Endian>
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> class handler_entry_read_dispatch : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler);
~handler_entry_read_dispatch();
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const override;
@@ -35,9 +35,10 @@ public:
void enumerate_references(handler_entry::reflist &refs) const override;
- virtual void get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const override;
+ virtual const handler_entry_read<Width, AddrShift, Endian> *const *get_dispatch() const override;
protected:
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_lowbits(HighBits, Width, AddrShift);
static constexpr u32 BITCOUNT = HighBits > LowBits ? HighBits - LowBits : 0;
static constexpr u32 COUNT = 1 << BITCOUNT;
diff --git a/src/emu/emumem_hedr.ipp b/src/emu/emumem_hedr.ipp
index 1f4484d0a15..844cae6dd90 100644
--- a/src/emu/emumem_hedr.ipp
+++ b/src/emu/emumem_hedr.ipp
@@ -9,13 +9,12 @@
#include "emumem_hep.h"
#include "emumem_hedr.h"
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch(handler_entry_read<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> const handler_entry_read<Width, AddrShift, Endian> *const *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch() const
{
- dispatch = m_dispatch;
- shift = LowBits;
+ return m_dispatch;
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_read_dispatch(address_space *space, const handler_entry::range &init, handler_entry_read<Width, AddrShift, Endian> *handler) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
{
if (!handler)
handler = space->get_unmap_r<Width, AddrShift, Endian>();
@@ -26,19 +25,19 @@ template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_read_dispatch()
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_read_dispatch()
{
for(unsigned int i=0; i != COUNT; i++)
m_dispatch[i]->unref();
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(unsigned int i=0; i != COUNT; i++)
refs.add(m_dispatch[i]);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
{
offs_t cur = map.empty() ? 0 : map.back().end + 1;
offs_t base = cur & UPMASK;
@@ -53,22 +52,22 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
- return dispatch_read<Width, AddrShift, Endian>(BITMASK, LowBits, offset, mem_mask, m_dispatch);
+ return dispatch_read<Level, Width, AddrShift, Endian>(HIGHMASK, offset, mem_mask, m_dispatch);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
- return m_dispatch[(offset >> LowBits) & BITMASK]->get_ptr(offset);
+ return m_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);
}
-template<int HighBits, int Width, int AddrShift, int Endian> std::string handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::name() const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::name() const
{
return "dispatch";
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_read<Width, AddrShift, Endian> *&handler) const
{
offs_t slot = (address >> LowBits) & BITMASK;
auto h = m_dispatch[slot];
@@ -81,7 +80,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
{
while(--start >= 0) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -94,7 +93,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
{
while(++start < COUNT) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -107,7 +106,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -120,7 +119,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read<Width, AddrShift, Endian> *handler)
{
offs_t start_entry = start >> LowBits;
offs_t end_entry = end >> LowBits;
@@ -167,7 +166,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -181,7 +180,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read<Width, AddrShift, Endian> *handler)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -212,7 +211,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
{
u8 ukey = descriptor.rkey_to_ukey(rkey);
handler_entry_read<Width, AddrShift, Endian> *original = target->is_units() ? target : nullptr;
@@ -235,7 +234,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -248,7 +247,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
offs_t start_entry = start >> LowBits;
offs_t end_entry = end >> LowBits;
@@ -307,7 +306,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -320,7 +319,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -348,7 +347,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_read<Width, AddrShift, Endian> *&target)
{
handler_entry_read<Width, AddrShift, Endian> *original = target;
handler_entry_read<Width, AddrShift, Endian> *replacement = nullptr;
@@ -366,7 +365,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -379,7 +378,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -422,7 +421,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -435,7 +434,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_read_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -462,7 +461,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_read_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
for(unsigned int i=0; i != COUNT; i++) {
if(m_dispatch[i]->is_dispatch()) {
diff --git a/src/emu/emumem_hedw.h b/src/emu/emumem_hedw.h
index d0986893d6e..219b51d89f7 100644
--- a/src/emu/emumem_hedw.h
+++ b/src/emu/emumem_hedw.h
@@ -5,7 +5,7 @@
// dispatches an access among multiple handlers indexed on part of the address
-template<int HighBits, int Width, int AddrShift, int Endian> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift, Endian>
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> class handler_entry_write_dispatch : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler);
~handler_entry_write_dispatch();
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
void lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const override;
@@ -35,9 +35,10 @@ public:
void enumerate_references(handler_entry::reflist &refs) const override;
- virtual void get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const override;
+ virtual const handler_entry_write<Width, AddrShift, Endian> *const *get_dispatch() const override;
protected:
+ static constexpr int Level = emu::detail::handler_entry_dispatch_level(HighBits);
static constexpr u32 LowBits = emu::detail::handler_entry_dispatch_lowbits(HighBits, Width, AddrShift);
static constexpr u32 BITCOUNT = HighBits > LowBits ? HighBits - LowBits : 0;
static constexpr u32 COUNT = 1 << BITCOUNT;
diff --git a/src/emu/emumem_hedw.ipp b/src/emu/emumem_hedw.ipp
index 23b0c70572b..3e12c702864 100644
--- a/src/emu/emumem_hedw.ipp
+++ b/src/emu/emumem_hedw.ipp
@@ -10,13 +10,12 @@
#include "emumem_hedw.h"
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch(handler_entry_write<Width, AddrShift, Endian> *const *&dispatch, u8 &shift) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> const handler_entry_write<Width, AddrShift, Endian> *const *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_dispatch() const
{
- dispatch = m_dispatch;
- shift = LowBits;
+ return m_dispatch;
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler) : handler_entry_write<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::handler_entry_write_dispatch(address_space *space, const handler_entry::range &init, handler_entry_write<Width, AddrShift, Endian> *handler) : handler_entry_write<Width, AddrShift, Endian>(space, handler_entry::F_DISPATCH)
{
if (!handler)
handler = space->get_unmap_w<Width, AddrShift, Endian>();
@@ -27,19 +26,19 @@ template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_write_dispatch()
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::~handler_entry_write_dispatch()
{
for(unsigned int i=0; i != COUNT; i++)
m_dispatch[i]->unref();
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(unsigned int i=0; i != COUNT; i++)
refs.add(m_dispatch[i]);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::dump_map(std::vector<memory_entry> &map) const
{
offs_t cur = map.empty() ? 0 : map.back().end + 1;
offs_t base = cur & UPMASK;
@@ -53,22 +52,22 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
} while(cur && !((cur ^ base) & UPMASK));
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
- dispatch_write<Width, AddrShift, Endian>(BITMASK, LowBits, offset, data, mem_mask, m_dispatch);
+ dispatch_write<Level, Width, AddrShift, Endian>(HIGHMASK, offset, data, mem_mask, m_dispatch);
}
-template<int HighBits, int Width, int AddrShift, int Endian> void *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
- return m_dispatch[(offset >> LowBits) & BITMASK]->get_ptr(offset);
+ return m_dispatch[(offset & HIGHMASK) >> LowBits]->get_ptr(offset);
}
-template<int HighBits, int Width, int AddrShift, int Endian> std::string handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::name() const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::name() const
{
return "dispatch";
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::lookup(offs_t address, offs_t &start, offs_t &end, handler_entry_write<Width, AddrShift, Endian> *&handler) const
{
offs_t slot = (address >> LowBits) & BITMASK;
auto h = m_dispatch[slot];
@@ -81,7 +80,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_before(offs_t address, int start)
{
while(--start >= 0) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -94,7 +93,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::range_cut_after(offs_t address, int start)
{
while(++start < COUNT) {
if(int(LowBits) > -AddrShift && m_dispatch[start]->is_dispatch()) {
@@ -107,7 +106,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -120,7 +119,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write<Width, AddrShift, Endian> *handler)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -168,7 +167,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -181,7 +180,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write<Width, AddrShift, Endian> *handler)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -212,7 +211,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::mismatched_patch(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
{
u8 ukey = descriptor.rkey_to_ukey(rkey);
handler_entry_write<Width, AddrShift, Endian> *original = target->is_units() ? target : nullptr;
@@ -235,7 +234,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -248,7 +247,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 rkey, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -307,7 +306,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -320,7 +319,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_mismatched_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -348,7 +347,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::passthrough_patch(handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings, handler_entry_write<Width, AddrShift, Endian> *&target)
{
handler_entry_write<Width, AddrShift, Endian> *original = target;
handler_entry_write<Width, AddrShift, Endian> *replacement = nullptr;
@@ -366,7 +365,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
target = replacement;
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -379,7 +378,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_nomirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t start_entry = (start & HIGHMASK) >> LowBits;
offs_t end_entry = (end & HIGHMASK) >> LowBits;
@@ -426,7 +425,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror_subdispatch(offs_t entry, offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
auto cur = m_dispatch[entry];
if(cur->is_dispatch())
@@ -439,7 +438,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::populate_passthrough_mirror(offs_t start, offs_t end, offs_t ostart, offs_t oend, offs_t mirror, handler_entry_write_passthrough<Width, AddrShift, Endian> *handler, std::vector<mapping> &mappings)
{
offs_t hmirror = mirror & HIGHMASK;
offs_t lmirror = mirror & LOWMASK;
@@ -466,7 +465,7 @@ template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_
}
}
-template<int HighBits, int Width, int AddrShift, int Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int HighBits, int Width, int AddrShift, endianness_t Endian> void handler_entry_write_dispatch<HighBits, Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
for(unsigned int i=0; i != COUNT; i++) {
if(m_dispatch[i]->is_dispatch()) {
diff --git a/src/emu/emumem_hem.cpp b/src/emu/emumem_hem.cpp
index 1a2963951f1..741a2c649b4 100644
--- a/src/emu/emumem_hem.cpp
+++ b/src/emu/emumem_hem.cpp
@@ -5,44 +5,44 @@
#include "emumem_hea.h"
#include "emumem_hem.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return m_base[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return m_base + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_memory<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_memory<Width, AddrShift, Endian>::name() const
{
return util::string_format("memory@%x", inh::m_address_base);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_memory<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_memory<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift);
m_base[off] = (m_base[off] & ~mem_mask) | (data & mem_mask);
}
-template<> void handler_entry_write_memory<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask) const
{
m_base[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<> void handler_entry_write_memory<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask) const
{
m_base[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_memory<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return m_base + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_memory<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_memory<Width, AddrShift, Endian>::name() const
{
return util::string_format("memory@%x", inh::m_address_base);
}
@@ -51,44 +51,44 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_m
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_memory_bank<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return static_cast<uX *>(m_bank.base())[((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift)];
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_read_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_read_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return static_cast<uX *>(m_bank.base()) + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_memory_bank<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_memory_bank<Width, AddrShift, Endian>::name() const
{
return m_bank.name();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_memory_bank<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_memory_bank<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
offs_t off = ((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift);
static_cast<uX *>(m_bank.base())[off] = (static_cast<uX *>(m_bank.base())[off] & ~mem_mask) | (data & mem_mask);
}
-template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_LITTLE>::write(offs_t offset, u8 data, u8 mem_mask) const
{
static_cast<uX *>(m_bank.base())[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask)
+template<> void handler_entry_write_memory_bank<0, 0, ENDIANNESS_BIG>::write(offs_t offset, u8 data, u8 mem_mask) const
{
static_cast<uX *>(m_bank.base())[(offset - inh::m_address_base) & inh::m_address_mask] = data;
}
-template<int Width, int AddrShift, int Endian> void *handler_entry_write_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
+template<int Width, int AddrShift, endianness_t Endian> void *handler_entry_write_memory_bank<Width, AddrShift, Endian>::get_ptr(offs_t offset) const
{
return static_cast<uX *>(m_bank.base()) + (((offset - inh::m_address_base) & inh::m_address_mask) >> (Width + AddrShift));
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_memory_bank<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_memory_bank<Width, AddrShift, Endian>::name() const
{
return m_bank.name();
}
diff --git a/src/emu/emumem_hem.h b/src/emu/emumem_hem.h
index 184c752625c..1d076ebc51b 100644
--- a/src/emu/emumem_hem.h
+++ b/src/emu/emumem_hem.h
@@ -5,7 +5,7 @@
// Accesses fixed memory (non-banked rom or ram)
-template<int Width, int AddrShift, int Endian> class handler_entry_read_memory : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_memory : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_memory(address_space *space) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_memory() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
inline void set_base(uX *base) { m_base = base; }
@@ -25,7 +25,7 @@ private:
uX *m_base;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_memory : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_memory : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -34,7 +34,7 @@ public:
handler_entry_write_memory(address_space *space) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_memory() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
inline void set_base(uX *base) { m_base = base; }
@@ -50,7 +50,7 @@ private:
// Accesses banked memory, associated to a memory_bank
-template<int Width, int AddrShift, int Endian> class handler_entry_read_memory_bank : public handler_entry_read_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_memory_bank : public handler_entry_read_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -59,7 +59,7 @@ public:
handler_entry_read_memory_bank(address_space *space, memory_bank &bank) : handler_entry_read_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}
~handler_entry_read_memory_bank() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
std::string name() const override;
@@ -68,7 +68,7 @@ private:
memory_bank &m_bank;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_memory_bank : public handler_entry_write_address<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_memory_bank : public handler_entry_write_address<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -77,7 +77,7 @@ public:
handler_entry_write_memory_bank(address_space *space, memory_bank &bank) : handler_entry_write_address<Width, AddrShift, Endian>(space, 0), m_bank(bank) {}
~handler_entry_write_memory_bank() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
void *get_ptr(offs_t offset) const override;
std::string name() const override;
diff --git a/src/emu/emumem_hep.cpp b/src/emu/emumem_hep.cpp
index f411dcb522c..25b54142d3e 100644
--- a/src/emu/emumem_hep.cpp
+++ b/src/emu/emumem_hep.cpp
@@ -4,7 +4,7 @@
#include "emu.h"
#include "emumem_hep.h"
-template<int Width, int AddrShift, int Endian> handler_entry_read_passthrough<Width, AddrShift, Endian>::~handler_entry_read_passthrough()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_passthrough<Width, AddrShift, Endian>::~handler_entry_read_passthrough()
{
if(m_next) {
m_mph.remove_handler(this);
@@ -12,7 +12,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_passthrough<Wi
}
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
if(!m_next->is_passthrough())
return;
@@ -27,7 +27,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_read_passthrou
np->detach(handlers);
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_passthrough<Width, AddrShift, Endian>::~handler_entry_write_passthrough()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_passthrough<Width, AddrShift, Endian>::~handler_entry_write_passthrough()
{
if(m_next) {
m_mph.remove_handler(this);
@@ -35,7 +35,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_passthrough<W
}
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_passthrough<Width, AddrShift, Endian>::detach(const std::unordered_set<handler_entry *> &handlers)
{
if(!m_next->is_passthrough())
return;
diff --git a/src/emu/emumem_hep.h b/src/emu/emumem_hep.h
index 0b166d77698..08b453c9fb0 100644
--- a/src/emu/emumem_hep.h
+++ b/src/emu/emumem_hep.h
@@ -5,7 +5,7 @@
// parent class for handlers which want to tap the access and usually pass it on to another handler
-template<int Width, int AddrShift, int Endian> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_passthrough : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -26,7 +26,7 @@ protected:
handler_entry_read_passthrough(address_space *space, memory_passthrough_handler &mph, handler_entry_read<Width, AddrShift, Endian> *next) : handler_entry_read<Width, AddrShift, Endian>(space, handler_entry::F_PASSTHROUGH), m_mph(mph), m_next(next) { next->ref(); mph.add_handler(this); }
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_passthrough : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
diff --git a/src/emu/emumem_het.cpp b/src/emu/emumem_het.cpp
index 571b8246eac..2d2f818e770 100644
--- a/src/emu/emumem_het.cpp
+++ b/src/emu/emumem_het.cpp
@@ -5,7 +5,7 @@
#include "emumem_hep.h"
#include "emumem_het.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_tap<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
this->ref();
@@ -16,18 +16,18 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return data;
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_tap<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_tap<Width, AddrShift, Endian>::name() const
{
return '(' + m_name + ") " + inh::m_next->name();
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_tap<Width, AddrShift, Endian> *handler_entry_read_tap<Width, AddrShift, Endian>::instantiate(handler_entry_read<Width, AddrShift, Endian> *next) const
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_tap<Width, AddrShift, Endian> *handler_entry_read_tap<Width, AddrShift, Endian>::instantiate(handler_entry_read<Width, AddrShift, Endian> *next) const
{
return new handler_entry_read_tap<Width, AddrShift, Endian>(inh::m_space, inh::m_mph, next, m_name, m_tap);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_tap<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_tap<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
@@ -37,13 +37,13 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_tap<Widt
this->unref();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_tap<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_tap<Width, AddrShift, Endian>::name() const
{
return '(' + m_name + ") " + inh::m_next->name();
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_tap<Width, AddrShift, Endian> *handler_entry_write_tap<Width, AddrShift, Endian>::instantiate(handler_entry_write<Width, AddrShift, Endian> *next) const
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_tap<Width, AddrShift, Endian> *handler_entry_write_tap<Width, AddrShift, Endian>::instantiate(handler_entry_write<Width, AddrShift, Endian> *next) const
{
return new handler_entry_write_tap<Width, AddrShift, Endian>(inh::m_space, inh::m_mph, next, m_name, m_tap);
}
diff --git a/src/emu/emumem_het.h b/src/emu/emumem_het.h
index 274aa138403..2e788108896 100644
--- a/src/emu/emumem_het.h
+++ b/src/emu/emumem_het.h
@@ -5,7 +5,7 @@
// handler which tap on a bus access and possibly change the data value through a std::function
-template<int Width, int AddrShift, int Endian> class handler_entry_read_tap : public handler_entry_read_passthrough<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_tap : public handler_entry_read_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,7 +14,7 @@ public:
handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_read_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}
~handler_entry_read_tap() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -27,7 +27,7 @@ protected:
handler_entry_read_tap(address_space *space, memory_passthrough_handler &mph, handler_entry_read<Width, AddrShift, Endian> *next, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_read_passthrough<Width, AddrShift, Endian>(space, mph, next), m_name(name), m_tap(tap) {}
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_tap : public handler_entry_write_passthrough<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_tap : public handler_entry_write_passthrough<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -36,7 +36,7 @@ public:
handler_entry_write_tap(address_space *space, memory_passthrough_handler &mph, std::string name, std::function<void (offs_t offset, uX &data, uX mem_mask)> tap) : handler_entry_write_passthrough<Width, AddrShift, Endian>(space, mph), m_name(name), m_tap(std::move(tap)) {}
~handler_entry_write_tap() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_heu.cpp b/src/emu/emumem_heu.cpp
index 7000f77dc25..42cc8c3f83c 100644
--- a/src/emu/emumem_heu.cpp
+++ b/src/emu/emumem_heu.cpp
@@ -7,7 +7,7 @@
#include "emumem_heu.h"
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
handler_entry_read<Width, AddrShift, Endian>(space, inh::F_UNITS),
m_subunits(0)
{
@@ -16,7 +16,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, A
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src) :
handler_entry_read<Width, AddrShift, Endian>(src->m_space, inh::F_UNITS),
m_subunits(0)
{
@@ -36,19 +36,19 @@ template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, A
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_read_units<Width, AddrShift, Endian>::~handler_entry_read_units()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_read_units<Width, AddrShift, Endian>::~handler_entry_read_units()
{
for(u32 i=0; i != m_subunits; i++)
m_subunit_infos[i].m_handler->unref();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(u32 i=0; i != m_subunits; i++)
refs.add(m_subunit_infos[i].m_handler);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_read_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
{
handler_entry *handler = descriptor.get_subunit_handler();
handler->ref(entries.size());
@@ -60,7 +60,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_read_units<Wid
}
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_units<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
this->ref();
@@ -98,7 +98,7 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return result;
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;
@@ -109,7 +109,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_read_un
return util::string_format("%d-%d", end, start);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_units<Width, AddrShift, Endian>::name() const
{
std::string result;
@@ -126,7 +126,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_read_un
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, address_space *space) :
handler_entry_write<Width, AddrShift, Endian>(space, inh::F_UNITS),
m_subunits(0)
{
@@ -135,7 +135,7 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width,
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src) :
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src) :
handler_entry_write<Width, AddrShift, Endian>(src->m_space, inh::F_UNITS),
m_subunits(0)
{
@@ -155,19 +155,19 @@ template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width,
std::sort(m_subunit_infos, m_subunit_infos + m_subunits, [](const subunit_info &a, const subunit_info &b) { return a.m_offset < b.m_offset; });
}
-template<int Width, int AddrShift, int Endian> handler_entry_write_units<Width, AddrShift, Endian>::~handler_entry_write_units()
+template<int Width, int AddrShift, endianness_t Endian> handler_entry_write_units<Width, AddrShift, Endian>::~handler_entry_write_units()
{
for(u32 i=0; i != m_subunits; i++)
m_subunit_infos[i].m_handler->unref();
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::enumerate_references(handler_entry::reflist &refs) const
{
for(u32 i=0; i != m_subunits; i++)
refs.add(m_subunit_infos[i].m_handler);
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::fill(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, const std::vector<typename memory_units_descriptor<Width, AddrShift, Endian>::entry> &entries)
{
handler_entry *handler = descriptor.get_subunit_handler();
handler->ref(entries.size());
@@ -175,7 +175,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Wi
m_subunit_infos[m_subunits++] = subunit_info{ handler, e.m_amask, e.m_dmask, e.m_ashift, e.m_offset, e.m_dshift, descriptor.get_subunit_width(), descriptor.get_subunit_endian() };
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_units<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
this->ref();
@@ -212,7 +212,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_units<Wi
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::m2r(typename emu::detail::handler_entry_size<Width>::uX mask)
{
constexpr u32 mbits = 8*sizeof(uX);
u32 start, end;
@@ -223,7 +223,7 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_u
return util::string_format("%d-%d", end, start);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_units<Width, AddrShift, Endian>::name() const
{
std::string result;
diff --git a/src/emu/emumem_heu.h b/src/emu/emumem_heu.h
index dbc0cf064f7..d084fddfe98 100644
--- a/src/emu/emumem_heu.h
+++ b/src/emu/emumem_heu.h
@@ -5,7 +5,7 @@
// merges/splits an access among multiple handlers (unitmask support)
-template<int Width, int AddrShift, int Endian> class handler_entry_read_units : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_units : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -15,7 +15,7 @@ public:
handler_entry_read_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_read_units *src);
~handler_entry_read_units();
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
@@ -46,7 +46,7 @@ private:
static std::string m2r(uX mask);
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_units : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_units : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -56,7 +56,7 @@ public:
handler_entry_write_units(const memory_units_descriptor<Width, AddrShift, Endian> &descriptor, u8 ukey, const handler_entry_write_units<Width, AddrShift, Endian> *src);
~handler_entry_write_units();
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
diff --git a/src/emu/emumem_heun.cpp b/src/emu/emumem_heun.cpp
index c25d77bbd33..ff1899d686e 100644
--- a/src/emu/emumem_heun.cpp
+++ b/src/emu/emumem_heun.cpp
@@ -5,7 +5,7 @@
#include "emumem_hea.h"
#include "emumem_heun.h"
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_unmapped<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
if (inh::m_space->log_unmap() && !inh::m_space->m_manager.machine().side_effects_disabled())
inh::m_space->device().logerror(inh::m_space->is_octal()
@@ -17,13 +17,13 @@ template<int Width, int AddrShift, int Endian> typename emu::detail::handler_ent
return inh::m_space->unmap();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_unmapped<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_unmapped<Width, AddrShift, Endian>::name() const
{
return "unmapped";
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_unmapped<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_unmapped<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)const
{
if (inh::m_space->log_unmap() && !inh::m_space->m_manager.machine().side_effects_disabled())
inh::m_space->device().logerror(inh::m_space->is_octal()
@@ -35,7 +35,7 @@ template<int Width, int AddrShift, int Endian> void handler_entry_write_unmapped
2 << Width, mem_mask);
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_unmapped<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_unmapped<Width, AddrShift, Endian>::name() const
{
return "unmapped";
}
@@ -43,22 +43,22 @@ template<int Width, int AddrShift, int Endian> std::string handler_entry_write_u
-template<int Width, int AddrShift, int Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> typename emu::detail::handler_entry_size<Width>::uX handler_entry_read_nop<Width, AddrShift, Endian>::read(offs_t offset, uX mem_mask) const
{
return inh::m_space->unmap();
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_read_nop<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_read_nop<Width, AddrShift, Endian>::name() const
{
return "nop";
}
-template<int Width, int AddrShift, int Endian> void handler_entry_write_nop<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask)
+template<int Width, int AddrShift, endianness_t Endian> void handler_entry_write_nop<Width, AddrShift, Endian>::write(offs_t offset, uX data, uX mem_mask) const
{
}
-template<int Width, int AddrShift, int Endian> std::string handler_entry_write_nop<Width, AddrShift, Endian>::name() const
+template<int Width, int AddrShift, endianness_t Endian> std::string handler_entry_write_nop<Width, AddrShift, Endian>::name() const
{
return "nop";
}
diff --git a/src/emu/emumem_heun.h b/src/emu/emumem_heun.h
index 02a79d825ab..4e76e4cb531 100644
--- a/src/emu/emumem_heun.h
+++ b/src/emu/emumem_heun.h
@@ -5,7 +5,7 @@
// Logs an unmapped access
-template<int Width, int AddrShift, int Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_unmapped : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -14,12 +14,12 @@ public:
handler_entry_read_unmapped(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_unmapped() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_unmapped : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -28,7 +28,7 @@ public:
handler_entry_write_unmapped(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_unmapped() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
};
@@ -39,7 +39,7 @@ public:
// Drops an unmapped access silently
-template<int Width, int AddrShift, int Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_read_nop : public handler_entry_read<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -48,12 +48,12 @@ public:
handler_entry_read_nop(address_space *space) : handler_entry_read<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_read_nop() = default;
- uX read(offs_t offset, uX mem_mask) override;
+ uX read(offs_t offset, uX mem_mask) const override;
std::string name() const override;
};
-template<int Width, int AddrShift, int Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
+template<int Width, int AddrShift, endianness_t Endian> class handler_entry_write_nop : public handler_entry_write<Width, AddrShift, Endian>
{
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
@@ -62,7 +62,7 @@ public:
handler_entry_write_nop(address_space *space) : handler_entry_write<Width, AddrShift, Endian>(space, 0) {}
~handler_entry_write_nop() = default;
- void write(offs_t offset, uX data, uX mem_mask) override;
+ void write(offs_t offset, uX data, uX mem_mask) const override;
std::string name() const override;
};
diff --git a/src/emu/emumem_mud.cpp b/src/emu/emumem_mud.cpp
index 2fff5649b62..8359dd8224e 100644
--- a/src/emu/emumem_mud.cpp
+++ b/src/emu/emumem_mud.cpp
@@ -35,7 +35,7 @@ template<> u8 mask_to_ukey<u64>(u64 mask)
(mask & 0x00000000000000ff ? 0x01 : 0x00);
}
-template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename emu::detail::handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
+template<int Width, int AddrShift, endianness_t Endian> memory_units_descriptor<Width, AddrShift, Endian>::memory_units_descriptor(u8 access_width, u8 access_endian, handler_entry *handler, offs_t addrstart, offs_t addrend, offs_t mask, typename emu::detail::handler_entry_size<Width>::uX unitmask, int cswidth) : m_handler(handler), m_access_width(access_width), m_access_endian(access_endian)
{
u32 bits_per_access = 8 << access_width;
constexpr u32 NATIVE_MASK = Width + AddrShift >= 0 ? make_bitmask<u32>(Width + AddrShift) : 0;
@@ -86,7 +86,7 @@ template<int Width, int AddrShift, int Endian> memory_units_descriptor<Width, Ad
generate(m_keymap[i], unitmask, umasks[i], cswidth, bits_per_access, base_shift, shift, active_count);
}
-template<int Width, int AddrShift, int Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename emu::detail::handler_entry_size<Width>::uX gumask, typename emu::detail::handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
+template<int Width, int AddrShift, endianness_t Endian> void memory_units_descriptor<Width, AddrShift, Endian>::generate(u8 ukey, typename emu::detail::handler_entry_size<Width>::uX gumask, typename emu::detail::handler_entry_size<Width>::uX umask, u32 cswidth, u32 bits_per_access, u8 base_shift, s8 shift, u32 active_count)
{
auto &entries = m_entries_for_key[ukey];
diff --git a/src/emu/emumem_mud.h b/src/emu/emumem_mud.h
index b5347ee82e2..a25ec7051a5 100644
--- a/src/emu/emumem_mud.h
+++ b/src/emu/emumem_mud.h
@@ -3,7 +3,7 @@
// Descriptors for subunit support
-template<int Width, int AddrShift, int Endian> class memory_units_descriptor {
+template<int Width, int AddrShift, endianness_t Endian> class memory_units_descriptor {
public:
using uX = typename emu::detail::handler_entry_size<Width>::uX;
diff --git a/src/mame/audio/m72.cpp b/src/mame/audio/m72.cpp
index a98cd163a49..0581361c649 100644
--- a/src/mame/audio/m72.cpp
+++ b/src/mame/audio/m72.cpp
@@ -51,7 +51,7 @@ DEFINE_DEVICE_TYPE(IREM_M72_AUDIO, m72_audio_device, "m72_audio", "Irem M72 Audi
m72_audio_device::m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, IREM_M72_AUDIO, tag, owner, clock)
- , device_rom_interface(mconfig, *this, 32) // unknown address bits
+ , device_rom_interface(mconfig, *this)
, m_sample_addr(0)
, m_dac(*this, finder_base::DUMMY_TAG)
{
diff --git a/src/mame/audio/m72.h b/src/mame/audio/m72.h
index 798cacad3c8..be4a31ce2fb 100644
--- a/src/mame/audio/m72.h
+++ b/src/mame/audio/m72.h
@@ -10,9 +10,10 @@
#pragma once
+#include "dirom.h"
#include "sound/dac.h"
-class m72_audio_device : public device_t, public device_rom_interface
+class m72_audio_device : public device_t, public device_rom_interface<32> // unknown address bits
{
public:
m72_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
diff --git a/src/mame/audio/seibu.cpp b/src/mame/audio/seibu.cpp
index 25debce9fc1..798338a29a6 100644
--- a/src/mame/audio/seibu.cpp
+++ b/src/mame/audio/seibu.cpp
@@ -314,7 +314,7 @@ DEFINE_DEVICE_TYPE(SEI80BU, sei80bu_device, "sei80bu", "SEI80BU Encrypted Z80 In
sei80bu_device::sei80bu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, SEI80BU, tag, owner, clock),
- device_rom_interface(mconfig, *this, 16)
+ device_rom_interface(mconfig, *this)
{
}
diff --git a/src/mame/audio/seibu.h b/src/mame/audio/seibu.h
index 496ec89a84e..396f4612d0b 100644
--- a/src/mame/audio/seibu.h
+++ b/src/mame/audio/seibu.h
@@ -31,6 +31,7 @@
#include "cpu/z80/z80.h"
#include "sound/okiadpcm.h"
+#include "dirom.h"
class seibu_sound_common {
public:
@@ -110,7 +111,7 @@ DECLARE_DEVICE_TYPE(SEIBU_SOUND, seibu_sound_device)
// SEI80BU (Z80 program decryption)
-class sei80bu_device : public device_t, public device_rom_interface
+class sei80bu_device : public device_t, public device_rom_interface<16>
{
public:
sei80bu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/mame/audio/turrett.cpp b/src/mame/audio/turrett.cpp
index 823e7ede161..34b0866399e 100644
--- a/src/mame/audio/turrett.cpp
+++ b/src/mame/audio/turrett.cpp
@@ -44,7 +44,7 @@ device_memory_interface::space_config_vector turrett_device::memory_space_config
void turrett_device::device_start()
{
// Find our direct access
- m_cache = space().cache<1, 0, ENDIANNESS_LITTLE>();
+ space().cache(m_cache);
// Create the sound stream
m_stream = machine().sound().stream_alloc(*this, 0, 2, 44100);
@@ -106,7 +106,7 @@ void turrett_device::sound_stream_update(sound_stream &stream, stream_sample_t *
for (int s = 0; s < samples; ++s)
{
- int16_t sample = m_cache->read_word(addr << 1);
+ int16_t sample = m_cache.read_word(addr << 1);
if ((uint16_t)sample == 0x8000)
{
diff --git a/src/mame/audio/wswan.cpp b/src/mame/audio/wswan.cpp
index a7cb1ab1ceb..8089d01a6d1 100644
--- a/src/mame/audio/wswan.cpp
+++ b/src/mame/audio/wswan.cpp
@@ -32,7 +32,7 @@ DEFINE_DEVICE_TYPE(WSWAN_SND, wswan_sound_device, "wswan_sound", "WonderSwan Cus
wswan_sound_device::wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, WSWAN_SND, tag, owner, clock),
device_sound_interface(mconfig, *this),
- device_rom_interface(mconfig, *this, 14),
+ device_rom_interface(mconfig, *this),
m_channel(nullptr),
m_sweep_step(0),
m_sweep_time(0),
diff --git a/src/mame/audio/wswan.h b/src/mame/audio/wswan.h
index 3e39081ad57..a23655e0b0b 100644
--- a/src/mame/audio/wswan.h
+++ b/src/mame/audio/wswan.h
@@ -11,6 +11,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -20,7 +21,7 @@
class wswan_sound_device : public device_t,
public device_sound_interface,
- public device_rom_interface
+ public device_rom_interface<14>
{
public:
wswan_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
diff --git a/src/mame/drivers/galgames.cpp b/src/mame/drivers/galgames.cpp
index 4f7a4e2f1d3..a96793e50dd 100644
--- a/src/mame/drivers/galgames.cpp
+++ b/src/mame/drivers/galgames.cpp
@@ -48,6 +48,7 @@ Notes:
#include "emupal.h"
#include "screen.h"
#include "speaker.h"
+#include "dirom.h"
/***************************************************************************
@@ -67,7 +68,7 @@ DECLARE_DEVICE_TYPE(GALGAMES_SLOT, galgames_slot_device)
// CART declaration
-class galgames_cart_device : public device_t, public device_rom_interface
+class galgames_cart_device : public device_t, public device_rom_interface<21, 1, 0, ENDIANNESS_BIG>
{
public:
// construction/destruction
@@ -313,7 +314,7 @@ galgames_cart_device::galgames_cart_device(
device_t *owner,
u32 clock):
device_t(mconfig, type, tag, owner, clock),
- device_rom_interface(mconfig, *this, 21, ENDIANNESS_BIG, 16),
+ device_rom_interface(mconfig, *this),
m_cart(0),
m_slot(*this, "^slot"),
m_eeprom(*this, "eeprom"),
diff --git a/src/mame/drivers/mindset.cpp b/src/mame/drivers/mindset.cpp
index cffba194b09..279ad92bbf8 100644
--- a/src/mame/drivers/mindset.cpp
+++ b/src/mame/drivers/mindset.cpp
@@ -330,7 +330,7 @@ protected:
required_device<dac_byte_interface> m_dac;
required_device_array<mindset_module, 6> m_modules;
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_gcps;
+ memory_access<20, 1, 0, ENDIANNESS_LITTLE>::cache m_gcps;
floppy_image_device *m_floppy[2];
u32 m_palette[16];
@@ -450,7 +450,7 @@ void mindset_state::machine_start()
m_yellow_led.resolve();
m_green_led.resolve();
- m_gcps = m_maincpu->space(AS_PROGRAM).cache<1, 0, ENDIANNESS_LITTLE>();
+ m_maincpu->space(AS_PROGRAM).cache(m_gcps);
for(int i=0; i<2; i++)
m_floppy[i] = m_fdco[i]->get_device();
@@ -1000,20 +1000,20 @@ u16 (*const mindset_state::gcp_blend[8])(u16, u16) = {
void mindset_state::blit(u16 packet_seg, u16 packet_adr)
{
- u16 mode = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 0) & 0xffff)));
- u16 src_adr = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 2) & 0xffff)));
- u16 src_sft = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 4) & 0xffff)));
- u16 dst_adr = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 6) & 0xffff)));
- u16 dst_sft = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 8) & 0xffff)));
- u16 width = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 10) & 0xffff)));
- u16 height = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 12) & 0xffff)));
- u16 sy = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 14) & 0xffff)));
- u16 dy = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 16) & 0xffff)));
- u16 rmask = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 18) & 0xffff)));
- u16 src_seg = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 20) & 0xffff)));
- u16 dst_seg = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 22) & 0xffff)));
- u16 wmask = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 24) & 0xffff)));
- u16 kmask = sw(m_gcps->read_word((packet_seg << 4) + ((packet_adr + 26) & 0xffff)));
+ u16 mode = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 0) & 0xffff)));
+ u16 src_adr = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 2) & 0xffff)));
+ u16 src_sft = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 4) & 0xffff)));
+ u16 dst_adr = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 6) & 0xffff)));
+ u16 dst_sft = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 8) & 0xffff)));
+ u16 width = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 10) & 0xffff)));
+ u16 height = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 12) & 0xffff)));
+ u16 sy = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 14) & 0xffff)));
+ u16 dy = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 16) & 0xffff)));
+ u16 rmask = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 18) & 0xffff)));
+ u16 src_seg = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 20) & 0xffff)));
+ u16 dst_seg = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 22) & 0xffff)));
+ u16 wmask = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 24) & 0xffff)));
+ u16 kmask = sw(m_gcps.read_word((packet_seg << 4) + ((packet_adr + 26) & 0xffff)));
// -f-w wnpi ktxm mm--
// f = fast (pure word copy)
@@ -1040,9 +1040,9 @@ void mindset_state::blit(u16 packet_seg, u16 packet_adr)
if(mode & 0x200) {
// pattern fill
- u16 src = m_gcps->read_word((src_seg << 4) + src_adr);
+ u16 src = m_gcps.read_word((src_seg << 4) + src_adr);
for(u16 w=0; w != width/2; w++) {
- m_gcps->write_word((dst_seg << 4) + dst_adr, src);
+ m_gcps.write_word((dst_seg << 4) + dst_adr, src);
dst_adr += 2;
}
@@ -1053,7 +1053,7 @@ void mindset_state::blit(u16 packet_seg, u16 packet_adr)
u16 src_cadr = src_adr;
u16 dst_cadr = dst_adr;
for(u32 w=0; w!=nw; w++) {
- m_gcps->write_word((dst_seg << 4) + dst_cadr, m_gcps->read_word((src_seg << 4) + src_cadr));
+ m_gcps.write_word((dst_seg << 4) + dst_cadr, m_gcps.read_word((src_seg << 4) + src_cadr));
src_cadr += 2;
dst_cadr += 2;
}
@@ -1095,14 +1095,14 @@ void mindset_state::blit(u16 packet_seg, u16 packet_adr)
u16 nw1 = nw;
u32 srcs = 0;
if(preload) {
- srcs = sw(m_gcps->read_word((src_seg << 4) + src_cadr)) << src_do_sft;
+ srcs = sw(m_gcps.read_word((src_seg << 4) + src_cadr)) << src_do_sft;
if(mode & 0x100)
src_cadr += 2;
}
do {
- srcs = (srcs << 16) | (sw(m_gcps->read_word((src_seg << 4) + src_cadr)) << src_do_sft);
+ srcs = (srcs << 16) | (sw(m_gcps.read_word((src_seg << 4) + src_cadr)) << src_do_sft);
u16 src = (srcs >> dst_do_sft) & rmask;
- u16 dst = sw(m_gcps->read_word((dst_seg << 4) + dst_cadr));
+ u16 dst = sw(m_gcps.read_word((dst_seg << 4) + dst_cadr));
u16 res = blend(src, dst);
if(mode & 0x40) {
u16 tmask;
@@ -1132,7 +1132,7 @@ void mindset_state::blit(u16 packet_seg, u16 packet_adr)
res = (dst & ~cmask) | (res & cmask);
- m_gcps->write_word((dst_seg << 4) + dst_cadr, sw(res));
+ m_gcps.write_word((dst_seg << 4) + dst_cadr, sw(res));
if(mode & 0x100)
src_cadr += 2;
dst_cadr += 2;
@@ -1151,9 +1151,9 @@ void mindset_state::blit(u16 packet_seg, u16 packet_adr)
void mindset_state::gcp_w(u16)
{
- u16 packet_seg = sw(m_gcps->read_word(0xbfd7a));
- u16 packet_adr = sw(m_gcps->read_word(0xbfd78));
- u16 global_mode = sw(m_gcps->read_word(0xbfd76));
+ u16 packet_seg = sw(m_gcps.read_word(0xbfd7a));
+ u16 packet_adr = sw(m_gcps.read_word(0xbfd78));
+ u16 global_mode = sw(m_gcps.read_word(0xbfd76));
if(0)
logerror("GCP: start %04x:%04x mode %04x (%05x)\n", packet_seg, packet_adr, global_mode, m_maincpu->pc());
@@ -1166,7 +1166,7 @@ void mindset_state::gcp_w(u16)
}
// 100 = done, 200 = done too???, 400 = collision?
- m_gcps->write_word(0xbfd74, m_gcps->read_word(0xbfd74) | 0x0700);
+ m_gcps.write_word(0xbfd74, m_gcps.read_word(0xbfd74) | 0x0700);
// Can trigger an irq, on mode & 2 (or is it 200?) (0x40 on 8282, ack on 0x41, which means the system 8042...)
}
diff --git a/src/mame/drivers/sun4.cpp b/src/mame/drivers/sun4.cpp
index 45a53f5ead9..c227436a98a 100644
--- a/src/mame/drivers/sun4.cpp
+++ b/src/mame/drivers/sun4.cpp
@@ -612,7 +612,6 @@ protected:
required_device<ncr53c90a_device> m_scsi;
required_device<address_map_bank_device> m_type1space;
- memory_access_cache<2, 0, ENDIANNESS_BIG> *m_type1_cache;
required_device<ram_device> m_ram;
required_memory_region m_rom;
diff --git a/src/mame/includes/osborne1.h b/src/mame/includes/osborne1.h
index e06c6043604..6acd8efbbaa 100644
--- a/src/mame/includes/osborne1.h
+++ b/src/mame/includes/osborne1.h
@@ -57,8 +57,7 @@ public:
m_p_chargen(*this, "chargen"),
m_video_timer(nullptr),
m_tilemap(nullptr),
- m_acia_rxc_txc_timer(nullptr),
- m_mem_cache(nullptr)
+ m_acia_rxc_txc_timer(nullptr)
{
}
@@ -166,7 +165,7 @@ private:
u8 m_acia_rxc_txc_state;
emu_timer *m_acia_rxc_txc_timer;
- memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_mem_cache;
+ memory_access<16, 0, 0, ENDIANNESS_LITTLE>::cache m_mem_cache;
};
diff --git a/src/mame/includes/turrett.h b/src/mame/includes/turrett.h
index 4056d560f19..62df61202eb 100644
--- a/src/mame/includes/turrett.h
+++ b/src/mame/includes/turrett.h
@@ -129,7 +129,7 @@ protected:
const address_space_config m_space_config;
private:
- memory_access_cache<1, 0, ENDIANNESS_LITTLE> *m_cache;
+ memory_access<28, 1, 0, ENDIANNESS_LITTLE>::cache m_cache;
sound_stream *m_stream;
struct
diff --git a/src/mame/machine/315-5838_317-0229_comp.cpp b/src/mame/machine/315-5838_317-0229_comp.cpp
index 202e180145b..c87d7622484 100644
--- a/src/mame/machine/315-5838_317-0229_comp.cpp
+++ b/src/mame/machine/315-5838_317-0229_comp.cpp
@@ -38,7 +38,7 @@ DEFINE_DEVICE_TYPE(SEGA315_5838_COMP, sega_315_5838_comp_device, "sega315_5838",
sega_315_5838_comp_device::sega_315_5838_comp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, SEGA315_5838_COMP, tag, owner, clock),
- device_rom_interface(mconfig, *this, 23),
+ device_rom_interface(mconfig, *this),
m_hackmode(0)
{
}
diff --git a/src/mame/machine/315-5838_317-0229_comp.h b/src/mame/machine/315-5838_317-0229_comp.h
index 7f777c899b5..c5185ed9879 100644
--- a/src/mame/machine/315-5838_317-0229_comp.h
+++ b/src/mame/machine/315-5838_317-0229_comp.h
@@ -5,12 +5,14 @@
#pragma once
+#include "dirom.h"
+
// #define SEGA315_DUMP_DEBUG // dump stuff to files to help with decryption efforts
DECLARE_DEVICE_TYPE(SEGA315_5838_COMP, sega_315_5838_comp_device)
class sega_315_5838_comp_device : public device_t,
- public device_rom_interface
+ public device_rom_interface<23>
{
public:
// construction/destruction
diff --git a/src/mame/machine/6883sam.cpp b/src/mame/machine/6883sam.cpp
index 8209d479dd1..8e20c5e940d 100644
--- a/src/mame/machine/6883sam.cpp
+++ b/src/mame/machine/6883sam.cpp
@@ -83,10 +83,6 @@ sam6883_device::sam6883_device(const machine_config &mconfig, const char *tag, d
, m_io1_config("I/O1", ENDIANNESS_BIG, 8, 5, 0)
, m_io2_config("I/O2", ENDIANNESS_BIG, 8, 5, 0)
, m_boot_config("boot", ENDIANNESS_BIG, 8, 7, 0)
- , m_ram_space(nullptr)
- , m_rom_space{nullptr, nullptr, nullptr}
- , m_io_space{nullptr, nullptr, nullptr}
- , m_boot_space(nullptr)
{
}
@@ -126,12 +122,12 @@ device_memory_interface::space_config_vector sam6883_device::memory_space_config
void sam6883_device::device_start()
{
// get spaces
- m_ram_space = space(0).cache<0, 0, ENDIANNESS_BIG>();
+ space(0).cache(m_ram_space);
for (int i = 0; i < 3; i++)
- m_rom_space[i] = space(i + 1).cache<0, 0, ENDIANNESS_BIG>();
+ space(i + 1).cache(m_rom_space[i]);
for (int i = 0; i < 3; i++)
- m_io_space[i] = &space(i + 4);
- m_boot_space = space(7).cache<0, 0, ENDIANNESS_BIG>();
+ space(i + 4).specific(m_io_space[i]);
+ space(7).cache(m_boot_space);
// save state support
save_item(NAME(m_sam_state));
@@ -153,27 +149,27 @@ uint8_t sam6883_device::read(offs_t offset)
// RAM reads: 0000–7FFF or 0000–FEFF
if (mode_64k && (m_sam_state & (SAM_STATE_TY|SAM_STATE_P1)) == SAM_STATE_P1)
offset |= 0x8000;
- return m_ram_space->read_byte(offset);
+ return m_ram_space.read_byte(offset);
}
else if (offset < 0xc000 || offset >= 0xffe0)
{
// ROM spaces: 8000–9FFF and A000–BFFF + FFE0–FFFF
- return m_rom_space[BIT(offset, 13)]->read_byte(offset & 0x1fff);
+ return m_rom_space[BIT(offset, 13)].read_byte(offset & 0x1fff);
}
else if (offset < 0xff00)
{
// ROM2 space: C000–FEFF
- return m_rom_space[2]->read_byte(offset & 0x3fff);
+ return m_rom_space[2].read_byte(offset & 0x3fff);
}
else if (offset < 0xff60)
{
// I/O spaces: FF00–FF1F (slow), FF20–FF3F, FF40–FF5F
- return m_io_space[BIT(offset, 5, 2)]->read_byte(offset & 0x1f);
+ return m_io_space[BIT(offset, 5, 2)].read_byte(offset & 0x1f);
}
else
{
// FF60–FFDF
- return m_boot_space->read_byte(offset - 0xff60);
+ return m_boot_space.read_byte(offset - 0xff60);
}
}
@@ -190,31 +186,31 @@ void sam6883_device::write(offs_t offset, uint8_t data)
// RAM write space: 0000–7FFF (nominally space 7)
if (mode_64k && (m_sam_state & (SAM_STATE_TY|SAM_STATE_P1)) == SAM_STATE_P1)
offset |= 0x8000;
- m_ram_space->write_byte(offset, data);
+ m_ram_space.write_byte(offset, data);
}
else if (offset < 0xc000 || offset >= 0xffe0)
{
// ROM spaces: 8000–9FFF and A000–BFFF + FFE0–FFFF (may write through to RAM)
if (offset < 0xc000 && mode_64k && (m_sam_state & SAM_STATE_TY))
- m_ram_space->write_byte(offset, data);
- m_rom_space[BIT(offset, 13)]->write_byte(offset & 0x1fff, data);
+ m_ram_space.write_byte(offset, data);
+ m_rom_space[BIT(offset, 13)].write_byte(offset & 0x1fff, data);
}
else if (offset < 0xff00)
{
// ROM2 space: C000–FEFF (may write through to RAM)
if (mode_64k && (m_sam_state & SAM_STATE_TY))
- m_ram_space->write_byte(offset, data);
- m_rom_space[2]->write_byte(offset & 0x3fff, data);
+ m_ram_space.write_byte(offset, data);
+ m_rom_space[2].write_byte(offset & 0x3fff, data);
}
else if (offset < 0xff60)
{
// I/O spaces: FF00–FF1F (slow), FF20–FF3F, FF40–FF5F
- m_io_space[BIT(offset, 5, 2)]->write_byte(offset & 0x1f, data);
+ m_io_space[BIT(offset, 5, 2)].write_byte(offset & 0x1f, data);
}
else
{
// FF60–FFDF
- m_boot_space->write_byte(offset - 0xff60, data);
+ m_boot_space.write_byte(offset - 0xff60, data);
if (offset >= 0xffc0)
internal_write(offset & 0x1f, data);
}
diff --git a/src/mame/machine/6883sam.h b/src/mame/machine/6883sam.h
index f21140151f7..d3e7e725e8a 100644
--- a/src/mame/machine/6883sam.h
+++ b/src/mame/machine/6883sam.h
@@ -114,7 +114,7 @@ public:
if (bit3_carry)
counter_carry_bit3();
}
- return m_ram_space->read_byte(m_counter & m_counter_mask);
+ return m_ram_space.read_byte(m_counter & m_counter_mask);
}
DECLARE_WRITE_LINE_MEMBER( hs_w );
@@ -140,11 +140,10 @@ private:
address_space_config m_boot_config;
// memory spaces
- using memory_cache_8be = memory_access_cache<0, 0, ENDIANNESS_BIG>;
- memory_cache_8be * m_ram_space;
- memory_cache_8be * m_rom_space[3];
- address_space * m_io_space[3];
- memory_cache_8be * m_boot_space;
+ memory_access<16, 0, 0, ENDIANNESS_BIG>::cache m_ram_space;
+ memory_access<14, 0, 0, ENDIANNESS_BIG>::cache m_rom_space[3];
+ memory_access< 5, 0, 0, ENDIANNESS_BIG>::specific m_io_space[3];
+ memory_access< 7, 0, 0, ENDIANNESS_BIG>::cache m_boot_space;
uint16_t m_counter_mask;
// SAM state
diff --git a/src/mame/machine/bert.cpp b/src/mame/machine/bert.cpp
index 4311a861e65..b175a3efad7 100644
--- a/src/mame/machine/bert.cpp
+++ b/src/mame/machine/bert.cpp
@@ -16,7 +16,6 @@ DEFINE_DEVICE_TYPE(BERT, bert_device, "ncd_bert_asic", "NCD BERT ASIC")
bert_device::bert_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, BERT, tag, owner, clock)
, m_memory_space(*this, finder_base::DUMMY_TAG, 24, 16)
- , m_memory(nullptr)
{
}
@@ -27,7 +26,7 @@ void bert_device::device_start()
save_item(NAME(m_step));
save_item(NAME(m_qlc_mode));
save_item(NAME(m_qlc_src));
- m_memory = m_memory_space->cache<1, 0, ENDIANNESS_BIG>();
+ m_memory_space->cache(m_memory);
}
void bert_device::device_reset()
@@ -57,7 +56,7 @@ u16 bert_device::read(offs_t offset)
}
constexpr u16 type = 0x00ca;
- u16 data = m_memory->read_word(offset << 1);
+ u16 data = m_memory.read_word(offset << 1);
u16 res;
if(type & (1 << (((m_control >> 8) & 0xc) | m_step))) {
@@ -82,12 +81,12 @@ void bert_device::write(offs_t offset, u16 data, u16 mem_mask)
if(m_qlc_mode) {
u32 dest = offset << 1;
for(u32 i=0; i<512; i+=2)
- m_memory->write_word(dest + i, m_memory->read_word(m_qlc_src + i));
+ m_memory.write_word(dest + i, m_memory.read_word(m_qlc_src + i));
return;
}
m_step = 0;
- m_memory->write_word(offset << 1, data, mem_mask);
+ m_memory.write_word(offset << 1, data, mem_mask);
if(!offset) {
COMBINE_DATA(&m_control);
m_step = 0;
diff --git a/src/mame/machine/bert.h b/src/mame/machine/bert.h
index 628e8e8753e..410fbcf61c1 100644
--- a/src/mame/machine/bert.h
+++ b/src/mame/machine/bert.h
@@ -26,7 +26,7 @@ protected:
private:
required_address_space m_memory_space;
- memory_access_cache<1, 0, ENDIANNESS_BIG> *m_memory;
+ memory_access<24, 1, 0, ENDIANNESS_BIG>::cache m_memory;
u16 m_control;
u16 m_history;
diff --git a/src/mame/machine/c117.cpp b/src/mame/machine/c117.cpp
index 34bc20ccdaa..32904271278 100644
--- a/src/mame/machine/c117.cpp
+++ b/src/mame/machine/c117.cpp
@@ -58,10 +58,10 @@ void namco_c117_device::device_start()
{
m_subres_cb.resolve_safe();
- m_program = &space(AS_PROGRAM);
+ space(AS_PROGRAM).specific(m_program);
- m_cpucache[0] = m_cpuexec[0]->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>();
- m_cpucache[1] = m_cpuexec[1]->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>();
+ m_cpuexec[0]->space(AS_PROGRAM).cache(m_cpucache[0]);
+ m_cpuexec[1]->space(AS_PROGRAM).cache(m_cpucache[1]);
memset(&m_offsets, 0, sizeof(m_offsets));
m_subres = m_wdog = 0;
@@ -106,18 +106,18 @@ void namco_c117_device::device_add_mconfig(machine_config &config)
uint8_t namco_c117_device::main_r(offs_t offset)
{
- return m_program->read_byte(remap(0, offset));
+ return m_program.read_byte(remap(0, offset));
}
uint8_t namco_c117_device::sub_r(offs_t offset)
{
- return m_program->read_byte(remap(1, offset));
+ return m_program.read_byte(remap(1, offset));
}
void namco_c117_device::main_w(offs_t offset, uint8_t data)
{
if (offset < 0xe000)
- m_program->write_byte(remap(0, offset), data);
+ m_program.write_byte(remap(0, offset), data);
else
register_w(0, offset, data);
}
@@ -125,7 +125,7 @@ void namco_c117_device::main_w(offs_t offset, uint8_t data)
void namco_c117_device::sub_w(offs_t offset, uint8_t data)
{
if (offset < 0xe000)
- m_program->write_byte(remap(1, offset), data);
+ m_program.write_byte(remap(1, offset), data);
else
register_w(1, offset, data);
}
diff --git a/src/mame/machine/c117.h b/src/mame/machine/c117.h
index 2e5d56db2de..d41ee5fde5b 100644
--- a/src/mame/machine/c117.h
+++ b/src/mame/machine/c117.h
@@ -63,11 +63,11 @@ private:
// address space
const address_space_config m_program_config;
- address_space * m_program;
+ memory_access<23, 0, 0, ENDIANNESS_BIG>::specific m_program;
// cpu interfaces
required_device<cpu_device> m_cpuexec[2];
- memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cpucache[2];
+ memory_access<23, 0, 0, ENDIANNESS_BIG>::cache m_cpucache[2];
required_device<watchdog_timer_device> m_watchdog;
};
diff --git a/src/mame/machine/cammu.cpp b/src/mame/machine/cammu.cpp
index 3db37813700..1a2ceac6cd3 100644
--- a/src/mame/machine/cammu.cpp
+++ b/src/mame/machine/cammu.cpp
@@ -196,10 +196,10 @@ void cammu_c3_device::device_start()
tlb_set.u = false;
tlb_set.w.ra = tlb_set.w.va = 0;
- tlb_set.w.cache = m_memory[ST0].space->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_memory[ST0].space->cache(tlb_set.w.cache);
tlb_set.x.ra = tlb_set.x.va = 0;
- tlb_set.x.cache = m_memory[ST0].space->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_memory[ST0].space->cache(tlb_set.x.cache);
}
}
@@ -226,7 +226,7 @@ void cammu_device::set_spaces(address_space &main_space, address_space &io_space
m_memory[ST7].space = &main_space;
for (memory_t &memory : m_memory)
- memory.cache = memory.space->cache<2, 0, ENDIANNESS_LITTLE>();
+ memory.space->cache(memory.cache);
}
bool cammu_device::memory_translate(const u32 ssw, const int spacenum, const int intention, offs_t &address)
@@ -270,24 +270,24 @@ cammu_device::translated_t cammu_device::translate_address(const u32 ssw, const
switch (virtual_address & 0x7000)
{
// pages 0-3: main space pages 0-3
- case 0x0000: return { m_memory[ST1].cache, virtual_address & 0x3fff };
- case 0x1000: return { m_memory[ST2].cache, virtual_address & 0x3fff };
- case 0x2000: return { m_memory[ST3].cache, virtual_address & 0x3fff };
- case 0x3000: return { m_memory[ST3].cache, virtual_address & 0x3fff };
+ case 0x0000: return { &m_memory[ST1].cache, virtual_address & 0x3fff };
+ case 0x1000: return { &m_memory[ST2].cache, virtual_address & 0x3fff };
+ case 0x2000: return { &m_memory[ST3].cache, virtual_address & 0x3fff };
+ case 0x3000: return { &m_memory[ST3].cache, virtual_address & 0x3fff };
// pages 4-5: i/o space pages 0-1
- case 0x4000: return { m_memory[ST4].cache, virtual_address & 0x1fff };
- case 0x5000: return { m_memory[ST4].cache, virtual_address & 0x1fff };
+ case 0x4000: return { &m_memory[ST4].cache, virtual_address & 0x1fff };
+ case 0x5000: return { &m_memory[ST4].cache, virtual_address & 0x1fff };
// pages 6-7: boot space pages 0-1
- case 0x6000: return { m_memory[ST5].cache, virtual_address & 0x1fff };
- case 0x7000: return { m_memory[ST5].cache, virtual_address & 0x1fff };
+ case 0x6000: return { &m_memory[ST5].cache, virtual_address & 0x1fff };
+ case 0x7000: return { &m_memory[ST5].cache, virtual_address & 0x1fff };
}
}
// if not in mapped mode, use unmapped system tag
if ((ssw & SSW_M) == 0)
- return { m_memory[get_ust_space()].cache, virtual_address };
+ return { &m_memory[get_ust_space()].cache, virtual_address };
// get the page table entry
pte_t pte = get_pte(virtual_address, user);
@@ -343,16 +343,16 @@ cammu_device::translated_t cammu_device::translate_address(const u32 ssw, const
// set pte referenced and dirty flags
if ((mode & WRITE) && !(pte.entry & PTE_D))
- m_memory[ST0].cache->write_dword(pte.address, pte.entry | PTE_D | PTE_R);
+ m_memory[ST0].cache.write_dword(pte.address, pte.entry | PTE_D | PTE_R);
else if (!(pte.entry & PTE_R))
- m_memory[ST0].cache->write_dword(pte.address, pte.entry | PTE_R);
+ m_memory[ST0].cache.write_dword(pte.address, pte.entry | PTE_R);
// translate the address
LOGMASKED(LOG_DTU, "%s address translated 0x%08x\n", mode == EXECUTE ? "instruction" : "data",
(pte.entry & ~CAMMU_PAGE_MASK) | (virtual_address & CAMMU_PAGE_MASK));
// return the system tag and translated address
- return { m_memory[(pte.entry & PTE_ST) >> ST_SHIFT].cache, (pte.entry & ~CAMMU_PAGE_MASK) | (virtual_address & CAMMU_PAGE_MASK) };
+ return { &m_memory[(pte.entry & PTE_ST) >> ST_SHIFT].cache, (pte.entry & ~CAMMU_PAGE_MASK) | (virtual_address & CAMMU_PAGE_MASK) };
}
cammu_c3_device::tlb_line_t &cammu_c3_device::tlb_lookup(const bool user, const u32 virtual_address, const access_type mode)
@@ -425,24 +425,24 @@ cammu_device::translated_t cammu_c3_device::translate_address(const u32 ssw, con
switch (virtual_address & 0x7000)
{
// pages 0-3: main space pages 0-3
- case 0x0000: return { m_memory[ST1].cache, virtual_address & 0x3fff };
- case 0x1000: return { m_memory[ST2].cache, virtual_address & 0x3fff };
- case 0x2000: return { m_memory[ST3].cache, virtual_address & 0x3fff };
- case 0x3000: return { m_memory[ST3].cache, virtual_address & 0x3fff };
+ case 0x0000: return { &m_memory[ST1].cache, virtual_address & 0x3fff };
+ case 0x1000: return { &m_memory[ST2].cache, virtual_address & 0x3fff };
+ case 0x2000: return { &m_memory[ST3].cache, virtual_address & 0x3fff };
+ case 0x3000: return { &m_memory[ST3].cache, virtual_address & 0x3fff };
// pages 4-5: i/o space pages 0-1
- case 0x4000: return { m_memory[ST4].cache, virtual_address & 0x1fff };
- case 0x5000: return { m_memory[ST4].cache, virtual_address & 0x1fff };
+ case 0x4000: return { &m_memory[ST4].cache, virtual_address & 0x1fff };
+ case 0x5000: return { &m_memory[ST4].cache, virtual_address & 0x1fff };
// pages 6-7: boot space pages 0-1
- case 0x6000: return { m_memory[ST5].cache, virtual_address & 0x1fff };
- case 0x7000: return { m_memory[ST5].cache, virtual_address & 0x1fff };
+ case 0x6000: return { &m_memory[ST5].cache, virtual_address & 0x1fff };
+ case 0x7000: return { &m_memory[ST5].cache, virtual_address & 0x1fff };
}
}
// if not in mapped mode, use unmapped system tag
if ((ssw & SSW_M) == 0)
- return { m_memory[get_ust_space()].cache, virtual_address };
+ return { &m_memory[get_ust_space()].cache, virtual_address };
// check translation lookaside buffer
tlb_line_t &tlbl = tlb_lookup(user, virtual_address, mode);
@@ -519,7 +519,7 @@ cammu_device::translated_t cammu_c3_device::translate_address(const u32 ssw, con
if (!(pte.entry & PTE_D))
{
pte.entry |= PTE_D | PTE_R;
- m_memory[ST0].cache->write_dword(pte.address, pte.entry);
+ m_memory[ST0].cache.write_dword(pte.address, pte.entry);
}
tlbl.ra |= TLB_RA_D | TLB_RA_R;
@@ -536,7 +536,7 @@ cammu_device::translated_t cammu_c3_device::translate_address(const u32 ssw, con
if (!(pte.entry & PTE_R))
{
pte.entry |= PTE_R;
- m_memory[ST0].cache->write_dword(pte.address, pte.entry);
+ m_memory[ST0].cache.write_dword(pte.address, pte.entry);
}
tlbl.ra |= TLB_RA_R;
@@ -547,9 +547,9 @@ cammu_device::translated_t cammu_c3_device::translate_address(const u32 ssw, con
(tlbl.ra & TLB_RA_RA) | (virtual_address & CAMMU_PAGE_MASK));
if (tlbl.ra & 0x800)
- return { m_memory[(tlbl.ra & TLB_RA_ST) >> ST_SHIFT].cache, (tlbl.ra & TLB_RA_RA) | (virtual_address & CAMMU_PAGE_MASK) };
+ return { &m_memory[(tlbl.ra & TLB_RA_ST) >> ST_SHIFT].cache, (tlbl.ra & TLB_RA_RA) | (virtual_address & CAMMU_PAGE_MASK) };
else
- return { tlbl.cache, (tlbl.ra & TLB_RA_RA) | (virtual_address & CAMMU_PAGE_MASK) };
+ return { &tlbl.cache, (tlbl.ra & TLB_RA_RA) | (virtual_address & CAMMU_PAGE_MASK) };
}
// return the page table entry for a given virtual address
@@ -562,7 +562,7 @@ cammu_device::pte_t cammu_device::get_pte(const u32 va, const bool user)
const u32 ptdi = (va & VA_PTDI) >> 20;
// fetch page table directory entry
- const u32 ptde = m_memory[ST0].cache->read_dword(pdo | ptdi);
+ const u32 ptde = m_memory[ST0].cache.read_dword(pdo | ptdi);
LOGMASKED(LOG_DTU, "get_pte pdo 0x%08x ptdi 0x%08x ptde 0x%08x\n", pdo, ptdi, ptde);
@@ -577,7 +577,7 @@ cammu_device::pte_t cammu_device::get_pte(const u32 va, const bool user)
const u32 pti = (va & VA_PTI) >> 10;
// fetch page table entry
- pte_t pte = { m_memory[ST0].cache->read_dword(pto | pti), pto | pti };
+ pte_t pte = { m_memory[ST0].cache.read_dword(pto | pti), pto | pti };
LOGMASKED(LOG_DTU, "get_pte pto 0x%08x pti 0x%08x pte 0x%08x\n", pto, pti, pte.entry);
diff --git a/src/mame/machine/cammu.h b/src/mame/machine/cammu.h
index 1a600efa6cb..ea348221a12 100644
--- a/src/mame/machine/cammu.h
+++ b/src/mame/machine/cammu.h
@@ -227,7 +227,7 @@ protected:
struct translated_t
{
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *const cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache *const cache;
const u32 address;
};
@@ -240,7 +240,7 @@ protected:
struct memory_t
{
address_space *space;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache cache;
};
// address translation
@@ -562,7 +562,7 @@ private:
u32 ra; // real address field
u32 va; // virtual address field
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *cache;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache cache;
};
struct tlb_set_t
{
diff --git a/src/mame/machine/deco222.cpp b/src/mame/machine/deco222.cpp
index e4151943f9a..2e78dcbfdfd 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 bitswap<8>(cache->read_byte(adr) ,7,5,6,4,3,2,1,0);
+ return bitswap<8>(cprogram.read_byte(adr) ,7,5,6,4,3,2,1,0);
}
std::unique_ptr<util::disasm_interface> deco_222_device::create_disassembler()
@@ -68,7 +68,7 @@ void deco_c10707_device::device_reset()
uint8_t deco_c10707_device::mi_decrypt::read_sync(uint16_t adr)
{
- return bitswap<8>(cache->read_byte(adr) ,7,5,6,4,3,2,1,0);
+ return bitswap<8>(cprogram.read_byte(adr) ,7,5,6,4,3,2,1,0);
}
std::unique_ptr<util::disasm_interface> deco_c10707_device::create_disassembler()
diff --git a/src/mame/machine/decocpu6.cpp b/src/mame/machine/decocpu6.cpp
index 64729a28cf0..bc167c5e35f 100644
--- a/src/mame/machine/decocpu6.cpp
+++ b/src/mame/machine/decocpu6.cpp
@@ -31,9 +31,9 @@ void deco_cpu6_device::device_reset()
uint8_t deco_cpu6_device::mi_decrypt::read_sync(uint16_t adr)
{
if (adr&1)
- return bitswap<8>(cache->read_byte(adr),6,4,7,5,3,2,1,0);
+ return bitswap<8>(cprogram.read_byte(adr),6,4,7,5,3,2,1,0);
else
- return cache->read_byte(adr);
+ return cprogram.read_byte(adr);
}
std::unique_ptr<util::disasm_interface> deco_cpu6_device::create_disassembler()
diff --git a/src/mame/machine/decocpu7.cpp b/src/mame/machine/decocpu7.cpp
index 08c32625e89..7f90c30ff01 100644
--- a/src/mame/machine/decocpu7.cpp
+++ b/src/mame/machine/decocpu7.cpp
@@ -26,7 +26,7 @@ void deco_cpu7_device::device_reset()
uint8_t deco_cpu7_device::mi_decrypt::read_sync(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(had_written) {
had_written = false;
if((adr & 0x0104) == 0x0104)
@@ -37,7 +37,7 @@ uint8_t deco_cpu7_device::mi_decrypt::read_sync(uint16_t adr)
void deco_cpu7_device::mi_decrypt::write(uint16_t adr, uint8_t val)
{
- program->write_byte(adr, val);
+ program.write_byte(adr, val);
had_written = true;
}
diff --git a/src/mame/machine/interpro_ioga.cpp b/src/mame/machine/interpro_ioga.cpp
index 83ae60d551b..74e02917bd4 100644
--- a/src/mame/machine/interpro_ioga.cpp
+++ b/src/mame/machine/interpro_ioga.cpp
@@ -134,7 +134,6 @@ DEFINE_DEVICE_TYPE(SAPPHIRE_IOGA, sapphire_ioga_device, "ioga_s", "I/O Gate Arra
interpro_ioga_device::interpro_ioga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, m_memory_space(*this, finder_base::DUMMY_TAG, -1, 32)
- , m_memory(nullptr)
, m_out_nmi_func(*this)
, m_out_irq_func(*this)
, m_out_irq_vector_func(*this)
@@ -168,7 +167,7 @@ sapphire_ioga_device::sapphire_ioga_device(const machine_config &mconfig, const
void interpro_ioga_device::device_start()
{
- m_memory = m_memory_space->cache<2, 0, ENDIANNESS_LITTLE>();
+ m_memory_space->cache(m_memory);
// resolve callbacks
m_out_nmi_func.resolve();
@@ -694,9 +693,9 @@ TIMER_CALLBACK_MEMBER(interpro_ioga_device::dma)
{
// transfer from the memory to device or device to memory
if (dma_channel.control & DMA_CTRL_WRITE)
- dma_channel.device_w(m_memory->read_byte(dma_channel.real_address));
+ dma_channel.device_w(m_memory.read_byte(dma_channel.real_address));
else
- m_memory->write_byte(dma_channel.real_address, dma_channel.device_r());
+ m_memory.write_byte(dma_channel.real_address, dma_channel.device_r());
// increment address and decrement count
dma_channel.real_address++;
@@ -710,7 +709,7 @@ TIMER_CALLBACK_MEMBER(interpro_ioga_device::dma)
// translate virtual address
if (dma_channel.control & DMA_CTRL_VIRTUAL)
{
- const u32 ptde = m_memory->read_dword(dma_channel.virtual_address);
+ const u32 ptde = m_memory.read_dword(dma_channel.virtual_address);
// FIXME: ignore the page fault flag?
dma_channel.real_address = ptde & ~0xfff;
@@ -888,7 +887,7 @@ void interpro_ioga_device::dma_w(address_space &space, offs_t offset, u32 data,
// translate virtual address
if (data & DMA_CTRL_VIRTUAL)
{
- const u32 ptde = m_memory->read_dword(dma_channel.virtual_address);
+ const u32 ptde = m_memory.read_dword(dma_channel.virtual_address);
// FIXME: ignore the page fault flag?
dma_channel.real_address = (ptde & ~0xfff) | (dma_channel.real_address & 0xfff);
@@ -930,7 +929,7 @@ TIMER_CALLBACK_MEMBER(interpro_ioga_device::serial_dma)
{
if (dma_channel.control & SDMA_WRITE)
{
- u8 data = m_memory->read_byte(dma_channel.address++);
+ u8 data = m_memory.read_byte(dma_channel.address++);
LOGMASKED(LOG_SERIALDMA, "dma: writing byte 0x%02x to serial channel %d\n",
data, dma_channel.channel);
@@ -944,7 +943,7 @@ TIMER_CALLBACK_MEMBER(interpro_ioga_device::serial_dma)
LOGMASKED(LOG_SERIALDMA, "dma: reading byte 0x%02x from serial channel %d\n",
data, dma_channel.channel);
- m_memory->write_byte(dma_channel.address++, data);
+ m_memory.write_byte(dma_channel.address++, data);
}
// decrement transfer count
@@ -1309,14 +1308,14 @@ WRITE16_MEMBER(emerald_ioga_device::eth_w)
LOGMASKED(LOG_NETWORK, "eth_w address 0x%08x mask 0x%04x data 0x%04x\n",
address, mem_mask, data);
- m_memory->write_word(address, data, mem_mask);
+ m_memory.write_word(address, data, mem_mask);
}
READ16_MEMBER(emerald_ioga_device::eth_r)
{
const u32 address = m_eth_base | ((offset << 1) & ~ETH_BASE_MASK);
- const u16 data = m_memory->read_word(address, mem_mask);
+ const u16 data = m_memory.read_word(address, mem_mask);
LOGMASKED(LOG_NETWORK, "eth_r 0x%08x mask 0x%04x data 0x%04x\n",
address, mem_mask, data);
@@ -1370,14 +1369,14 @@ WRITE16_MEMBER(turquoise_ioga_device::eth_w)
LOGMASKED(LOG_NETWORK, "eth_w address 0x%08x mask 0x%04x data 0x%04x\n",
address, mem_mask, data);
- m_memory->write_word(address, data, mem_mask);
+ m_memory.write_word(address, data, mem_mask);
}
READ16_MEMBER(turquoise_ioga_device::eth_r)
{
const u32 address = m_eth_base | ((offset << 1) & ~ETH_BASE_MASK);
- const u16 data = m_memory->read_word(address, mem_mask);
+ const u16 data = m_memory.read_word(address, mem_mask);
LOGMASKED(LOG_NETWORK, "eth_r 0x%08x mask 0x%04x data 0x%04x\n",
address, mem_mask, data);
@@ -1458,7 +1457,7 @@ WRITE16_MEMBER(sapphire_ioga_device::eth_w)
LOGMASKED(LOG_NETWORK, "eth_w channel %c address 0x%08x mask 0x%08x data 0x%04x\n",
channel + 'A', address, mem_mask, data);
- m_memory->write_word(address, data, mem_mask);
+ m_memory.write_word(address, data, mem_mask);
}
READ16_MEMBER(sapphire_ioga_device::eth_r)
@@ -1477,7 +1476,7 @@ READ16_MEMBER(sapphire_ioga_device::eth_r)
offset << 1, address);
}
- u16 data = m_memory->read_word(address, mem_mask);
+ u16 data = m_memory.read_word(address, mem_mask);
LOGMASKED(LOG_NETWORK, "eth_r channel %c address 0x%08x mask 0x%08x data 0x%04x\n",
channel + 'A', address, mem_mask, data);
return data;
diff --git a/src/mame/machine/interpro_ioga.h b/src/mame/machine/interpro_ioga.h
index 1a13257ecca..dea37f24c7c 100644
--- a/src/mame/machine/interpro_ioga.h
+++ b/src/mame/machine/interpro_ioga.h
@@ -243,7 +243,7 @@ protected:
virtual void device_reset() override;
required_address_space m_memory_space;
- memory_access_cache<2, 0, ENDIANNESS_LITTLE> *m_memory;
+ memory_access<32, 2, 0, ENDIANNESS_LITTLE>::cache m_memory;
// callbacks
devcb_write_line m_out_nmi_func;
diff --git a/src/mame/machine/konami1.cpp b/src/mame/machine/konami1.cpp
index f856a5da4ed..05990da5fa0 100644
--- a/src/mame/machine/konami1.cpp
+++ b/src/mame/machine/konami1.cpp
@@ -61,7 +61,7 @@ konami1_device::mi_konami1::mi_konami1(uint16_t adr)
uint8_t konami1_device::mi_konami1::read_opcode(uint16_t adr)
{
- uint8_t val = m_scache->read_byte(adr);
+ uint8_t val = csprogram.read_byte(adr);
if(adr < m_boundary)
return val;
switch(adr & 0xa) {
diff --git a/src/mame/machine/m6502_swap_op_d2_d7.cpp b/src/mame/machine/m6502_swap_op_d2_d7.cpp
index eab70e43d93..fa58c4e834d 100644
--- a/src/mame/machine/m6502_swap_op_d2_d7.cpp
+++ b/src/mame/machine/m6502_swap_op_d2_d7.cpp
@@ -42,7 +42,7 @@ uint8_t m6502_swap_op_d2_d7::mi_decrypt::descramble(uint8_t op)
uint8_t m6502_swap_op_d2_d7::mi_decrypt::read_sync(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
res = descramble(res);
diff --git a/src/mame/machine/m6502_swap_op_d5_d6.cpp b/src/mame/machine/m6502_swap_op_d5_d6.cpp
index 12a853ab807..d3c661f8c2b 100644
--- a/src/mame/machine/m6502_swap_op_d5_d6.cpp
+++ b/src/mame/machine/m6502_swap_op_d5_d6.cpp
@@ -39,7 +39,7 @@ uint8_t m6502_swap_op_d5_d6::mi_decrypt::descramble(uint8_t op)
uint8_t m6502_swap_op_d5_d6::mi_decrypt::read_sync(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
res = descramble(res);
diff --git a/src/mame/machine/m6502_vtscr.cpp b/src/mame/machine/m6502_vtscr.cpp
index 5c7c9168cb8..5cb7decf55f 100644
--- a/src/mame/machine/m6502_vtscr.cpp
+++ b/src/mame/machine/m6502_vtscr.cpp
@@ -59,7 +59,7 @@ bool m6502_vtscr::mi_decrypt::toggle_scramble(uint8_t op) {
uint8_t m6502_vtscr::mi_decrypt::read_sync(uint16_t adr)
{
- uint8_t res = cache->read_byte(adr);
+ uint8_t res = cprogram.read_byte(adr);
if(m_scramble_en)
{
res = descramble(res);
diff --git a/src/mame/machine/osborne1.cpp b/src/mame/machine/osborne1.cpp
index c6322f9e403..a715f3af65d 100644
--- a/src/mame/machine/osborne1.cpp
+++ b/src/mame/machine/osborne1.cpp
@@ -130,7 +130,7 @@ READ8_MEMBER( osborne1_state::opcode_r )
}
// Now that's sorted out we can call the normal read handler
- return m_mem_cache->read_byte(offset);
+ return m_mem_cache.read_byte(offset);
}
WRITE8_MEMBER( osborne1_state::bankswitch_w )
@@ -287,7 +287,7 @@ void osborne1_state::machine_start()
m_acia_rxc_txc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osborne1_state::acia_rxc_txc_callback), this));
- m_mem_cache = m_maincpu->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_LITTLE>();
+ m_maincpu->space(AS_PROGRAM).cache(m_mem_cache);
save_item(NAME(m_acia_rxc_txc_div));
save_item(NAME(m_acia_rxc_txc_p_low));
diff --git a/src/mame/video/dynax_blitter_rev2.cpp b/src/mame/video/dynax_blitter_rev2.cpp
index 4024c8e0e0e..2d5343ae916 100644
--- a/src/mame/video/dynax_blitter_rev2.cpp
+++ b/src/mame/video/dynax_blitter_rev2.cpp
@@ -61,7 +61,7 @@ dynax_blitter_rev2_device::dynax_blitter_rev2_device(const machine_config &mconf
dynax_blitter_rev2_device::dynax_blitter_rev2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, type, tag, owner, clock)
- , device_rom_interface(mconfig, *this, 20, ENDIANNESS_LITTLE, 8)
+ , device_rom_interface(mconfig, *this)
, m_vram_out_cb(*this)
, m_scrollx_cb(*this)
, m_scrolly_cb(*this)
diff --git a/src/mame/video/dynax_blitter_rev2.h b/src/mame/video/dynax_blitter_rev2.h
index 94aa120b5b4..a0e8b80f12f 100644
--- a/src/mame/video/dynax_blitter_rev2.h
+++ b/src/mame/video/dynax_blitter_rev2.h
@@ -10,6 +10,7 @@
#pragma once
+#include "dirom.h"
//**************************************************************************
// TYPE DEFINITIONS
@@ -17,7 +18,7 @@
// ======================> dynax_blitter_rev2_device
-class dynax_blitter_rev2_device : public device_t, public device_rom_interface
+class dynax_blitter_rev2_device : public device_t, public device_rom_interface<20>
{
public:
// construction/destruction
diff --git a/src/mame/video/kaneko_grap2.cpp b/src/mame/video/kaneko_grap2.cpp
index 16d7abe595a..4c299a2579e 100644
--- a/src/mame/video/kaneko_grap2.cpp
+++ b/src/mame/video/kaneko_grap2.cpp
@@ -36,7 +36,7 @@ DEFINE_DEVICE_TYPE(KANEKO_GRAP2, kaneko_grap2_device, "kaneko_grap2", "Kaneko GR
kaneko_grap2_device::kaneko_grap2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, KANEKO_GRAP2, tag, owner, clock)
- , device_rom_interface(mconfig, *this, 32) // TODO : Unknown Address Bits
+ , device_rom_interface(mconfig, *this)
, device_palette_interface(mconfig, *this)
{
}
diff --git a/src/mame/video/kaneko_grap2.h b/src/mame/video/kaneko_grap2.h
index 5dd27042f6a..0c566d22b7e 100644
--- a/src/mame/video/kaneko_grap2.h
+++ b/src/mame/video/kaneko_grap2.h
@@ -5,9 +5,11 @@
#pragma once
+#include "dirom.h"
#include "emupal.h"
-class kaneko_grap2_device : public device_t, public device_rom_interface, public device_palette_interface
+// TODO : Unknown Address Bits
+class kaneko_grap2_device : public device_t, public device_rom_interface<32>, public device_palette_interface
{
public:
static constexpr unsigned PALETTE_SIZE = 256 + 1; // 0x00-0xff is internal palette, 0x100 is background colour
diff --git a/src/mame/video/sknsspr.cpp b/src/mame/video/sknsspr.cpp
index ac40ce43792..12e70d8536f 100644
--- a/src/mame/video/sknsspr.cpp
+++ b/src/mame/video/sknsspr.cpp
@@ -28,7 +28,7 @@ DEFINE_DEVICE_TYPE(SKNS_SPRITE, sknsspr_device, "sknsspr", "SKNS Sprite")
sknsspr_device::sknsspr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock)
: device_t(mconfig, SKNS_SPRITE, tag, owner, clock)
, device_video_interface(mconfig, *this)
- , device_rom_interface(mconfig, *this, 27) // TODO : Unknown address bits; maybe 27?
+ , device_rom_interface(mconfig, *this)
{
}
diff --git a/src/mame/video/sknsspr.h b/src/mame/video/sknsspr.h
index e6dc9f2dc25..3ea59ce9a29 100644
--- a/src/mame/video/sknsspr.h
+++ b/src/mame/video/sknsspr.h
@@ -5,7 +5,10 @@
#pragma once
-class sknsspr_device : public device_t, public device_video_interface, public device_rom_interface
+#include "dirom.h"
+
+ // TODO : Unknown address bits; maybe 27?
+class sknsspr_device : public device_t, public device_video_interface, public device_rom_interface<27>
{
public:
sknsspr_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);